json_ir_generator: rework argument printing

for next commit

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig 2024-06-17 14:35:19 -04:00
parent 4965344ef5
commit 5fb84866e0

View File

@ -552,9 +552,14 @@ def print_ir_arg_printer():
output_file.write("\t*out << \" \";\n")
SSAArgNum = 0
FirstArg = True
for i in range(0, len(op.Arguments)):
arg = op.Arguments[i]
LastArg = len(op.Arguments) - i - 1 == 0
if FirstArg:
FirstArg = False
else:
output_file.write("\t*out << \", \";\n")
if arg.Temporary:
# Temporary that we can't recover
@ -567,9 +572,6 @@ def print_ir_arg_printer():
# User defined op that is stored
output_file.write("\tPrintArg(out, IR, Op->{});\n".format(arg.Name))
if not LastArg:
output_file.write("\t*out << \", \";\n")
output_file.write("break;\n")
output_file.write("}\n")