Code Cleanup.
[oota-llvm.git] / lib / Transforms / Instrumentation / MaximumSpanningTree.h
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(std::vector<ProfileInfo::EdgeWeight>&);
41     virtual ~MaximumSpanningTree() {}
42
43     virtual MaxSpanTree::iterator begin();
44     virtual MaxSpanTree::iterator end();
45
46     virtual void dump();
47   };
48
49 } // End llvm namespace
50
51 #endif