@@ -225,6 +225,13 @@ class string:
225
225
r'.Lfunc_end[0-9]+:\n' ,
226
226
flags = (re .M | re .S ))
227
227
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
+
228
235
SCRUB_X86_SHUFFLES_RE = (
229
236
re .compile (
230
237
r'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem)( \{%k\d+\}( \{z\})?)? = .*)$' ,
@@ -465,6 +472,16 @@ def scrub_asm_loongarch(asm, args):
465
472
asm = common .SCRUB_TRAILING_WHITESPACE_RE .sub (r'' , asm )
466
473
return asm
467
474
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
+
468
485
# Returns a tuple of a scrub function and a function regex. Scrub function is
469
486
# used to alter function body in some way, for example, remove trailing spaces.
470
487
# Function regex is used to match function name, body, etc. in raw llc output.
@@ -515,7 +532,8 @@ def get_run_handler(triple):
515
532
'csky' : (scrub_asm_csky , ASM_FUNCTION_CSKY_RE ),
516
533
'nvptx' : (scrub_asm_nvptx , ASM_FUNCTION_NVPTX_RE ),
517
534
'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 )
519
537
}
520
538
handler = None
521
539
best_prefix = ''
0 commit comments