PowerPCInstrInfo has gone away, PPC32 and PPC64 share opcodes.
[oota-llvm.git] / lib / Target / SparcV9 / RegAlloc / InterferenceGraph.h
1 //===-- InterferenceGraph.h - Interference graph for register coloring -*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9
10 /* Title:   InterferenceGraph.h   -*- C++ -*-
11    Author:  Ruchira Sasanka
12    Date:    July 20, 01
13    Purpose: Interference Graph used for register coloring.
14
15    Notes: 
16    Adj Info is  stored in the lower trangular matrix (i.e., row > col ) 
17
18    This class must be used in the following way:
19
20    * Construct class
21    * call addLRToIG as many times to add ALL LRs to this IG
22    * call createGraph to create the actual matrix
23    * Then setInterference, getInterference, mergeIGNodesOfLRs can be 
24      called as desired to modify the graph.
25    * Once the modifications to the graph are over, call 
26      setCurDegreeOfIGNodes() before pushing IGNodes on to stack for coloring.
27 */
28
29 #ifndef INTERFERENCEGRAPH_H
30 #define INTERFERENCEGRAPH_H
31
32 #include <vector>
33
34 namespace llvm {
35
36 class LiveRange;
37 class RegClass;
38 class IGNode;
39
40 class InterferenceGraph {
41   char **IG;                            // a poiner to the interference graph
42   unsigned int Size;                    // size of a side of the IG
43   RegClass *const RegCl;                // RegCl contains this IG
44   std::vector<IGNode *> IGNodeList;     // a list of all IGNodes in a reg class
45                             
46  public:
47   // the matrix is not yet created by the constructor. Call createGraph() 
48   // to create it after adding all IGNodes to the IGNodeList
49   InterferenceGraph(RegClass *RC);
50   ~InterferenceGraph();
51
52   void createGraph();
53
54   void addLRToIG(LiveRange *LR);
55
56   void setInterference(const LiveRange *LR1,
57                        const LiveRange *LR2);
58
59   unsigned getInterference(const LiveRange *LR1,
60                            const LiveRange *LR2) const ;
61
62   void mergeIGNodesOfLRs(const LiveRange *LR1, LiveRange *LR2);
63
64   std::vector<IGNode *> &getIGNodeList() { return IGNodeList; } 
65   const std::vector<IGNode *> &getIGNodeList() const { return IGNodeList; } 
66
67   void setCurDegreeOfIGNodes();
68
69   void printIG() const;
70   void printIGNodeList() const;
71 };
72
73 } // End llvm namespace
74
75 #endif