Skip to content

Commit 14485ac

Browse files
authored
[AMDGPU] Determine MCFixupKind in a more general way. NFCI. (#155864)
1 parent f2e6ca8 commit 14485ac

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCCodeEmitter.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,7 @@ std::optional<uint64_t> AMDGPUMCCodeEmitter::getLitEncoding(
272272
int64_t Imm;
273273
if (MO.isExpr()) {
274274
if (!MO.getExpr()->evaluateAsAbsolute(Imm))
275-
return (STI.hasFeature(AMDGPU::Feature64BitLiterals) &&
276-
OpInfo.OperandType == AMDGPU::OPERAND_REG_IMM_INT64)
277-
? 254
278-
: 255;
275+
return AMDGPU::getOperandSize(OpInfo) == 8 ? 254 : 255;
279276
} else {
280277
assert(!MO.isDFPImm());
281278

@@ -695,11 +692,8 @@ void AMDGPUMCCodeEmitter::getMachineOpValueCommon(
695692
const MCInstrDesc &Desc = MCII.get(MI.getOpcode());
696693
uint32_t Offset = Desc.getSize();
697694
assert(Offset == 4 || Offset == 8);
698-
auto OpType = Desc.operands()[OpNo].OperandType;
699-
MCFixupKind Kind = (STI.hasFeature(AMDGPU::Feature64BitLiterals) &&
700-
OpType == AMDGPU::OPERAND_REG_IMM_INT64)
701-
? FK_Data_8
702-
: FK_Data_4;
695+
unsigned Size = AMDGPU::getOperandSize(Desc, OpNo);
696+
MCFixupKind Kind = MCFixup::getDataKindForSize(Size);
703697
addFixup(Fixups, Offset, MO.getExpr(), Kind, PCRel);
704698
}
705699

0 commit comments

Comments
 (0)