llvm.org GIT mirror llvm / 3916f6c
Fixed various whitespace/spelling/80+ issues. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196310 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Gottesman 5 years ago
1 changed file(s) with 16 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
None //====----- MachineBlockFrequencyInfo.cpp - Machine Block Frequency Analysis ----====//
0 //====------ MachineBlockFrequencyInfo.cpp - MBB Frequency Analysis ------====//
11 //
22 // The LLVM Compiler Infrastructure
33 //
3232 ViewMachineBlockFreqPropagationDAG("view-machine-block-freq-propagation-dags",
3333 cl::Hidden,
3434 cl::desc("Pop up a window to show a dag displaying how machine block "
35 "frequencies propgate through the CFG."),
35 "frequencies propagate through the CFG."),
3636 cl::values(
3737 clEnumValN(GVDT_None, "none",
3838 "do not display graphs."),
5050 typedef MachineBasicBlock::const_succ_iterator ChildIteratorType;
5151 typedef MachineFunction::const_iterator nodes_iterator;
5252
53 static inline const NodeType *getEntryNode(const MachineBlockFrequencyInfo *G) {
53 static inline
54 const NodeType *getEntryNode(const MachineBlockFrequencyInfo *G) {
5455 return G->getFunction()->begin();
5556 }
57
5658 static ChildIteratorType child_begin(const NodeType *N) {
5759 return N->succ_begin();
5860 }
61
5962 static ChildIteratorType child_end(const NodeType *N) {
6063 return N->succ_end();
6164 }
65
6266 static nodes_iterator nodes_begin(const MachineBlockFrequencyInfo *G) {
6367 return G->getFunction()->begin();
6468 }
69
6570 static nodes_iterator nodes_end(const MachineBlockFrequencyInfo *G) {
6671 return G->getFunction()->end();
6772 }
6873 };
6974
7075 template<>
71 struct DOTGraphTraits : public DefaultDOTGraphTraits {
76 struct DOTGraphTraits :
77 public DefaultDOTGraphTraits {
7278 explicit DOTGraphTraits(bool isSimple=false) :
7379 DefaultDOTGraphTraits(isSimple) {}
7480
111117 char MachineBlockFrequencyInfo::ID = 0;
112118
113119
114 MachineBlockFrequencyInfo::MachineBlockFrequencyInfo() : MachineFunctionPass(ID) {
120 MachineBlockFrequencyInfo::
121 MachineBlockFrequencyInfo() :MachineFunctionPass(ID) {
115122 initializeMachineBlockFrequencyInfoPass(*PassRegistry::getPassRegistry());
116123 MBFI = new BlockFrequencyImpl
117124 MachineBranchProbabilityInfo>();
128135 }
129136
130137 bool MachineBlockFrequencyInfo::runOnMachineFunction(MachineFunction &F) {
131 MachineBranchProbabilityInfo &MBPI = getAnalysis();
138 MachineBranchProbabilityInfo &MBPI =
139 getAnalysis();
132140 MBFI->doFunction(&F, &MBPI);
133141 #ifndef NDEBUG
134142 if (ViewMachineBlockFreqPropagationDAG != GVDT_None) {
146154 ViewGraph(const_cast(this),
147155 "MachineBlockFrequencyDAGs");
148156 #else
149 errs() << "BlockFrequencyInfo::view is only available in debug builds on "
150 "systems with Graphviz or gv!\n";
157 errs() << "MachineBlockFrequencyInfo::view is only available in debug builds "
158 "on systems with Graphviz or gv!\n";
151159 #endif // NDEBUG
152160 }
153161
159167 MachineFunction *MachineBlockFrequencyInfo::getFunction() const {
160168 return MBFI->Fn;
161169 }
162