[llvm] 5715510 - [RISCV] Remove unused declarations and getSpecifier. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 30 11:10:01 PDT 2025
Author: Fangrui Song
Date: 2025-03-30T11:09:56-07:00
New Revision: 5715510d00d44d97a0024caf864e649225372281
URL: https://github.com/llvm/llvm-project/commit/5715510d00d44d97a0024caf864e649225372281
DIFF: https://github.com/llvm/llvm-project/commit/5715510d00d44d97a0024caf864e649225372281.diff
LOG: [RISCV] Remove unused declarations and getSpecifier. NFC
Remove unused declarations after #132569.
Simplify some code as we no longer use MCSymbolRefExpr::VariantKind.
Added:
Modified:
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index c767e1e60f17f..52b38c19873c1 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -2104,8 +2104,7 @@ ParseStatus RISCVAsmParser::parsePseudoJumpSymbol(OperandVector &Operands) {
if (getParser().parseExpression(Res, E))
return ParseStatus::Failure;
- if (Res->getKind() != MCExpr::ExprKind::SymbolRef ||
- getSpecifier(cast<MCSymbolRefExpr>(Res)) == RISCVMCExpr::VK_PLTPCREL)
+ if (Res->getKind() != MCExpr::ExprKind::SymbolRef)
return Error(S, "operand must be a valid jump target");
Res = RISCVMCExpr::create(Res, RISCVMCExpr::VK_CALL, getContext());
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
index b27f13e6b95ba..69ad3d936fbbe 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
@@ -557,10 +557,7 @@ uint64_t RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo,
FixupKind = RISCV::fixup_riscv_tlsdesc_call;
break;
}
- } else if ((Kind == MCExpr::SymbolRef &&
- getSpecifier(cast<MCSymbolRefExpr>(Expr)) ==
- RISCVMCExpr::VK_None) ||
- Kind == MCExpr::Binary) {
+ } else if (Kind == MCExpr::SymbolRef || Kind == MCExpr::Binary) {
// FIXME: Sub kind binary exprs have chance of underflow.
if (MIFrm == RISCVII::InstFormatJ) {
FixupKind = RISCV::fixup_riscv_jal;
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
index 604d2ebc66d1c..fd6993c18d820 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
@@ -49,8 +49,6 @@ class RISCVMCExpr : public MCTargetExpr {
const MCExpr *Expr;
const Specifier specifier;
- int64_t evaluateAsInt64(int64_t Value) const;
-
explicit RISCVMCExpr(const MCExpr *Expr, Specifier S)
: Expr(Expr), specifier(S) {}
@@ -77,8 +75,6 @@ class RISCVMCExpr : public MCTargetExpr {
return getSubExpr()->findAssociatedFragment();
}
- bool evaluateAsConstant(int64_t &Res) const;
-
static bool classof(const MCExpr *E) {
return E->getKind() == MCExpr::Target;
}
@@ -86,10 +82,6 @@ class RISCVMCExpr : public MCTargetExpr {
static std::optional<Specifier> getSpecifierForName(StringRef name);
static StringRef getSpecifierName(Specifier Kind);
};
-
-static inline RISCVMCExpr::Specifier getSpecifier(const MCSymbolRefExpr *SRE) {
- return RISCVMCExpr::Specifier(SRE->getKind());
-}
} // end namespace llvm.
#endif
More information about the llvm-commits
mailing list