llvm.org GIT mirror llvm / 0346364
Use the new interface, simplifies code NOTE that these two files are _BUGGY_ and need to be fixed, just not by me :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8241 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 16 years ago
2 changed file(s) with 13 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
120120
121121 removeRedundant(be);
122122
123 // FIXME: THIS IS HORRIBLY BROKEN. FunctionPass's cannot do this, except in
124 // their initialize function!!
125 Function *inCountMth =
126 F.getParent()->getOrInsertFunction("llvm_first_trigger",
127 Type::VoidTy, 0);
128
123129 for(std::map::iterator MI = be.begin(),
124130 ME = be.end(); MI != ME; ++MI){
125131 BasicBlock *u = MI->first;
136142 ti->setSuccessor(index, newBB);
137143
138144 BasicBlock::InstListType < = newBB->getInstList();
139
140 std::vector inCountArgs;
141 const FunctionType *cFty = FunctionType::get(Type::VoidTy, inCountArgs,
142 false);
143 Function *inCountMth =
144 u->getParent()->getParent()->getOrInsertFunction("llvm_first_trigger",
145 cFty);
146
147 assert(inCountMth && "Initial method could not be inserted!");
148145
149146 Instruction *call = new CallInst(inCountMth);
150147 lt.push_back(call);
175175
176176 if(fr->getParent()->getName() == "main"){
177177 //intialize threshold
178 vector initialize_args;
179 initialize_args.push_back(PointerType::get(Type::IntTy));
180
181 const FunctionType *Fty = FunctionType::get(Type::VoidTy, initialize_args,
182 false);
183 Function *initialMeth = fr->getParent()->getParent()->getOrInsertFunction("reoptimizerInitialize", Fty);
184 assert(initialMeth && "Initialize method could not be inserted!");
178
179 // FIXME: THIS IS HORRIBLY BROKEN. FUNCTION PASSES CANNOT DO THIS, EXCEPT
180 // IN THEIR INITIALIZE METHOD!!
181 Function *initialize =
182 F.getParent()->getOrInsertFunction("reoptimizerInitialize", Type::VoidTy,
183 PointerType::get(Type::IntTy), 0);
185184
186185 vector trargs;
187186 trargs.push_back(threshold);
188
189 new CallInst(initialMeth, trargs, "", fr->begin());
187 new CallInst(initialize, trargs, "", fr->begin());
190188 }
191189
192190