[llvm-commits] [llvm] r147446 - in /llvm/trunk: include/llvm/Type.h lib/VMCore/Type.cpp

Stepan Dyatkovskiy stpworld at narod.ru
Tue Jan 3 06:05:04 PST 2012


Author: dyatkovskiy
Date: Tue Jan  3 08:05:04 2012
New Revision: 147446

URL: http://llvm.org/viewvc/llvm-project?rev=147446&view=rev
Log:
Type: replaced usage of ID with getTypeID().

Modified:
    llvm/trunk/include/llvm/Type.h
    llvm/trunk/lib/VMCore/Type.cpp

Modified: llvm/trunk/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=147446&r1=147445&r2=147446&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Tue Jan  3 08:05:04 2012
@@ -120,49 +120,51 @@
   TypeID getTypeID() const { return ID; }
 
   /// isVoidTy - Return true if this is 'void'.
-  bool isVoidTy() const { return ID == VoidTyID; }
+  bool isVoidTy() const { return getTypeID() == VoidTyID; }
 
   /// isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type.
-  bool isHalfTy() const { return ID == HalfTyID; }
+  bool isHalfTy() const { return getTypeID() == HalfTyID; }
 
   /// isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
-  bool isFloatTy() const { return ID == FloatTyID; }
+  bool isFloatTy() const { return getTypeID() == FloatTyID; }
   
   /// isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
-  bool isDoubleTy() const { return ID == DoubleTyID; }
+  bool isDoubleTy() const { return getTypeID() == DoubleTyID; }
 
   /// isX86_FP80Ty - Return true if this is x86 long double.
-  bool isX86_FP80Ty() const { return ID == X86_FP80TyID; }
+  bool isX86_FP80Ty() const { return getTypeID() == X86_FP80TyID; }
 
   /// isFP128Ty - Return true if this is 'fp128'.
-  bool isFP128Ty() const { return ID == FP128TyID; }
+  bool isFP128Ty() const { return getTypeID() == FP128TyID; }
 
   /// isPPC_FP128Ty - Return true if this is powerpc long double.
-  bool isPPC_FP128Ty() const { return ID == PPC_FP128TyID; }
+  bool isPPC_FP128Ty() const { return getTypeID() == PPC_FP128TyID; }
 
   /// isFloatingPointTy - Return true if this is one of the five floating point
   /// types
   bool isFloatingPointTy() const {
-    return ID == HalfTyID || ID == FloatTyID || ID == DoubleTyID ||
-      ID == X86_FP80TyID || ID == FP128TyID || ID == PPC_FP128TyID;
+    return getTypeID() == HalfTyID || getTypeID() == FloatTyID ||
+           getTypeID() == DoubleTyID ||
+           getTypeID() == X86_FP80TyID || getTypeID() == FP128TyID ||
+           getTypeID() == PPC_FP128TyID;
   }
 
   /// isX86_MMXTy - Return true if this is X86 MMX.
-  bool isX86_MMXTy() const { return ID == X86_MMXTyID; }
+  bool isX86_MMXTy() const { return getTypeID() == X86_MMXTyID; }
 
   /// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
   ///
   bool isFPOrFPVectorTy() const;
  
   /// isLabelTy - Return true if this is 'label'.
-  bool isLabelTy() const { return ID == LabelTyID; }
+  bool isLabelTy() const { return getTypeID() == LabelTyID; }
 
   /// isMetadataTy - Return true if this is 'metadata'.
-  bool isMetadataTy() const { return ID == MetadataTyID; }
+  bool isMetadataTy() const { return getTypeID() == MetadataTyID; }
 
   /// isIntegerTy - True if this is an instance of IntegerType.
   ///
-  bool isIntegerTy() const { return ID == IntegerTyID; } 
+  bool isIntegerTy() const { return getTypeID() == IntegerTyID; } 
 
   /// isIntegerTy - Return true if this is an IntegerType of the given width.
   bool isIntegerTy(unsigned Bitwidth) const;
@@ -174,23 +176,23 @@
   
   /// isFunctionTy - True if this is an instance of FunctionType.
   ///
-  bool isFunctionTy() const { return ID == FunctionTyID; }
+  bool isFunctionTy() const { return getTypeID() == FunctionTyID; }
 
   /// isStructTy - True if this is an instance of StructType.
   ///
-  bool isStructTy() const { return ID == StructTyID; }
+  bool isStructTy() const { return getTypeID() == StructTyID; }
 
   /// isArrayTy - True if this is an instance of ArrayType.
   ///
-  bool isArrayTy() const { return ID == ArrayTyID; }
+  bool isArrayTy() const { return getTypeID() == ArrayTyID; }
 
   /// isPointerTy - True if this is an instance of PointerType.
   ///
-  bool isPointerTy() const { return ID == PointerTyID; }
+  bool isPointerTy() const { return getTypeID() == PointerTyID; }
 
   /// isVectorTy - True if this is an instance of VectorType.
   ///
-  bool isVectorTy() const { return ID == VectorTyID; }
+  bool isVectorTy() const { return getTypeID() == VectorTyID; }
 
   /// canLosslesslyBitCastTo - Return true if this type could be converted 
   /// with a lossless BitCast to type 'Ty'. For example, i8* to i32*. BitCasts 
@@ -206,14 +208,14 @@
   /// Here are some useful little methods to query what type derived types are
   /// Note that all other types can just compare to see if this == Type::xxxTy;
   ///
-  bool isPrimitiveType() const { return ID <= LastPrimitiveTyID; }
-  bool isDerivedType()   const { return ID >= FirstDerivedTyID; }
+  bool isPrimitiveType() const { return getTypeID() <= LastPrimitiveTyID; }
+  bool isDerivedType()   const { return getTypeID() >= FirstDerivedTyID; }
 
   /// isFirstClassType - Return true if the type is "first class", meaning it
   /// is a valid type for a Value.
   ///
   bool isFirstClassType() const {
-    return ID != FunctionTyID && ID != VoidTyID;
+    return getTypeID() != FunctionTyID && getTypeID() != VoidTyID;
   }
 
   /// isSingleValueType - Return true if the type is a valid type for a
@@ -221,8 +223,9 @@
   /// and array types.
   ///
   bool isSingleValueType() const {
-    return (ID != VoidTyID && isPrimitiveType()) ||
-            ID == IntegerTyID || ID == PointerTyID || ID == VectorTyID;
+    return (getTypeID() != VoidTyID && isPrimitiveType()) ||
+            getTypeID() == IntegerTyID || getTypeID() == PointerTyID ||
+            getTypeID() == VectorTyID;
   }
 
   /// isAggregateType - Return true if the type is an aggregate type. This
@@ -231,7 +234,7 @@
   /// does not include vector types.
   ///
   bool isAggregateType() const {
-    return ID == StructTyID || ID == ArrayTyID;
+    return getTypeID() == StructTyID || getTypeID() == ArrayTyID;
   }
 
   /// isSized - Return true if it makes sense to take the size of this type.  To
@@ -240,12 +243,14 @@
   ///
   bool isSized() const {
     // If it's a primitive, it is always sized.
-    if (ID == IntegerTyID || isFloatingPointTy() || ID == PointerTyID ||
-        ID == X86_MMXTyID)
+    if (getTypeID() == IntegerTyID || isFloatingPointTy() ||
+        getTypeID() == PointerTyID ||
+        getTypeID() == X86_MMXTyID)
       return true;
     // If it is not something that can have a size (e.g. a function or label),
     // it doesn't have a size.
-    if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID)
+    if (getTypeID() != StructTyID && getTypeID() != ArrayTyID &&
+        getTypeID() != VectorTyID)
       return false;
     // Otherwise we have to try harder to decide.
     return isSizedDerivedType();

Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=147446&r1=147445&r2=147446&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Tue Jan  3 08:05:04 2012
@@ -66,7 +66,7 @@
 bool Type::isIntOrIntVectorTy() const {
   if (isIntegerTy())
     return true;
-  if (ID != Type::VectorTyID) return false;
+  if (getTypeID() != Type::VectorTyID) return false;
   
   return cast<VectorType>(this)->getElementType()->isIntegerTy();
 }
@@ -74,11 +74,12 @@
 /// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP types.
 ///
 bool Type::isFPOrFPVectorTy() const {
-  if (ID == Type::HalfTyID || ID == Type::FloatTyID || ID == Type::DoubleTyID ||
-      ID == Type::FP128TyID || ID == Type::X86_FP80TyID || 
-      ID == Type::PPC_FP128TyID)
+  if (getTypeID() == Type::HalfTyID || getTypeID() == Type::FloatTyID ||
+      getTypeID() == Type::DoubleTyID ||
+      getTypeID() == Type::FP128TyID || getTypeID() == Type::X86_FP80TyID || 
+      getTypeID() == Type::PPC_FP128TyID)
     return true;
-  if (ID != Type::VectorTyID) return false;
+  if (getTypeID() != Type::VectorTyID) return false;
   
   return cast<VectorType>(this)->getElementType()->isFloatingPointTy();
 }
@@ -167,12 +168,12 @@
   if (const VectorType *VTy = dyn_cast<VectorType>(this))
     return VTy->getElementType()->getFPMantissaWidth();
   assert(isFloatingPointTy() && "Not a floating point type!");
-  if (ID == HalfTyID) return 11;
-  if (ID == FloatTyID) return 24;
-  if (ID == DoubleTyID) return 53;
-  if (ID == X86_FP80TyID) return 64;
-  if (ID == FP128TyID) return 113;
-  assert(ID == PPC_FP128TyID && "unknown fp type");
+  if (getTypeID() == HalfTyID) return 11;
+  if (getTypeID() == FloatTyID) return 24;
+  if (getTypeID() == DoubleTyID) return 53;
+  if (getTypeID() == X86_FP80TyID) return 64;
+  if (getTypeID() == FP128TyID) return 113;
+  assert(getTypeID() == PPC_FP128TyID && "unknown fp type");
   return -1;
 }
 





More information about the llvm-commits mailing list