CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
89 lines
2.2 KiB
Python
Executable File
89 lines
2.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import re, sys
|
|
|
|
|
|
def fix_string(s):
|
|
TYPE = re.compile(
|
|
'\s*(i[0-9]+|float|double|x86_fp80|fp128|ppc_fp128|\[\[.*?\]\]|\[2 x \[\[[A-Z_0-9]+\]\]\]|<.*?>|{.*?}|\[[0-9]+ x .*?\]|%["a-z:A-Z0-9._]+({{.*?}})?|%{{.*?}}|{{.*?}}|\[\[.*?\]\])(\s*(\*|addrspace\(.*?\)|dereferenceable\(.*?\)|byval\(.*?\)|sret|zeroext|inreg|returned|signext|nocapture|align \d+|swiftself|swifterror|readonly|noalias|inalloca|nocapture))*\s*'
|
|
)
|
|
|
|
counter = 0
|
|
if "i32{{.*}}" in s:
|
|
counter = 1
|
|
|
|
at_pos = s.find("@")
|
|
if at_pos == -1:
|
|
at_pos = 0
|
|
|
|
annoying_pos = s.find("{{[^(]+}}")
|
|
if annoying_pos != -1:
|
|
at_pos = annoying_pos + 9
|
|
|
|
paren_pos = s.find("(", at_pos)
|
|
if paren_pos == -1:
|
|
return s
|
|
|
|
res = s[: paren_pos + 1]
|
|
s = s[paren_pos + 1 :]
|
|
|
|
m = TYPE.match(s)
|
|
while m:
|
|
res += m.group()
|
|
s = s[m.end() :]
|
|
if s.startswith(",") or s.startswith(")"):
|
|
res += f" %{counter}"
|
|
counter += 1
|
|
|
|
next_arg = s.find(",")
|
|
if next_arg == -1:
|
|
break
|
|
|
|
res += s[: next_arg + 1]
|
|
s = s[next_arg + 1 :]
|
|
m = TYPE.match(s)
|
|
|
|
return res + s
|
|
|
|
|
|
def process_file(contents):
|
|
PREFIX = re.compile(r"check-prefix(es)?(=|\s+)([a-zA-Z0-9,]+)")
|
|
check_prefixes = ["CHECK"]
|
|
result = ""
|
|
for line in contents.split("\n"):
|
|
if "FileCheck" in line:
|
|
m = PREFIX.search(line)
|
|
if m:
|
|
check_prefixes.extend(m.group(3).split(","))
|
|
|
|
found_check = False
|
|
for prefix in check_prefixes:
|
|
if prefix in line:
|
|
found_check = True
|
|
break
|
|
|
|
if not found_check or "define" not in line:
|
|
result += line + "\n"
|
|
continue
|
|
|
|
# We have a check for a function definition. Number the args.
|
|
line = fix_string(line)
|
|
result += line + "\n"
|
|
return result
|
|
|
|
|
|
def main():
|
|
print(f"Processing {sys.argv[1]}")
|
|
f = open(sys.argv[1])
|
|
content = f.read()
|
|
f.close()
|
|
|
|
content = process_file(content)
|
|
|
|
f = open(sys.argv[1], "w")
|
|
f.write(content)
|
|
f.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|