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

Chris Lattner sabre at nondot.org
Sat Jan 6 23:22:35 PST 2007



Changes in directory llvm/lib/Transforms/Instrumentation:

ProfilingUtils.cpp updated: 1.13 -> 1.14
RSProfiling.cpp updated: 1.14 -> 1.15
TraceBasicBlocks.cpp updated: 1.20 -> 1.21
TraceValues.cpp updated: 1.79 -> 1.80
---
Log message:

relax some types


---
Diffs of the changes:  (+20 -21)

 ProfilingUtils.cpp   |    2 +-
 RSProfiling.cpp      |    2 +-
 TraceBasicBlocks.cpp |   11 +++++------
 TraceValues.cpp      |   26 +++++++++++++-------------
 4 files changed, 20 insertions(+), 21 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.13 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.14
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.13	Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp	Sun Jan  7 01:22:20 2007
@@ -25,7 +25,7 @@
   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::Int32Ty, Type::Int32Ty,
+  Constant *InitFn = M.getOrInsertFunction(FnName, Type::Int32Ty, Type::Int32Ty,
                                            ArgVTy, UIntPtr, Type::Int32Ty,
                                            (Type *)0);
 


Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.14 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.15
--- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.14	Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp	Sun Jan  7 01:22:20 2007
@@ -127,7 +127,7 @@
   //deciding when to sample.
   class CycleCounter : public Chooser {
     uint64_t rm;
-    Function* F;
+    Constant *F;
   public:
     CycleCounter(Module& m, uint64_t resetmask);
     virtual ~CycleCounter();


Index: llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.20 llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.21
--- llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.20	Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp	Sun Jan  7 01:22:20 2007
@@ -45,17 +45,16 @@
   DOUT << "InsertInstrumentationCall (\"" << BB->getName ()
        << "\", \"" << FnName << "\", " << BBNumber << ")\n";
   Module &M = *BB->getParent ()->getParent ();
-  Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
+  Constant *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
                                              Type::Int32Ty, (Type *)0);
-  std::vector<Value*> Args (1);
-  Args[0] = ConstantInt::get (Type::Int32Ty, BBNumber);
-
-  // Insert the call after any alloca or PHI instructions...
+  
+  // Insert the call after any alloca or PHI instructions.
   BasicBlock::iterator InsertPos = BB->begin();
   while (isa<AllocaInst>(InsertPos) || isa<PHINode>(InsertPos))
     ++InsertPos;
 
-  new CallInst (InstrFn, Args, "", InsertPos);
+  new CallInst(InstrFn, ConstantInt::get (Type::Int32Ty, BBNumber),
+               "", InsertPos);
 }
 
 bool TraceBasicBlocks::runOnModule(Module &M) {


Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.79 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.80
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.79	Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp	Sun Jan  7 01:22:20 2007
@@ -36,7 +36,7 @@
                cl::value_desc("function"), cl::Hidden);
 
 static void TraceValuesAtBBExit(BasicBlock *BB,
-                                Function *Printf, Function* HashPtrToSeqNum,
+                                Constant *Printf, Constant* HashPtrToSeqNum,
                              std::vector<Instruction*> *valuesStoredInFunction);
 
 // We trace a particular function if no functions to trace were specified
@@ -54,8 +54,8 @@
 
 namespace {
   struct ExternalFuncs {
-    Function *PrintfFunc, *HashPtrFunc, *ReleasePtrFunc;
-    Function *RecordPtrFunc, *PushOnEntryFunc, *ReleaseOnReturnFunc;
+    Constant *PrintfFunc, *HashPtrFunc, *ReleasePtrFunc;
+    Constant *RecordPtrFunc, *PushOnEntryFunc, *ReleaseOnReturnFunc;
     void doInitialization(Module &M); // Add prototypes for external functions
   };
 
@@ -224,7 +224,7 @@
 
 static void InsertPrintInst(Value *V, BasicBlock *BB, Instruction *InsertBefore,
                             std::string Message,
-                            Function *Printf, Function* HashPtrToSeqNum) {
+                            Constant *Printf, Constant* HashPtrToSeqNum) {
   // Escape Message by replacing all % characters with %% chars.
   std::string Tmp;
   std::swap(Tmp, Message);
@@ -266,8 +266,8 @@
 
 static void InsertVerbosePrintInst(Value *V, BasicBlock *BB,
                                    Instruction *InsertBefore,
-                                   const std::string &Message, Function *Printf,
-                                   Function* HashPtrToSeqNum) {
+                                   const std::string &Message, Constant *Printf,
+                                   Constant * HashPtrToSeqNum) {
   std::ostringstream OutStr;
   if (V) WriteAsOperand(OutStr, V);
   InsertPrintInst(V, BB, InsertBefore, Message+OutStr.str()+" = ",
@@ -277,7 +277,7 @@
 static void
 InsertReleaseInst(Value *V, BasicBlock *BB,
                   Instruction *InsertBefore,
-                  Function* ReleasePtrFunc) {
+                  Constant *ReleasePtrFunc) {
 
   const Type *SBP = PointerType::get(Type::Int8Ty);
   if (V->getType() != SBP)    // Cast pointer to be sbyte*
@@ -290,7 +290,7 @@
 static void
 InsertRecordInst(Value *V, BasicBlock *BB,
                  Instruction *InsertBefore,
-                 Function* RecordPtrFunc) {
+                 Constant *RecordPtrFunc) {
     const Type *SBP = PointerType::get(Type::Int8Ty);
   if (V->getType() != SBP)     // Cast pointer to be sbyte*
     V = new BitCastInst(V, SBP, "RP_cast", InsertBefore);
@@ -325,7 +325,7 @@
 // store instruction).
 //
 static void TraceValuesAtBBExit(BasicBlock *BB,
-                                Function *Printf, Function* HashPtrToSeqNum,
+                                Constant *Printf, Constant * HashPtrToSeqNum,
                             std::vector<Instruction*> *valuesStoredInFunction) {
   // Get an iterator to point to the insertion location, which is
   // just before the terminator instruction.
@@ -354,8 +354,8 @@
   }
 }
 
-static inline void InsertCodeToShowFunctionEntry(Function &F, Function *Printf,
-                                                 Function* HashPtrToSeqNum){
+static inline void InsertCodeToShowFunctionEntry(Function &F, Constant *Printf,
+                                                 Constant * HashPtrToSeqNum){
   // Get an iterator to point to the insertion location
   BasicBlock &BB = F.getEntryBlock();
   Instruction *InsertPos = BB.begin();
@@ -376,8 +376,8 @@
 
 
 static inline void InsertCodeToShowFunctionExit(BasicBlock *BB,
-                                                Function *Printf,
-                                                Function* HashPtrToSeqNum) {
+                                                Constant *Printf,
+                                                Constant * HashPtrToSeqNum) {
   // Get an iterator to point to the insertion location
   ReturnInst *Ret = cast<ReturnInst>(BB->getTerminator());
 






More information about the llvm-commits mailing list