From 82f40e8210445b436481537738d909e4ed9e968c Mon Sep 17 00:00:00 2001 From: Anand Shukla Date: Mon, 8 Jul 2002 19:36:39 +0000 Subject: [PATCH] small corrections git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2816 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Instrumentation/ProfilePaths/EdgeCode.cpp | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp index efbd5c86c6f..b4629d8c9f7 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp @@ -19,7 +19,7 @@ #include "llvm/Module.h" #include "llvm/SymbolTable.h" #include "llvm/GlobalVariable.h" -#include "llvm/Constants.h"//llvm/ConstantVals.h" +#include "llvm/Constants.h" #include "llvm/BasicBlock.h" #include "llvm/Function.h" #include @@ -33,9 +33,7 @@ using std::vector; void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo, - Value *cnt){ - // return; - //cerr<<"In trigger code"<getSymbolTable(); vector args; - args.push_back(PointerType::get(Type::SByteTy)); + //args.push_back(PointerType::get(Type::SByteTy)); args.push_back(Type::IntTy); args.push_back(Type::IntTy); args.push_back(Type::IntTy); @@ -58,21 +56,26 @@ void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo, vector trargs; //pred_iterator piter=BB->pred_begin(); - std::string predName=BB->getName(); - Constant *bbName=ConstantArray::get(predName);//BB->getName()); - GlobalVariable *gbl=new GlobalVariable(ArrayType::get(Type::SByteTy, - predName.size()+1), - true, true, bbName, gstr); - M->getGlobalList().push_back(gbl); + //std::string predName = "uu";//BB->getName(); + //Constant *bbName=ConstantArray::get(predName);//BB->getName()); + //GlobalVariable *gbl=new GlobalVariable(ArrayType::get(Type::SByteTy, + // predName.size()+1), + // true, true, bbName, gstr); + + //M->getGlobalList().push_back(gbl); vector elargs; elargs.push_back(ConstantUInt::get(Type::UIntTy, 0)); elargs.push_back(ConstantUInt::get(Type::UIntTy, 0)); - Instruction *getElmntInst=new GetElementPtrInst(gbl,elargs,"elmntInst"); - + // commented out bb name frm which its called + //Instruction *getElmntInst=new GetElementPtrInst(gbl,elargs,"elmntInst"); + //trargs.push_back(ConstantArray::get(BB->getName())); - trargs.push_back(getElmntInst); + + //trargs.push_back(getElmntInst); + //trargs.push_back(bbName); + trargs.push_back(ConstantSInt::get(Type::IntTy,MethNo)); //trargs.push_back(ConstantSInt::get(Type::IntTy,-1));//erase this @@ -82,14 +85,8 @@ void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo, BasicBlock::InstListType& instList=BB->getInstList(); BasicBlock::iterator here=instList.begin(); - here = ++instList.insert(here, getElmntInst); + //here = ++instList.insert(here, getElmntInst); instList.insert(here,callInst); - //} - //else{ - //insert trigger method - - //assert(0&&"No method trigger"); - //} } @@ -340,8 +337,9 @@ void insertBB(Edge ed, //Is terminator a branch instruction? //then we need to change branch destinations to include new BB - BranchInst *BI=cast(TI); - + //std::cerr<<"before cast!\n"; + BranchInst *BI = cast(TI); + if(BI->isUnconditional()){ BI->setUnconditionalDest(newBB); Instruction *newBI2=new BranchInst(BB2); @@ -358,6 +356,7 @@ void insertBB(Edge ed, newBB->getInstList().push_back(newBI2); } + //std::cerr<<"After casting\n"; //get code for the new BB //now iterate over BB2, and set its Phi nodes right for(BasicBlock::iterator BB2Inst = BB2->begin(), BBend = BB2->end(); -- 2.34.1