// except that the root node is implicitly the first node of the function.
//
template <> struct GraphTraits<Function*> : public GraphTraits<BasicBlock*> {
- static NodeType *getEntryNode(Function *F) { return &F->getEntryNode(); }
+ static NodeType *getEntryNode(Function *F) { return &F->getEntryBlock(); }
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
typedef Function::iterator nodes_iterator;
};
template <> struct GraphTraits<const Function*> :
public GraphTraits<const BasicBlock*> {
- static NodeType *getEntryNode(const Function *F) { return &F->getEntryNode();}
+ static NodeType *getEntryNode(const Function *F) {return &F->getEntryBlock();}
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
typedef Function::const_iterator nodes_iterator;
template <> struct GraphTraits<Inverse<Function*> > :
public GraphTraits<Inverse<BasicBlock*> > {
static NodeType *getEntryNode(Inverse<Function*> G) {
- return &G.Graph->getEntryNode();
+ return &G.Graph->getEntryBlock();
}
};
template <> struct GraphTraits<Inverse<const Function*> > :
public GraphTraits<Inverse<const BasicBlock*> > {
static NodeType *getEntryNode(Inverse<const Function *> G) {
- return &G.Graph->getEntryNode();
+ return &G.Graph->getEntryBlock();
}
};
if (!AI) return false;
if (AI->isArrayAllocation())
return 0; // FIXME: we can also inline fixed size array allocas!
- if (AI->getParent() != &AI->getParent()->getParent()->getEntryNode())
+ if (AI->getParent() != &AI->getParent()->getParent()->getEntryBlock())
return 0;
return AI;
}
if (!AI) return false;
if (AI->isArrayAllocation())
return 0; // FIXME: we can also inline fixed size array allocas!
- if (AI->getParent() != &AI->getParent()->getParent()->getEntryNode())
+ if (AI->getParent() != &AI->getParent()->getParent()->getEntryBlock())
return 0;
return AI;
}
// Insert the setjmp map initialization before the first instruction in
// the function.
- Instruction* Inst = Func->getEntryNode().begin();
+ Instruction* Inst = Func->getEntryBlock().begin();
assert(Inst && "Couldn't find even ONE instruction in entry block!");
// Fill in the alloca and call to initialize the SJ map.
// insert initialization code in first (entry) BB
// this includes initializing r and count
- insertInTopBB(&F.getEntryNode(),numPaths, rVar, threshold);
+ insertInTopBB(&F.getEntryBlock(), numPaths, rVar, threshold);
//now process the graph: get path numbers,
//get increments along different paths,
static inline void InsertCodeToShowFunctionEntry(Function &F, Function *Printf,
Function* HashPtrToSeqNum){
// Get an iterator to point to the insertion location
- BasicBlock &BB = F.getEntryNode();
+ BasicBlock &BB = F.getEntryBlock();
Instruction *InsertPos = BB.begin();
std::ostringstream OutStr;
// Push a pointer set for recording alloca'd pointers at entry.
if (!DisablePtrHashing)
new CallInst(externalFuncs.PushOnEntryFunc, vector<Value*>(), "",
- F.getEntryNode().begin());
+ F.getEntryBlock().begin());
for (Function::iterator BB = F.begin(); BB != F.end(); ++BB) {
if (isa<ReturnInst>(BB->getTerminator()))
// transformations safely.
//
PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
- if (DT[&Func->getEntryNode()] == 0) {
+ if (DT[&Func->getEntryBlock()] == 0) {
WorkList.clear();
return MadeChanges;
}
DT = &getAnalysis<DominatorTree>();
std::set<BasicBlock*> VisitedBlocks;
- bool Changed = TransformRegion(&F.getEntryNode(), VisitedBlocks);
+ bool Changed = TransformRegion(&F.getEntryBlock(), VisitedBlocks);
RegionInfoMap.clear();
RankMap.clear();
std::vector<AllocaInst*> Allocas;
const TargetData &TD = getAnalysis<TargetData>();
- BasicBlock &BB = F.getEntryNode(); // Get the entry node for the function
+ BasicBlock &BB = F.getEntryBlock(); // Get the entry node for the function
bool Changed = false;
std::vector<AllocationInst*> WorkList;
// Scan the entry basic block, adding any alloca's and mallocs to the worklist
- BasicBlock &BB = F.getEntryNode();
+ BasicBlock &BB = F.getEntryBlock();
for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
if (AllocationInst *A = dyn_cast<AllocationInst>(I))
WorkList.push_back(A);
// Ok, so this is the first tail call we have found in this
// function. Insert a new entry block into the function, allowing
// us to branch back to the old entry block.
- OldEntry = &F.getEntryNode();
+ OldEntry = &F.getEntryBlock();
BasicBlock *NewEntry = new BasicBlock("tailrecurse", OldEntry);
NewEntry->getInstList().push_back(new BranchInst(OldEntry));
std::vector<AllocaInst*> Allocas;
const TargetData &TD = getAnalysis<TargetData>();
- BasicBlock &BB = F.getEntryNode(); // Get the entry node for the function
+ BasicBlock &BB = F.getEntryBlock(); // Get the entry node for the function
bool Changed = false;
// specified function.
//
bool DominatorSet::runOnFunction(Function &F) {
- BasicBlock *Root = &F.getEntryNode();
+ BasicBlock *Root = &F.getEntryBlock();
Roots.clear();
Roots.push_back(Root);
assert(pred_begin(Root) == pred_end(Root) &&
verifySymbolTable(F.getSymbolTable());
// Check the entry node
- BasicBlock *Entry = &F.getEntryNode();
+ BasicBlock *Entry = &F.getEntryBlock();
Assert1(pred_begin(Entry) == pred_end(Entry),
"Entry block to function must not have predecessors!", Entry);
}
// Use must be dominated by by definition unless use is unreachable!
Assert2(DS->dominates(BB, Pred) ||
- !DS->dominates(&BB->getParent()->getEntryNode(), Pred),
+ !DS->dominates(&BB->getParent()->getEntryBlock(), Pred),
"Instruction does not dominate all uses!",
&I, PN);
}
} else {
// Use must be dominated by by definition unless use is unreachable!
Assert2(DS->dominates(&I, Use) ||
- !DS->dominates(&BB->getParent()->getEntryNode(),Use->getParent()),
+ !DS->dominates(&BB->getParent()->getEntryBlock(),
+ Use->getParent()),
"Instruction does not dominate all uses!", &I, Use);
}
}