diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-01-05 00:26:49 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-01-05 00:26:49 +0000 |
commit | d9e5c764bfea339fc5082bf17e558db959fd6d28 (patch) | |
tree | fd5c1e5c86fda13c754e87965fb64027891a6f68 /lib | |
parent | febaf8401779fedf8db7b02e499c5e39848fb9f5 (diff) | |
download | llvm-d9e5c764bfea339fc5082bf17e558db959fd6d28.tar.gz llvm-d9e5c764bfea339fc5082bf17e558db959fd6d28.tar.bz2 llvm-d9e5c764bfea339fc5082bf17e558db959fd6d28.tar.xz |
Freeze reserved registers before starting register allocation.
The register allocators don't currently support adding reserved
registers while they are running. Extend the MRI API to keep track of
the set of reserved registers when register allocation started.
Target hooks like hasFP() and needsStackRealignment() can look at this
set to avoid reserving more registers during register allocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/MachineRegisterInfo.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/RegAllocBasic.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/RegAllocFast.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/RegAllocPBQP.cpp | 1 |
4 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineRegisterInfo.cpp b/lib/CodeGen/MachineRegisterInfo.cpp index c35b154aa1..67291a0eb8 100644 --- a/lib/CodeGen/MachineRegisterInfo.cpp +++ b/lib/CodeGen/MachineRegisterInfo.cpp @@ -259,3 +259,7 @@ void MachineRegisterInfo::dumpUses(unsigned Reg) const { I.getOperand().getParent()->dump(); } #endif + +void MachineRegisterInfo::freezeReservedRegs(const MachineFunction &MF) { + ReservedRegs = TRI->getReservedRegs(MF); +} diff --git a/lib/CodeGen/RegAllocBasic.cpp b/lib/CodeGen/RegAllocBasic.cpp index 5496d69fd3..8019cf227b 100644 --- a/lib/CodeGen/RegAllocBasic.cpp +++ b/lib/CodeGen/RegAllocBasic.cpp @@ -233,6 +233,7 @@ void RegAllocBase::init(VirtRegMap &vrm, LiveIntervals &lis) { MRI = &vrm.getRegInfo(); VRM = &vrm; LIS = &lis; + MRI->freezeReservedRegs(vrm.getMachineFunction()); RegClassInfo.runOnMachineFunction(vrm.getMachineFunction()); const unsigned NumRegs = TRI->getNumRegs(); diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp index c2656c5e5c..93f39b6c66 100644 --- a/lib/CodeGen/RegAllocFast.cpp +++ b/lib/CodeGen/RegAllocFast.cpp @@ -1047,6 +1047,7 @@ bool RAFast::runOnMachineFunction(MachineFunction &Fn) { TM = &Fn.getTarget(); TRI = TM->getRegisterInfo(); TII = TM->getInstrInfo(); + MRI->freezeReservedRegs(Fn); RegClassInfo.runOnMachineFunction(Fn); UsedInInstr.resize(TRI->getNumRegs()); diff --git a/lib/CodeGen/RegAllocPBQP.cpp b/lib/CodeGen/RegAllocPBQP.cpp index a053cccc9e..f8b0b9fa6e 100644 --- a/lib/CodeGen/RegAllocPBQP.cpp +++ b/lib/CodeGen/RegAllocPBQP.cpp @@ -619,6 +619,7 @@ bool RegAllocPBQP::runOnMachineFunction(MachineFunction &MF) { vrm = &getAnalysis<VirtRegMap>(); spiller.reset(createInlineSpiller(*this, MF, *vrm)); + mri->freezeReservedRegs(MF); DEBUG(dbgs() << "PBQP Register Allocating for " << mf->getFunction()->getName() << "\n"); |