diff options
author | Chris Lattner <sabre@nondot.org> | 2005-04-21 19:11:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-04-21 19:11:03 +0000 |
commit | 109026290b3b07152322e65801edb51dccfe7ddc (patch) | |
tree | 7d02ed863e6a7f513a5c88ae8083f2372d46f79d /lib | |
parent | 75f354bd7a0e59c3e7ba488db2bb5113bc13cdfe (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/X86ISelSimple.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/X86/X86ISelSimple.cpp b/lib/Target/X86/X86ISelSimple.cpp index 6c37b7095f..b7e15207a4 100644 --- a/lib/Target/X86/X86ISelSimple.cpp +++ b/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))) { |