summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-06 21:32:22 +0000
committerChris Lattner <sabre@nondot.org>2003-05-06 21:32:22 +0000
commit37ffac92d54914b953739822c62aaa4330cb49df (patch)
treefc806b7e9e8d77148d420f996745ca7aaa2fbd7d /llvm
parent4b1e02df8fd4d8805fcd31188558a5f3325dff9b (diff)
downloadbcm5719-llvm-37ffac92d54914b953739822c62aaa4330cb49df.tar.gz
bcm5719-llvm-37ffac92d54914b953739822c62aaa4330cb49df.zip
Emit pseudo instructions to indicate that some registers are live on entrance
and exit of the function. This fixes bug: Jello/2003-05-06-LivenessClobber.llx and the Fhourstones benchmark llvm-svn: 6010
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/X86/InstSelectSimple.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/InstSelectSimple.cpp b/llvm/lib/Target/X86/InstSelectSimple.cpp
index a65a42737ef..3a12d5e2c9c 100644
--- a/llvm/lib/Target/X86/InstSelectSimple.cpp
+++ b/llvm/lib/Target/X86/InstSelectSimple.cpp
@@ -78,6 +78,11 @@ namespace {
F->getBasicBlockList().push_back(MBBMap[I] = new MachineBasicBlock(I));
BB = &F->front();
+
+ // Declare that the stack pointer is live on entrance to the function
+ BuildMI(BB, X86::IMPLICIT_DEF, 0, X86::ESP);
+
+ // Copy incoming arguments off of the stack...
LoadArgumentsToVirtualRegs(Fn);
// Instruction select everything except PHI nodes
@@ -671,13 +676,19 @@ void ISel::visitReturnInst(ReturnInst &I) {
case cShort:
case cInt:
promote32(X86::EAX, ValueRecord(RetReg, RetVal->getType()));
+ // Declare that EAX is live on exit
+ BuildMI(BB, X86::IMPLICIT_USE, 1).addReg(X86::EAX);
break;
case cFP: // Floats & Doubles: Return in ST(0)
BuildMI(BB, X86::FpSETRESULT, 1).addReg(RetReg);
+ // Declare that top-of-stack is live on exit
+ BuildMI(BB, X86::IMPLICIT_USE, 1).addReg(X86::ST0);
break;
case cLong:
BuildMI(BB, X86::MOVrr32, 1, X86::EAX).addReg(RetReg);
BuildMI(BB, X86::MOVrr32, 1, X86::EDX).addReg(RetReg+1);
+ // Declare that EAX & EDX are live on exit
+ BuildMI(BB, X86::IMPLICIT_USE, 2).addReg(X86::EAX).addReg(X86::EDX);
break;
default:
visitInstruction(I);
OpenPOWER on IntegriCloud