This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Fix the regular expression for BE PPC in update_llc_test_checks.py
ClosedPublic

Authored by nemanjai on Oct 9 2018, 9:17 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

nemanjai created this revision.Oct 9 2018, 9:17 PM
MaskRay added inline comments.Oct 9 2018, 9:57 PM
utils/UpdateTestChecks/asm.py
53 ↗(On Diff #168937)

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)?

245 ↗(On Diff #168937)

The leading tab should be replaced with spaces.

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

utils/UpdateTestChecks/asm.py
53 ↗(On Diff #168937)

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:

245 ↗(On Diff #168937)

OK.

MaskRay added inline comments.Oct 10 2018, 12:32 PM
utils/UpdateTestChecks/asm.py
53 ↗(On Diff #168937)

Yeah if .p2align .quad .text are not that important, maybe a catch-all .* is better..

nemanjai updated this revision to Diff 170410.Oct 22 2018, 7:41 AM

Updated the regular expression to just eat any text that is not relevant between the function directive and its text. This seems to work for both ELFv1 and ELFv2 asm output.

MaskRay accepted this revision.Oct 22 2018, 10:17 AM
This revision is now accepted and ready to land.Oct 22 2018, 10:17 AM
This revision was automatically updated to reflect the committed changes.