Put this change back in after testing from Reid proved its innocence. getSpillSize...
[oota-llvm.git] / lib / CodeGen / PrologEpilogInserter.cpp
index 20442129650444c9de55adb35bb943fa5a5413b6..1aee69f9cca74cf46b5bfbd3c88ee394cd629545 100644 (file)
@@ -163,29 +163,30 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
     return;   // Early exit if no caller saved registers are modified!
 
   unsigned NumFixedSpillSlots;
-  std::pair<unsigned,int> *FixedSpillSlots =
+  const std::pair<unsigned,int> *FixedSpillSlots =
     TFI->getCalleeSaveSpillSlots(NumFixedSpillSlots);
 
   // Now that we know which registers need to be saved and restored, allocate
   // stack slots for them.
   for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
     unsigned Reg = RegsToSave[i];
-    int FrameIdx;
-    const TargetRegisterClass *RC = RegInfo->getRegClass(Reg);
 
     // Check to see if this physreg must be spilled to a particular stack slot
     // on this target.
-    std::pair<unsigned,int> *FixedSlot = FixedSpillSlots;
+    const std::pair<unsigned,int> *FixedSlot = FixedSpillSlots;
     while (FixedSlot != FixedSpillSlots+NumFixedSpillSlots &&
            FixedSlot->first != Reg)
       ++FixedSlot;
 
+    int FrameIdx;
     if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) {
       // Nope, just spill it anywhere convenient.
-      FrameIdx = FFI->CreateStackObject(RC);
+      FrameIdx = FFI->CreateStackObject(RegInfo->getSpillSize(Reg)/8,
+                                        RegInfo->getSpillAlignment(Reg)/8);
     } else {
       // Spill it to the stack where we must.
-      FrameIdx = FFI->CreateFixedObject(RC->getSize(), FixedSlot->second);
+      FrameIdx = FFI->CreateFixedObject(RegInfo->getSpillSize(Reg)/8,
+                                        FixedSlot->second);
     }
     StackSlots.push_back(FrameIdx);
   }
@@ -206,10 +207,8 @@ void PEI::saveCallerSavedRegisters(MachineFunction &Fn) {
   MachineBasicBlock *MBB = Fn.begin();
   MachineBasicBlock::iterator I = MBB->begin();
   for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
-    const TargetRegisterClass *RC = RegInfo->getRegClass(RegsToSave[i]);
-
-    // Insert the spill to the stack frame...
-    RegInfo->storeRegToStackSlot(*MBB, I, RegsToSave[i], StackSlots[i], RC);
+    // Insert the spill to the stack frame.
+    RegInfo->storeRegToStackSlot(*MBB, I, RegsToSave[i], StackSlots[i]);
   }
 
   // Add code to restore the callee-save registers in each exiting block.
@@ -221,8 +220,7 @@ void PEI::saveCallerSavedRegisters(MachineFunction &Fn) {
       I = MBB->end(); --I;
 
       for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
-        const TargetRegisterClass *RC = RegInfo->getRegClass(RegsToSave[i]);
-        RegInfo->loadRegFromStackSlot(*MBB, I, RegsToSave[i],StackSlots[i], RC);
+        RegInfo->loadRegFromStackSlot(*MBB, I, RegsToSave[i],StackSlots[i]);
         --I;  // Insert in reverse order
       }
     }