diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/BlockFrequencyInfo.cpp | 23 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp | 10 |
2 files changed, 30 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/BlockFrequencyInfo.cpp b/llvm/lib/Analysis/BlockFrequencyInfo.cpp index f470d3c6a8b..de1c8553c93 100644 --- a/llvm/lib/Analysis/BlockFrequencyInfo.cpp +++ b/llvm/lib/Analysis/BlockFrequencyInfo.cpp @@ -42,7 +42,19 @@ static cl::opt<GVDAGType> ViewBlockFreqPropagationDAG( "profile count if available."), clEnumValEnd)); -cl::opt<std::string> ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden); +cl::opt<std::string> + ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden, + cl::desc("The option to specify " + "the name of the function " + "whose CFG will be displayed.")); + +cl::opt<unsigned> + ViewHotFreqPercent("view-hot-freq-percent", cl::init(10), cl::Hidden, + cl::desc("An integer in percent used to specify " + "the hot blocks/edges to be displayed " + "in red: a block or edge whose frequency " + "is no less than the max frequency of the " + "function multiplied by this percent.")); namespace llvm { @@ -84,9 +96,16 @@ struct DOTGraphTraits<BlockFrequencyInfo *> : public BFIDOTGTraitsBase { ViewBlockFreqPropagationDAG); } + std::string getNodeAttributes(const BasicBlock *Node, + const BlockFrequencyInfo *Graph) { + return BFIDOTGTraitsBase::getNodeAttributes(Node, Graph, + ViewHotFreqPercent); + } + std::string getEdgeAttributes(const BasicBlock *Node, EdgeIter EI, const BlockFrequencyInfo *BFI) { - return BFIDOTGTraitsBase::getEdgeAttributes(Node, EI, BFI->getBPI()); + return BFIDOTGTraitsBase::getEdgeAttributes(Node, EI, BFI, BFI->getBPI(), + ViewHotFreqPercent); } }; diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp index 7e05ebe2848..4353ec4546a 100644 --- a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp +++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp @@ -47,6 +47,7 @@ static cl::opt<GVDAGType> ViewMachineBlockFreqPropagationDAG( clEnumValEnd)); extern cl::opt<std::string> ViewBlockFreqFuncName; +extern cl::opt<uint64_t> ViewHotFreqPercent; namespace llvm { @@ -92,9 +93,16 @@ struct DOTGraphTraits<MachineBlockFrequencyInfo *> Node, Graph, ViewMachineBlockFreqPropagationDAG); } + std::string getNodeAttributes(const MachineBasicBlock *Node, + const MachineBlockFrequencyInfo *Graph) { + return MBFIDOTGraphTraitsBase::getNodeAttributes(Node, Graph, + ViewHotFreqPercent); + } + std::string getEdgeAttributes(const MachineBasicBlock *Node, EdgeIter EI, const MachineBlockFrequencyInfo *MBFI) { - return MBFIDOTGraphTraitsBase::getEdgeAttributes(Node, EI, MBFI->getMBPI()); + return MBFIDOTGraphTraitsBase::getEdgeAttributes( + Node, EI, MBFI, MBFI->getMBPI(), ViewHotFreqPercent); } }; |

