[PATCH] D53059: [NFC] Fix the regular expression for BE PPC in update_llc_test_checks.py

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 21:19:06 PDT 2018


nemanjai created this revision.
nemanjai added reviewers: MaskRay, RKSimon.

Currently, the regular expression that matches the lines of assembly for PPC LE (ELFv2) does not work for the assembly for BE (ELFv1). This patch fixes it. Keep in mind that I really don't know Python, so this may not be the way we want to fix it, but it gets the job done on the simple input I used it on.


Repository:
  rL LLVM

https://reviews.llvm.org/D53059

Files:
  utils/UpdateTestChecks/asm.py


Index: utils/UpdateTestChecks/asm.py
===================================================================
--- utils/UpdateTestChecks/asm.py
+++ utils/UpdateTestChecks/asm.py
@@ -50,6 +50,18 @@
                                               # .Lfunc_end0: (mips64 - NewABI)
     flags=(re.M | re.S))
 
+ASM_FUNCTION_PPC_BE_RE = re.compile(
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
+    r'.*?\n[ \t]+.text\n'
+    r'\.Lfunc_begin[0-9]+:\n'
+    r'(?:[ \t]+.cfi_startproc\n)?'
+    r'(?:\.Lfunc_[gl]ep[0-9]+:\n(?:[ \t]+.*?\n)*)*'
+    r'(?P<body>.*?)\n'
+    # This list is incomplete
+    r'(?:^[ \t]*(?:\.long[ \t]+[^\n]+|\.quad[ \t]+[^\n]+)\n)*'
+    r'.Lfunc_end[0-9]+:\n',
+    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'
@@ -230,8 +242,9 @@
       'armv7eb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
       'armv7eb': (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),
+# Including the dashes in the triple so PPC BE does not subsume LE.
+      'powerpc64-': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_BE_RE),
+      'powerpc64le-': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
       'riscv32': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),
       'riscv64': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),
       'sparc': (scrub_asm_sparc, ASM_FUNCTION_SPARC_RE),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53059.168937.patch
Type: text/x-patch
Size: 1549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181010/bf1940ad/attachment.bin>


More information about the llvm-commits mailing list