This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][MC] Use a custom ParserMethod for the bare_symbol operand type
ClosedPublic

Authored by asb on Sep 6 2018, 6:54 AM.

Details

Summary

This allows the hard-coded shouldForceImmediate logic to be removed because the generated MatchOperandParserImpl makes use of the current context (i.e. the current mnemonic) to determine parsing behaviour, and so won't first try to parse a register before parsing a symbol name.

No functional change is intended. gas accepts immediate arguments for call, tail and lla. This patch doesn't address this discrepancy.

Diff Detail

Repository
rL LLVM

Event Timeline

asb created this revision.Sep 6 2018, 6:54 AM
rogfer01 accepted this revision.Sep 6 2018, 10:45 PM

Oh this is great! Scales much better than my earlier hack. Thanks a lot @asb !

I think I will be able to apply something similar with foo@plt symbols. Currently I have a nasty hack in parseImmediate

LGTM

This revision is now accepted and ready to land.Sep 6 2018, 10:45 PM

LGTM, I also verified this patch with the fuzzer tool.

This revision was automatically updated to reflect the committed changes.