1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Handle the global address case here, not just the offset case.

llvm-svn: 19487
This commit is contained in:
Chris Lattner 2005-01-11 22:58:43 +00:00
parent 9eb2cc700b
commit 282473a25d

View File

@ -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;
}
}