[llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9Internals.h SparcV9RegClassInfo.cpp SparcV9RegClassInfo.h SparcV9RegInfo.cpp SparcV9RegInfo.h

Nate Begeman natebegeman at mac.com
Sun Jun 12 16:53:09 PDT 2005



Changes in directory llvm/lib/Target/SparcV9:

SparcV9Internals.h updated: 1.120 -> 1.121
SparcV9RegClassInfo.cpp updated: 1.40 -> 1.41
SparcV9RegClassInfo.h updated: 1.29 -> 1.30
SparcV9RegInfo.cpp updated: 1.140 -> 1.141
SparcV9RegInfo.h updated: 1.18 -> 1.19
---
Log message:

When compiled with GCC 4.0, a latent bug was exposed where both SparcV9
and the target independant register allocator were both using a class named
'LiveRange'.  This lead to the target independant code calling code in the
SparcV9 backend, which crashed.  Fixed by renaming SparcV9's LiveRange to
V9LiveRange.


---
Diffs of the changes:  (+21 -21)

 SparcV9Internals.h      |    2 +-
 SparcV9RegClassInfo.cpp |   12 ++++++------
 SparcV9RegClassInfo.h   |    2 +-
 SparcV9RegInfo.cpp      |   20 ++++++++++----------
 SparcV9RegInfo.h        |    6 +++---
 5 files changed, 21 insertions(+), 21 deletions(-)


Index: llvm/lib/Target/SparcV9/SparcV9Internals.h
diff -u llvm/lib/Target/SparcV9/SparcV9Internals.h:1.120 llvm/lib/Target/SparcV9/SparcV9Internals.h:1.121
--- llvm/lib/Target/SparcV9/SparcV9Internals.h:1.120	Thu Apr 21 18:25:42 2005
+++ llvm/lib/Target/SparcV9/SparcV9Internals.h	Sun Jun 12 18:52:58 2005
@@ -25,7 +25,7 @@
 
 namespace llvm {
 
-class LiveRange;
+class V9LiveRange;
 class SparcV9TargetMachine;
 class ModulePass;
 class GetElementPtrInst;


Index: llvm/lib/Target/SparcV9/SparcV9RegClassInfo.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9RegClassInfo.cpp:1.40 llvm/lib/Target/SparcV9/SparcV9RegClassInfo.cpp:1.41
--- llvm/lib/Target/SparcV9/SparcV9RegClassInfo.cpp:1.40	Thu Apr 21 18:25:42 2005
+++ llvm/lib/Target/SparcV9/SparcV9RegClassInfo.cpp	Sun Jun 12 18:52:58 2005
@@ -39,7 +39,7 @@
 void SparcV9IntRegClass::colorIGNode(IGNode * Node,
                                const std::vector<bool> &IsColorUsedArr) const
 {
-  LiveRange *LR = Node->getParentLR();
+  V9LiveRange *LR = Node->getParentLR();
 
   if (DEBUG_RA)
     std::cerr << "\nColoring LR [CallInt=" << LR->isCallInterference() <<"]:"
@@ -152,7 +152,7 @@
   // spill algorithm cannot find it.  In particular, we have to choose
   // whether to use %xcc or %icc based on type of value compared
   //
-  const LiveRange* ccLR = Node->getParentLR();
+  const V9LiveRange* ccLR = Node->getParentLR();
   const Type* setCCType = (* ccLR->begin())->getType(); // any Value in LR
   assert(setCCType->isIntegral() || isa<PointerType>(setCCType));
   int ccReg = ((isa<PointerType>(setCCType) || setCCType == Type::LongTy)
@@ -161,7 +161,7 @@
 #ifndef NDEBUG
   // Let's just make sure values of two different types have not been
   // coalesced into this LR.
-  for (LiveRange::const_iterator I=ccLR->begin(), E=ccLR->end(); I!=E; ++I) {
+  for (V9LiveRange::const_iterator I=ccLR->begin(), E=ccLR->end(); I!=E; ++I) {
     const Type* ccType = (*I)->getType();
     assert((ccReg == xcc && (isa<PointerType>(ccType)
                              || ccType == Type::LongTy)) ||
@@ -205,7 +205,7 @@
 void SparcV9FloatRegClass::colorIGNode(IGNode * Node,
                                  const std::vector<bool> &IsColorUsedArr) const
 {
-  LiveRange *LR = Node->getParentLR();
+  V9LiveRange *LR = Node->getParentLR();
 
 #ifndef NDEBUG
   // Check that the correct colors have been are marked for fp-doubles.
@@ -222,7 +222,7 @@
   unsigned NumNeighbors =  Node->getNumOfNeighbors();   // total # of neighbors
   for(unsigned n=0; n < NumNeighbors; n++) {            // for each neigh
     IGNode *NeighIGNode = Node->getAdjIGNode(n);
-    LiveRange *NeighLR = NeighIGNode->getParentLR();
+    V9LiveRange *NeighLR = NeighIGNode->getParentLR();
 
     if (NeighLR->hasColor()) {
       assert(IsColorUsedArr[ NeighLR->getColor() ]);
@@ -369,7 +369,7 @@
 // type of the Node (i.e., float/double)
 //-----------------------------------------------------------------------------
 
-int SparcV9FloatRegClass::findFloatColor(const LiveRange *LR,
+int SparcV9FloatRegClass::findFloatColor(const V9LiveRange *LR,
                                        unsigned Start,
                                        unsigned End,
                                const std::vector<bool> &IsColorUsedArr) const


Index: llvm/lib/Target/SparcV9/SparcV9RegClassInfo.h
diff -u llvm/lib/Target/SparcV9/SparcV9RegClassInfo.h:1.29 llvm/lib/Target/SparcV9/SparcV9RegClassInfo.h:1.30
--- llvm/lib/Target/SparcV9/SparcV9RegClassInfo.h:1.29	Thu Apr 21 18:25:42 2005
+++ llvm/lib/Target/SparcV9/SparcV9RegClassInfo.h	Sun Jun 12 18:52:58 2005
@@ -89,7 +89,7 @@
 //-----------------------------------------------------------------------------
 
 class SparcV9FloatRegClass : public TargetRegClassInfo {
-  int findFloatColor(const LiveRange *LR, unsigned Start,
+  int findFloatColor(const V9LiveRange *LR, unsigned Start,
 		     unsigned End,
                      const std::vector<bool> &IsColorUsedArr) const;
 public:


Index: llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.140 llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.141
--- llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.140	Thu Apr 21 18:25:42 2005
+++ llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp	Sun Jun 12 18:52:58 2005
@@ -221,7 +221,7 @@
 //---------------------------------------------------------------------------
 
 // 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 @@
   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());
 }
@@ -330,7 +330,7 @@
   // 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 @@
   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();
@@ -376,7 +376,7 @@
   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 @@
   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);
@@ -584,7 +584,7 @@
   // 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 @@
     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 @@
   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);
@@ -948,7 +948,7 @@
 // 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 ";
 


Index: llvm/lib/Target/SparcV9/SparcV9RegInfo.h
diff -u llvm/lib/Target/SparcV9/SparcV9RegInfo.h:1.18 llvm/lib/Target/SparcV9/SparcV9RegInfo.h:1.19
--- llvm/lib/Target/SparcV9/SparcV9RegInfo.h:1.18	Wed May 11 16:40:40 2005
+++ llvm/lib/Target/SparcV9/SparcV9RegInfo.h	Sun Jun 12 18:52:58 2005
@@ -27,7 +27,7 @@
 class Value;
 class LiveRangeInfo;
 class Function;
-class LiveRange;
+class V9LiveRange;
 class AddedInstrns;
 class MachineInstr;
 class BasicBlock;
@@ -324,7 +324,7 @@
 
   // method used for printing a register for debugging purposes
   //
-  void printReg(const LiveRange *LR) const;
+  void printReg(const V9LiveRange *LR) const;
 
   // To obtain the return value and the indirect call address (if any)
   // contained in a CALL machine instruction
@@ -369,7 +369,7 @@
   // The reg class of a LR depends both on the Value types in it and whether
   // they are CC registers or not (for example).
   int getRegTypeForDataType(const Type* type) const;
-  int getRegTypeForLR(const LiveRange *LR) const;
+  int getRegTypeForLR(const V9LiveRange *LR) const;
   int getRegType(int unifiedRegNum) const;
 
   unsigned getFramePointer() const;






More information about the llvm-commits mailing list