forked from OSchip/llvm-project
Use the new interface, simplifies code
NOTE that these two files are _BUGGY_ and need to be fixed, just not by me :) llvm-svn: 8241
This commit is contained in:
parent
ea27751e4b
commit
25bc3f86de
|
@ -121,6 +121,12 @@ void InstLoops::findAndInstrumentBackEdges(Function &F){
|
|||
|
||||
removeRedundant(be);
|
||||
|
||||
// FIXME: THIS IS HORRIBLY BROKEN. FunctionPass's cannot do this, except in
|
||||
// their initialize function!!
|
||||
Function *inCountMth =
|
||||
F.getParent()->getOrInsertFunction("llvm_first_trigger",
|
||||
Type::VoidTy, 0);
|
||||
|
||||
for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
|
||||
ME = be.end(); MI != ME; ++MI){
|
||||
BasicBlock *u = MI->first;
|
||||
|
@ -138,15 +144,6 @@ void InstLoops::findAndInstrumentBackEdges(Function &F){
|
|||
|
||||
BasicBlock::InstListType < = newBB->getInstList();
|
||||
|
||||
std::vector<const Type*> inCountArgs;
|
||||
const FunctionType *cFty = FunctionType::get(Type::VoidTy, inCountArgs,
|
||||
false);
|
||||
Function *inCountMth =
|
||||
u->getParent()->getParent()->getOrInsertFunction("llvm_first_trigger",
|
||||
cFty);
|
||||
|
||||
assert(inCountMth && "Initial method could not be inserted!");
|
||||
|
||||
Instruction *call = new CallInst(inCountMth);
|
||||
lt.push_back(call);
|
||||
lt.push_back(new BranchInst(BB));
|
||||
|
|
|
@ -176,18 +176,16 @@ bool ProfilePaths::runOnFunction(Function &F){
|
|||
|
||||
if(fr->getParent()->getName() == "main"){
|
||||
//intialize threshold
|
||||
vector<const Type*> initialize_args;
|
||||
initialize_args.push_back(PointerType::get(Type::IntTy));
|
||||
|
||||
const FunctionType *Fty = FunctionType::get(Type::VoidTy, initialize_args,
|
||||
false);
|
||||
Function *initialMeth = fr->getParent()->getParent()->getOrInsertFunction("reoptimizerInitialize", Fty);
|
||||
assert(initialMeth && "Initialize method could not be inserted!");
|
||||
|
||||
// FIXME: THIS IS HORRIBLY BROKEN. FUNCTION PASSES CANNOT DO THIS, EXCEPT
|
||||
// IN THEIR INITIALIZE METHOD!!
|
||||
Function *initialize =
|
||||
F.getParent()->getOrInsertFunction("reoptimizerInitialize", Type::VoidTy,
|
||||
PointerType::get(Type::IntTy), 0);
|
||||
|
||||
vector<Value *> trargs;
|
||||
trargs.push_back(threshold);
|
||||
|
||||
new CallInst(initialMeth, trargs, "", fr->begin());
|
||||
new CallInst(initialize, trargs, "", fr->begin());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue