summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-04-21 19:11:03 +0000
committerChris Lattner <sabre@nondot.org>2005-04-21 19:11:03 +0000
commit486a1ec909f356817281d3fdb6840e798e30fc52 (patch)
treefafa029f01a987a113a9e73c1174b22f5c173d83 /llvm/lib
parentadcfc1748bebd36edd8ceacd580adfd68af49849 (diff)
downloadbcm5719-llvm-486a1ec909f356817281d3fdb6840e798e30fc52.tar.gz
bcm5719-llvm-486a1ec909f356817281d3fdb6840e798e30fc52.zip
Handle stores of global address as stores of immediates. Instead of:
test1: movl $N, %eax movl %eax, G ret emit: test1: movl $N, G ret llvm-svn: 21407
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelSimple.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelSimple.cpp b/llvm/lib/Target/X86/X86ISelSimple.cpp
index 6c37b7095f8..b7e15207a44 100644
--- a/llvm/lib/Target/X86/X86ISelSimple.cpp
+++ b/llvm/lib/Target/X86/X86ISelSimple.cpp
@@ -1620,6 +1620,9 @@ void X86ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI,
} else if (Args[i].Val && isa<ConstantPointerNull>(Args[i].Val)) {
addRegOffset(BuildMI(BB, X86::MOV32mi, 5),
X86::ESP, ArgOffset).addImm(0);
+ } else if (Args[i].Val && isa<GlobalValue>(Args[i].Val)) {
+ addRegOffset(BuildMI(BB, X86::MOV32mi, 5), X86::ESP, ArgOffset)
+ .addGlobalAddress(cast<GlobalValue>(Args[i].Val));
} else {
ArgReg = Args[i].Val ? getReg(Args[i].Val) : Args[i].Reg;
addRegOffset(BuildMI(BB, X86::MOV32mr, 5),
@@ -3311,6 +3314,8 @@ void X86ISel::visitStoreInst(StoreInst &I) {
}
} else if (isa<ConstantPointerNull>(I.getOperand(0))) {
addFullAddress(BuildMI(BB, X86::MOV32mi, 5), AM).addImm(0);
+ } else if (GlobalValue *GV = dyn_cast<GlobalValue>(I.getOperand(0))) {
+ addFullAddress(BuildMI(BB, X86::MOV32mi, 5), AM).addGlobalAddress(GV);
} else if (ConstantBool *CB = dyn_cast<ConstantBool>(I.getOperand(0))) {
addFullAddress(BuildMI(BB, X86::MOV8mi, 5), AM).addImm(CB->getValue());
} else if (ConstantFP *CFP = dyn_cast<ConstantFP>(I.getOperand(0))) {
OpenPOWER on IntegriCloud