mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 15:39:00 +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 Scale = MI->getOperand(1).getImmedValue();
|
||||
unsigned R1 = MI->getOperand(2).getReg();
|
||||
unsigned Offset = MI->getOperand(3).getImmedValue();
|
||||
I = MBB.insert(MBB.erase(I),
|
||||
BuildMI(Opcode, 5).addReg(R0).addZImm(Scale).
|
||||
addReg(R1).addSImm(Offset).addZImm((char)Val));
|
||||
if (MI->getOperand(3).isImmediate()) {
|
||||
unsigned Offset = MI->getOperand(3).getImmedValue();
|
||||
I = MBB.insert(MBB.erase(I),
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user