[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp ConstantFolding.cpp Constants.cpp Type.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Jun 17 13:26:11 PDT 2004


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.140 -> 1.141
ConstantFolding.cpp updated: 1.58 -> 1.59
Constants.cpp updated: 1.90 -> 1.91
Type.cpp updated: 1.101 -> 1.102

---
Log message:

Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()


---
Diffs of the changes:  (+24 -26)

Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.140 llvm/lib/VMCore/AsmWriter.cpp:1.141
--- llvm/lib/VMCore/AsmWriter.cpp:1.140	Tue Jun 15 16:07:32 2004
+++ llvm/lib/VMCore/AsmWriter.cpp	Thu Jun 17 13:18:53 2004
@@ -262,7 +262,7 @@
 
   TypeStack.push_back(Ty);    // Recursive case: Add us to the stack..
   
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   case Type::FunctionTyID: {
     const FunctionType *FTy = cast<FunctionType>(Ty);
     calcTypeName(FTy->getReturnType(), TypeStack, TypeNames, Result);


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.58 llvm/lib/VMCore/ConstantFolding.cpp:1.59
--- llvm/lib/VMCore/ConstantFolding.cpp:1.58	Sat May 29 20:19:48 2004
+++ llvm/lib/VMCore/ConstantFolding.cpp	Thu Jun 17 13:18:53 2004
@@ -489,7 +489,7 @@
       isa<ConstantPointerRef>(V1) || isa<ConstantPointerRef>(V2))
     return EmptyR;
 
-  switch (V1->getType()->getPrimitiveID()) {
+  switch (V1->getType()->getTypeID()) {
   default: assert(0 && "Unknown value type for constant folding!");
   case Type::BoolTyID:    return BoolR;
   case Type::PointerTyID: return NullPointerR;
@@ -564,7 +564,7 @@
 
   ConstRules &Rules = ConstRules::get(V, V);
 
-  switch (DestTy->getPrimitiveID()) {
+  switch (DestTy->getTypeID()) {
   case Type::BoolTyID:    return Rules.castToBool(V);
   case Type::UByteTyID:   return Rules.castToUByte(V);
   case Type::SByteTyID:   return Rules.castToSByte(V);


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.90 llvm/lib/VMCore/Constants.cpp:1.91
--- llvm/lib/VMCore/Constants.cpp:1.90	Tue Jun  8 18:21:39 2004
+++ llvm/lib/VMCore/Constants.cpp	Thu Jun 17 13:18:53 2004
@@ -66,7 +66,7 @@
 
 // Static constructor to create a '0' constant of arbitrary type...
 Constant *Constant::getNullValue(const Type *Ty) {
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   case Type::BoolTyID: {
     static Constant *NullBool = ConstantBool::get(false);
     return NullBool;
@@ -128,7 +128,7 @@
 
 // Static constructor to create the maximum constant of an integral type...
 ConstantIntegral *ConstantIntegral::getMaxValue(const Type *Ty) {
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   case Type::BoolTyID:   return ConstantBool::True;
   case Type::SByteTyID:
   case Type::ShortTyID:
@@ -152,7 +152,7 @@
 
 // Static constructor to create the minimum constant for an integral type...
 ConstantIntegral *ConstantIntegral::getMinValue(const Type *Ty) {
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   case Type::BoolTyID:   return ConstantBool::False;
   case Type::SByteTyID:
   case Type::ShortTyID:
@@ -176,7 +176,7 @@
 
 // Static constructor to create an integral constant with all bits set
 ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) {
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   case Type::BoolTyID:   return ConstantBool::True;
   case Type::SByteTyID:
   case Type::ShortTyID:
@@ -243,8 +243,7 @@
   for (unsigned i = 0, e = V.size(); i != e; ++i) {
     assert(V[i]->getType() == T->getElementType() ||
            (T->isAbstract() &&
-            V[i]->getType()->getPrimitiveID() ==
-            T->getElementType()->getPrimitiveID()));
+            V[i]->getType()->getTypeID() == T->getElementType()->getTypeID()));
     Operands.push_back(Use(V[i], this));
   }
 }
@@ -258,8 +257,7 @@
     assert((V[i]->getType() == T->getElementType(i) ||
             ((T->getElementType(i)->isAbstract() ||
               V[i]->getType()->isAbstract()) &&
-             T->getElementType(i)->getPrimitiveID() == 
-                      V[i]->getType()->getPrimitiveID())) &&
+             T->getElementType(i)->getTypeID() == V[i]->getType()->getTypeID())) &&
            "Initializer for struct element doesn't match struct element type!");
     Operands.push_back(Use(V[i], this));
   }
@@ -433,7 +431,7 @@
 //                      isValueValidForType implementations
 
 bool ConstantSInt::isValueValidForType(const Type *Ty, int64_t Val) {
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   default:
     return false;         // These can't be represented as integers!!!
     // Signed types...
@@ -449,7 +447,7 @@
 }
 
 bool ConstantUInt::isValueValidForType(const Type *Ty, uint64_t Val) {
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   default:
     return false;         // These can't be represented as integers!!!
 
@@ -466,7 +464,7 @@
 }
 
 bool ConstantFP::isValueValidForType(const Type *Ty, double Val) {
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   default:
     return false;         // These can't be represented as floating point!
 


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.101 llvm/lib/VMCore/Type.cpp:1.102
--- llvm/lib/VMCore/Type.cpp:1.101	Fri Jun  4 15:14:29 2004
+++ llvm/lib/VMCore/Type.cpp	Thu Jun 17 13:18:53 2004
@@ -42,7 +42,7 @@
 static std::map<const Type*, std::string> ConcreteTypeDescriptions;
 static std::map<const Type*, std::string> AbstractTypeDescriptions;
 
-Type::Type(const std::string &name, PrimitiveID id)
+Type::Type(const std::string &name, TypeID id)
   : Value(Type::TypeTy, Value::TypeVal), RefCount(0), ForwardType(0) {
   if (!name.empty())
     ConcreteTypeDescriptions[this] = name;
@@ -64,7 +64,7 @@
   return UIDMappings[UID];
 }
 
-const Type *Type::getPrimitiveType(PrimitiveID IDNumber) {
+const Type *Type::getPrimitiveType(TypeID IDNumber) {
   switch (IDNumber) {
   case VoidTyID  : return VoidTy;
   case BoolTyID  : return BoolTy;
@@ -93,11 +93,11 @@
   if ((!isPrimitiveType()    && !isa<PointerType>(this)) ||
       (!isa<PointerType>(Ty) && !Ty->isPrimitiveType())) return false;
 
-  if (getPrimitiveID() == Ty->getPrimitiveID())
+  if (getTypeID() == Ty->getTypeID())
     return true;  // Handles identity cast, and cast of differing pointer types
 
   // Now we know that they are two differing primitive or pointer types
-  switch (getPrimitiveID()) {
+  switch (getTypeID()) {
   case Type::UByteTyID:   return Ty == Type::SByteTy;
   case Type::SByteTyID:   return Ty == Type::UByteTy;
   case Type::UShortTyID:  return Ty == Type::ShortTy;
@@ -115,7 +115,7 @@
 /// getUnsignedVersion - If this is an integer type, return the unsigned
 /// variant of this type.  For example int -> uint.
 const Type *Type::getUnsignedVersion() const {
-  switch (getPrimitiveID()) {
+  switch (getTypeID()) {
   default:
     assert(isInteger()&&"Type::getUnsignedVersion is only valid for integers!");
   case Type::UByteTyID:   
@@ -132,7 +132,7 @@
 /// getSignedVersion - If this is an integer type, return the signed variant
 /// of this type.  For example uint -> int.
 const Type *Type::getSignedVersion() const {
-  switch (getPrimitiveID()) {
+  switch (getTypeID()) {
   default:
     assert(isInteger() && "Type::getSignedVersion is only valid for integers!");
   case Type::UByteTyID:   
@@ -152,7 +152,7 @@
 // return zero if the type does not have a size or is not a primitive type.
 //
 unsigned Type::getPrimitiveSize() const {
-  switch (getPrimitiveID()) {
+  switch (getTypeID()) {
 #define HANDLE_PRIM_TYPE(TY,SIZE)  case TY##TyID: return SIZE;
 #include "llvm/Type.def"
   default: return 0;
@@ -220,7 +220,7 @@
   std::string Result;
   TypeStack.push_back(Ty);    // Add us to the stack..
       
-  switch (Ty->getPrimitiveID()) {
+  switch (Ty->getTypeID()) {
   case Type::FunctionTyID: {
     const FunctionType *FTy = cast<FunctionType>(Ty);
     Result = getTypeDescription(FTy->getReturnType(), TypeStack) + " (";
@@ -318,7 +318,7 @@
 // type.
 //
 struct SignedIntType : public Type {
-  SignedIntType(const std::string &Name, PrimitiveID id) : Type(Name, id) {}
+  SignedIntType(const std::string &Name, TypeID id) : Type(Name, id) {}
 
   // isSigned - Return whether a numeric type is signed.
   virtual bool isSigned() const { return 1; }
@@ -330,7 +330,7 @@
 };
 
 struct UnsignedIntType : public Type {
-  UnsignedIntType(const std::string &N, PrimitiveID id) : Type(N, id) {}
+  UnsignedIntType(const std::string &N, TypeID id) : Type(N, id) {}
 
   // isUnsigned - Return whether a numeric type is signed.
   virtual bool isUnsigned() const { return 1; }
@@ -342,7 +342,7 @@
 };
 
 struct OtherType : public Type {
-  OtherType(const std::string &N, PrimitiveID id) : Type(N, id) {}
+  OtherType(const std::string &N, TypeID id) : Type(N, id) {}
 };
 
 static struct TypeType : public Type {
@@ -503,7 +503,7 @@
 static bool TypesEqual(const Type *Ty, const Type *Ty2,
 		       std::map<const Type *, const Type *> &EqTypes) {
   if (Ty == Ty2) return true;
-  if (Ty->getPrimitiveID() != Ty2->getPrimitiveID()) return false;
+  if (Ty->getTypeID() != Ty2->getTypeID()) return false;
   if (isa<OpaqueType>(Ty))
     return false;  // Two unequal opaque types are never equal
 





More information about the llvm-commits mailing list