There is no need to build an archive version of this library
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9RegInfo.cpp
index 66aab3644460989ca1b2b9756b984afd1ba203c7..0a88e07fd359110a2ba85c80a73bf7f831eae4a7 100644 (file)
@@ -211,7 +211,7 @@ SparcV9RegInfo::regNumForFPArg(unsigned regType,
           getInvalidRegNum() : SparcV9FloatRegClass::f0 + (argNo * 2);
       else
         assert(0 && "Illegal FP register type");
-       return 0;
+        return 0;
     }
 }
 
@@ -221,7 +221,7 @@ SparcV9RegInfo::regNumForFPArg(unsigned regType,
 //---------------------------------------------------------------------------
 
 // The following 4  methods are used to find the RegType (SparcV9Internals.h)
-// of a LiveRange, a Value, and for a given register unified reg number.
+// of a V9LiveRange, a Value, and for a given register unified reg number.
 //
 int SparcV9RegInfo::getRegTypeForClassAndType(unsigned regClassID,
                                                  const Type* type) const
@@ -244,7 +244,7 @@ int SparcV9RegInfo::getRegTypeForDataType(const Type* type) const
   return getRegTypeForClassAndType(getRegClassIDOfType(type), type);
 }
 
-int SparcV9RegInfo::getRegTypeForLR(const LiveRange *LR) const
+int SparcV9RegInfo::getRegTypeForLR(const V9LiveRange *LR) const
 {
   return getRegTypeForClassAndType(LR->getRegClassID(), LR->getType());
 }
@@ -313,7 +313,7 @@ unsigned SparcV9RegInfo::getRegClassIDOfRegType(int regType) const {
 // We always suggest %i7 by convention.
 //---------------------------------------------------------------------------
 void SparcV9RegInfo::suggestReg4RetAddr(MachineInstr *RetMI,
-                                          LiveRangeInfo& LRI) const {
+                                           LiveRangeInfo& LRI) const {
 
   assert(target.getInstrInfo()->isReturn(RetMI->getOpcode()));
 
@@ -330,7 +330,7 @@ void SparcV9RegInfo::suggestReg4RetAddr(MachineInstr *RetMI,
   // MachineOperand & MO  = RetMI->getOperand(0);
   // const Value *RetAddrVal = MO.getVRegValue();
   // assert( RetAddrVal && "LR for ret address must be created at start");
-  // LiveRange * RetAddrLR = LRI.getLiveRangeForValue( RetAddrVal);
+  // V9LiveRange * RetAddrLR = LRI.getLiveRangeForValue( RetAddrVal);
   // RetAddrLR->setSuggestedColor(getUnifiedRegNum( IntRegClassID,
   //                              SparcV9IntRegOrdr::i7) );
 }
@@ -349,7 +349,7 @@ SparcV9RegInfo::suggestReg4CallAddr(MachineInstr * CallMI,
   assert(RetAddrVal && "INTERNAL ERROR: Return address value is required");
 
   // A LR must already exist for the return address.
-  LiveRange *RetAddrLR = LRI.getLiveRangeForValue(RetAddrVal);
+  V9LiveRange *RetAddrLR = LRI.getLiveRangeForValue(RetAddrVal);
   assert(RetAddrLR && "INTERNAL ERROR: No LR for return address of call!");
 
   unsigned RegClassID = RetAddrLR->getRegClassID();
@@ -366,7 +366,7 @@ SparcV9RegInfo::suggestReg4CallAddr(MachineInstr * CallMI,
 //  done - it will be colored (or spilled) as a normal live range.
 //---------------------------------------------------------------------------
 void SparcV9RegInfo::suggestRegs4MethodArgs(const Function *Meth,
-                                              LiveRangeInfo& LRI) const
+                                               LiveRangeInfo& LRI) const
 {
   // Check if this is a varArgs function. needed for choosing regs.
   bool isVarArgs = isVarArgsFunction(Meth->getType());
@@ -376,7 +376,7 @@ void SparcV9RegInfo::suggestRegs4MethodArgs(const Function *Meth,
   unsigned argNo=0;
   for(Function::const_arg_iterator I = Meth->arg_begin(), E = Meth->arg_end();
       I != E; ++I, ++argNo) {
-    LiveRange *LR = LRI.getLiveRangeForValue(I);
+    V9LiveRange *LR = LRI.getLiveRangeForValue(I);
     assert(LR && "No live range found for method arg");
 
     unsigned regType = getRegTypeForLR(LR);
@@ -413,7 +413,7 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
   for(Function::const_arg_iterator I = Meth->arg_begin(), E = Meth->arg_end();
       I != E; ++I, ++argNo) {
     // get the LR of arg
-    LiveRange *LR = LRI.getLiveRangeForValue(I);
+    V9LiveRange *LR = LRI.getLiveRangeForValue(I);
     assert( LR && "No live range found for method arg");
 
     unsigned regType = getRegTypeForLR(LR);
@@ -444,7 +444,7 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
       // if LR received the correct color, nothing to do
       //
       if( UniLRReg == UniArgReg )
-       continue;
+        continue;
 
       // We are here because the LR did not receive the suggested
       // but LR received another register.
@@ -455,36 +455,36 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
       // the UniLRReg register
       //
       if( isArgInReg ) {
-       if( regClassIDOfArgReg != RegClassID ) {
-         // NOTE: This code has not been well-tested.
+        if( regClassIDOfArgReg != RegClassID ) {
+          // NOTE: This code has not been well-tested.
 
-         // It is a variable argument call: the float reg must go in a %o reg.
-         // We have to move an int reg to a float reg via memory.
+          // It is a variable argument call: the float reg must go in a %o reg.
+          // We have to move an int reg to a float reg via memory.
           //
           assert(isVarArgs &&
                  RegClassID == FloatRegClassID &&
                  regClassIDOfArgReg == IntRegClassID &&
                  "This should only be an Int register for an FP argument");
 
-         int TmpOff = MachineFunction::get(Meth).getInfo<SparcV9FunctionInfo>()->pushTempValue(
+          int TmpOff = MachineFunction::get(Meth).getInfo<SparcV9FunctionInfo>()->pushTempValue(
                                                 getSpilledRegSize(regType));
-         cpReg2MemMI(InstrnsBefore,
+          cpReg2MemMI(InstrnsBefore,
                       UniArgReg, getFramePointer(), TmpOff, IntRegType);
 
-         cpMem2RegMI(InstrnsBefore,
+          cpMem2RegMI(InstrnsBefore,
                       getFramePointer(), TmpOff, UniLRReg, regType);
-       }
-       else {  
-         cpReg2RegMI(InstrnsBefore, UniArgReg, UniLRReg, regType);
-       }
+        }
+        else {
+          cpReg2RegMI(InstrnsBefore, UniArgReg, UniLRReg, regType);
+        }
       }
       else {
 
-       // Now the arg is coming on stack. Since the LR received a register,
-       // we just have to load the arg on stack into that register
-       //
+        // Now the arg is coming on stack. Since the LR received a register,
+        // we just have to load the arg on stack into that register
+        //
         const TargetFrameInfo& frameInfo = *target.getFrameInfo();
-       int offsetFromFP =
+        int offsetFromFP =
           frameInfo.getIncomingArgOffset(MachineFunction::get(Meth),
                                          argNo);
 
@@ -498,7 +498,7 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
           offsetFromFP += slotSize - argSize;
         }
 
-       cpMem2RegMI(InstrnsBefore,
+        cpMem2RegMI(InstrnsBefore,
                     getFramePointer(), offsetFromFP, UniLRReg, regType);
       }
 
@@ -513,12 +513,12 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
 
       if( isArgInReg ) {
 
-       if( regClassIDOfArgReg != RegClassID ) {
+        if( regClassIDOfArgReg != RegClassID ) {
           assert(0 &&
                  "FP arguments to a varargs function should be explicitly "
                  "copied to/from int registers by instruction selection!");
 
-         // It must be a float arg for a variable argument call, which
+          // It must be a float arg for a variable argument call, which
           // must come in a %o reg.  Move the int reg to the stack.
           //
           assert(isVarArgs && regClassIDOfArgReg == IntRegClassID &&
@@ -535,14 +535,14 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
 
       else {
 
-       // Now the arg is coming on stack. Since the LR did NOT
-       // received a register as well, it is allocated a stack position. We
-       // can simply change the stack position of the LR. We can do this,
-       // since this method is called before any other method that makes
-       // uses of the stack pos of the LR (e.g., updateMachineInstr)
+        // Now the arg is coming on stack. Since the LR did NOT
+        // received a register as well, it is allocated a stack position. We
+        // can simply change the stack position of the LR. We can do this,
+        // since this method is called before any other method that makes
+        // uses of the stack pos of the LR (e.g., updateMachineInstr)
         //
         const TargetFrameInfo& frameInfo = *target.getFrameInfo();
-       int offsetFromFP =
+        int offsetFromFP =
           frameInfo.getIncomingArgOffset(MachineFunction::get(Meth),
                                          argNo);
 
@@ -556,7 +556,7 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
           offsetFromFP += slotSize - argSize;
         }
 
-       LR->modifySpillOffFromFP( offsetFromFP );
+        LR->modifySpillOffFromFP( offsetFromFP );
       }
 
     }
@@ -572,7 +572,7 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
 // outgoing call args and the return value of the call.
 //---------------------------------------------------------------------------
 void SparcV9RegInfo::suggestRegs4CallArgs(MachineInstr *CallMI,
-                                            LiveRangeInfo& LRI) const {
+                                             LiveRangeInfo& LRI) const {
   assert ( (target.getInstrInfo())->isCall(CallMI->getOpcode()) );
 
   CallArgsDescriptor* argDesc = CallArgsDescriptor::get(CallMI);
@@ -584,7 +584,7 @@ void SparcV9RegInfo::suggestRegs4CallArgs(MachineInstr *CallMI,
   // or in %f0 if the value is a float type.
   //
   if (const Value *RetVal = argDesc->getReturnValue()) {
-    LiveRange *RetValLR = LRI.getLiveRangeForValue(RetVal);
+    V9LiveRange *RetValLR = LRI.getLiveRangeForValue(RetVal);
     assert(RetValLR && "No LR for return Value of call!");
 
     unsigned RegClassID = RetValLR->getRegClassID();
@@ -610,7 +610,7 @@ void SparcV9RegInfo::suggestRegs4CallArgs(MachineInstr *CallMI,
     const Value *CallArg = argDesc->getArgInfo(i).getArgVal();
 
     // get the LR of call operand (parameter)
-    LiveRange *const LR = LRI.getLiveRangeForValue(CallArg);
+    V9LiveRange *const LR = LRI.getLiveRangeForValue(CallArg);
     if (!LR)
       continue;                    // no live ranges for constants and labels
 
@@ -651,7 +651,7 @@ void SparcV9RegInfo::suggestReg4RetValue(MachineInstr *RetMI,
   Value* tmpI = RetMI->getOperand(0).getVRegValue();
   ReturnInst* retI=cast<ReturnInst>(cast<TmpInstruction>(tmpI)->getOperand(0));
   if (const Value *RetVal = retI->getReturnValue())
-    if (LiveRange *const LR = LRI.getLiveRangeForValue(RetVal))
+    if (V9LiveRange *const LR = LRI.getLiveRangeForValue(RetVal))
       LR->setSuggestedColor(LR->getRegClassID() == IntRegClassID
                             ? (unsigned) SparcV9IntRegClass::i0
                             : (unsigned) SparcV9FloatRegClass::f0);
@@ -690,7 +690,7 @@ SparcV9RegInfo::cpReg2RegMI(std::vector<MachineInstr*>& mvec,
                                int RegType) const {
   assert( ((int)SrcReg != getInvalidRegNum()) &&
           ((int)DestReg != getInvalidRegNum()) &&
-         "Invalid Register");
+          "Invalid Register");
 
   MachineInstr * MI = NULL;
 
@@ -948,7 +948,7 @@ SparcV9RegInfo::cpValue2Value(Value *Src, Value *Dest,
 // Print the register assigned to a LR
 //---------------------------------------------------------------------------
 
-void SparcV9RegInfo::printReg(const LiveRange *LR) const {
+void SparcV9RegInfo::printReg(const V9LiveRange *LR) const {
   unsigned RegClassID = LR->getRegClassID();
   std::cerr << " Node ";