diff options
Diffstat (limited to 'contrib/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp')
-rw-r--r-- | contrib/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/contrib/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/contrib/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp index 6c0f99f..7d5124d 100644 --- a/contrib/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp +++ b/contrib/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp @@ -42,9 +42,7 @@ static cl::opt<GVDAGType> ViewMachineBlockFreqPropagationDAG( "display a graph using the raw " "integer fractional block frequency representation."), clEnumValN(GVDT_Count, "count", "display a graph using the real " - "profile count if available."), - - clEnumValEnd)); + "profile count if available."))); extern cl::opt<std::string> ViewBlockFreqFuncName; extern cl::opt<unsigned> ViewHotFreqPercent; @@ -52,29 +50,26 @@ extern cl::opt<unsigned> ViewHotFreqPercent; namespace llvm { template <> struct GraphTraits<MachineBlockFrequencyInfo *> { - typedef const MachineBasicBlock NodeType; + typedef const MachineBasicBlock *NodeRef; typedef MachineBasicBlock::const_succ_iterator ChildIteratorType; - typedef MachineFunction::const_iterator nodes_iterator; + typedef pointer_iterator<MachineFunction::const_iterator> nodes_iterator; - static inline const NodeType * - getEntryNode(const MachineBlockFrequencyInfo *G) { + static NodeRef getEntryNode(const MachineBlockFrequencyInfo *G) { return &G->getFunction()->front(); } - static ChildIteratorType child_begin(const NodeType *N) { + static ChildIteratorType child_begin(const NodeRef N) { return N->succ_begin(); } - static ChildIteratorType child_end(const NodeType *N) { - return N->succ_end(); - } + static ChildIteratorType child_end(const NodeRef N) { return N->succ_end(); } static nodes_iterator nodes_begin(const MachineBlockFrequencyInfo *G) { - return G->getFunction()->begin(); + return nodes_iterator(G->getFunction()->begin()); } static nodes_iterator nodes_end(const MachineBlockFrequencyInfo *G) { - return G->getFunction()->end(); + return nodes_iterator(G->getFunction()->end()); } }; @@ -175,6 +170,12 @@ Optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount( return MBFI ? MBFI->getBlockProfileCount(*F, MBB) : None; } +Optional<uint64_t> +MachineBlockFrequencyInfo::getProfileCountFromFreq(uint64_t Freq) const { + const Function *F = MBFI->getFunction()->getFunction(); + return MBFI ? MBFI->getProfileCountFromFreq(*F, Freq) : None; +} + const MachineFunction *MachineBlockFrequencyInfo::getFunction() const { return MBFI ? MBFI->getFunction() : nullptr; } |