This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][MC] Improve parsing of jal/j operands
ClosedPublic

Authored by asb on Sep 13 2018, 5:53 AM.

Details

Summary

Examples such as jal a3, j a3 and jal a3, a3 were previously accepted by gas but rejected by LLVM MC. This patch rectifies this. I introduce RISCVAsmParser::parseJALOffset to ensure that symbol names that coincide with register names can safely be parsed. This is made a somewhat fiddly due to the single-operand alias form (see the comment in parseJALOffset for more info).

Diff Detail

Event Timeline

asb created this revision.Sep 13 2018, 5:53 AM

I ran the fuzzer with this patch. No issues detected, LGTM.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 20 2018, 1:12 AM
This revision was automatically updated to reflect the committed changes.