[PATCH] D73176: [ARM] Fix dropped dollar sign from symbols in branch targets
Lucas Prates via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 03:25:36 PST 2020
pratlucas added a comment.
Regarding the `b $4` case, I found that the limitation currently lies in the expression/identifier parsing at the core AsmParser, which only detects $-prefixed `Identifier` or `String` tokens at the moment.
As this part of the code has no knowledge of the branch instruction context, I'm afraid updating it to accept `Integer` tokens as well might cause some inconsistencies in the instructions for which we drop the leading `Dollar` token. For example:
# Branch instructions consistently treat $<integere> as identifier
b $4 @ b ($4) - Symbol
b $4 + $4 @ b #($4)+($4) - Symbol
# Other instructions treat those as identifiers only when they're
# on the begining of the operand
movw r0, $4 @ movw r0, #4 - Immediate constant
movw r0, :lower16:$4 @ movw r0, :lower16:($4) - Symbol
>From what I checked on the gas behavior, it seems to only treat those as constant immediates when actual constants are explicitly expected by the instruction. Otherwise it assumes those are identifiers.
Would you say the behavior above is the expected one? Or should we go for the alignment with gas' behavior?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73176/new/
https://reviews.llvm.org/D73176
More information about the llvm-commits
mailing list