[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Dec 16 16:08:01 PST 2004
Changes in directory llvm/lib/Target/X86:
X86ISelSimple.cpp updated: 1.301 -> 1.302
---
Log message:
Create a stack slot for the return address lazily instead of eagerly. This
save small amounts of time for functions that don't call llvm.returnaddress
or llvm.frameaddress (which is almost all functions).
---
Diffs of the changes: (+8 -4)
Index: llvm/lib/Target/X86/X86ISelSimple.cpp
diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.301 llvm/lib/Target/X86/X86ISelSimple.cpp:1.302
--- llvm/lib/Target/X86/X86ISelSimple.cpp:1.301 Mon Dec 13 11:23:11 2004
+++ llvm/lib/Target/X86/X86ISelSimple.cpp Thu Dec 16 18:07:46 2004
@@ -96,6 +96,9 @@
/// the entire function.
///
bool runOnFunction(Function &Fn) {
+ // Lazily create a stack slot for the return address if needed.
+ ReturnAddressIndex = -1;
+
// First pass over the function, lower any unknown intrinsic functions
// with the IntrinsicLowering class.
LowerUnknownIntrinsicFunctionCalls(Fn);
@@ -108,10 +111,6 @@
BB = &F->front();
- // Set up a frame object for the return address. This is used by the
- // llvm.returnaddress & llvm.frameaddress intrinisics.
- ReturnAddressIndex = F->getFrameInfo()->CreateFixedObject(4, -4);
-
// Copy incoming arguments off of the stack...
LoadArgumentsToVirtualRegs(Fn);
@@ -1765,6 +1764,11 @@
case Intrinsic::frameaddress:
TmpReg1 = getReg(CI);
if (cast<Constant>(CI.getOperand(1))->isNullValue()) {
+ if (ReturnAddressIndex == -1) {
+ // Set up a frame object for the return address.
+ ReturnAddressIndex = F->getFrameInfo()->CreateFixedObject(4, -4);
+ }
+
if (ID == Intrinsic::returnaddress) {
// Just load the return address
addFrameReference(BuildMI(BB, X86::MOV32rm, 4, TmpReg1),
More information about the llvm-commits
mailing list