[llvm] [utils] update_llc_test_checks --downstream-target-handler-path option (PR #135879)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 15 16:25:02 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/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/downstream_target.py llvm/utils/update_llc_test_checks.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/downstream_target.py 2025-04-15 22:53:42.000000 +0000
+++ test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/downstream_target.py 2025-04-15 23:24:33.494324 +0000
@@ -10,20 +10,21 @@
import re
import sys
import os
from pathlib import Path
+
common_dir = Path(__file__).parent / "../../../../../utils/"
sys.path.append(common_dir)
from UpdateTestChecks import common
+
# The asm scrubber returns the scrubbed asm.
# In this test we return a fixed string.
def scrub(asm, args):
- return ("Test\n"
- "Downstream\n"
- "Target\n")
+ return "Test\n" "Downstream\n" "Target\n"
+
# The regular expression for matching func, body, etc.
regex = re.compile(
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*(@"?(?P=func)"?| -- Begin function (?P=func))\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?'
r"(?:\.L(?P=func)\$local:\n)?" # drop .L<func>$local:
@@ -32,12 +33,14 @@
r"(?P<body>^##?[ \t]+[^:]+:.*?)\s*"
r"^\s*(?:[^:\n]+?:\s*\n\s*\.size|\.cfi_endproc|\.globl|\.comm|\.(?:sub)?section|#+ -- End function)",
flags=(re.M | re.S),
)
+
def get_run_handler(triple):
return (scrub, regex)
+
def add_checks(
output_lines,
comment_marker,
prefix_list,
--- utils/update_llc_test_checks.py 2025-04-15 22:53:42.000000 +0000
+++ utils/update_llc_test_checks.py 2025-04-15 23:24:33.580814 +0000
@@ -19,10 +19,11 @@
# llc is the only llc-like in the LLVM tree but downstream forks can add
# additional ones here if they have them.
LLC_LIKE_TOOLS = [
"llc",
]
+
# Helper that imports module from `module_path` and returns it.
def import_module(module_path):
if not os.path.exists(module_path):
common.error("Path does not exist", module_path)
@@ -126,12 +127,14 @@
if m:
march_in_cmd = m.groups()[0]
m = common.DEBUG_ONLY_ARG_RE.search(llc_cmd)
if initial_args.downstream_target_handler_path:
- common.warn("Downstream handlers provided by '%s'"
- % initial_args.downstream_target_handler_path)
+ common.warn(
+ "Downstream handlers provided by '%s'"
+ % initial_args.downstream_target_handler_path
+ )
output_type = import_module(initial_args.downstream_target_handler_path)
else:
if m and m.groups()[0] == "isel":
from UpdateTestChecks import isel as output_type
else:
``````````
</details>
https://github.com/llvm/llvm-project/pull/135879
More information about the llvm-commits
mailing list