LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
interference-graph.hh
Go to the documentation of this file.
1 
6 #ifndef LIVENESS_INTERFERENCE_GRAPH_HH
7 # define LIVENESS_INTERFERENCE_GRAPH_HH
8 
9 # include <list>
10 # include <map>
11 
12 # include <misc/graph.hh>
13 # include <temp/fwd.hh>
14 # include <assem/libassem.hh>
15 # include <misc/set.hh>
16 # include <liveness/liveness.hh>
17 # include <target/libtarget.hh>
18 
19 namespace liveness
20 {
21 
22  /*--------------------.
23  | InterferenceGraph. |
24  `--------------------*/
25 
31  : public misc::undirected_graph<temp::Temp>
32  {
35  public:
42  InterferenceGraph(const std::string& name,
43  const assem::Instrs& instrs,
44  const temp::TempMap& tempmap,
45  bool trace = false);
46 
47  virtual ~InterferenceGraph();
53  private:
55  typedef std::map<const temp::Temp, vertex_descriptor> temp2vertex;
60  public:
62  bool has(const temp::Temp& t) const;
70  protected:
71  /* \brief Build the InterferenceGraph from \a liveness.
72 
73  \a Liveness remembers what is live at the exit of each
74  flow-graph node. Keep track of the moves. Kept out of the
75  ctor only to make it easier to read. */
76  void compute_liveness(const liveness::Liveness& liveness);
84  public:
89  typedef std::pair<vertex_descriptor, vertex_descriptor> move_type;
90 
93 
95  const move_set_type& moves_get() const;
98 
99  public:
101  const misc::timer& timer_get() const;
102 
103  protected:
105  virtual std::ostream& epilogue_print(std::ostream& ostr) const;
107  virtual std::ostream&
108  vertex_print(vertex_descriptor v, std::ostream& ostr) const override;
109 
116  protected:
118  bool trace_;
123  private:
128  }; // class InterferenceGraph
129 
130 
131  /*------------.
132  | Iterators. |
133  `------------*/
134 
136  typedef boost::graph_traits<InterferenceGraph>::vertex_iterator
139  typedef boost::graph_traits<InterferenceGraph>::edge_iterator
141 
143  typedef boost::graph_traits<InterferenceGraph>::adjacency_iterator
145 
146 } // namespace liveness
147 
149 
150 #endif // !LIVENESS_INTERFERENCE_GRAPH_HH