1 /* Title: InterferenceGraph.h -*- C++ -*-
2 Author: Ruchira Sasanka
4 Purpose: Interference Graph used for register coloring.
7 Adj Info is stored in the lower trangular matrix (i.e., row > col )
9 This class must be used in the following way:
12 * call addLRToIG as many times to add ALL LRs to this IG
13 * call createGraph to create the actual matrix
14 * Then setInterference, getInterference, mergeIGNodesOfLRs can be
15 called as desired to modify the graph.
16 * Once the modifications to the graph are over, call
17 setCurDegreeOfIGNodes() before pushing IGNodes on to stack for coloring.
21 #ifndef INTERFERENCE_GRAPH_H
22 #define INTERFERENCE_GRAPH_H
29 class InterferenceGraph {
30 char **IG; // a poiner to the interference graph
31 unsigned int Size; // size of a side of the IG
32 RegClass *const RegCl; // RegCl contains this IG
33 std::vector<IGNode *> IGNodeList; // a list of all IGNodes in a reg class
36 // the matrix is not yet created by the constructor. Call createGraph()
37 // to create it after adding all IGNodes to the IGNodeList
38 InterferenceGraph(RegClass *RC);
43 void addLRToIG(LiveRange *LR);
45 void setInterference(const LiveRange *LR1,
46 const LiveRange *LR2);
48 unsigned getInterference(const LiveRange *LR1,
49 const LiveRange *LR2) const ;
51 void mergeIGNodesOfLRs(const LiveRange *LR1, LiveRange *LR2);
53 std::vector<IGNode *> &getIGNodeList() { return IGNodeList; }
54 const std::vector<IGNode *> &getIGNodeList() const { return IGNodeList; }
56 void setCurDegreeOfIGNodes();
59 void printIGNodeList() const;