This method belonged in VirtRegMap.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 19 Feb 2011 00:38:43 +0000 (00:38 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 19 Feb 2011 00:38:43 +0000 (00:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126002 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveRangeEdit.cpp
lib/CodeGen/LiveRangeEdit.h
lib/CodeGen/VirtRegMap.h

index e23f38283430fa97f92d6ef50a9ae18c24a4d53c..3bbda1c2e609a41a5f8f34f37648940fdba1eb34 100644 (file)
 
 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;
index 832a12db4f4214a4552b4ce6479cf4287c842cb9..73f69ed639836a1eef47772c502cec49ef4fa71b 100644 (file)
@@ -73,10 +73,6 @@ 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_; }
index 23101ce74f915174e64c934a1671c804751b7a1d..ba50f4e42302d473fb3cfb96427405d64db58fc6 100644 (file)
@@ -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 {