* Code Cleanups
* Removal dependencies on Type.h & remove uses of getTypeID()
llvm-svn: 1718
diff --git a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
index 96ff39e..b25dd01 100644
--- a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
+++ b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
@@ -1,6 +1,7 @@
#include "SparcRegClassInfo.h"
#include "llvm/CodeGen/IGNode.h"
#include "llvm/Target/Sparc.h"
+#include "llvm/Type.h"
#include <iostream>
using std::cerr;
@@ -145,10 +146,8 @@
// If a color is still not fond, mark for spilling
//
//----------------------------------------------------------------------------
-void SparcFloatRegClass::colorIGNode(IGNode * Node,bool IsColorUsedArr[]) const
-{
-
- LiveRange * LR = Node->getParentLR();
+void SparcFloatRegClass::colorIGNode(IGNode * Node,bool IsColorUsedArr[]) const{
+ LiveRange *LR = Node->getParentLR();
unsigned NumNeighbors = Node->getNumOfNeighbors(); // total # of neighbors
for(unsigned n=0; n < NumNeighbors; n++) { // for each neigh
@@ -157,7 +156,7 @@
if( NeighLR->hasColor() ) { // if neigh has a color
IsColorUsedArr[ NeighLR->getColor() ] = true; // record that color
- if( NeighLR->getTypeID() == Type::DoubleTyID )
+ if (NeighLR->getType() == Type::DoubleTy)
IsColorUsedArr[ (NeighLR->getColor()) + 1 ] = true;
}
else if( NeighLR->hasSuggestedColor() ) { // if neigh has sugg color
@@ -167,7 +166,7 @@
// if the neighbout can use the suggested color
IsColorUsedArr[ NeighLR->getSuggestedColor() ] = true;
- if( NeighLR->getTypeID() == Type::DoubleTyID )
+ if (NeighLR->getType() == Type::DoubleTy)
IsColorUsedArr[ (NeighLR->getSuggestedColor()) + 1 ] = true;
}
@@ -200,7 +199,7 @@
// cannot go there. By doing that, we provide more space for singles
// in f0 - f31
//
- if( LR->getTypeID() == Type::DoubleTyID )
+ if (LR->getType() == Type::DoubleTy)
ColorFound = findFloatColor( LR, 32, 64, IsColorUsedArr );
@@ -265,11 +264,11 @@
int SparcFloatRegClass::findFloatColor(const LiveRange *LR,
unsigned Start, unsigned End,
- bool IsColorUsedArr[] ) const {
+ bool IsColorUsedArr[]) const {
bool ColorFound = false;
unsigned c;
- if (LR->getTypeID() == Type::DoubleTyID) {
+ if (LR->getType() == Type::DoubleTy) {
// find first unused color for a double
for (c=Start; c < End ; c+= 2)
if (!IsColorUsedArr[c] && !IsColorUsedArr[c+1])
diff --git a/llvm/lib/Target/Sparc/SparcRegInfo.cpp b/llvm/lib/Target/Sparc/SparcRegInfo.cpp
index 879b01e..9af470a 100644
--- a/llvm/lib/Target/Sparc/SparcRegInfo.cpp
+++ b/llvm/lib/Target/Sparc/SparcRegInfo.cpp
@@ -143,17 +143,16 @@
// of a LiveRange, Value and using the unified RegClassID
//
int UltraSparcRegInfo::getRegType(const LiveRange *LR) const {
- unsigned Typ;
switch (LR->getRegClass()->getID()) {
case IntRegClassID: return IntRegType;
- case FloatRegClassID:
- Typ = LR->getTypeID();
- if (Typ == Type::FloatTyID)
+ case FloatRegClassID: {
+ const Type *Typ = LR->getType();
+ if (Typ == Type::FloatTy)
return FPSingleRegType;
- else if (Typ == Type::DoubleTyID)
+ else if (Typ == Type::DoubleTy)
return FPDoubleRegType;
assert(0 && "Unknown type in FloatRegClass");
-
+ }
case IntCCRegClassID: return IntCCRegType;
case FloatCCRegClassID: return FloatCCRegType;
default: assert( 0 && "Unknown reg class ID");
@@ -1444,7 +1443,7 @@
} else if (RegClassID == FloatRegClassID) {
cerr << "[" << SparcFloatRegOrder::getRegName(LR->getColor());
- if( LR->getTypeID() == Type::DoubleTyID )
+ if( LR->getType() == Type::DoubleTy)
cerr << "+" << SparcFloatRegOrder::getRegName(LR->getColor()+1);
cerr << "]\n";
}