mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-06 12:04:52 +00:00
Handle the global address case here, not just the offset case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19487 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c4b6a78980
commit
5f75d9a88c
@ -191,10 +191,17 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB,
|
|||||||
unsigned R0 = MI->getOperand(0).getReg();
|
unsigned R0 = MI->getOperand(0).getReg();
|
||||||
unsigned Scale = MI->getOperand(1).getImmedValue();
|
unsigned Scale = MI->getOperand(1).getImmedValue();
|
||||||
unsigned R1 = MI->getOperand(2).getReg();
|
unsigned R1 = MI->getOperand(2).getReg();
|
||||||
unsigned Offset = MI->getOperand(3).getImmedValue();
|
if (MI->getOperand(3).isImmediate()) {
|
||||||
I = MBB.insert(MBB.erase(I),
|
unsigned Offset = MI->getOperand(3).getImmedValue();
|
||||||
BuildMI(Opcode, 5).addReg(R0).addZImm(Scale).
|
I = MBB.insert(MBB.erase(I),
|
||||||
addReg(R1).addSImm(Offset).addZImm((char)Val));
|
BuildMI(Opcode, 5).addReg(R0).addZImm(Scale).
|
||||||
|
addReg(R1).addSImm(Offset).addZImm((char)Val));
|
||||||
|
} else if (MI->getOperand(3).isGlobalAddress()) {
|
||||||
|
GlobalValue *GA = MI->getOperand(3).getGlobal();
|
||||||
|
I = MBB.insert(MBB.erase(I),
|
||||||
|
BuildMI(Opcode, 5).addReg(R0).addZImm(Scale).
|
||||||
|
addReg(R1).addGlobalAddress(GA).addZImm((char)Val));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user