Start using the nicer terminator auto-insertion API

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10111 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2003-11-20 18:25:24 +00:00
parent adbc0b5287
commit f8485c6434
12 changed files with 32 additions and 46 deletions

View File

@@ -33,7 +33,7 @@
#include "llvm/Pass.h"
#include "Support/Statistic.h"
namespace llvm {
using namespace llvm;
namespace {
Statistic<> NumEliminated("tailcallelim", "Number of tail calls removed");
@@ -45,7 +45,9 @@ namespace {
}
// Public interface to the TailCallElimination pass
FunctionPass *createTailCallEliminationPass() { return new TailCallElim(); }
FunctionPass *llvm::createTailCallEliminationPass() {
return new TailCallElim();
}
bool TailCallElim::runOnFunction(Function &F) {
@@ -74,7 +76,7 @@ bool TailCallElim::runOnFunction(Function &F) {
// us to branch back to the old entry block.
OldEntry = &F.getEntryBlock();
BasicBlock *NewEntry = new BasicBlock("tailrecurse", OldEntry);
NewEntry->getInstList().push_back(new BranchInst(OldEntry));
new BranchInst(OldEntry, 0, 0, NewEntry);
// Now that we have created a new block, which jumps to the entry
// block, insert a PHI node for each argument of the function.
@@ -107,5 +109,3 @@ bool TailCallElim::runOnFunction(Function &F) {
return MadeChange;
}
} // End llvm namespace