[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp EdgeProfiling.cpp EmitFunctions.cpp ProfilingUtils.cpp RSProfiling.cpp TraceBasicBlocks.cpp TraceValues.cpp

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



Changes in directory llvm/lib/Transforms/Instrumentation:

BlockProfiling.cpp updated: 1.18 -> 1.19
EdgeProfiling.cpp updated: 1.9 -> 1.10
EmitFunctions.cpp updated: 1.26 -> 1.27
ProfilingUtils.cpp updated: 1.12 -> 1.13
RSProfiling.cpp updated: 1.13 -> 1.14
TraceBasicBlocks.cpp updated: 1.19 -> 1.20
TraceValues.cpp updated: 1.78 -> 1.79
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int   -> Int32
4. [U]Long  -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
   and other methods related to signedness. In a few places this warranted
   identifying the signedness information from other sources.



---
Diffs of the changes:  (+37 -37)

 BlockProfiling.cpp   |    4 ++--
 EdgeProfiling.cpp    |    2 +-
 EmitFunctions.cpp    |    8 ++++----
 ProfilingUtils.cpp   |   26 +++++++++++++-------------
 RSProfiling.cpp      |   16 ++++++++--------
 TraceBasicBlocks.cpp |    4 ++--
 TraceValues.cpp      |   14 +++++++-------
 7 files changed, 37 insertions(+), 37 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.18 llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.19
--- llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.18	Wed Dec  6 19:30:31 2006
+++ llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp	Sat Dec 30 23:48:39 2006
@@ -57,7 +57,7 @@
     if (!I->isExternal())
       ++NumFunctions;
 
-  const Type *ATy = ArrayType::get(Type::UIntTy, NumFunctions);
+  const Type *ATy = ArrayType::get(Type::Int32Ty, NumFunctions);
   GlobalVariable *Counters =
     new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "FuncProfCounters", &M);
@@ -99,7 +99,7 @@
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     NumBlocks += I->size();
 
-  const Type *ATy = ArrayType::get(Type::UIntTy, NumBlocks);
+  const Type *ATy = ArrayType::get(Type::Int32Ty, NumBlocks);
   GlobalVariable *Counters =
     new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "BlockProfCounters", &M);


Index: llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.9 llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.10
--- llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.9	Wed Dec  6 19:30:31 2006
+++ llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp	Sat Dec 30 23:48:39 2006
@@ -58,7 +58,7 @@
       NumEdges += BB->getTerminator()->getNumSuccessors();
     }
 
-  const Type *ATy = ArrayType::get(Type::UIntTy, NumEdges);
+  const Type *ATy = ArrayType::get(Type::Int32Ty, NumEdges);
   GlobalVariable *Counters =
     new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "EdgeProfCounters", &M);


Index: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp
diff -u llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.26 llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.27
--- llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.26	Fri Oct 20 02:07:24 2006
+++ llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp	Sat Dec 30 23:48:39 2006
@@ -87,7 +87,7 @@
       //std::cerr<<MI;
 
       vConsts.push_back(MI);
-      sBCons.push_back(ConstantInt::get(Type::SByteTy, hasBackEdge(MI)));
+      sBCons.push_back(ConstantInt::get(Type::Int8Ty, hasBackEdge(MI)));
 
       counter++;
     }
@@ -100,7 +100,7 @@
                                           cstruct, "llvmFunctionTable");
   M.getGlobalList().push_back(gb);
 
-  Constant *constArray = ConstantArray::get(ArrayType::get(Type::SByteTy,
+  Constant *constArray = ConstantArray::get(ArrayType::get(Type::Int8Ty,
                                                                 sBCons.size()),
                                                  sBCons);
 
@@ -110,8 +110,8 @@
 
   M.getGlobalList().push_back(funcArray);
 
-  ConstantInt *cnst = ConstantInt::get(Type::IntTy, counter);
-  GlobalVariable *fnCount = new GlobalVariable(Type::IntTy, true,
+  ConstantInt *cnst = ConstantInt::get(Type::Int32Ty, counter);
+  GlobalVariable *fnCount = new GlobalVariable(Type::Int32Ty, true,
                                                GlobalValue::ExternalLinkage,
                                                cnst, "llvmFunctionCount");
   M.getGlobalList().push_back(fnCount);


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.12 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.13
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.12	Thu Dec 21 01:49:49 2006
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp	Sat Dec 30 23:48:39 2006
@@ -22,17 +22,17 @@
 
 void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
                                    GlobalValue *Array) {
-  const Type *ArgVTy = PointerType::get(PointerType::get(Type::SByteTy));
-  const PointerType *UIntPtr = PointerType::get(Type::UIntTy);
+  const Type *ArgVTy = PointerType::get(PointerType::get(Type::Int8Ty));
+  const PointerType *UIntPtr = PointerType::get(Type::Int32Ty);
   Module &M = *MainFn->getParent();
-  Function *InitFn = M.getOrInsertFunction(FnName, Type::IntTy, Type::IntTy,
-                                           ArgVTy, UIntPtr, Type::UIntTy,
+  Function *InitFn = M.getOrInsertFunction(FnName, Type::Int32Ty, Type::Int32Ty,
+                                           ArgVTy, UIntPtr, Type::Int32Ty,
                                            (Type *)0);
 
   // This could force argc and argv into programs that wouldn't otherwise have
   // them, but instead we just pass null values in.
   std::vector<Value*> Args(4);
-  Args[0] = Constant::getNullValue(Type::IntTy);
+  Args[0] = Constant::getNullValue(Type::Int32Ty);
   Args[1] = Constant::getNullValue(ArgVTy);
 
   // Skip over any allocas in the entry block.
@@ -40,7 +40,7 @@
   BasicBlock::iterator InsertPos = Entry->begin();
   while (isa<AllocaInst>(InsertPos)) ++InsertPos;
 
-  std::vector<Constant*> GEPIndices(2, Constant::getNullValue(Type::IntTy));
+  std::vector<Constant*> GEPIndices(2, Constant::getNullValue(Type::Int32Ty));
   unsigned NumElements = 0;
   if (Array) {
     Args[2] = ConstantExpr::getGetElementPtr(Array, GEPIndices);
@@ -51,7 +51,7 @@
     // pass null.
     Args[2] = ConstantPointerNull::get(UIntPtr);
   }
-  Args[3] = ConstantInt::get(Type::UIntTy, NumElements);
+  Args[3] = ConstantInt::get(Type::Int32Ty, NumElements);
 
   Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos);
 
@@ -75,16 +75,16 @@
     AI = MainFn->arg_begin();
     // If the program looked at argc, have it look at the return value of the
     // init call instead.
-    if (AI->getType() != Type::IntTy) {
+    if (AI->getType() != Type::Int32Ty) {
       Instruction::CastOps opcode;
       if (!AI->use_empty()) {
         opcode = CastInst::getCastOpcode(InitCall, true, AI->getType(), true);
         AI->replaceAllUsesWith(
           CastInst::create(opcode, InitCall, AI->getType(), "", InsertPos));
       }
-      opcode = CastInst::getCastOpcode(AI, true, Type::IntTy, true);
+      opcode = CastInst::getCastOpcode(AI, true, Type::Int32Ty, true);
       InitCall->setOperand(1, 
-          CastInst::create(opcode, AI, Type::IntTy, "argc.cast", InitCall));
+          CastInst::create(opcode, AI, Type::Int32Ty, "argc.cast", InitCall));
     } else {
       AI->replaceAllUsesWith(InitCall);
       InitCall->setOperand(1, AI);
@@ -103,14 +103,14 @@
 
   // Create the getelementptr constant expression
   std::vector<Constant*> Indices(2);
-  Indices[0] = Constant::getNullValue(Type::IntTy);
-  Indices[1] = ConstantInt::get(Type::IntTy, CounterNum);
+  Indices[0] = Constant::getNullValue(Type::Int32Ty);
+  Indices[1] = ConstantInt::get(Type::Int32Ty, CounterNum);
   Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices);
 
   // Load, increment and store the value back.
   Value *OldVal = new LoadInst(ElementPtr, "OldFuncCounter", InsertPos);
   Value *NewVal = BinaryOperator::create(Instruction::Add, OldVal,
-                                         ConstantInt::get(Type::UIntTy, 1),
+                                         ConstantInt::get(Type::Int32Ty, 1),
                                          "NewFuncCounter", InsertPos);
   new StoreInst(NewVal, ElementPtr, InsertPos);
 }


Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.13 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.14
--- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.13	Sat Dec 23 00:05:41 2006
+++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp	Sat Dec 30 23:48:39 2006
@@ -290,7 +290,7 @@
 
 
 CycleCounter::CycleCounter(Module& m, uint64_t resetmask) : rm(resetmask) {
-  F = m.getOrInsertFunction("llvm.readcyclecounter", Type::ULongTy, NULL);
+  F = m.getOrInsertFunction("llvm.readcyclecounter", Type::Int64Ty, NULL);
 }
 
 CycleCounter::~CycleCounter() {}
@@ -302,11 +302,11 @@
   
   CallInst* c = new CallInst(F, "rdcc", t);
   BinaryOperator* b = 
-    BinaryOperator::createAnd(c, ConstantInt::get(Type::ULongTy, rm),
+    BinaryOperator::createAnd(c, ConstantInt::get(Type::Int64Ty, rm),
 			      "mrdcc", t);
   
   ICmpInst *s = new ICmpInst(ICmpInst::ICMP_EQ, b,
-                             ConstantInt::get(Type::ULongTy, 0), 
+                             ConstantInt::get(Type::Int64Ty, 0), 
                              "mrdccc", t);
 
   t->setCondition(s);
@@ -332,15 +332,15 @@
   
   // Create the getelementptr constant expression
   std::vector<Constant*> Indices(2);
-  Indices[0] = Constant::getNullValue(Type::IntTy);
-  Indices[1] = ConstantInt::get(Type::IntTy, CounterNum);
+  Indices[0] = Constant::getNullValue(Type::Int32Ty);
+  Indices[1] = ConstantInt::get(Type::Int32Ty, CounterNum);
   Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices);
   
   // Load, increment and store the value back.
   Value *OldVal = new LoadInst(ElementPtr, "OldCounter", InsertPos);
   profcode.insert(OldVal);
   Value *NewVal = BinaryOperator::createAdd(OldVal,
-					    ConstantInt::get(Type::UIntTy, 1),
+					    ConstantInt::get(Type::Int32Ty, 1),
 					    "NewCounter", InsertPos);
   profcode.insert(NewVal);
   profcode.insert(new StoreInst(NewVal, ElementPtr, InsertPos));
@@ -539,10 +539,10 @@
 bool ProfilerRS::doInitialization(Module &M) {
   switch (RandomMethod) {
   case GBV:
-    c = new GlobalRandomCounter(M, Type::UIntTy, (1 << 14) - 1);
+    c = new GlobalRandomCounter(M, Type::Int32Ty, (1 << 14) - 1);
     break;
   case GBVO:
-    c = new GlobalRandomCounterOpt(M, Type::UIntTy, (1 << 14) - 1);
+    c = new GlobalRandomCounterOpt(M, Type::Int32Ty, (1 << 14) - 1);
     break;
   case HOSTCC:
     c = new CycleCounter(M, (1 << 14) - 1);


Index: llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.19 llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.20
--- llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.19	Wed Dec  6 19:30:31 2006
+++ llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp	Sat Dec 30 23:48:39 2006
@@ -46,9 +46,9 @@
        << "\", \"" << FnName << "\", " << BBNumber << ")\n";
   Module &M = *BB->getParent ()->getParent ();
   Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
-                                             Type::UIntTy, (Type *)0);
+                                             Type::Int32Ty, (Type *)0);
   std::vector<Value*> Args (1);
-  Args[0] = ConstantInt::get (Type::UIntTy, BBNumber);
+  Args[0] = ConstantInt::get (Type::Int32Ty, BBNumber);
 
   // Insert the call after any alloca or PHI instructions...
   BasicBlock::iterator InsertPos = BB->begin();


Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.78 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.79
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.78	Tue Dec 12 18:50:17 2006
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp	Sat Dec 30 23:48:39 2006
@@ -123,13 +123,13 @@
 //
 void ExternalFuncs::doInitialization(Module &M) {
   M.addLibrary("trace");
-  const Type *SBP = PointerType::get(Type::SByteTy);
+  const Type *SBP = PointerType::get(Type::Int8Ty);
   const FunctionType *MTy =
-    FunctionType::get(Type::IntTy, std::vector<const Type*>(1, SBP), true);
+    FunctionType::get(Type::Int32Ty, std::vector<const Type*>(1, SBP), true);
   PrintfFunc = M.getOrInsertFunction("printf", MTy);
 
   // uint (sbyte*)
-  HashPtrFunc = M.getOrInsertFunction("HashPointerToSeqNum", Type::UIntTy, SBP,
+  HashPtrFunc = M.getOrInsertFunction("HashPointerToSeqNum", Type::Int32Ty, SBP,
                                       (Type *)0);
 
   // void (sbyte*)
@@ -244,11 +244,11 @@
 
   // Turn the format string into an sbyte *
   Constant *GEP=ConstantExpr::getGetElementPtr(fmtVal,
-                std::vector<Constant*>(2,Constant::getNullValue(Type::LongTy)));
+                std::vector<Constant*>(2,Constant::getNullValue(Type::Int64Ty)));
 
   // Insert a call to the hash function if this is a pointer value
   if (V && isa<PointerType>(V->getType()) && !DisablePtrHashing) {
-    const Type *SBP = PointerType::get(Type::SByteTy);
+    const Type *SBP = PointerType::get(Type::Int8Ty);
     if (V->getType() != SBP)     // Cast pointer to be sbyte*
       V = new BitCastInst(V, SBP, "Hash_cast", InsertBefore);
 
@@ -279,7 +279,7 @@
                   Instruction *InsertBefore,
                   Function* ReleasePtrFunc) {
 
-  const Type *SBP = PointerType::get(Type::SByteTy);
+  const Type *SBP = PointerType::get(Type::Int8Ty);
   if (V->getType() != SBP)    // Cast pointer to be sbyte*
     V = new BitCastInst(V, SBP, "RPSN_cast", InsertBefore);
 
@@ -291,7 +291,7 @@
 InsertRecordInst(Value *V, BasicBlock *BB,
                  Instruction *InsertBefore,
                  Function* RecordPtrFunc) {
-    const Type *SBP = PointerType::get(Type::SByteTy);
+    const Type *SBP = PointerType::get(Type::Int8Ty);
   if (V->getType() != SBP)     // Cast pointer to be sbyte*
     V = new BitCastInst(V, SBP, "RP_cast", InsertBefore);
 






More information about the llvm-commits mailing list