[llvm-commits] [llvm] r117945 - in /llvm/trunk/lib/CodeGen: InlineSpiller.cpp LiveRangeEdit.cpp LiveRangeEdit.h

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Nov 1 12:49:57 PDT 2010


Author: stoklund
Date: Mon Nov  1 14:49:57 2010
New Revision: 117945

URL: http://llvm.org/viewvc/llvm-project?rev=117945&view=rev
Log:
Don't assign new registers created during a split to the same stack slot, but
give them individual stack slots once the are actually spilled.

Modified:
    llvm/trunk/lib/CodeGen/InlineSpiller.cpp
    llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp
    llvm/trunk/lib/CodeGen/LiveRangeEdit.h

Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=117945&r1=117944&r2=117945&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/InlineSpiller.cpp (original)
+++ llvm/trunk/lib/CodeGen/InlineSpiller.cpp Mon Nov  1 14:49:57 2010
@@ -369,12 +369,12 @@
     return;
 
   rc_ = mri_.getRegClass(edit.getReg());
-  stackSlot_ = edit.assignStackSlot(vrm_);
+  stackSlot_ = vrm_.assignVirt2StackSlot(edit_->getReg());
 
   // Update LiveStacks now that we are committed to spilling.
   LiveInterval &stacklvr = lss_.getOrCreateInterval(stackSlot_, rc_);
-  if (!stacklvr.hasAtLeastOneValue())
-    stacklvr.getNextValue(SlotIndex(), 0, lss_.getVNInfoAllocator());
+  assert(stacklvr.empty() && "Just created stack slot not empty");
+  stacklvr.getNextValue(SlotIndex(), 0, lss_.getVNInfoAllocator());
   stacklvr.MergeRangesInAsValue(edit_->getParent(), stacklvr.getValNumInfo(0));
 
   // Iterate over instructions using register.

Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp?rev=117945&r1=117944&r2=117945&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp Mon Nov  1 14:49:57 2010
@@ -19,21 +19,12 @@
 
 using namespace llvm;
 
-int LiveRangeEdit::assignStackSlot(VirtRegMap &vrm) {
-  int ss = vrm.getStackSlot(getReg());
-  if (ss != VirtRegMap::NO_STACK_SLOT)
-    return ss;
-  return vrm.assignVirt2StackSlot(getReg());
-}
-
 LiveInterval &LiveRangeEdit::create(MachineRegisterInfo &mri,
                                     LiveIntervals &lis,
                                     VirtRegMap &vrm) {
   const TargetRegisterClass *RC = mri.getRegClass(parent_.reg);
   unsigned VReg = mri.createVirtualRegister(RC);
   vrm.grow();
-  // Immediately assign to the same stack slot as parent.
-  vrm.assignVirt2StackSlot(VReg, assignStackSlot(vrm));
   LiveInterval &li = lis.getOrCreateInterval(VReg);
   newRegs_.push_back(&li);
   return li;

Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.h?rev=117945&r1=117944&r2=117945&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveRangeEdit.h (original)
+++ llvm/trunk/lib/CodeGen/LiveRangeEdit.h Mon Nov  1 14:49:57 2010
@@ -80,10 +80,6 @@
   unsigned size() const { return newRegs_.size()-firstNew_; }
   LiveInterval *get(unsigned idx) const { return newRegs_[idx+firstNew_]; }
 
-  /// assignStackSlot - Ensure a stack slot is assigned to parent.
-  /// @return the assigned stack slot number.
-  int assignStackSlot(VirtRegMap&);
-
   /// create - Create a new register with the same class and stack slot as
   /// parent.
   LiveInterval &create(MachineRegisterInfo&, LiveIntervals&, VirtRegMap&);





More information about the llvm-commits mailing list