Skip to content

Commit 1b043c2

Browse files
committed
[RISCV] Simplify RISCVMCExpr::evaluateAsConstant
Most VariantKind cannot be evaluated at the parsing time. It makes more sense to list the evaluable cases.
1 parent aaaaa4d commit 1b043c2

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,7 @@ void RISCVMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {
214214

215215
bool RISCVMCExpr::evaluateAsConstant(int64_t &Res) const {
216216
MCValue Value;
217-
218-
if (Kind == VK_RISCV_PCREL_HI || Kind == VK_RISCV_PCREL_LO ||
219-
Kind == VK_RISCV_GOT_HI || Kind == VK_RISCV_TPREL_HI ||
220-
Kind == VK_RISCV_TPREL_LO || Kind == VK_RISCV_TPREL_ADD ||
221-
Kind == VK_RISCV_TLS_GOT_HI || Kind == VK_RISCV_TLS_GD_HI ||
222-
Kind == VK_RISCV_TLSDESC_HI || Kind == VK_RISCV_TLSDESC_LOAD_LO ||
223-
Kind == VK_RISCV_TLSDESC_ADD_LO || Kind == VK_RISCV_TLSDESC_CALL ||
224-
Kind == VK_RISCV_CALL || Kind == VK_RISCV_CALL_PLT)
217+
if (Kind != VK_RISCV_LO && Kind != VK_RISCV_HI)
225218
return false;
226219

227220
if (!getSubExpr()->evaluateAsRelocatable(Value, nullptr, nullptr))

0 commit comments

Comments
 (0)