summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-04 23:42:37 +0000
committerChris Lattner <sabre@nondot.org>2003-08-04 23:42:37 +0000
commit4b637cc6668ae3135d1692c58d64dd21b07fa36e (patch)
tree1a236571190d25584edddbc3200e8680d1af500f /llvm/lib/CodeGen
parent815b85e3bac04e542ba3ac4fee9d8fb4e711da66 (diff)
downloadbcm5719-llvm-4b637cc6668ae3135d1692c58d64dd21b07fa36e.tar.gz
bcm5719-llvm-4b637cc6668ae3135d1692c58d64dd21b07fa36e.zip
Don't bother calculating info unless its needed. May reduce number of stack slots created.
llvm-svn: 7584
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegAllocLocal.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp
index 57f3c836e55..f6eacda9c45 100644
--- a/llvm/lib/CodeGen/RegAllocLocal.cpp
+++ b/llvm/lib/CodeGen/RegAllocLocal.cpp
@@ -238,10 +238,6 @@ void RA::spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
DEBUG(std::cerr << " which corresponds to no vreg, "
<< "must be spurious physreg: ignoring (WARNING)\n");
} else {
- // FIXME: move this into the conditional??
- const TargetRegisterClass *RC = MF->getSSARegMap()->getRegClass(VirtReg);
- int FrameIndex = getStackSpaceFor(VirtReg, RC);
-
DEBUG(std::cerr << " containing %reg" << VirtReg;
if (!isVirtRegModified(VirtReg))
std::cerr << " which has not been modified, so no store necessary!");
@@ -250,6 +246,8 @@ void RA::spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
// register. We only need to spill it into its stack slot if it has been
// modified.
if (isVirtRegModified(VirtReg)) {
+ const TargetRegisterClass *RC = MF->getSSARegMap()->getRegClass(VirtReg);
+ int FrameIndex = getStackSpaceFor(VirtReg, RC);
DEBUG(std::cerr << " to stack slot #" << FrameIndex);
RegInfo->storeRegToStackSlot(MBB, I, PhysReg, FrameIndex, RC);
++NumSpilled; // Update statistics
OpenPOWER on IntegriCloud