Skip to content

Commit 3ed29bb

Browse files
committed
[Utils][UpdateTestChecks] Add Xtensa support to
update_llc_test_checks.py
1 parent bbf508a commit 3ed29bb

File tree

1 file changed

+19
-1
lines changed
  • llvm/utils/UpdateTestChecks

1 file changed

+19
-1
lines changed

llvm/utils/UpdateTestChecks/asm.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,13 @@ class string:
225225
r'.Lfunc_end[0-9]+:\n',
226226
flags=(re.M | re.S))
227227

228+
ASM_FUNCTION_XTENSA_RE = re.compile(
229+
r'^_?(?P<func>[^.:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n\s?\.?(cfi_startproc\s)?# %bb.0:.*?\n'
230+
r'(?P<body>.*?)\n'
231+
r'^\.Lfunc_end\d+:\n', # Match the end label
232+
flags=(re.M | re.S)
233+
)
234+
228235
SCRUB_X86_SHUFFLES_RE = (
229236
re.compile(
230237
r'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem)( \{%k\d+\}( \{z\})?)? = .*)$',
@@ -465,6 +472,16 @@ def scrub_asm_loongarch(asm, args):
465472
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
466473
return asm
467474

475+
def scrub_asm_xtensa(asm, args):
476+
# Scrub runs of whitespace out of the assembly, but leave the leading
477+
# whitespace in place.
478+
asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
479+
# Expand the tabs used for indentation.
480+
asm = string.expandtabs(asm, 2)
481+
# Strip trailing whitespace.
482+
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
483+
return asm
484+
468485
# Returns a tuple of a scrub function and a function regex. Scrub function is
469486
# used to alter function body in some way, for example, remove trailing spaces.
470487
# Function regex is used to match function name, body, etc. in raw llc output.
@@ -515,7 +532,8 @@ def get_run_handler(triple):
515532
'csky': (scrub_asm_csky, ASM_FUNCTION_CSKY_RE),
516533
'nvptx': (scrub_asm_nvptx, ASM_FUNCTION_NVPTX_RE),
517534
'loongarch32': (scrub_asm_loongarch, ASM_FUNCTION_LOONGARCH_RE),
518-
'loongarch64': (scrub_asm_loongarch, ASM_FUNCTION_LOONGARCH_RE)
535+
'loongarch64': (scrub_asm_loongarch, ASM_FUNCTION_LOONGARCH_RE),
536+
'xtensa': (scrub_asm_xtensa, ASM_FUNCTION_XTENSA_RE)
519537
}
520538
handler = None
521539
best_prefix = ''

0 commit comments

Comments
 (0)