Skip to content

Commit

Permalink
This method belonged in VirtRegMap.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126002 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
stoklund committed Feb 19, 2011
1 parent a2ebf60 commit fd38917
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
7 changes: 1 addition & 6 deletions lib/CodeGen/LiveRangeEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@

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(getReg());
unsigned VReg = mri.createVirtualRegister(RC);
vrm.grow();
vrm.setIsSplitFromReg(VReg, getOriginal(vrm));
vrm.setIsSplitFromReg(VReg, vrm.getOriginal(getReg()));
LiveInterval &li = lis.getOrCreateInterval(VReg);
newRegs_.push_back(&li);
return li;
Expand Down
4 changes: 0 additions & 4 deletions lib/CodeGen/LiveRangeEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ class LiveRangeEdit {
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_; }
Expand Down
9 changes: 9 additions & 0 deletions lib/CodeGen/VirtRegMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ namespace llvm {
return Virt2SplitMap[virtReg];
}

/// getOriginal - Return the original virtual register that VirtReg descends
/// from through splitting.
/// A register that was not created by splitting is its own original.
/// This operation is idempotent.
unsigned getOriginal(unsigned VirtReg) const {
unsigned Orig = getPreSplitReg(VirtReg);
return Orig ? Orig : VirtReg;
}

/// @brief returns true if the specified virtual register is not
/// mapped to a stack slot or rematerialized.
bool isAssignedReg(unsigned virtReg) const {
Expand Down

0 comments on commit fd38917

Please sign in to comment.