[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Function.cpp Instructions.cpp Module.cpp ValueTypes.cpp Verifier.cpp

Reid Spencer reid at x10sys.com
Sat Dec 30 21:27:00 PST 2006



Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.121 -> 1.122
Constants.cpp updated: 1.192 -> 1.193
Function.cpp updated: 1.107 -> 1.108
Instructions.cpp updated: 1.57 -> 1.58
Module.cpp updated: 1.69 -> 1.70
ValueTypes.cpp updated: 1.8 -> 1.9
Verifier.cpp updated: 1.179 -> 1.180
---
Log message:

For PR950: http://llvm.org/PR950 :
Change signed integer type names to unsigned equivalents.


---
Diffs of the changes:  (+82 -137)

 ConstantFolding.cpp |   37 +++++++---------
 Constants.cpp       |  117 +++++++++++++++++-----------------------------------
 Function.cpp        |    2 
 Instructions.cpp    |   38 +++++-----------
 Module.cpp          |   15 +++---
 ValueTypes.cpp      |    8 +--
 Verifier.cpp        |    2 
 7 files changed, 82 insertions(+), 137 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.121 llvm/lib/VMCore/ConstantFolding.cpp:1.122
--- llvm/lib/VMCore/ConstantFolding.cpp:1.121	Sun Dec 24 12:52:08 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp	Sat Dec 30 23:26:44 2006
@@ -87,7 +87,7 @@
       for (unsigned i = 0; i != SrcNumElts; ++i) {
         uint64_t V =
           DoubleToBits(cast<ConstantFP>(CP->getOperand(i))->getValue());
-        Constant *C = ConstantInt::get(Type::ULongTy, V);
+        Constant *C = ConstantInt::get(Type::Int64Ty, V);
         Result.push_back(ConstantExpr::getBitCast(C, DstEltTy ));
       }
       return ConstantPacked::get(Result);
@@ -96,7 +96,7 @@
     assert(SrcEltTy->getTypeID() == Type::FloatTyID);
     for (unsigned i = 0; i != SrcNumElts; ++i) {
       uint32_t V = FloatToBits(cast<ConstantFP>(CP->getOperand(i))->getValue());
-      Constant *C = ConstantInt::get(Type::UIntTy, V);
+      Constant *C = ConstantInt::get(Type::Int32Ty, V);
       Result.push_back(ConstantExpr::getBitCast(C, DstEltTy));
     }
     return ConstantPacked::get(Result);
@@ -132,7 +132,7 @@
 
   // Let CastInst::isEliminableCastPair do the heavy lifting.
   return CastInst::isEliminableCastPair(firstOp, secondOp, SrcTy, MidTy, DstTy,
-                                        Type::ULongTy);
+                                        Type::Int64Ty);
 }
 
 Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
@@ -217,13 +217,13 @@
     if (const PointerType *PTy = dyn_cast<PointerType>(V->getType()))
       if (const PointerType *DPTy = dyn_cast<PointerType>(DestTy)) {
         std::vector<Value*> IdxList;
-        IdxList.push_back(Constant::getNullValue(Type::IntTy));
+        IdxList.push_back(Constant::getNullValue(Type::Int32Ty));
         const Type *ElTy = PTy->getElementType();
         while (ElTy != DPTy->getElementType()) {
           if (const StructType *STy = dyn_cast<StructType>(ElTy)) {
             if (STy->getNumElements() == 0) break;
             ElTy = STy->getElementType(0);
-            IdxList.push_back(Constant::getNullValue(Type::UIntTy));
+            IdxList.push_back(Constant::getNullValue(Type::Int32Ty));
           } else if (const SequentialType *STy = 
                      dyn_cast<SequentialType>(ElTy)) {
             if (isa<PointerType>(ElTy)) break;  // Can't index into pointers!
@@ -296,10 +296,10 @@
     if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) {
       // FP -> Integral.
       if (DestTy->isIntegral()) {
-        if (DestTy == Type::IntTy || DestTy == Type::UIntTy)
+        if (DestTy == Type::Int32Ty)
           return ConstantInt::get(DestTy, FloatToBits(FP->getValue()));
-        assert((DestTy == Type::LongTy || DestTy == Type::ULongTy) 
-               && "Incorrect integer  type for bitcast!");
+        assert(DestTy == Type::Int64Ty && 
+               "Incorrect integer  type for bitcast!");
         return ConstantInt::get(DestTy, DoubleToBits(FP->getValue()));
       }
     }
@@ -712,16 +712,13 @@
 
   // Ok, we have two differing integer indices.  Sign extend them to be the same
   // type.  Long is always big enough, so we use it.
-  if (C1->getType() != Type::LongTy && C1->getType() != Type::ULongTy)
-    C1 = ConstantExpr::getSExt(C1, Type::LongTy);
-  else
-    C1 = ConstantExpr::getBitCast(C1, Type::LongTy);
-  if (C2->getType() != Type::LongTy && C1->getType() != Type::ULongTy)
-    C2 = ConstantExpr::getSExt(C2, Type::LongTy);
-  else
-    C2 = ConstantExpr::getBitCast(C2, Type::LongTy);
+  if (C1->getType() != Type::Int64Ty)
+    C1 = ConstantExpr::getSExt(C1, Type::Int64Ty);
+
+  if (C2->getType() != Type::Int64Ty)
+    C1 = ConstantExpr::getSExt(C2, Type::Int64Ty);
 
-  if (C1 == C2) return 0;  // Are they just differing types?
+  if (C1 == C2) return 0;  // They are equal
 
   // If the type being indexed over is really just a zero sized type, there is
   // no pointer difference being made here.
@@ -1324,7 +1321,7 @@
       if (uint32_t ElSize = ElTy->getPrimitiveSize()) {
         // gep null, C is equal to C*sizeof(nullty).  If nullty is a known llvm
         // type, we can statically fold this.
-        Constant *R = ConstantInt::get(Type::UIntTy, ElSize);
+        Constant *R = ConstantInt::get(Type::Int32Ty, ElSize);
         // We know R is unsigned, Idx0 is signed because it must be an index
         // through a sequential type (gep pointer operand) which is always
         // signed.
@@ -1360,9 +1357,9 @@
         if (!Idx0->isNullValue()) {
           const Type *IdxTy = Combined->getType();
           if (IdxTy != Idx0->getType()) {
-            Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, Type::LongTy);
+            Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, Type::Int64Ty);
             Constant *C2 = ConstantExpr::getSExtOrBitCast(Combined, 
-                                                          Type::LongTy);
+                                                          Type::Int64Ty);
             Combined = ConstantExpr::get(Instruction::Add, C1, C2);
           } else {
             Combined =


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.192 llvm/lib/VMCore/Constants.cpp:1.193
--- llvm/lib/VMCore/Constants.cpp:1.192	Sun Dec 24 12:42:29 2006
+++ llvm/lib/VMCore/Constants.cpp	Sat Dec 30 23:26:44 2006
@@ -96,39 +96,22 @@
     static Constant *NullBool = ConstantBool::get(false);
     return NullBool;
   }
-  case Type::SByteTyID: {
-    static Constant *NullSByte = ConstantInt::get(Type::SByteTy, 0);
-    return NullSByte;
-  }
-  case Type::UByteTyID: {
-    static Constant *NullUByte = ConstantInt::get(Type::UByteTy, 0);
-    return NullUByte;
-  }
-  case Type::ShortTyID: {
-    static Constant *NullShort = ConstantInt::get(Type::ShortTy, 0);
-    return NullShort;
-  }
-  case Type::UShortTyID: {
-    static Constant *NullUShort = ConstantInt::get(Type::UShortTy, 0);
-    return NullUShort;
-  }
-  case Type::IntTyID: {
-    static Constant *NullInt = ConstantInt::get(Type::IntTy, 0);
-    return NullInt;
-  }
-  case Type::UIntTyID: {
-    static Constant *NullUInt = ConstantInt::get(Type::UIntTy, 0);
-    return NullUInt;
-  }
-  case Type::LongTyID: {
-    static Constant *NullLong = ConstantInt::get(Type::LongTy, 0);
-    return NullLong;
-  }
-  case Type::ULongTyID: {
-    static Constant *NullULong = ConstantInt::get(Type::ULongTy, 0);
-    return NullULong;
+  case Type::Int8TyID: {
+    static Constant *NullInt8 = ConstantInt::get(Type::Int8Ty, 0);
+    return NullInt8;
+  }
+  case Type::Int16TyID: {
+    static Constant *NullInt16 = ConstantInt::get(Type::Int16Ty, 0);
+    return NullInt16;
+  }
+  case Type::Int32TyID: {
+    static Constant *NullInt32 = ConstantInt::get(Type::Int32Ty, 0);
+    return NullInt32;
+  }
+  case Type::Int64TyID: {
+    static Constant *NullInt64 = ConstantInt::get(Type::Int64Ty, 0);
+    return NullInt64;
   }
-
   case Type::FloatTyID: {
     static Constant *NullFloat = ConstantFP::get(Type::FloatTy, 0);
     return NullFloat;
@@ -137,10 +120,8 @@
     static Constant *NullDouble = ConstantFP::get(Type::DoubleTy, 0);
     return NullDouble;
   }
-
   case Type::PointerTyID:
     return ConstantPointerNull::get(cast<PointerType>(Ty));
-
   case Type::StructTyID:
   case Type::ArrayTyID:
   case Type::PackedTyID:
@@ -157,21 +138,10 @@
 ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) {
   switch (Ty->getTypeID()) {
   case Type::BoolTyID:   return ConstantBool::getTrue();
-  case Type::SByteTyID:
-  case Type::ShortTyID:
-  case Type::IntTyID:
-  case Type::LongTyID:   return ConstantInt::get(Ty, -1);
-
-  case Type::UByteTyID:
-  case Type::UShortTyID:
-  case Type::UIntTyID:
-  case Type::ULongTyID: {
-    // Calculate ~0 of the right type...
-    unsigned TypeBits = Ty->getPrimitiveSize()*8;
-    uint64_t Val = ~0ULL;                // All ones
-    Val >>= 64-TypeBits;                 // Shift out unwanted 1 bits...
-    return ConstantInt::get(Ty, Val);
-  }
+  case Type::Int8TyID:
+  case Type::Int16TyID:
+  case Type::Int32TyID:
+  case Type::Int64TyID:   return ConstantInt::get(Ty, int64_t(-1));
   default: return 0;
   }
 }
@@ -573,28 +543,20 @@
 bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) {
   switch (Ty->getTypeID()) {
   default:              return false; // These can't be represented as integers!
-  case Type::SByteTyID:
-  case Type::UByteTyID: return Val <= UINT8_MAX;
-  case Type::ShortTyID:
-  case Type::UShortTyID:return Val <= UINT16_MAX;
-  case Type::IntTyID:
-  case Type::UIntTyID:  return Val <= UINT32_MAX;
-  case Type::LongTyID:
-  case Type::ULongTyID: return true; // always true, has to fit in largest type
+  case Type::Int8TyID:  return Val <= UINT8_MAX;
+  case Type::Int16TyID: return Val <= UINT16_MAX;
+  case Type::Int32TyID: return Val <= UINT32_MAX;
+  case Type::Int64TyID: return true; // always true, has to fit in largest type
   }
 }
 
 bool ConstantInt::isValueValidForType(const Type *Ty, int64_t Val) {
   switch (Ty->getTypeID()) {
   default:              return false; // These can't be represented as integers!
-  case Type::SByteTyID:
-  case Type::UByteTyID: return (Val >= INT8_MIN && Val <= INT8_MAX);
-  case Type::ShortTyID:
-  case Type::UShortTyID:return (Val >= INT16_MIN && Val <= UINT16_MAX);
-  case Type::IntTyID:
-  case Type::UIntTyID:  return (Val >= INT32_MIN && Val <= UINT32_MAX);
-  case Type::LongTyID:
-  case Type::ULongTyID: return true; // always true, has to fit in largest type
+  case Type::Int8TyID:  return (Val >= INT8_MIN && Val <= INT8_MAX);
+  case Type::Int16TyID: return (Val >= INT16_MIN && Val <= UINT16_MAX);
+  case Type::Int32TyID: return (Val >= INT32_MIN && Val <= UINT32_MAX);
+  case Type::Int64TyID: return true; // always true, has to fit in largest type
   }
 }
 
@@ -1029,14 +991,14 @@
 Constant *ConstantArray::get(const std::string &Str, bool AddNull) {
   std::vector<Constant*> ElementVals;
   for (unsigned i = 0; i < Str.length(); ++i)
-    ElementVals.push_back(ConstantInt::get(Type::SByteTy, Str[i]));
+    ElementVals.push_back(ConstantInt::get(Type::Int8Ty, Str[i]));
 
   // Add a null terminator to the string...
   if (AddNull) {
-    ElementVals.push_back(ConstantInt::get(Type::SByteTy, 0));
+    ElementVals.push_back(ConstantInt::get(Type::Int8Ty, 0));
   }
 
-  ArrayType *ATy = ArrayType::get(Type::SByteTy, ElementVals.size());
+  ArrayType *ATy = ArrayType::get(Type::Int8Ty, ElementVals.size());
   return ConstantArray::get(ATy, ElementVals);
 }
 
@@ -1044,8 +1006,7 @@
 /// ubyte, and if the elements of the array are all ConstantInt's.
 bool ConstantArray::isString() const {
   // Check the element type for sbyte or ubyte...
-  if (getType()->getElementType() != Type::UByteTy &&
-      getType()->getElementType() != Type::SByteTy)
+  if (getType()->getElementType() != Type::Int8Ty)
     return false;
   // Check the elements to make sure they are all integers, not constant
   // expressions.
@@ -1060,8 +1021,7 @@
 /// null bytes except its terminator.
 bool ConstantArray::isCString() const {
   // Check the element type for sbyte or ubyte...
-  if (getType()->getElementType() != Type::UByteTy &&
-      getType()->getElementType() != Type::SByteTy)
+  if (getType()->getElementType() != Type::Int8Ty)
     return false;
   Constant *Zero = Constant::getNullValue(getOperand(0)->getType());
   // Last element must be a null.
@@ -1292,6 +1252,7 @@
 
 //---- ConstantExpr::get() implementations...
 //
+
 struct ExprMapKeyType {
   explicit ExprMapKeyType(unsigned opc, std::vector<Constant*> ops,
       unsigned short pred = 0) : opcode(opc), predicate(pred), operands(ops) { }
@@ -1612,12 +1573,12 @@
   // sizeof is implemented as: (ulong) gep (Ty*)null, 1
   return getCast(Instruction::PtrToInt, getGetElementPtr(getNullValue(
     PointerType::get(Ty)), std::vector<Constant*>(1, 
-    ConstantInt::get(Type::UIntTy, 1))), Type::ULongTy);
+    ConstantInt::get(Type::Int32Ty, 1))), Type::Int64Ty);
 }
 
 Constant *ConstantExpr::getPtrPtrFromArrayPtr(Constant *C) {
   // pointer from array is implemented as: getelementptr arr ptr, 0, 0
-  static std::vector<Constant*> Indices(2, ConstantInt::get(Type::UIntTy, 0));
+  static std::vector<Constant*> Indices(2, ConstantInt::get(Type::Int32Ty, 0));
 
   return ConstantExpr::getGetElementPtr(C, Indices);
 }
@@ -1710,7 +1671,7 @@
   case Instruction::Shl:
   case Instruction::LShr:
   case Instruction::AShr:
-    assert(C2->getType() == Type::UByteTy && "Shift should be by ubyte!");
+    assert(C2->getType() == Type::Int8Ty && "Shift should be by ubyte!");
     assert(C1->getType()->isInteger() &&
            "Tried to create a shift operation on a non-integer type!");
     break;
@@ -1753,7 +1714,7 @@
           Opcode == Instruction::LShr  ||
           Opcode == Instruction::AShr) &&
          "Invalid opcode in binary constant expression");
-  assert(C1->getType()->isIntegral() && C2->getType() == Type::UByteTy &&
+  assert(C1->getType()->isIntegral() && C2->getType() == Type::Int8Ty &&
          "Invalid operand types for Shift constant expr!");
 
   if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2))
@@ -1854,7 +1815,7 @@
 Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) {
   assert(isa<PackedType>(Val->getType()) &&
          "Tried to create extractelement operation on non-packed type!");
-  assert(Idx->getType() == Type::UIntTy &&
+  assert(Idx->getType() == Type::Int32Ty &&
          "Extractelement index must be uint type!");
   return getExtractElementTy(cast<PackedType>(Val->getType())->getElementType(),
                              Val, Idx);
@@ -1878,7 +1839,7 @@
          "Tried to create insertelement operation on non-packed type!");
   assert(Elt->getType() == cast<PackedType>(Val->getType())->getElementType()
          && "Insertelement types must match!");
-  assert(Idx->getType() == Type::UIntTy &&
+  assert(Idx->getType() == Type::Int32Ty &&
          "Insertelement index must be uint type!");
   return getInsertElementTy(cast<PackedType>(Val->getType())->getElementType(),
                             Val, Elt, Idx);


Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.107 llvm/lib/VMCore/Function.cpp:1.108
--- llvm/lib/VMCore/Function.cpp:1.107	Sun Nov 26 19:05:10 2006
+++ llvm/lib/VMCore/Function.cpp	Sat Dec 30 23:26:44 2006
@@ -32,7 +32,7 @@
 }
 
 Argument *ilist_traits<Argument>::createSentinel() {
-  Argument *Ret = new Argument(Type::IntTy);
+  Argument *Ret = new Argument(Type::Int32Ty);
   // This should not be garbage monitored.
   LeakDetector::removeGarbageObject(Ret);
   return Ret;


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.57 llvm/lib/VMCore/Instructions.cpp:1.58
--- llvm/lib/VMCore/Instructions.cpp:1.57	Sat Dec 23 00:05:41 2006
+++ llvm/lib/VMCore/Instructions.cpp	Sat Dec 30 23:26:44 2006
@@ -513,11 +513,11 @@
 
 static Value *getAISize(Value *Amt) {
   if (!Amt)
-    Amt = ConstantInt::get(Type::UIntTy, 1);
+    Amt = ConstantInt::get(Type::Int32Ty, 1);
   else {
     assert(!isa<BasicBlock>(Amt) &&
            "Passed basic block into allocation size parameter!  Ue other ctor");
-    assert(Amt->getType() == Type::UIntTy &&
+    assert(Amt->getType() == Type::Int32Ty &&
            "Malloc/Allocation array size != UIntTy!");
   }
   return Amt;
@@ -849,7 +849,7 @@
                                        Instruction *InsertBef)
   : Instruction(cast<PackedType>(Val->getType())->getElementType(),
                 ExtractElement, Ops, 2, Name, InsertBef) {
-  Constant *Index = ConstantInt::get(Type::UIntTy, IndexV);
+  Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV);
   assert(isValidOperands(Val, Index) &&
          "Invalid extractelement instruction operands!");
   Ops[0].init(Val, this);
@@ -874,7 +874,7 @@
                                        BasicBlock *InsertAE)
   : Instruction(cast<PackedType>(Val->getType())->getElementType(),
                 ExtractElement, Ops, 2, Name, InsertAE) {
-  Constant *Index = ConstantInt::get(Type::UIntTy, IndexV);
+  Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV);
   assert(isValidOperands(Val, Index) &&
          "Invalid extractelement instruction operands!");
   
@@ -884,7 +884,7 @@
 
 
 bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) {
-  if (!isa<PackedType>(Val->getType()) || Index->getType() != Type::UIntTy)
+  if (!isa<PackedType>(Val->getType()) || Index->getType() != Type::Int32Ty)
     return false;
   return true;
 }
@@ -915,7 +915,7 @@
                                      const std::string &Name,
                                      Instruction *InsertBef)
   : Instruction(Vec->getType(), InsertElement, Ops, 3, Name, InsertBef) {
-  Constant *Index = ConstantInt::get(Type::UIntTy, IndexV);
+  Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV);
   assert(isValidOperands(Vec, Elt, Index) &&
          "Invalid insertelement instruction operands!");
   Ops[0].init(Vec, this);
@@ -940,7 +940,7 @@
                                      const std::string &Name,
                                      BasicBlock *InsertAE)
 : Instruction(Vec->getType(), InsertElement, Ops, 3, Name, InsertAE) {
-  Constant *Index = ConstantInt::get(Type::UIntTy, IndexV);
+  Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV);
   assert(isValidOperands(Vec, Elt, Index) &&
          "Invalid insertelement instruction operands!");
   
@@ -957,7 +957,7 @@
   if (Elt->getType() != cast<PackedType>(Vec->getType())->getElementType())
     return false;// Second operand of insertelement must be packed element type.
     
-  if (Index->getType() != Type::UIntTy)
+  if (Index->getType() != Type::Int32Ty)
     return false;  // Third operand of insertelement must be uint.
   return true;
 }
@@ -1002,7 +1002,7 @@
   if (!isa<PackedType>(V1->getType())) return false;
   if (V1->getType() != V2->getType()) return false;
   if (!isa<PackedType>(Mask->getType()) ||
-         cast<PackedType>(Mask->getType())->getElementType() != Type::UIntTy ||
+         cast<PackedType>(Mask->getType())->getElementType() != Type::Int32Ty ||
          cast<PackedType>(Mask->getType())->getNumElements() !=
          cast<PackedType>(V1->getType())->getNumElements())
     return false;
@@ -1233,23 +1233,9 @@
   if (SrcTy == DstTy)
     return true;
   
-  // The remaining possibilities are lossless if the typeID of the source type
-  // matches the type ID of the destination in size and fundamental type. This 
-  // prevents things like int -> ptr, int -> float, packed -> int, mismatched 
-  // packed types of the same size, and etc.
-  switch (SrcTy->getTypeID()) {
-  case Type::UByteTyID:   return DstTy == Type::SByteTy;
-  case Type::SByteTyID:   return DstTy == Type::UByteTy;
-  case Type::UShortTyID:  return DstTy == Type::ShortTy;
-  case Type::ShortTyID:   return DstTy == Type::UShortTy;
-  case Type::UIntTyID:    return DstTy == Type::IntTy;
-  case Type::IntTyID:     return DstTy == Type::UIntTy;
-  case Type::ULongTyID:   return DstTy == Type::LongTy;
-  case Type::LongTyID:    return DstTy == Type::ULongTy;
-  case Type::PointerTyID: return isa<PointerType>(DstTy);
-  default:
-    break;
-  }
+  // Pointer to pointer is always lossless.
+  if (isa<PointerType>(SrcTy))
+    return isa<PointerType>(DstTy);
   return false;  // Other types have no identity values
 }
 


Index: llvm/lib/VMCore/Module.cpp
diff -u llvm/lib/VMCore/Module.cpp:1.69 llvm/lib/VMCore/Module.cpp:1.70
--- llvm/lib/VMCore/Module.cpp:1.69	Thu Dec  7 14:04:42 2006
+++ llvm/lib/VMCore/Module.cpp	Sat Dec 30 23:26:44 2006
@@ -31,14 +31,15 @@
 
 Function *ilist_traits<Function>::createSentinel() {
   FunctionType *FTy =
-    FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false);
+    FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false, 
+                      std::vector<FunctionType::ParameterAttributes>() );
   Function *Ret = new Function(FTy, GlobalValue::ExternalLinkage);
   // This should not be garbage monitored.
   LeakDetector::removeGarbageObject(Ret);
   return Ret;
 }
 GlobalVariable *ilist_traits<GlobalVariable>::createSentinel() {
-  GlobalVariable *Ret = new GlobalVariable(Type::IntTy, false,
+  GlobalVariable *Ret = new GlobalVariable(Type::Int32Ty, false,
                                            GlobalValue::ExternalLinkage);
   // This should not be garbage monitored.
   LeakDetector::removeGarbageObject(Ret);
@@ -206,7 +207,7 @@
   std::vector<const Type*> Params;
 
   // int main(void)...
-  if (Function *F = getFunction("main", FunctionType::get(Type::IntTy,
+  if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty,
                                                           Params, false)))
     return F;
 
@@ -215,10 +216,10 @@
                                                           Params, false)))
     return F;
 
-  Params.push_back(Type::IntTy);
+  Params.push_back(Type::Int32Ty);
 
   // int main(int argc)...
-  if (Function *F = getFunction("main", FunctionType::get(Type::IntTy,
+  if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty,
                                                           Params, false)))
     return F;
 
@@ -228,10 +229,10 @@
     return F;
 
   for (unsigned i = 0; i != 2; ++i) {  // Check argv and envp
-    Params.push_back(PointerType::get(PointerType::get(Type::SByteTy)));
+    Params.push_back(PointerType::get(PointerType::get(Type::Int8Ty)));
 
     // int main(int argc, char **argv)...
-    if (Function *F = getFunction("main", FunctionType::get(Type::IntTy,
+    if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty,
                                                             Params, false)))
       return F;
 


Index: llvm/lib/VMCore/ValueTypes.cpp
diff -u llvm/lib/VMCore/ValueTypes.cpp:1.8 llvm/lib/VMCore/ValueTypes.cpp:1.9
--- llvm/lib/VMCore/ValueTypes.cpp:1.8	Tue Jul 18 19:40:45 2006
+++ llvm/lib/VMCore/ValueTypes.cpp	Sat Dec 30 23:26:44 2006
@@ -88,10 +88,10 @@
   default: assert(0 && "ValueType does not correspond to LLVM type!");
   case MVT::isVoid:return Type::VoidTy;
   case MVT::i1:    return Type::BoolTy;
-  case MVT::i8:    return Type::UByteTy;
-  case MVT::i16:   return Type::UShortTy;
-  case MVT::i32:   return Type::UIntTy;
-  case MVT::i64:   return Type::ULongTy;
+  case MVT::i8:    return Type::Int8Ty;
+  case MVT::i16:   return Type::Int16Ty;
+  case MVT::i32:   return Type::Int32Ty;
+  case MVT::i64:   return Type::Int64Ty;
   case MVT::f32:   return Type::FloatTy;
   case MVT::f64:   return Type::DoubleTy;
   }


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.179 llvm/lib/VMCore/Verifier.cpp:1.180
--- llvm/lib/VMCore/Verifier.cpp:1.179	Sat Dec 23 00:05:41 2006
+++ llvm/lib/VMCore/Verifier.cpp	Sat Dec 30 23:26:44 2006
@@ -764,7 +764,7 @@
           "Shift must return an integer result!", &SI);
   Assert1(SI.getType() == SI.getOperand(0)->getType(),
           "Shift return type must be same as first operand!", &SI);
-  Assert1(SI.getOperand(1)->getType() == Type::UByteTy,
+  Assert1(SI.getOperand(1)->getType() == Type::Int8Ty,
           "Second operand to shift must be ubyte type!", &SI);
   visitInstruction(SI);
 }






More information about the llvm-commits mailing list