Page MenuHomePhabricator

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

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



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


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


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.