aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-01-29 01:13:00 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-01-29 01:13:00 +0000
commit7ddee0ad249e69753a08356708fe3bfbedbb7712 (patch)
treef65f8bcc20c49853403dc9e6d2302bd0d45ace18 /lib
parente8c17335c53f0f37262ee342f46b0d00ac0c1493 (diff)
downloadexternal_llvm-7ddee0ad249e69753a08356708fe3bfbedbb7712.zip
external_llvm-7ddee0ad249e69753a08356708fe3bfbedbb7712.tar.gz
external_llvm-7ddee0ad249e69753a08356708fe3bfbedbb7712.tar.bz2
A slight compile time optimization. If the caller knows there isn't a free register getReg() should not call getFreeReg().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63263 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/RegAllocLocal.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp
index acd3dde..174e394 100644
--- a/lib/CodeGen/RegAllocLocal.cpp
+++ b/lib/CodeGen/RegAllocLocal.cpp
@@ -220,10 +220,10 @@ namespace {
/// getReg - Find a physical register to hold the specified virtual
/// register. If all compatible physical registers are used, this method
/// spills the last used virtual register to the stack, and uses that
- /// register.
- ///
+ /// register. If NoFree is true, that means the caller knows there isn't
+ /// a free register, do not call getFreeReg().
unsigned getReg(MachineBasicBlock &MBB, MachineInstr *MI,
- unsigned VirtReg);
+ unsigned VirtReg, bool NoFree = false);
/// reloadVirtReg - This method transforms the specified specified virtual
/// register use to refer to a physical register. This method may do this
@@ -398,11 +398,11 @@ unsigned RALocal::getFreeReg(const TargetRegisterClass *RC) {
/// the last used virtual register to the stack, and uses that register.
///
unsigned RALocal::getReg(MachineBasicBlock &MBB, MachineInstr *I,
- unsigned VirtReg) {
+ unsigned VirtReg, bool NoFree) {
const TargetRegisterClass *RC = MF->getRegInfo().getRegClass(VirtReg);
// First check to see if we have a free register of the requested type...
- unsigned PhysReg = getFreeReg(RC);
+ unsigned PhysReg = NoFree ? 0 : getFreeReg(RC);
// If we didn't find an unused register, scavenge one now!
if (PhysReg == 0) {
@@ -498,7 +498,7 @@ MachineInstr *RALocal::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI,
} else { // No registers available.
// 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);
+ PhysReg = getReg(MBB, MI, VirtReg, true);
}
markVirtRegModified(VirtReg, false); // Note that this reg was just reloaded