[llvm-commits] [dragonegg] r96243 - in /dragonegg/trunk: llvm-abi-default.cpp llvm-backend.cpp llvm-convert.cpp llvm-types.cpp x86/llvm-target.cpp

Duncan Sands baldrick at free.fr
Mon Feb 15 10:01:44 PST 2010


Author: baldrick
Date: Mon Feb 15 12:01:44 2010
New Revision: 96243

URL: http://llvm.org/viewvc/llvm-project?rev=96243&view=rev
Log:
Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

Modified:
    dragonegg/trunk/llvm-abi-default.cpp
    dragonegg/trunk/llvm-backend.cpp
    dragonegg/trunk/llvm-convert.cpp
    dragonegg/trunk/llvm-types.cpp
    dragonegg/trunk/x86/llvm-target.cpp

Modified: dragonegg/trunk/llvm-abi-default.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-abi-default.cpp?rev=96243&r1=96242&r2=96243&view=diff

==============================================================================
--- dragonegg/trunk/llvm-abi-default.cpp (original)
+++ dragonegg/trunk/llvm-abi-default.cpp Mon Feb 15 12:01:44 2010
@@ -324,7 +324,7 @@
     if (InSize < Size) {
       unsigned N = STy->getNumElements();
       const llvm::Type *LastEltTy = STy->getElementType(N-1);
-      if (LastEltTy->isInteger())
+      if (LastEltTy->isIntegerTy())
         LastEltSizeDiff =
           getTargetData().getTypeAllocSize(LastEltTy) - (Size - InSize);
     }

Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=96243&r1=96242&r2=96243&view=diff

==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Mon Feb 15 12:01:44 2010
@@ -1686,7 +1686,7 @@
   }
 
   // Covariant return thunk - adjust the returned value by the thunk offsets.
-  assert(Call->getType()->isPointer() && "Only know how to adjust pointers!");
+  assert(Call->getType()->isPointerTy() && "Only know how to adjust pointers!");
   Value *RetVal = Call;
 
   // First check if the returned value is NULL.

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=96243&r1=96242&r2=96243&view=diff

==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Mon Feb 15 12:01:44 2010
@@ -455,7 +455,7 @@
           // If this is just a mismatch between integer types, this is due
           // to K&R prototypes, where the forward proto defines the arg as int
           // and the actual impls is a short or char.
-          assert(ArgVal->getType()->isInteger(32) && LLVMTy->isInteger() &&
+          assert(ArgVal->getType()->isIntegerTy(32) && LLVMTy->isIntegerTy() &&
                  "Lowerings don't match?");
           ArgVal = Builder.CreateTrunc(ArgVal, LLVMTy,NameStack.back().c_str());
         }
@@ -1501,14 +1501,14 @@
 /// contains any floating point elements.
 
 static bool containsFPField(const Type *LLVMTy) {
-  if (LLVMTy->isFloatingPoint())
+  if (LLVMTy->isFloatingPointTy())
     return true;
   const StructType* STy = dyn_cast<StructType>(LLVMTy);
   if (STy) {
     for (StructType::element_iterator I = STy->element_begin(),
                                       E = STy->element_end(); I != E; I++) {
       const Type *Ty = *I;
-      if (Ty->isFloatingPoint())
+      if (Ty->isFloatingPointTy())
         return true;
       if (isa<StructType>(Ty) && containsFPField(Ty))
         return true;
@@ -2178,7 +2178,7 @@
     // The number of loads needed to read the entire bitfield.
     unsigned Strides = 1 + (LV.BitStart + LV.BitSize - 1) / ValSizeInBits;
 
-    assert(ValTy->isInteger() && "Invalid bitfield lvalue!");
+    assert(ValTy->isIntegerTy() && "Invalid bitfield lvalue!");
     assert(ValSizeInBits > LV.BitStart && "Bad bitfield lvalue!");
     assert(ValSizeInBits >= LV.BitSize && "Bad bitfield lvalue!");
     assert(2*ValSizeInBits > LV.BitSize+LV.BitStart && "Bad bitfield lvalue!");
@@ -4809,7 +4809,7 @@
   Value *Offset = EmitMemory(gimple_call_arg(stmt, 0));
   Value *Handler = EmitMemory(gimple_call_arg(stmt, 1));
 
-  Intrinsic::ID IID = IntPtr->isInteger(32) ?
+  Intrinsic::ID IID = IntPtr->isIntegerTy(32) ?
     Intrinsic::eh_return_i32 : Intrinsic::eh_return_i64;
 
   Offset = Builder.CreateIntCast(Offset, IntPtr, /*isSigned*/true);
@@ -5395,7 +5395,7 @@
 
   if (isBitfield(FieldDecl)) {
     // If this is a bitfield, the declared type must be an integral type.
-    assert(FieldTy->isInteger() && "Invalid bitfield");
+    assert(FieldTy->isIntegerTy() && "Invalid bitfield");
 
     assert(DECL_SIZE(FieldDecl) &&
            TREE_CODE(DECL_SIZE(FieldDecl)) == INTEGER_CST &&
@@ -5410,7 +5410,7 @@
     // things that are difficult to clean up later.  This occurs in cases like
     // "struct X{ unsigned long long x:50; unsigned y:2; }" when accessing y.
     // We want to access the field as a ulong, not as a uint with an offset.
-    if (LLVMFieldTy->isInteger() &&
+    if (LLVMFieldTy->isIntegerTy() &&
         LLVMFieldTy->getPrimitiveSizeInBits() >= BitStart + BitfieldSize &&
         LLVMFieldTy->getPrimitiveSizeInBits() ==
         TD.getTypeAllocSizeInBits(LLVMFieldTy))
@@ -5689,7 +5689,7 @@
   if (MemTy == RegTy)
     return V;
 
-  assert(RegTy->isInteger() && MemTy->isInteger() &&
+  assert(RegTy->isIntegerTy() && MemTy->isIntegerTy() &&
          "Unexpected type mismatch!");
   return Builder.CreateIntCast(V, RegTy, /*isSigned*/!TYPE_UNSIGNED(type));
 }
@@ -5702,7 +5702,7 @@
   if (MemTy == RegTy)
     return C;
 
-  assert(RegTy->isInteger() && MemTy->isInteger() &&
+  assert(RegTy->isIntegerTy() && MemTy->isIntegerTy() &&
          "Unexpected type mismatch!");
   return Folder.CreateIntCast(C, RegTy, /*isSigned*/!TYPE_UNSIGNED(type));
 }
@@ -5717,7 +5717,7 @@
   if (RegTy == MemTy)
     return V;
 
-  assert(RegTy->isInteger() && MemTy->isInteger() &&
+  assert(RegTy->isIntegerTy() && MemTy->isIntegerTy() &&
          "Unexpected type mismatch!");
   return Builder.CreateIntCast(V, MemTy, /*isSigned*/!TYPE_UNSIGNED(type));
 }
@@ -5842,7 +5842,7 @@
 // Unary expressions.
 Value *TreeToLLVM::EmitReg_ABS_EXPR(tree op) {
   Value *Op = EmitRegister(op);
-  if (!Op->getType()->isFloatingPoint()) {
+  if (!Op->getType()->isFloatingPointTy()) {
     Value *OpN = Builder.CreateNeg(Op, Op->getName()+"neg");
     ICmpInst::Predicate pred = TYPE_UNSIGNED(TREE_TYPE(op)) ?
       ICmpInst::ICMP_UGE : ICmpInst::ICMP_SGE;
@@ -5917,7 +5917,7 @@
 
 Value *TreeToLLVM::EmitReg_TRUTH_NOT_EXPR(tree type, tree op) {
   Value *V = EmitRegister(op);
-  if (!V->getType()->isInteger(1))
+  if (!V->getType()->isIntegerTy(1))
     V = Builder.CreateICmpNE(V,
           Constant::getNullValue(V->getType()), "toBool");
   V = Builder.CreateNot(V, V->getName()+"not");
@@ -5985,7 +5985,7 @@
     SplitComplex(RHS, RHSr, RHSi, TREE_TYPE(TREE_TYPE(lhs)));
 
     Value *DSTr, *DSTi;
-    if (LHSr->getType()->isFloatingPoint()) {
+    if (LHSr->getType()->isFloatingPointTy()) {
       DSTr = Builder.CreateFCmp(FPPred, LHSr, RHSr);
       DSTi = Builder.CreateFCmp(FPPred, LHSi, RHSi);
       if (FPPred == CmpInst::FCMP_OEQ)
@@ -6003,7 +6003,7 @@
     return Builder.CreateOr(DSTr, DSTi);
   }
 
-  if (LHS->getType()->isFPOrFPVector())
+  if (LHS->getType()->isFPOrFPVectorTy())
     return Builder.CreateFCmp(FPPred, LHS, RHS);
 
   // Determine which predicate to use based on signedness.
@@ -6032,7 +6032,7 @@
   RHS = Builder.CreateCast(opcode, RHS, Ty);
 
   Value *Compare;
-  if (LHS->getType()->isFloatingPoint())
+  if (LHS->getType()->isFloatingPointTy())
     Compare = Builder.CreateFCmp(FCmpInst::Predicate(FPPred), LHS, RHS);
   else if (TYPE_UNSIGNED(type))
     Compare = Builder.CreateICmp(ICmpInst::Predicate(UIPred), LHS, RHS);
@@ -6479,7 +6479,7 @@
     Value *DSTr, *DSTi;
 
     // (a+ib) / (c+id) = ((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd))
-    assert (LHSr->getType()->isInteger() && "TRUNC_DIV_EXPR not integer!");
+    assert (LHSr->getType()->isIntegerTy() && "TRUNC_DIV_EXPR not integer!");
     // If overflow does not wrap in the element type then it is tempting to
     // use NSW operations here.  However that would be wrong since overflow
     // of an intermediate value calculated here does not necessarily imply
@@ -6503,7 +6503,7 @@
     return CreateComplex(DSTr, DSTi, elt_type);
   }
 
-  assert(LHS->getType()->isIntOrIntVector() && "TRUNC_DIV_EXPR not integer!");
+  assert(LHS->getType()->isIntOrIntVectorTy() && "TRUNC_DIV_EXPR not integer!");
   if (TYPE_UNSIGNED(type)) {
 //    if (isExact)
 //      return Builder.CreateExactUDiv(LHS, RHS);
@@ -7430,7 +7430,7 @@
   // The number of stores needed to write the entire bitfield.
   unsigned Strides = 1 + (LV.BitStart + LV.BitSize - 1) / ValSizeInBits;
 
-  assert(ValTy->isInteger() && "Invalid bitfield lvalue!");
+  assert(ValTy->isIntegerTy() && "Invalid bitfield lvalue!");
   assert(ValSizeInBits > LV.BitStart && "Bad bitfield lvalue!");
   assert(ValSizeInBits >= LV.BitSize && "Bad bitfield lvalue!");
   assert(2*ValSizeInBits > LV.BitSize+LV.BitStart && "Bad bitfield lvalue!");
@@ -7552,7 +7552,7 @@
 
 Constant *TreeConstantToLLVM::ConvertREAL_CST(tree exp) {
   const Type *Ty = ConvertType(TREE_TYPE(exp));
-  assert(Ty->isFloatingPoint() && "Integer REAL_CST?");
+  assert(Ty->isFloatingPointTy() && "Integer REAL_CST?");
   long RealArr[2];
   union {
     int UArr[2];
@@ -7634,11 +7634,11 @@
   unsigned Len = (unsigned)TREE_STRING_LENGTH(exp);
 
   std::vector<Constant*> Elts;
-  if (ElTy->isInteger(8)) {
+  if (ElTy->isIntegerTy(8)) {
     const unsigned char *InStr =(const unsigned char *)TREE_STRING_POINTER(exp);
     for (unsigned i = 0; i != Len; ++i)
       Elts.push_back(ConstantInt::get(Type::getInt8Ty(Context), InStr[i]));
-  } else if (ElTy->isInteger(16)) {
+  } else if (ElTy->isIntegerTy(16)) {
     assert((Len&1) == 0 &&
            "Length in bytes should be a multiple of element size");
     const uint16_t *InStr =
@@ -7650,9 +7650,10 @@
       if (llvm::sys::isBigEndianHost() == BYTES_BIG_ENDIAN)
         Elts.push_back(ConstantInt::get(Type::getInt16Ty(Context), InStr[i]));
       else
-        Elts.push_back(ConstantInt::get(Type::getInt16Ty(Context), ByteSwap_16(InStr[i])));
+        Elts.push_back(ConstantInt::get(Type::getInt16Ty(Context),
+                                        ByteSwap_16(InStr[i])));
     }
-  } else if (ElTy->isInteger(32)) {
+  } else if (ElTy->isIntegerTy(32)) {
     assert((Len&3) == 0 &&
            "Length in bytes should be a multiple of element size");
     const uint32_t *InStr = (const uint32_t *)TREE_STRING_POINTER(exp);
@@ -7663,7 +7664,8 @@
       if (llvm::sys::isBigEndianHost() == BYTES_BIG_ENDIAN)
         Elts.push_back(ConstantInt::get(Type::getInt32Ty(Context), InStr[i]));
       else
-        Elts.push_back(ConstantInt::get(Type::getInt32Ty(Context), ByteSwap_32(InStr[i])));
+        Elts.push_back(ConstantInt::get(Type::getInt32Ty(Context),
+                                        ByteSwap_32(InStr[i])));
     }
   } else {
     assert(0 && "Unknown character type!");
@@ -8118,7 +8120,7 @@
   if (GCCFieldOffsetInBits < NextFieldByteStart*8) {
     unsigned ValBitSize = ValC->getBitWidth();
     assert(!ResultElts.empty() && "Bitfield starts before first element?");
-    assert(ResultElts.back()->getType()->isInteger(8) &&
+    assert(ResultElts.back()->getType()->isIntegerTy(8) &&
            isa<ConstantInt>(ResultElts.back()) &&
            "Merging bitfield with non-bitfield value?");
     assert(NextFieldByteStart*8 - GCCFieldOffsetInBits < 8 &&

Modified: dragonegg/trunk/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-types.cpp?rev=96243&r1=96242&r2=96243&view=diff

==============================================================================
--- dragonegg/trunk/llvm-types.cpp (original)
+++ dragonegg/trunk/llvm-types.cpp Mon Feb 15 12:01:44 2010
@@ -943,8 +943,8 @@
       if (KNRPromotion) {
         if (type == float_type_node)
           LLVMTy = ConvertType(double_type_node);
-        else if (LLVMTy->isInteger(16) || LLVMTy->isInteger(8) ||
-                 LLVMTy->isInteger(1))
+        else if (LLVMTy->isIntegerTy(16) || LLVMTy->isIntegerTy(8) ||
+                 LLVMTy->isIntegerTy(1))
           LLVMTy = Type::getInt32Ty(Context);
       }
       ArgTypes.push_back(LLVMTy);
@@ -1345,13 +1345,13 @@
     const Type *LastType = Elements.back();
     unsigned PadBytes = 0;
 
-    if (LastType->isInteger(8))
+    if (LastType->isIntegerTy(8))
       PadBytes = 1 - NoOfBytesToRemove;
-    else if (LastType->isInteger(16))
+    else if (LastType->isIntegerTy(16))
       PadBytes = 2 - NoOfBytesToRemove;
-    else if (LastType->isInteger(32))
+    else if (LastType->isIntegerTy(32))
       PadBytes = 4 - NoOfBytesToRemove;
-    else if (LastType->isInteger(64))
+    else if (LastType->isIntegerTy(64))
       PadBytes = 8 - NoOfBytesToRemove;
     else
       return;

Modified: dragonegg/trunk/x86/llvm-target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.cpp?rev=96243&r1=96242&r2=96243&view=diff

==============================================================================
--- dragonegg/trunk/x86/llvm-target.cpp (original)
+++ dragonegg/trunk/x86/llvm-target.cpp Mon Feb 15 12:01:44 2010
@@ -1296,7 +1296,7 @@
   for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end();
        I != E; ++I) {
     const Type *STy = I->get();
-    if (!STy->isIntOrIntVector() && !isa<PointerType>(STy))
+    if (!STy->isIntOrIntVectorTy() && !isa<PointerType>(STy))
       return false;
   }
   return true;
@@ -1359,10 +1359,10 @@
   // makes it ABI compatible for x86-64. Same for _Complex char and _Complex
   // short in 32-bit.
   const Type *EltTy = STy->getElementType(0);
-  return !((TARGET_64BIT && (EltTy->isInteger() ||
+  return !((TARGET_64BIT && (EltTy->isIntegerTy() ||
                              EltTy == Type::getFloatTy(Context) ||
                              EltTy == Type::getDoubleTy(Context))) ||
-           EltTy->isInteger(16) || EltTy->isInteger(8));
+           EltTy->isIntegerTy(16) || EltTy->isIntegerTy(8));
 }
 
 /* Target hook for llvm-abi.h. It returns true if an aggregate of the
@@ -1401,14 +1401,14 @@
       else
         // All other vector scalar values are passed in XMM registers.
         ++NumXMMs;
-    } else if (Ty->isInteger() || isa<PointerType>(Ty)) {
+    } else if (Ty->isIntegerTy() || isa<PointerType>(Ty)) {
       ++NumGPRs;
     } else if (Ty==Type::getVoidTy(Context)) {
       // Padding bytes that are not passed anywhere
       ;
     } else {
       // Floating point scalar argument.
-      assert(Ty->isFloatingPoint() && Ty->isPrimitiveType() &&
+      assert(Ty->isFloatingPointTy() && Ty->isPrimitiveType() &&
              "Expecting a floating point primitive type!");
       if (Ty->getTypeID() == Type::FloatTyID
           || Ty->getTypeID() == Type::DoubleTyID)
@@ -1522,7 +1522,7 @@
               Ty = STy->getElementType(0);
           if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {
             if (VTy->getNumElements() == 2) {
-              if (VTy->getElementType()->isInteger()) {
+              if (VTy->getElementType()->isIntegerTy()) {
                 Elts.push_back(VectorType::get(Type::getInt64Ty(Context), 2));
               } else {
                 Elts.push_back(VectorType::get(Type::getDoubleTy(Context), 2));
@@ -1530,7 +1530,7 @@
               Bytes -= 8;
             } else {
               assert(VTy->getNumElements() == 4);
-              if (VTy->getElementType()->isInteger()) {
+              if (VTy->getElementType()->isIntegerTy()) {
                 Elts.push_back(VectorType::get(Type::getInt32Ty(Context), 4));
               } else {
                 Elts.push_back(VectorType::get(Type::getFloatTy(Context), 4));
@@ -1886,14 +1886,14 @@
               Ty = STy->getElementType(0);
           if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {
             if (VTy->getNumElements() == 2) {
-              if (VTy->getElementType()->isInteger())
+              if (VTy->getElementType()->isIntegerTy())
                 Elts.push_back(VectorType::get(Type::getInt64Ty(Context), 2));
               else
                 Elts.push_back(VectorType::get(Type::getDoubleTy(Context), 2));
               Bytes -= 8;
             } else {
               assert(VTy->getNumElements() == 4);
-              if (VTy->getElementType()->isInteger())
+              if (VTy->getElementType()->isIntegerTy())
                 Elts.push_back(VectorType::get(Type::getInt32Ty(Context), 4));
               else
                 Elts.push_back(VectorType::get(Type::getFloatTy(Context), 4));





More information about the llvm-commits mailing list