typedef Function::const_iterator nodes_iterator;
static inline const NodeType *getEntryNode(const BlockFrequencyInfo *G) {
- return G->getFunction()->begin();
+ return &G->getFunction()->front();
}
static ChildIteratorType child_begin(const NodeType *N) {
return succ_begin(N);
} // end namespace llvm
#endif
+BlockFrequencyInfo::BlockFrequencyInfo() {}
+
+BlockFrequencyInfo::BlockFrequencyInfo(const Function &F,
+ const BranchProbabilityInfo &BPI,
+ const LoopInfo &LI) {
+ calculate(F, BPI, LI);
+}
+
void BlockFrequencyInfo::calculate(const Function &F,
const BranchProbabilityInfo &BPI,
const LoopInfo &LI) {
return BFI ? BFI->getBlockFreq(BB) : 0;
}
+void BlockFrequencyInfo::setBlockFreq(const BasicBlock *BB,
+ uint64_t Freq) {
+ assert(BFI && "Expected analysis to be available");
+ BFI->setBlockFreq(BB, Freq);
+}
+
/// Pop up a ghostview window with the current block frequency propagation
/// rendered using dot.
void BlockFrequencyInfo::view() const {