[llvm] Makslevental/unison tblgen (PR #150084)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 11:37:44 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r HEAD~1...HEAD llvm/tools/llc-unison/llc-unison.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- llc-unison.py	2025-07-22 18:17:18.000000 +0000
+++ llc-unison.py	2025-07-22 18:37:11.922403 +0000
@@ -42,56 +42,70 @@
 import sys
 import argparse
 import subprocess
 import tempfile
 
+
 def execute(cmd):
     print(" ".join(cmd))
     subprocess.call(cmd)
     return
 
+
 def temp_filename(ext):
     return tempfile.NamedTemporaryFile(suffix=ext).name
 
+
 # Intercept input file, output file, and Unison flags
-parser = argparse.ArgumentParser(description='Run llc with Unison. The option -o must be given.')
-parser.add_argument('infile', metavar='INPUT', help='input file')
-parser.add_argument('-o', metavar='OUTPUT', help='output file')
-parser.add_argument('--uni-flags', help='flags to be passed to Unison')
+parser = argparse.ArgumentParser(
+    description="Run llc with Unison. The option -o must be given."
+)
+parser.add_argument("infile", metavar="INPUT", help="input file")
+parser.add_argument("-o", metavar="OUTPUT", help="output file")
+parser.add_argument("--uni-flags", help="flags to be passed to Unison")
 (args, llc_flags) = parser.parse_known_args()
 
-exit_pass  = "phi-node-elimination"
+exit_pass = "phi-node-elimination"
 entry_pass = "funclet-layout"
 
 # Expect 'llc' in the same directory
 llc = os.path.join(os.path.dirname(sys.argv[0]), "llc")
 # Expect 'uni' in the PATH
 uni = "uni"
 
 # Generate main input to Unison (.ll -> .mir)
 
-mir = temp_filename('.mir')
-cmd_mir = [llc] + llc_flags + \
-          ["-stop-before", exit_pass, "-unison-mir", "-o", mir, args.infile]
+mir = temp_filename(".mir")
+cmd_mir = (
+    [llc]
+    + llc_flags
+    + ["-stop-before", exit_pass, "-unison-mir", "-o", mir, args.infile]
+)
 execute(cmd_mir)
 
 # Generate initial solution for Unison (.ll -> .asm.mir)
 
-asm_mir = temp_filename('.asm.mir')
-cmd_asm_mir = [llc] + llc_flags + \
-              ["-stop-before", entry_pass, "-unison-mir", "-o", asm_mir, args.infile]
+asm_mir = temp_filename(".asm.mir")
+cmd_asm_mir = (
+    [llc]
+    + llc_flags
+    + ["-stop-before", entry_pass, "-unison-mir", "-o", asm_mir, args.infile]
+)
 execute(cmd_asm_mir)
 
 # Run Unison (.mir -> .asm.mir -> .unison.mir)
 
-unison_mir = temp_filename('.unison.mir')
-cmd_uni = [uni, "run", "--llvm6", "--verbose"] + \
-          ["-o", unison_mir, mir, "--basefile=" + asm_mir]
+unison_mir = temp_filename(".unison.mir")
+cmd_uni = [uni, "run", "--llvm6", "--verbose"] + [
+    "-o",
+    unison_mir,
+    mir,
+    "--basefile=" + asm_mir,
+]
 if args.uni_flags is not None:
     cmd_uni += [args.uni_flags]
 execute(cmd_uni)
 
 # Generate assembly code (.unison.mir -> .s)
 
-cmd_s = [llc] + llc_flags + \
-        ["-start-before", entry_pass, "-o", args.o, unison_mir]
+cmd_s = [llc] + llc_flags + ["-start-before", entry_pass, "-o", args.o, unison_mir]
 execute(cmd_s)

``````````

</details>


https://github.com/llvm/llvm-project/pull/150084


More information about the llvm-commits mailing list