[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Apr 21 12:11:20 PDT 2005
Changes in directory llvm/lib/Target/X86:
X86ISelSimple.cpp updated: 1.312 -> 1.313
---
Log message:
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
---
Diffs of the changes: (+5 -0)
X86ISelSimple.cpp | 5 +++++
1 files changed, 5 insertions(+)
Index: llvm/lib/Target/X86/X86ISelSimple.cpp
diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.312 llvm/lib/Target/X86/X86ISelSimple.cpp:1.313
--- llvm/lib/Target/X86/X86ISelSimple.cpp:1.312 Sat Apr 9 10:23:56 2005
+++ llvm/lib/Target/X86/X86ISelSimple.cpp Thu Apr 21 14:11:03 2005
@@ -1620,6 +1620,9 @@
} 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 @@
}
} 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))) {
More information about the llvm-commits
mailing list