summaryrefslogtreecommitdiffstats
path: root/llvm/utils/update_llc_test_checks.py
diff options
context:
space:
mode:
authorSimon Dardis <simon.dardis@mips.com>2017-11-26 19:22:44 +0000
committerSimon Dardis <simon.dardis@mips.com>2017-11-26 19:22:44 +0000
commit9d68565262401bd9d26c69ec496e76e92616d8df (patch)
tree9d101a57a9bd1c6781d3da4609fd5d6a38dc1d45 /llvm/utils/update_llc_test_checks.py
parent3984ee8400df7741ffff2bc2e04fded296b34619 (diff)
downloadbcm5719-llvm-9d68565262401bd9d26c69ec496e76e92616d8df.tar.gz
bcm5719-llvm-9d68565262401bd9d26c69ec496e76e92616d8df.zip
[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
Diffstat (limited to 'llvm/utils/update_llc_test_checks.py')
-rwxr-xr-xllvm/utils/update_llc_test_checks.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py
index 9b2df90ad39..79608f159f3 100755
--- a/llvm/utils/update_llc_test_checks.py
+++ b/llvm/utils/update_llc_test_checks.py
@@ -47,6 +47,15 @@ ASM_FUNCTION_AARCH64_RE = re.compile(
r'.Lfunc_end[0-9]+:\n',
flags=(re.M | re.S))
+ASM_FUNCTION_MIPS_RE = re.compile(
+ r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n[^:]*?' # f: (name of func)
+ r'(?:^[ \t]+\.(frame|f?mask|set).*?\n)+' # Mips+LLVM standard asm prologue
+ r'(?P<body>.*?)\n' # (body of the function)
+ r'(?:^[ \t]+\.(set|end).*?\n)+' # Mips+LLVM standard asm epilogue
+ r'(\$|\.L)func_end[0-9]+:\n', # $func_end0: (mips32 - O32) or
+ # .Lfunc_end0: (mips64 - NewABI)
+ flags=(re.M | re.S))
+
ASM_FUNCTION_PPC_RE = re.compile(
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
r'\.Lfunc_begin[0-9]+:\n'
@@ -141,6 +150,16 @@ def scrub_asm_powerpc64(asm, args):
asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
+def scrub_asm_mips(asm, args):
+ # Scrub runs of whitespace out of the assembly, but leave the leading
+ # whitespace in place.
+ asm = SCRUB_WHITESPACE_RE.sub(r' ', asm)
+ # Expand the tabs used for indentation.
+ asm = string.expandtabs(asm, 2)
+ # Strip trailing whitespace.
+ asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
+ return asm
+
def scrub_asm_riscv(asm, args):
# Scrub runs of whitespace out of the assembly, but leave the leading
# whitespace in place.
@@ -175,6 +194,7 @@ def build_function_body_dictionary(raw_tool_output, triple, prefixes, func_dict,
'thumb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
'thumbv8-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
'armeb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
+ 'mips': (scrub_asm_mips, ASM_FUNCTION_MIPS_RE),
'powerpc64': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
'powerpc64le': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
'riscv32': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),
OpenPOWER on IntegriCloud