diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:44:37 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:44:37 +0000 |
commit | 518310cb0d136906ff0a99d7a24cb460794de5bf (patch) | |
tree | d8ad6b32edf261c90ce2c190f4c74dc3d044502f /lib/Transforms/Instrumentation | |
parent | 593eb952281138e1877adbfb11b88b6e32fdd732 (diff) | |
download | llvm-518310cb0d136906ff0a99d7a24cb460794de5bf.tar.gz llvm-518310cb0d136906ff0a99d7a24cb460794de5bf.tar.bz2 llvm-518310cb0d136906ff0a99d7a24cb460794de5bf.tar.xz |
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation')
6 files changed, 9 insertions, 16 deletions
diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp index b7c19e6e09..e357e841cd 100644 --- a/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp @@ -55,14 +55,12 @@ bool FunctionProfiler::run(Module &M) { 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 @@ bool BlockProfiler::run(Module &M) { 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); diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp index ef334f22f3..c584ca5dfe 100644 --- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp @@ -60,8 +60,6 @@ bool EdgeProfiler::run(Module &M) { 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 @@ bool EdgeProfiler::run(Module &M) { // 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); } } } diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp index 27c2587546..a1c23dab23 100644 --- a/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp @@ -77,7 +77,7 @@ bool EmitFunctionTable::run(Module &M){ //std::cerr<<MI; - vConsts.push_back(ConstantPointerRef::get(MI)); + vConsts.push_back(MI); sBCons.push_back(ConstantInt::get(Type::SByteTy, hasBackEdge(MI))); counter++; diff --git a/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/lib/Transforms/Instrumentation/ProfilingUtils.cpp index 3c22b4bf42..1c0c4ada32 100644 --- a/lib/Transforms/Instrumentation/ProfilingUtils.cpp +++ b/lib/Transforms/Instrumentation/ProfilingUtils.cpp @@ -42,8 +42,7 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName, 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::InsertProfilingInitCall(Function *MainFn, const char *FnName, } 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)) diff --git a/lib/Transforms/Instrumentation/ProfilingUtils.h b/lib/Transforms/Instrumentation/ProfilingUtils.h index 17e234806c..c6d1b73928 100644 --- a/lib/Transforms/Instrumentation/ProfilingUtils.h +++ b/lib/Transforms/Instrumentation/ProfilingUtils.h @@ -26,7 +26,7 @@ namespace llvm { void InsertProfilingInitCall(Function *MainFn, const char *FnName, GlobalValue *Arr = 0); void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum, - ConstantPointerRef *CounterArray); + GlobalValue *CounterArray); } #endif diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index 30904a627e..6cc46fa6c6 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -243,7 +243,7 @@ static void InsertPrintInst(Value *V, BasicBlock *BB, Instruction *InsertBefore, 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 |