Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / utils / generate_microtask_cases.py
blob1376c3ef547257feb1ea5689251368ed2c3cada5
1 #!/usr/bin/env python3
3 import argparse
6 def main():
7 parser = argparse.ArgumentParser()
8 parser.add_argument(
9 "--max_args",
10 type=int,
11 help="Max number of arguments to generate case statements for",
12 required=True,
14 parser.add_argument("--output", help="Output header file to include", required=True)
15 args = parser.parse_args()
17 output = ""
18 for i in range(args.max_args + 1):
19 output += "case %d:\n" % (i)
20 output += "((void (*)(kmp_int32 *, kmp_int32 *\n"
21 for j in range(i):
22 output += ", void *"
23 if (j + 1) % 4 == 0:
24 output += "\n"
25 output += "))fn)(&global_tid, &bound_tid\n"
26 for j in range(i):
27 output += ", args[%d]" % (j)
28 if (j + 1) % 4 == 0:
29 output += "\n"
30 output += ");\n"
31 output += "break;\n"
33 with open(args.output, "w") as f:
34 print(output, file=f)
37 if __name__ == "__main__":
38 main()