summaryrefslogtreecommitdiffstats
path: root/lib
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
commit27615d7f2159ef219167cfc3e804d17105a62e78 (patch)
tree70c3121f4ac92c60a2d5dacea65b3d88bfa2f6bd /lib
parentb8822ad224d4eb5dc1b8b770bee11a2160e79141 (diff)
downloadexternal_llvm-27615d7f2159ef219167cfc3e804d17105a62e78.zip
external_llvm-27615d7f2159ef219167cfc3e804d17105a62e78.tar.gz
external_llvm-27615d7f2159ef219167cfc3e804d17105a62e78.tar.bz2
Don't bother calculating info unless its needed. May reduce number of stack slots created.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/RegAllocLocal.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp
index 57f3c83..f6eacda 100644
--- a/lib/CodeGen/RegAllocLocal.cpp
+++ b/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