1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

Use VirtRegMap's Virt2SplitMap to keep track of the original live range before splitting.

All new virtual registers created for spilling or splitting point back to their original.

llvm-svn: 125980
This commit is contained in:
Jakob Stoklund Olesen 2011-02-18 22:35:20 +00:00
parent a0dede2c21
commit 0dd5f07ac0
3 changed files with 12 additions and 2 deletions

View File

@ -19,12 +19,18 @@
using namespace llvm;
unsigned LiveRangeEdit::getOriginal(const VirtRegMap &vrm) const {
unsigned Orig = vrm.getPreSplitReg(getReg());
return Orig ? Orig : getReg();
}
LiveInterval &LiveRangeEdit::create(MachineRegisterInfo &mri,
LiveIntervals &lis,
VirtRegMap &vrm) {
const TargetRegisterClass *RC = mri.getRegClass(parent_.reg);
const TargetRegisterClass *RC = mri.getRegClass(getReg());
unsigned VReg = mri.createVirtualRegister(RC);
vrm.grow();
vrm.setIsSplitFromReg(VReg, getOriginal(vrm));
LiveInterval &li = lis.getOrCreateInterval(VReg);
newRegs_.push_back(&li);
return li;

View File

@ -73,6 +73,10 @@ public:
LiveInterval &getParent() const { return parent_; }
unsigned getReg() const { return parent_.reg; }
/// getOriginal - Return the original virtual register that parent descends
/// from through splitting. The original was not created by splitting.
unsigned getOriginal(const VirtRegMap&) const;
/// Iterator for accessing the new registers added by this edit.
typedef SmallVectorImpl<LiveInterval*>::const_iterator iterator;
iterator begin() const { return newRegs_.begin()+firstNew_; }

View File

@ -214,7 +214,7 @@ namespace llvm {
}
/// @brief returns the live interval virtReg is split from.
unsigned getPreSplitReg(unsigned virtReg) {
unsigned getPreSplitReg(unsigned virtReg) const {
return Virt2SplitMap[virtReg];
}