[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp IntrinsicLowering.cpp MachOWriter.cpp MachineDebugInfo.cpp

Reid Spencer reid at x10sys.com
Sat Dec 30 21:56:04 PST 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.128 -> 1.129
IntrinsicLowering.cpp updated: 1.54 -> 1.55
MachOWriter.cpp updated: 1.9 -> 1.10
MachineDebugInfo.cpp updated: 1.64 -> 1.65
---
Log message:

For PR950: http://llvm.org/PR950 :
Three changes:
1. Convert signed integer types to signless versions.
2. Implement the @sext and @zext parameter attributes. Previously the
   type of an function parameter was used to determine whether it should
   be sign extended or zero extended before the call. This information is
   now communicated via the function type's parameter attributes. 
3. The interface to LowerCallTo had to be changed in order to accommodate
   the parameter attribute information. Although it would have been
   convenient to pass in the FunctionType itself, there isn't always one
   present in the caller. Consequently, a signedness indication for the
   result type and for each parameter was provided for in the interface
   to this method. All implementations were changed to make the adjustment
   necessary.


---
Diffs of the changes:  (+50 -54)

 AsmPrinter.cpp        |   10 ++++----
 IntrinsicLowering.cpp |   60 +++++++++++++++++++++++++-------------------------
 MachOWriter.cpp       |   12 +++-------
 MachineDebugInfo.cpp  |   22 +++++++++---------
 4 files changed, 50 insertions(+), 54 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.128 llvm/lib/CodeGen/AsmPrinter.cpp:1.129
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.128	Thu Dec 21 13:04:23 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Sat Dec 30 23:55:36 2006
@@ -607,7 +607,7 @@
         << "\t" << TAI->getCommentString() << " float " << Val << "\n";
       return;
     }
-  } else if (CV->getType() == Type::ULongTy || CV->getType() == Type::LongTy) {
+  } else if (CV->getType() == Type::Int64Ty) {
     if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
       uint64_t Val = CI->getZExtValue();
 
@@ -918,10 +918,10 @@
   const TargetData *TD = TM.getTargetData();
   switch (type->getTypeID()) {
   case Type::BoolTyID:
-  case Type::UByteTyID: case Type::SByteTyID:
+  case Type::Int8TyID:
     O << TAI->getData8bitsDirective();
     break;
-  case Type::UShortTyID: case Type::ShortTyID:
+  case Type::Int16TyID: 
     O << TAI->getData16bitsDirective();
     break;
   case Type::PointerTyID:
@@ -932,10 +932,10 @@
       break;
     }
     //Fall through for pointer size == int size
-  case Type::UIntTyID: case Type::IntTyID:
+  case Type::Int32TyID: 
     O << TAI->getData32bitsDirective();
     break;
-  case Type::ULongTyID: case Type::LongTyID:
+  case Type::Int64TyID:
     assert(TAI->getData64bitsDirective() &&
            "Target cannot handle 64-bit constant exprs!");
     O << TAI->getData64bitsDirective();


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.54 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.55
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.54	Sat Dec 23 00:05:40 2006
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp	Sat Dec 30 23:55:36 2006
@@ -95,7 +95,7 @@
       default: break;
       case Intrinsic::setjmp:
         EnsureFunctionExists(M, "setjmp", I->arg_begin(), I->arg_end(),
-                             Type::IntTy);
+                             Type::Int32Ty);
         break;
       case Intrinsic::longjmp:
         EnsureFunctionExists(M, "longjmp", I->arg_begin(), I->arg_end(),
@@ -117,9 +117,9 @@
         break;
       case Intrinsic::memset_i32:
       case Intrinsic::memset_i64:
-        M.getOrInsertFunction("memset", PointerType::get(Type::SByteTy),
-                              PointerType::get(Type::SByteTy),
-                              Type::IntTy, (--(--I->arg_end()))->getType(),
+        M.getOrInsertFunction("memset", PointerType::get(Type::Int8Ty),
+                              PointerType::get(Type::Int8Ty),
+                              Type::Int32Ty, (--(--I->arg_end()))->getType(),
                               (Type *)0);
         break;
       case Intrinsic::isunordered_f32:
@@ -150,26 +150,26 @@
   default: assert(0 && "Unhandled type size of value to byteswap!");
   case 16: {
     Value *Tmp1 = new ShiftInst(Instruction::Shl, V,
-                                ConstantInt::get(Type::UByteTy,8),"bswap.2",IP);
+                                ConstantInt::get(Type::Int8Ty,8),"bswap.2",IP);
     Value *Tmp2 = new ShiftInst(Instruction::LShr, V,
-                                ConstantInt::get(Type::UByteTy,8),"bswap.1",IP);
+                                ConstantInt::get(Type::Int8Ty,8),"bswap.1",IP);
     V = BinaryOperator::createOr(Tmp1, Tmp2, "bswap.i16", IP);
     break;
   }
   case 32: {
     Value *Tmp4 = new ShiftInst(Instruction::Shl, V,
-                              ConstantInt::get(Type::UByteTy,24),"bswap.4", IP);
+                              ConstantInt::get(Type::Int8Ty,24),"bswap.4", IP);
     Value *Tmp3 = new ShiftInst(Instruction::Shl, V,
-                              ConstantInt::get(Type::UByteTy,8),"bswap.3",IP);
+                              ConstantInt::get(Type::Int8Ty,8),"bswap.3",IP);
     Value *Tmp2 = new ShiftInst(Instruction::LShr, V,
-                              ConstantInt::get(Type::UByteTy,8),"bswap.2",IP);
+                              ConstantInt::get(Type::Int8Ty,8),"bswap.2",IP);
     Value *Tmp1 = new ShiftInst(Instruction::LShr, V,
-                              ConstantInt::get(Type::UByteTy,24),"bswap.1", IP);
+                              ConstantInt::get(Type::Int8Ty,24),"bswap.1", IP);
     Tmp3 = BinaryOperator::createAnd(Tmp3, 
-                                     ConstantInt::get(Type::UIntTy, 0xFF0000),
+                                     ConstantInt::get(Type::Int32Ty, 0xFF0000),
                                      "bswap.and3", IP);
     Tmp2 = BinaryOperator::createAnd(Tmp2, 
-                                     ConstantInt::get(Type::UIntTy, 0xFF00),
+                                     ConstantInt::get(Type::Int32Ty, 0xFF00),
                                      "bswap.and2", IP);
     Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or1", IP);
     Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, "bswap.or2", IP);
@@ -178,39 +178,39 @@
   }
   case 64: {
     Value *Tmp8 = new ShiftInst(Instruction::Shl, V,
-                              ConstantInt::get(Type::UByteTy,56),"bswap.8", IP);
+                              ConstantInt::get(Type::Int8Ty,56),"bswap.8", IP);
     Value *Tmp7 = new ShiftInst(Instruction::Shl, V,
-                              ConstantInt::get(Type::UByteTy,40),"bswap.7", IP);
+                              ConstantInt::get(Type::Int8Ty,40),"bswap.7", IP);
     Value *Tmp6 = new ShiftInst(Instruction::Shl, V,
-                              ConstantInt::get(Type::UByteTy,24),"bswap.6", IP);
+                              ConstantInt::get(Type::Int8Ty,24),"bswap.6", IP);
     Value *Tmp5 = new ShiftInst(Instruction::Shl, V,
-                              ConstantInt::get(Type::UByteTy,8),"bswap.5", IP);
+                              ConstantInt::get(Type::Int8Ty,8),"bswap.5", IP);
     Value* Tmp4 = new ShiftInst(Instruction::LShr, V,
-                              ConstantInt::get(Type::UByteTy,8),"bswap.4", IP);
+                              ConstantInt::get(Type::Int8Ty,8),"bswap.4", IP);
     Value* Tmp3 = new ShiftInst(Instruction::LShr, V,
-                              ConstantInt::get(Type::UByteTy,24),"bswap.3", IP);
+                              ConstantInt::get(Type::Int8Ty,24),"bswap.3", IP);
     Value* Tmp2 = new ShiftInst(Instruction::LShr, V,
-                              ConstantInt::get(Type::UByteTy,40),"bswap.2", IP);
+                              ConstantInt::get(Type::Int8Ty,40),"bswap.2", IP);
     Value* Tmp1 = new ShiftInst(Instruction::LShr, V,
-                              ConstantInt::get(Type::UByteTy,56),"bswap.1", IP);
+                              ConstantInt::get(Type::Int8Ty,56),"bswap.1", IP);
     Tmp7 = BinaryOperator::createAnd(Tmp7,
-                             ConstantInt::get(Type::ULongTy, 
+                             ConstantInt::get(Type::Int64Ty, 
                                0xFF000000000000ULL),
                              "bswap.and7", IP);
     Tmp6 = BinaryOperator::createAnd(Tmp6,
-                             ConstantInt::get(Type::ULongTy, 0xFF0000000000ULL),
+                             ConstantInt::get(Type::Int64Ty, 0xFF0000000000ULL),
                              "bswap.and6", IP);
     Tmp5 = BinaryOperator::createAnd(Tmp5,
-                             ConstantInt::get(Type::ULongTy, 0xFF00000000ULL),
+                             ConstantInt::get(Type::Int64Ty, 0xFF00000000ULL),
                              "bswap.and5", IP);
     Tmp4 = BinaryOperator::createAnd(Tmp4,
-                             ConstantInt::get(Type::ULongTy, 0xFF000000ULL),
+                             ConstantInt::get(Type::Int64Ty, 0xFF000000ULL),
                              "bswap.and4", IP);
     Tmp3 = BinaryOperator::createAnd(Tmp3,
-                             ConstantInt::get(Type::ULongTy, 0xFF0000ULL),
+                             ConstantInt::get(Type::Int64Ty, 0xFF0000ULL),
                              "bswap.and3", IP);
     Tmp2 = BinaryOperator::createAnd(Tmp2,
-                             ConstantInt::get(Type::ULongTy, 0xFF00ULL),
+                             ConstantInt::get(Type::Int64Ty, 0xFF00ULL),
                              "bswap.and2", IP);
     Tmp8 = BinaryOperator::createOr(Tmp8, Tmp7, "bswap.or1", IP);
     Tmp6 = BinaryOperator::createOr(Tmp6, Tmp5, "bswap.or2", IP);
@@ -242,7 +242,7 @@
     Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]);
     Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP);
     Value *VShift = new ShiftInst(Instruction::LShr, V,
-                      ConstantInt::get(Type::UByteTy, i), "ctpop.sh", IP);
+                      ConstantInt::get(Type::Int8Ty, i), "ctpop.sh", IP);
     Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, "cppop.and2", IP);
     V = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP);
   }
@@ -256,7 +256,7 @@
 
   unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
   for (unsigned i = 1; i != BitSize; i <<= 1) {
-    Value *ShVal = ConstantInt::get(Type::UByteTy, i);
+    Value *ShVal = ConstantInt::get(Type::Int8Ty, i);
     ShVal = new ShiftInst(Instruction::LShr, V, ShVal, "ctlz.sh", IP);
     V = BinaryOperator::createOr(V, ShVal, "ctlz.step", IP);
   }
@@ -289,7 +289,7 @@
     static Function *SetjmpFCache = 0;
     static const unsigned castOpcodes[] = { Instruction::BitCast };
     Value *V = ReplaceCallWith("setjmp", CI, CI->op_begin()+1, CI->op_end(),
-                               castOpcodes, Type::IntTy, SetjmpFCache);
+                               castOpcodes, Type::Int32Ty, SetjmpFCache);
     if (CI->getType() != Type::VoidTy)
       CI->replaceAllUsesWith(V);
     break;
@@ -381,7 +381,7 @@
   case Intrinsic::readcyclecounter: {
     cerr << "WARNING: this target does not support the llvm.readcyclecoun"
          << "ter intrinsic.  It is being lowered to a constant 0\n";
-    CI->replaceAllUsesWith(ConstantInt::get(Type::ULongTy, 0));
+    CI->replaceAllUsesWith(ConstantInt::get(Type::Int64Ty, 0));
     break;
   }
 


Index: llvm/lib/CodeGen/MachOWriter.cpp
diff -u llvm/lib/CodeGen/MachOWriter.cpp:1.9 llvm/lib/CodeGen/MachOWriter.cpp:1.10
--- llvm/lib/CodeGen/MachOWriter.cpp:1.9	Sun Dec 10 20:20:45 2006
+++ llvm/lib/CodeGen/MachOWriter.cpp	Sat Dec 30 23:55:36 2006
@@ -730,20 +730,17 @@
       
       switch (PC->getType()->getTypeID()) {
       case Type::BoolTyID:
-      case Type::UByteTyID:
-      case Type::SByteTyID:
+      case Type::Int8TyID:
         ptr[0] = cast<ConstantInt>(PC)->getZExtValue();
         break;
-      case Type::UShortTyID:
-      case Type::ShortTyID:
+      case Type::Int16TyID:
         val = cast<ConstantInt>(PC)->getZExtValue();
         if (TD->isBigEndian())
           val = ByteSwap_16(val);
         ptr[0] = val;
         ptr[1] = val >> 8;
         break;
-      case Type::UIntTyID:
-      case Type::IntTyID:
+      case Type::Int32TyID:
       case Type::FloatTyID:
         if (PC->getType()->getTypeID() == Type::FloatTyID) {
           val = FloatToBits(cast<ConstantFP>(PC)->getValue());
@@ -758,8 +755,7 @@
         ptr[3] = val >> 24;
         break;
       case Type::DoubleTyID:
-      case Type::ULongTyID:
-      case Type::LongTyID:
+      case Type::Int64TyID:
         if (PC->getType()->getTypeID() == Type::DoubleTyID) {
           val = DoubleToBits(cast<ConstantFP>(PC)->getValue());
         } else {


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.64 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.65
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.64	Mon Dec 11 19:17:40 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp	Sat Dec 30 23:55:36 2006
@@ -55,8 +55,8 @@
   std::vector<GlobalVariable*> Result;  // GlobalVariables matching criteria.
   
   std::vector<const Type*> FieldTypes;
-  FieldTypes.push_back(Type::UIntTy);
-  FieldTypes.push_back(Type::UIntTy);
+  FieldTypes.push_back(Type::Int32Ty);
+  FieldTypes.push_back(Type::Int32Ty);
 
   // Get the GlobalVariable root.
   GlobalVariable *UseRoot = M.getGlobalVariable(RootName,
@@ -264,16 +264,16 @@
   /// Apply - Set the value of each of the fields.
   ///
   virtual void Apply(int &Field) {
-    Elements.push_back(ConstantInt::get(Type::IntTy, int32_t(Field)));
+    Elements.push_back(ConstantInt::get(Type::Int32Ty, int32_t(Field)));
   }
   virtual void Apply(unsigned &Field) {
-    Elements.push_back(ConstantInt::get(Type::UIntTy, uint32_t(Field)));
+    Elements.push_back(ConstantInt::get(Type::Int32Ty, uint32_t(Field)));
   }
   virtual void Apply(int64_t &Field) {
-    Elements.push_back(ConstantInt::get(Type::LongTy, int64_t(Field)));
+    Elements.push_back(ConstantInt::get(Type::Int64Ty, int64_t(Field)));
   }
   virtual void Apply(uint64_t &Field) {
-    Elements.push_back(ConstantInt::get(Type::ULongTy, uint64_t(Field)));
+    Elements.push_back(ConstantInt::get(Type::Int64Ty, uint64_t(Field)));
   }
   virtual void Apply(bool &Field) {
     Elements.push_back(ConstantBool::get(Field));
@@ -351,16 +351,16 @@
   /// Apply - Set the value of each of the fields.
   ///
   virtual void Apply(int &Field) {
-    Fields.push_back(Type::IntTy);
+    Fields.push_back(Type::Int32Ty);
   }
   virtual void Apply(unsigned &Field) {
-    Fields.push_back(Type::UIntTy);
+    Fields.push_back(Type::Int32Ty);
   }
   virtual void Apply(int64_t &Field) {
-    Fields.push_back(Type::LongTy);
+    Fields.push_back(Type::Int64Ty);
   }
   virtual void Apply(uint64_t &Field) {
-    Fields.push_back(Type::ULongTy);
+    Fields.push_back(Type::Int64Ty);
   }
   virtual void Apply(bool &Field) {
     Fields.push_back(Type::BoolTy);
@@ -1259,7 +1259,7 @@
   // If not already defined.
   if (!StrPtrTy) {
     // Construct the pointer to signed bytes.
-    StrPtrTy = PointerType::get(Type::SByteTy);
+    StrPtrTy = PointerType::get(Type::Int8Ty);
   }
   
   return StrPtrTy;






More information about the llvm-commits mailing list