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

Reid Spencer reid at x10sys.com
Wed Oct 18 20:58:57 PDT 2006



Changes in directory llvm/lib/Transforms/Instrumentation:

EmitFunctions.cpp updated: 1.25 -> 1.25.2.1
ProfilingUtils.cpp updated: 1.7 -> 1.7.8.1
RSProfiling.cpp updated: 1.7 -> 1.7.2.1
TraceBasicBlocks.cpp updated: 1.15 -> 1.15.2.1
---
Log message:

For PR950: http://llvm.org/PR950 :
This commit (on SignlessTypes branch) provides the first Iteration for 
moving LLVM away from Signed types. This patch removes the ConstantSInt
and ConstantUInt classes from Type.h and makes all necessary changes in
LLVM to compensate.


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

 EmitFunctions.cpp    |    2 +-
 ProfilingUtils.cpp   |    4 ++--
 RSProfiling.cpp      |   22 +++++++++++-----------
 TraceBasicBlocks.cpp |    2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp
diff -u llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.25 llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.25.2.1
--- llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.25	Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp	Wed Oct 18 22:57:56 2006
@@ -110,7 +110,7 @@
 
   M.getGlobalList().push_back(funcArray);
 
-  ConstantInt *cnst = ConstantSInt::get(Type::IntTy, counter);
+  ConstantInt *cnst = ConstantInt::get(Type::IntTy, counter);
   GlobalVariable *fnCount = new GlobalVariable(Type::IntTy, true,
                                                GlobalValue::ExternalLinkage,
                                                cnst, "llvmFunctionCount");


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.7 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.7.8.1
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.7	Sat Oct 22 23:37:20 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp	Wed Oct 18 22:57:56 2006
@@ -51,7 +51,7 @@
     // pass null.
     Args[2] = ConstantPointerNull::get(UIntPtr);
   }
-  Args[3] = ConstantUInt::get(Type::UIntTy, NumElements);
+  Args[3] = ConstantInt::get(Type::UIntTy, NumElements);
 
   Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos);
 
@@ -96,7 +96,7 @@
   // Create the getelementptr constant expression
   std::vector<Constant*> Indices(2);
   Indices[0] = Constant::getNullValue(Type::IntTy);
-  Indices[1] = ConstantSInt::get(Type::IntTy, CounterNum);
+  Indices[1] = ConstantInt::get(Type::IntTy, CounterNum);
   Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices);
 
   // Load, increment and store the value back.


Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.7 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.7.2.1
--- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.7	Sun Aug 27 19:42:29 2006
+++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp	Wed Oct 18 22:57:56 2006
@@ -188,10 +188,10 @@
   
 GlobalRandomCounter::GlobalRandomCounter(Module& M, const Type* t, 
                                          uint64_t resetval) : T(t) {
+  ConstantInt* Init = ConstantInt::get(T, resetval); 
+  ResetValue = Init;
   Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage,
-                               ConstantUInt::get(T, resetval),
-                               "RandomSteeringCounter", &M);
-  ResetValue = ConstantUInt::get(T, resetval);
+                               Init, "RandomSteeringCounter", &M);
 }
 
 GlobalRandomCounter::~GlobalRandomCounter() {}
@@ -205,7 +205,7 @@
   LoadInst* l = new LoadInst(Counter, "counter", t);
   
   SetCondInst* s = new SetCondInst(Instruction::SetEQ, l, 
-				   ConstantUInt::get(T, 0), 
+				   ConstantInt::get(T, 0), 
                                    "countercc", t);
   Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1),
                                      "counternew", t);
@@ -225,10 +225,10 @@
 GlobalRandomCounterOpt::GlobalRandomCounterOpt(Module& M, const Type* t, 
                                                uint64_t resetval) 
   : AI(0), T(t) {
+  ConstantInt* Init = ConstantInt::get(T, resetval);
+  ResetValue  = Init;
   Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage,
-                               ConstantUInt::get(T, resetval),
-                               "RandomSteeringCounter", &M);
-  ResetValue = ConstantUInt::get(T, resetval);
+                               Init, "RandomSteeringCounter", &M);
 }
 
 GlobalRandomCounterOpt::~GlobalRandomCounterOpt() {}
@@ -278,7 +278,7 @@
   LoadInst* l = new LoadInst(AI, "counter", t);
   
   SetCondInst* s = new SetCondInst(Instruction::SetEQ, l, 
-				   ConstantUInt::get(T, 0), 
+				   ConstantInt::get(T, 0), 
                                    "countercc", t);
   Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1),
                                      "counternew", t);
@@ -309,11 +309,11 @@
   
   CallInst* c = new CallInst(F, "rdcc", t);
   BinaryOperator* b = 
-    BinaryOperator::createAnd(c, ConstantUInt::get(Type::ULongTy, rm),
+    BinaryOperator::createAnd(c, ConstantInt::get(Type::ULongTy, rm),
 			      "mrdcc", t);
   
   SetCondInst* s = new SetCondInst(Instruction::SetEQ, b, 
-				   ConstantUInt::get(Type::ULongTy, 0), 
+				   ConstantInt::get(Type::ULongTy, 0), 
                                    "mrdccc", t);
   t->setCondition(s);
 }
@@ -339,7 +339,7 @@
   // Create the getelementptr constant expression
   std::vector<Constant*> Indices(2);
   Indices[0] = Constant::getNullValue(Type::IntTy);
-  Indices[1] = ConstantSInt::get(Type::IntTy, CounterNum);
+  Indices[1] = ConstantInt::get(Type::IntTy, CounterNum);
   Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices);
   
   // Load, increment and store the value back.


Index: llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.15 llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.15.2.1
--- llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.15	Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp	Wed Oct 18 22:57:56 2006
@@ -49,7 +49,7 @@
   Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
                                              Type::UIntTy, (Type *)0);
   std::vector<Value*> Args (1);
-  Args[0] = ConstantUInt::get (Type::UIntTy, BBNumber);
+  Args[0] = ConstantInt::get (Type::UIntTy, BBNumber);
 
   // Insert the call after any alloca or PHI instructions...
   BasicBlock::iterator InsertPos = BB->begin();






More information about the llvm-commits mailing list