================ @@ -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 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits