This is an archive of the discontinued LLVM Phabricator instance.

[AArch64AsmParser] cleanup/rewrite of function parseSysAlias
ClosedPublic

Authored by SjoerdMeijer on Mar 1 2017, 2:40 AM.

Details

Summary

This is a cleanup/rewrite of the parseSysAlias function. This was not using the tablegen instruction descriptions, but was “manually” matching the mnemonics and recreating the operands whereas all this information is already in tablegen, so all this code has been replaced with calls to lookupXYZByName tablegen calls.

Diff Detail

Repository
rL LLVM

Event Timeline

SjoerdMeijer created this revision.Mar 1 2017, 2:40 AM
rengolin accepted this revision.Mar 2 2017, 6:59 AM

Much better! The error messages are already being tested, and you haven't changed a bit, so they should be fine.

LGTM, thanks!

lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
2337 ↗(On Diff #90140)

If the target parser was already connected to table-gen, this wouldn't be necessary. :(

2421 ↗(On Diff #90140)

Its a shame these are completely different namespaces. The code could have been so much simpler. :)

This revision is now accepted and ready to land.Mar 2 2017, 6:59 AM
SjoerdMeijer added inline comments.Mar 3 2017, 12:18 AM
lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
2421 ↗(On Diff #90140)

Thanks for reviewing! I agree and I am also not entirely happy yet as there is still a bit of code repetition going on here. But this is (almost infinitely) better than it was, and I will see if I can address this in a next cleanup. Cheers.

This revision was automatically updated to reflect the committed changes.