[llvm-branch-commits] [SPARC][IAS] Add definitions for OSA 2011 instructions (PR #138403)
Sergei Barannikov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue May 27 02:16:16 PDT 2025
================
@@ -141,6 +147,26 @@ getMachineOpValue(const MCInst &MI, const MCOperand &MO,
return 0;
}
+unsigned SparcMCCodeEmitter::getSImm5OpValue(const MCInst &MI, unsigned OpNo,
+ SmallVectorImpl<MCFixup> &Fixups,
+ const MCSubtargetInfo &STI) const {
+ const MCOperand &MO = MI.getOperand(OpNo);
+
+ if (MO.isImm())
+ return MO.getImm();
+
+ assert(MO.isExpr() &&
+ "getSImm5OpValue expects only expressions or an immediate");
+
+ const MCExpr *Expr = MO.getExpr();
+
+ // Constant value, no fixup is needed
+ if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Expr))
+ return CE->getValue();
+
+ llvm_unreachable("simm5 operands can only be used with constants!");
----------------
s-barannikov wrote:
Shouldn't it be a `R_SPARC_5` relocation?
EIther way, if this code is reachable, it shouldn't be `llvm_unreachable`.
https://github.com/llvm/llvm-project/pull/138403
More information about the llvm-branch-commits
mailing list