mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
Fixed a FuseTwoAddrInst() bug: consider GlobalAddress and JumpTableIndex
in addition to immediate operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30205 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0c5b8dac79
commit
6f34b43292
@ -169,12 +169,17 @@ static MachineInstr *FuseTwoAddrInst(unsigned Opcode, unsigned FrameIndex,
|
||||
|
||||
// Loop over the rest of the ri operands, converting them over.
|
||||
for (unsigned i = 0; i != NumOps; ++i) {
|
||||
if (MI->getOperand(i+2).isReg())
|
||||
MIB = MIB.addReg(MI->getOperand(i+2).getReg());
|
||||
else {
|
||||
assert(MI->getOperand(i+2).isImm() && "Unknown operand type!");
|
||||
MIB = MIB.addImm(MI->getOperand(i+2).getImm());
|
||||
}
|
||||
MachineOperand &MO = MI->getOperand(i+2);
|
||||
if (MO.isReg())
|
||||
MIB = MIB.addReg(MO.getReg());
|
||||
else if (MO.isImm())
|
||||
MIB = MIB.addImm(MO.getImm());
|
||||
else if (MO.isGlobalAddress())
|
||||
MIB = MIB.addGlobalAddress(MO.getGlobal(), MO.getOffset());
|
||||
else if (MO.isJumpTableIndex())
|
||||
MIB = MIB.addJumpTableIndex(MO.getJumpTableIndex());
|
||||
else
|
||||
assert(0 && "Unknown operand type!");
|
||||
}
|
||||
return MIB;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user