[PATCH] D52298: [RISCV][MC] Add support for evaluating constant symbols as immediates
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 20 05:32:58 PDT 2018
asb created this revision.
asb added reviewers: shiva0217, apazos.
Herald added subscribers: jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, mgrang, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar.
This further improves compatibility with GNU as, allowing input such as the following to be assembled:
.equ CONST, 0x123456
li a0, CONST
addi a0, a0, %lo(CONST)
.equ CONST, 1
slli a0, a0, CONST
Note that we don't have perfect compatibility with gas, as it will accept the following which we reject:
addi a0, a0, %lo(CONST)
.equ CONST, 0x123456
I believe that passing SetUsed=false to Sym.getVariableValue is correct - or at least that allows .equ to be used multiple times with the same symbol name in a way that matches gas. I'd appreciate a second opinion though.
Repository:
rL LLVM
https://reviews.llvm.org/D52298
Files:
lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
test/MC/RISCV/rv32i-aliases-valid.s
test/MC/RISCV/rv32i-valid.s
test/MC/RISCV/rv64i-aliases-valid.s
test/MC/RISCV/rv64i-valid.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52298.166267.patch
Type: text/x-patch
Size: 6450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180920/ba842a41/attachment.bin>
More information about the llvm-commits
mailing list