[llvm] r373605 - [UpdateTestChecks] add basic support for parsing msp430 asm

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 07:34:28 PDT 2019


Author: spatel
Date: Thu Oct  3 07:34:28 2019
New Revision: 373605

URL: http://llvm.org/viewvc/llvm-project?rev=373605&view=rev
Log:
[UpdateTestChecks] add basic support for parsing msp430 asm

Modified:
    llvm/trunk/utils/UpdateTestChecks/asm.py

Modified: llvm/trunk/utils/UpdateTestChecks/asm.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/UpdateTestChecks/asm.py?rev=373605&r1=373604&r2=373605&view=diff
==============================================================================
--- llvm/trunk/utils/UpdateTestChecks/asm.py (original)
+++ llvm/trunk/utils/UpdateTestChecks/asm.py Thu Oct  3 07:34:28 2019
@@ -58,6 +58,12 @@ ASM_FUNCTION_MIPS_RE = re.compile(
                                               # .Lfunc_end0: (mips64 - NewABI)
     flags=(re.M | re.S))
 
+ASM_FUNCTION_MSP430_RE = re.compile(
+    r'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@(?P=func)\n[^:]*?'
+    r'(?P<body>.*?)\n'
+    r'(\$|\.L)func_end[0-9]+:\n',             # $func_end0:
+    flags=(re.M | re.S))
+
 ASM_FUNCTION_PPC_RE = re.compile(
     r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
     r'.*?'
@@ -231,6 +237,16 @@ def scrub_asm_mips(asm, args):
   asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
   return asm
 
+def scrub_asm_msp430(asm, args):
+  # Scrub runs of whitespace out of the assembly, but leave the leading
+  # whitespace in place.
+  asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
+  # Expand the tabs used for indentation.
+  asm = string.expandtabs(asm, 2)
+  # Strip trailing whitespace.
+  asm = common.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.
@@ -315,6 +331,7 @@ def build_function_body_dictionary_for_t
       'thumbv5-macho': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_MACHO_RE),
       'thumbv7-apple-ios' : (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_IOS_RE),
       'mips': (scrub_asm_mips, ASM_FUNCTION_MIPS_RE),
+      'msp430': (scrub_asm_msp430, ASM_FUNCTION_MSP430_RE),
       'ppc32': (scrub_asm_powerpc, ASM_FUNCTION_PPC_RE),
       'powerpc': (scrub_asm_powerpc, ASM_FUNCTION_PPC_RE),
       'riscv32': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),




More information about the llvm-commits mailing list