diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-17 04:08:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-17 04:08:37 +0000 |
commit | 1e3812c1c539e973102efc52cb65a4b838173f4d (patch) | |
tree | c99eeac48f98837daecb9607b2e4ceb9143a6471 /lib/CodeGen/RegAllocLocal.cpp | |
parent | 355a724bd8366b982950ac913b0589d40eaf379b (diff) |
Once we have a way to fold spill code reloads into instructions, we have a way to use it. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocLocal.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index de12c6a573..dc375cc54e 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -487,9 +487,24 @@ MachineInstr *RA::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI, return MI; } - unsigned PhysReg = getReg(MBB, MI, VirtReg); - + // Otherwise, we need to fold it into the current instruction, or reload it. + // If we have registers available to hold the value, use them. const TargetRegisterClass *RC = MF->getSSARegMap()->getRegClass(VirtReg); + unsigned PhysReg = getFreeReg(RC); + + if (PhysReg == 0) { // No registers available... + /// If we can fold this spill into this instruction, do so now. + if (0) { + // TODO + return MI; + } + + // It looks like we can't fold this virtual register load into this + // instruction. Force some poor hapless value out of the register file to + // make room for the new register, and reload it. + PhysReg = getReg(MBB, MI, VirtReg); + } + int FrameIndex = getStackSpaceFor(VirtReg, RC); markVirtRegModified(VirtReg, false); // Note that this reg was just reloaded |