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

LLVM llvm at cs.uiuc.edu
Sat Jul 17 17:21:24 PDT 2004



Changes in directory llvm/lib/Transforms/Instrumentation:

BlockProfiling.cpp updated: 1.8 -> 1.9
EdgeProfiling.cpp updated: 1.2 -> 1.3
EmitFunctions.cpp updated: 1.17 -> 1.18
ProfilingUtils.cpp updated: 1.3 -> 1.4
ProfilingUtils.h updated: 1.2 -> 1.3
TraceValues.cpp updated: 1.66 -> 1.67

---
Log message:

bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Replace ConstantPointerRef usage with GlobalValue usage


---
Diffs of the changes:  (+9 -16)

Index: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.8 llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.9
--- llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.8	Sun Jul  4 07:19:56 2004
+++ llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp	Sat Jul 17 19:21:14 2004
@@ -55,14 +55,12 @@
     new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "FuncProfCounters", &M);
 
-  ConstantPointerRef *CounterCPR = ConstantPointerRef::get(Counters);
-
   // Instrument all of the functions...
   unsigned i = 0;
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) 
     if (!I->isExternal())
       // Insert counter at the start of the function
-      IncrementCounterInBlock(I->begin(), i++, CounterCPR);
+      IncrementCounterInBlock(I->begin(), i++, Counters);
 
   // Add the initialization call to main.
   InsertProfilingInitCall(Main, "llvm_start_func_profiling", Counters);
@@ -96,14 +94,12 @@
     new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "BlockProfCounters", &M);
 
-  ConstantPointerRef *CounterCPR = ConstantPointerRef::get(Counters);
-
   // Instrument all of the blocks...
   unsigned i = 0;
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) 
     for (Function::iterator BB = I->begin(), E = I->end(); BB != E; ++BB)
       // Insert counter at the start of the block
-      IncrementCounterInBlock(BB, i++, CounterCPR);
+      IncrementCounterInBlock(BB, i++, Counters);
 
   // Add the initialization call to main.
   InsertProfilingInitCall(Main, "llvm_start_block_profiling", Counters);


Index: llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.2 llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.3
--- llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.2	Sun Jul  4 07:19:56 2004
+++ llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp	Sat Jul 17 19:21:14 2004
@@ -60,8 +60,6 @@
     new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "EdgeProfCounters", &M);
 
-  ConstantPointerRef *CounterCPR = ConstantPointerRef::get(Counters);
-
   // Instrument all of the edges...
   unsigned i = 0;
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
@@ -80,10 +78,10 @@
           // otherwise insert it in the successor block.
           if (TI->getNumSuccessors() == 0) {
             // Insert counter at the start of the block
-            IncrementCounterInBlock(BB, i++, CounterCPR);
+            IncrementCounterInBlock(BB, i++, Counters);
           } else {
             // Insert counter at the start of the block
-            IncrementCounterInBlock(TI->getSuccessor(s), i++, CounterCPR);
+            IncrementCounterInBlock(TI->getSuccessor(s), i++, Counters);
           }
         }
       }


Index: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp
diff -u llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.17 llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.18
--- llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.17	Mon Mar  8 10:45:53 2004
+++ llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp	Sat Jul 17 19:21:14 2004
@@ -77,7 +77,7 @@
     
       //std::cerr<<MI;
 
-      vConsts.push_back(ConstantPointerRef::get(MI));
+      vConsts.push_back(MI);
       sBCons.push_back(ConstantInt::get(Type::SByteTy, hasBackEdge(MI)));
       
       counter++;


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.3 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.4
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.3	Mon May  3 17:06:33 2004
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp	Sat Jul 17 19:21:14 2004
@@ -42,8 +42,7 @@
   std::vector<Constant*> GEPIndices(2, Constant::getNullValue(Type::IntTy));
   unsigned NumElements = 0;
   if (Array) {
-    ConstantPointerRef *ArrayCPR = ConstantPointerRef::get(Array);
-    Args[2] = ConstantExpr::getGetElementPtr(ArrayCPR, GEPIndices);
+    Args[2] = ConstantExpr::getGetElementPtr(Array, GEPIndices);
     NumElements =
       cast<ArrayType>(Array->getType()->getElementType())->getNumElements();
   } else {
@@ -87,7 +86,7 @@
 }
 
 void llvm::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
-                                   ConstantPointerRef *CounterArray) {
+                                   GlobalValue *CounterArray) {
   // Insert the increment after any alloca or PHI instructions...
   BasicBlock::iterator InsertPos = BB->begin();
   while (isa<AllocaInst>(InsertPos) || isa<PHINode>(InsertPos))


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.h
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.2 llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.3
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.2	Mon May  3 17:06:33 2004
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.h	Sat Jul 17 19:21:14 2004
@@ -26,7 +26,7 @@
   void InsertProfilingInitCall(Function *MainFn, const char *FnName,
                                GlobalValue *Arr = 0);
   void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
-                               ConstantPointerRef *CounterArray);
+                               GlobalValue *CounterArray);
 }
 
 #endif


Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.66 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.67
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.66	Fri Jan  9 00:11:50 2004
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp	Sat Jul 17 19:21:14 2004
@@ -243,7 +243,7 @@
   GlobalVariable *fmtVal = getStringRef(Mod, Message+getPrintfCodeFor(V)+"\n");
 
   // Turn the format string into an sbyte *
-  Constant *GEP =ConstantExpr::getGetElementPtr(ConstantPointerRef::get(fmtVal),
+  Constant *GEP=ConstantExpr::getGetElementPtr(fmtVal,
                 std::vector<Constant*>(2,Constant::getNullValue(Type::LongTy)));
   
   // Insert a call to the hash function if this is a pointer value





More information about the llvm-commits mailing list