From 3e176c77ab593e2edf659e7318cb41319cae10ff Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Tue, 28 Jun 2016 06:58:21 +0000 Subject: [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 --- llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp') 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 ViewMachineBlockFreqPropagationDAG( clEnumValEnd)); extern cl::opt ViewBlockFreqFuncName; +extern cl::opt ViewHotFreqPercent; namespace llvm { @@ -92,9 +93,16 @@ struct DOTGraphTraits 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); } }; -- cgit v1.2.3