[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 22:57:43 PDT 2018


nemanjai added a comment.

Thanks for your comments @MaskRay. Let me know if you think that RE would work.



================
Comment at: utils/UpdateTestChecks/asm.py:53
 
+ASM_FUNCTION_PPC_BE_RE = re.compile(
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
----------------
MaskRay wrote:
> Can this be merged with `ASM_FUNCTION_PPC_RE`? If not, is it possible to extract the common part to a variable `ASM_FUNCTION_PPC_COMMON` (you make give it a better name)?
To be honest with you, this regular expression syntax is mostly gibberish to me. From what I was able to decipher, the first line looks for `function_name:  # @function_name` which appears in PPC asm syntax. Then for LE, the following line is `.Lfunc_beginN:` whereas for BE, there are a few more lines with `.p2align`, `.quad`, `.text`.
Perhaps it is possible to match both with something like `.*?`
i.e. match anything non-greedy until you encounter what's in the next RE. And the next thing will be the `.Lfunc_beginN:`


================
Comment at: utils/UpdateTestChecks/asm.py:245
       '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),
----------------
MaskRay wrote:
> The leading tab should be replaced with spaces.
OK.


Repository:
  rL LLVM

https://reviews.llvm.org/D53059





More information about the llvm-commits mailing list