Andreas Neustifter | 6ef116d | 2009-08-28 11:28:24 +0000 | [diff] [blame^] | 1 | //===- llvm/Analysis/MaximumSpanningTree.h - Interface ----------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This module privides means for calculating a maximum spanning tree for the |
| 11 | // CFG of a function according to a given profile. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_ANALYSIS_MAXIMUMSPANNINGTREE_H |
| 16 | #define LLVM_ANALYSIS_MAXIMUMSPANNINGTREE_H |
| 17 | |
| 18 | #include "llvm/Analysis/ProfileInfo.h" |
| 19 | #include "llvm/Support/raw_ostream.h" |
| 20 | #include <vector> |
| 21 | |
| 22 | namespace llvm { |
| 23 | class Function; |
| 24 | |
| 25 | class MaximumSpanningTree { |
| 26 | public: |
| 27 | typedef std::vector<ProfileInfo::Edge> MaxSpanTree; |
| 28 | |
| 29 | protected: |
| 30 | MaxSpanTree MST; |
| 31 | |
| 32 | public: |
| 33 | static char ID; // Class identification, replacement for typeinfo |
| 34 | |
| 35 | // MaxSpanTree() - Calculates a MST for a function according to a profile. |
| 36 | // If inverted is true, all the edges *not* in the MST are returned. As a |
| 37 | // special also all leaf edges of the MST are not included, this makes it |
| 38 | // easier for the OptimalEdgeProfileInstrumentation to use this MST to do |
| 39 | // an optimal profiling. |
| 40 | MaximumSpanningTree(Function *F, ProfileInfo *PI, bool invert); |
| 41 | |
| 42 | virtual MaxSpanTree::iterator begin(); |
| 43 | virtual MaxSpanTree::iterator end(); |
| 44 | |
| 45 | virtual void dump(); |
| 46 | }; |
| 47 | |
| 48 | } // End llvm namespace |
| 49 | |
| 50 | #endif |