blob: 2343985f23d43d7d8539d804c8645acfaf3aae79 [file] [log] [blame]
Andreas Neustifter6ef116d2009-08-28 11:28:24 +00001//===- 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
22namespace 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.
Andreas Neustifter39859432009-09-03 08:52:52 +000040 MaximumSpanningTree(std::vector<ProfileInfo::EdgeWeight>&);
Benjamin Kramerac6f73a2009-08-29 13:38:21 +000041 virtual ~MaximumSpanningTree() {}
Andreas Neustifter6ef116d2009-08-28 11:28:24 +000042
43 virtual MaxSpanTree::iterator begin();
44 virtual MaxSpanTree::iterator end();
45
46 virtual void dump();
47 };
48
49} // End llvm namespace
50
51#endif