diff options
author | Xinliang David Li <davidxl@google.com> | 2016-06-28 06:58:21 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2016-06-28 06:58:21 +0000 |
commit | 3e176c77ab593e2edf659e7318cb41319cae10ff (patch) | |
tree | 91c850fd5ff9444e40fa13d0f76d85f3fc5f1762 /llvm/lib/Analysis/BlockFrequencyInfo.cpp | |
parent | a727f3cfde91553113ee33f7fea6f8c4299d2919 (diff) | |
download | bcm5719-llvm-3e176c77ab593e2edf659e7318cb41319cae10ff.tar.gz bcm5719-llvm-3e176c77ab593e2edf659e7318cb41319cae10ff.zip |
[BFI/MBFI]: cfg graph view with color scheme
This patch enhances dot graph viewer to show hot regions
with hot bbs/edges displayed in red. The ratio of the bb
freq to the max freq of the function needs to be no less
than the value specified by view-hot-freq-percent option.
The default value is 10 (i.e. 10%).
llvm-svn: 273996
Diffstat (limited to 'llvm/lib/Analysis/BlockFrequencyInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/BlockFrequencyInfo.cpp | 23 |
1 files changed, 21 insertions, 2 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); } }; |