-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename RISCVMCExpr::VK_RISCV_ to VK_. NFC #131489
Rename RISCVMCExpr::VK_RISCV_ to VK_. NFC #131489
Conversation
Created using spr 1.3.5-bogner
@llvm/pr-subscribers-backend-risc-v Author: Fangrui Song (MaskRay) ChangesThey implement relocation operators and are named VK_RISCV_ probably to Therefore, there is no need to make the name long in the presence of the Patch is 49.01 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/131489.diff 7 Files Affected:
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index 7c5f1fc08cd0b..9a345a65c055b 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -510,7 +510,7 @@ struct RISCVOperand final : public MCParsedAsmOperand {
}
if (auto CE = dyn_cast<MCConstantExpr>(Expr)) {
- VK = RISCVMCExpr::VK_RISCV_None;
+ VK = RISCVMCExpr::VK_None;
Imm = CE->getValue();
return true;
}
@@ -522,7 +522,7 @@ struct RISCVOperand final : public MCParsedAsmOperand {
// modifiers and isShiftedInt<N-1, 1>(Op).
template <int N> bool isBareSimmNLsb0() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
@@ -531,71 +531,70 @@ struct RISCVOperand final : public MCParsedAsmOperand {
IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK);
else
IsValid = isShiftedInt<N - 1, 1>(fixImmediateForRV32(Imm, isRV64Imm()));
- return IsValid && VK == RISCVMCExpr::VK_RISCV_None;
+ return IsValid && VK == RISCVMCExpr::VK_None;
}
// Predicate methods for AsmOperands defined in RISCVInstrInfo.td
bool isBareSymbol() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
// Must be of 'immediate' type but not a constant.
if (!isImm() || evaluateConstantImm(getImm(), Imm, VK))
return false;
return RISCVAsmParser::classifySymbolRef(getImm(), VK) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isCallSymbol() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
// Must be of 'immediate' type but not a constant.
if (!isImm() || evaluateConstantImm(getImm(), Imm, VK))
return false;
return RISCVAsmParser::classifySymbolRef(getImm(), VK) &&
- (VK == RISCVMCExpr::VK_RISCV_CALL ||
- VK == RISCVMCExpr::VK_RISCV_CALL_PLT);
+ (VK == RISCVMCExpr::VK_CALL || VK == RISCVMCExpr::VK_CALL_PLT);
}
bool isPseudoJumpSymbol() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
// Must be of 'immediate' type but not a constant.
if (!isImm() || evaluateConstantImm(getImm(), Imm, VK))
return false;
return RISCVAsmParser::classifySymbolRef(getImm(), VK) &&
- VK == RISCVMCExpr::VK_RISCV_CALL;
+ VK == RISCVMCExpr::VK_CALL;
}
bool isTPRelAddSymbol() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
// Must be of 'immediate' type but not a constant.
if (!isImm() || evaluateConstantImm(getImm(), Imm, VK))
return false;
return RISCVAsmParser::classifySymbolRef(getImm(), VK) &&
- VK == RISCVMCExpr::VK_RISCV_TPREL_ADD;
+ VK == RISCVMCExpr::VK_TPREL_ADD;
}
bool isTLSDESCCallSymbol() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
// Must be of 'immediate' type but not a constant.
if (!isImm() || evaluateConstantImm(getImm(), Imm, VK))
return false;
return RISCVAsmParser::classifySymbolRef(getImm(), VK) &&
- VK == RISCVMCExpr::VK_RISCV_TLSDESC_CALL;
+ VK == RISCVMCExpr::VK_TLSDESC_CALL;
}
bool isCSRSystemRegister() const { return isSystemRegister(); }
bool isVTypeImm(unsigned N) const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
- return IsConstantImm && isUIntN(N, Imm) && VK == RISCVMCExpr::VK_RISCV_None;
+ return IsConstantImm && isUIntN(N, Imm) && VK == RISCVMCExpr::VK_None;
}
// If the last operand of the vsetvli/vsetvli instruction is a constant
@@ -635,19 +634,18 @@ struct RISCVOperand final : public MCParsedAsmOperand {
bool isImmXLenLI() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
- if (VK == RISCVMCExpr::VK_RISCV_LO ||
- VK == RISCVMCExpr::VK_RISCV_PCREL_LO ||
- VK == RISCVMCExpr::VK_RISCV_TLSDESC_LOAD_LO ||
- VK == RISCVMCExpr::VK_RISCV_TLSDESC_ADD_LO)
+ if (VK == RISCVMCExpr::VK_LO || VK == RISCVMCExpr::VK_PCREL_LO ||
+ VK == RISCVMCExpr::VK_TLSDESC_LOAD_LO ||
+ VK == RISCVMCExpr::VK_TLSDESC_ADD_LO)
return true;
// Given only Imm, ensuring that the actually specified constant is either
// a signed or unsigned 64-bit number is unfortunately impossible.
if (IsConstantImm) {
- return VK == RISCVMCExpr::VK_RISCV_None &&
+ return VK == RISCVMCExpr::VK_None &&
(isRV64Imm() || (isInt<32>(Imm) || isUInt<32>(Imm)));
}
@@ -656,33 +654,31 @@ struct RISCVOperand final : public MCParsedAsmOperand {
bool isImmXLenLI_Restricted() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
// 'la imm' supports constant immediates only.
- return IsConstantImm && (VK == RISCVMCExpr::VK_RISCV_None) &&
+ return IsConstantImm && (VK == RISCVMCExpr::VK_None) &&
(isRV64Imm() || (isInt<32>(Imm) || isUInt<32>(Imm)));
}
bool isUImmLog2XLen() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
- if (!evaluateConstantImm(getImm(), Imm, VK) ||
- VK != RISCVMCExpr::VK_RISCV_None)
+ if (!evaluateConstantImm(getImm(), Imm, VK) || VK != RISCVMCExpr::VK_None)
return false;
return (isRV64Imm() && isUInt<6>(Imm)) || isUInt<5>(Imm);
}
bool isUImmLog2XLenNonZero() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
- if (!evaluateConstantImm(getImm(), Imm, VK) ||
- VK != RISCVMCExpr::VK_RISCV_None)
+ if (!evaluateConstantImm(getImm(), Imm, VK) || VK != RISCVMCExpr::VK_None)
return false;
if (Imm == 0)
return false;
@@ -691,22 +687,21 @@ struct RISCVOperand final : public MCParsedAsmOperand {
bool isUImmLog2XLenHalf() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
- if (!evaluateConstantImm(getImm(), Imm, VK) ||
- VK != RISCVMCExpr::VK_RISCV_None)
+ if (!evaluateConstantImm(getImm(), Imm, VK) || VK != RISCVMCExpr::VK_None)
return false;
return (isRV64Imm() && isUInt<5>(Imm)) || isUInt<4>(Imm);
}
template <unsigned N> bool IsUImm() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
- return IsConstantImm && isUInt<N>(Imm) && VK == RISCVMCExpr::VK_RISCV_None;
+ return IsConstantImm && isUInt<N>(Imm) && VK == RISCVMCExpr::VK_None;
}
bool isUImm1() const { return IsUImm<1>(); }
@@ -729,202 +724,202 @@ struct RISCVOperand final : public MCParsedAsmOperand {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isUInt<5>(Imm) && (Imm != 0) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm5GT3() const {
if (!isImm())
return false;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isUInt<5>(Imm) && (Imm > 3) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm5Plus1() const {
if (!isImm())
return false;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && ((isUInt<5>(Imm) && (Imm != 0)) || (Imm == 32)) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm5GE6Plus1() const {
if (!isImm())
return false;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && ((isUInt<5>(Imm) && (Imm >= 6)) || (Imm == 32)) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm8GE32() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isUInt<8>(Imm) && Imm >= 32 &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isRnumArg() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && Imm >= INT64_C(0) && Imm <= INT64_C(10) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isRnumArg_0_7() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && Imm >= INT64_C(0) && Imm <= INT64_C(7) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isRnumArg_1_10() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && Imm >= INT64_C(1) && Imm <= INT64_C(10) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isRnumArg_2_14() const {
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
if (!isImm())
return false;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && Imm >= INT64_C(2) && Imm <= INT64_C(14) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isSImm5() const {
if (!isImm())
return false;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isInt<5>(fixImmediateForRV32(Imm, isRV64Imm())) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isSImm6() const {
if (!isImm())
return false;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isInt<6>(fixImmediateForRV32(Imm, isRV64Imm())) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isSImm6NonZero() const {
if (!isImm())
return false;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && Imm != 0 &&
isInt<6>(fixImmediateForRV32(Imm, isRV64Imm())) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isCLUIImm() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && (Imm != 0) &&
(isUInt<5>(Imm) || (Imm >= 0xfffe0 && Imm <= 0xfffff)) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm2Lsb0() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<1, 1>(Imm) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm5Lsb0() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<4, 1>(Imm) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm6Lsb0() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<5, 1>(Imm) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm7Lsb00() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<5, 2>(Imm) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm7Lsb000() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<4, 3>(Imm) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm8Lsb00() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<6, 2>(Imm) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm8Lsb000() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<5, 3>(Imm) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isSImm9Lsb0() const { return isBareSimmNLsb0<9>(); }
@@ -933,20 +928,20 @@ struct RISCVOperand final : public MCParsedAsmOperand {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<6, 3>(Imm) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isUImm10Lsb00NonZero() const {
if (!isImm())
return false;
int64_t Imm;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isShiftedUInt<8, 2>(Imm) && (Imm != 0) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
// If this a RV32 and the immediate is a uimm32, sign extend it to 32 bits.
@@ -960,15 +955,15 @@ struct RISCVOperand final : public MCParsedAsmOperand {
bool isSImm11() const {
if (!isImm())
return false;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm && isInt<11>(fixImmediateForRV32(Imm, isRV64Imm())) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isSImm12() const {
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsValid;
if (!isImm())
@@ -978,12 +973,12 @@ struct RISCVOperand final : public MCParsedAsmOperand {
IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK);
else
IsValid = isInt<12>(fixImmediateForRV32(Imm, isRV64Imm()));
- return IsValid && ((IsConstantImm && VK == RISCVMCExpr::VK_RISCV_None) ||
- VK == RISCVMCExpr::VK_RISCV_LO ||
- VK == RISCVMCExpr::VK_RISCV_PCREL_LO ||
- VK == RISCVMCExpr::VK_RISCV_TPREL_LO ||
- VK == RISCVMCExpr::VK_RISCV_TLSDESC_LOAD_LO ||
- VK == RISCVMCExpr::VK_RISCV_TLSDESC_ADD_LO);
+ return IsValid &&
+ ((IsConstantImm && VK == RISCVMCExpr::VK_None) ||
+ VK == RISCVMCExpr::VK_LO || VK == RISCVMCExpr::VK_PCREL_LO ||
+ VK == RISCVMCExpr::VK_TPREL_LO ||
+ VK == RISCVMCExpr::VK_TLSDESC_LOAD_LO ||
+ VK == RISCVMCExpr::VK_TLSDESC_ADD_LO);
}
bool isSImm12Lsb0() const { return isBareSimmNLsb0<12>(); }
@@ -991,12 +986,12 @@ struct RISCVOperand final : public MCParsedAsmOperand {
bool isSImm12Lsb00000() const {
if (!isImm())
return false;
- RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None;
+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_None;
int64_t Imm;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
return IsConstantImm &&
isShiftedInt<7, 5>(fixImmediateForRV32(Imm, isRV64Imm())) &&
- VK == RISCVMCExpr::VK_RISCV_None;
+ VK == RISCVMCExpr::VK_None;
}
bool isSImm13Lsb0() const { return isBareSimmNLsb0<13>(); }
@@ -1005,15 +1000,15 @@ struct RISCVOperand final : public MCParsedAsmOperand {
if (!isImm())
return false;
int64_t Imm;
- RI...
[truncated]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for tidying this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
They implement relocation operators and are named VK_RISCV_ probably to avoid confusion with `MCSymbolRefExpr::VariantKind`. `MCSymbolRefExpr::VariantKind` is discouraged (https://discourse.llvm.org/t/error-expected-relocatable-expression-with-mctargetexpr/84926/2) and targets are migrating away from `MCSymbolRefExpr::VariantKind`. Therefore, there is no need to make the name long in the presence of the clear `RISCVMCExpr::` prefix. Pull Request: llvm/llvm-project#131489
They implement relocation operators and are named VK_RISCV_ probably to
avoid confusion with
MCSymbolRefExpr::VariantKind
.MCSymbolRefExpr::VariantKind
is discouraged(https://discourse.llvm.org/t/error-expected-relocatable-expression-with-mctargetexpr/84926/2)
and targets are migrating away from
MCSymbolRefExpr::VariantKind
.Therefore, there is no need to make the name long in the presence of the
clear
RISCVMCExpr::
prefix.