Skip to content

Commit 9d68565

Browse files
author
Simon Dardis
committedNov 26, 2017
[utils][mips] Add support for mips for update_llc_checks.py
Add support for mips, particularly skipping the matching of .frame, .(f)mask and LLVM's usage of the .set no(reorder|at|macro) directives. Reviewers: spatel Differential Revision: https://reviews.llvm.org/D40268 llvm-svn: 319001
1 parent 3984ee8 commit 9d68565

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
 

‎llvm/utils/update_llc_test_checks.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ def llc(args, cmd_args, ir):
4747
r'.Lfunc_end[0-9]+:\n',
4848
flags=(re.M | re.S))
4949

50+
ASM_FUNCTION_MIPS_RE = re.compile(
51+
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n[^:]*?' # f: (name of func)
52+
r'(?:^[ \t]+\.(frame|f?mask|set).*?\n)+' # Mips+LLVM standard asm prologue
53+
r'(?P<body>.*?)\n' # (body of the function)
54+
r'(?:^[ \t]+\.(set|end).*?\n)+' # Mips+LLVM standard asm epilogue
55+
r'(\$|\.L)func_end[0-9]+:\n', # $func_end0: (mips32 - O32) or
56+
# .Lfunc_end0: (mips64 - NewABI)
57+
flags=(re.M | re.S))
58+
5059
ASM_FUNCTION_PPC_RE = re.compile(
5160
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
5261
r'\.Lfunc_begin[0-9]+:\n'
@@ -141,6 +150,16 @@ def scrub_asm_powerpc64(asm, args):
141150
asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
142151
return asm
143152

153+
def scrub_asm_mips(asm, args):
154+
# Scrub runs of whitespace out of the assembly, but leave the leading
155+
# whitespace in place.
156+
asm = SCRUB_WHITESPACE_RE.sub(r' ', asm)
157+
# Expand the tabs used for indentation.
158+
asm = string.expandtabs(asm, 2)
159+
# Strip trailing whitespace.
160+
asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
161+
return asm
162+
144163
def scrub_asm_riscv(asm, args):
145164
# Scrub runs of whitespace out of the assembly, but leave the leading
146165
# whitespace in place.
@@ -175,6 +194,7 @@ def build_function_body_dictionary(raw_tool_output, triple, prefixes, func_dict,
175194
'thumb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
176195
'thumbv8-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
177196
'armeb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
197+
'mips': (scrub_asm_mips, ASM_FUNCTION_MIPS_RE),
178198
'powerpc64': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
179199
'powerpc64le': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
180200
'riscv32': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),

0 commit comments

Comments
 (0)
Please sign in to comment.