diff options
author | Chris Lattner <sabre@nondot.org> | 2004-01-09 06:17:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-01-09 06:17:12 +0000 |
commit | b9c79998812dc0f9609951d4feb0ce764e538bb0 (patch) | |
tree | 8b4625654199cfeb90af013cd90a9161c5090eee /llvm/lib/Target/Sparc/RegAlloc/InterferenceGraph.h | |
parent | df3c342a4c254870b63709c7268a575a75e2bafc (diff) | |
download | bcm5719-llvm-b9c79998812dc0f9609951d4feb0ce764e538bb0.tar.gz bcm5719-llvm-b9c79998812dc0f9609951d4feb0ce764e538bb0.zip |
Move lib/Codegen/RegAlloc into lib/Target/Sparc, as it is sparc specific
llvm-svn: 10728
Diffstat (limited to 'llvm/lib/Target/Sparc/RegAlloc/InterferenceGraph.h')
-rw-r--r-- | llvm/lib/Target/Sparc/RegAlloc/InterferenceGraph.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/llvm/lib/Target/Sparc/RegAlloc/InterferenceGraph.h b/llvm/lib/Target/Sparc/RegAlloc/InterferenceGraph.h new file mode 100644 index 00000000000..79850c1fcf0 --- /dev/null +++ b/llvm/lib/Target/Sparc/RegAlloc/InterferenceGraph.h @@ -0,0 +1,75 @@ +//===-- InterferenceGraph.h - Interference graph for register coloring -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +/* Title: InterferenceGraph.h -*- C++ -*- + Author: Ruchira Sasanka + Date: July 20, 01 + Purpose: Interference Graph used for register coloring. + + Notes: + Adj Info is stored in the lower trangular matrix (i.e., row > col ) + + This class must be used in the following way: + + * Construct class + * call addLRToIG as many times to add ALL LRs to this IG + * call createGraph to create the actual matrix + * Then setInterference, getInterference, mergeIGNodesOfLRs can be + called as desired to modify the graph. + * Once the modifications to the graph are over, call + setCurDegreeOfIGNodes() before pushing IGNodes on to stack for coloring. +*/ + +#ifndef INTERFERENCEGRAPH_H +#define INTERFERENCEGRAPH_H + +#include <vector> + +namespace llvm { + +class LiveRange; +class RegClass; +class IGNode; + +class InterferenceGraph { + char **IG; // a poiner to the interference graph + unsigned int Size; // size of a side of the IG + RegClass *const RegCl; // RegCl contains this IG + std::vector<IGNode *> IGNodeList; // a list of all IGNodes in a reg class + + public: + // the matrix is not yet created by the constructor. Call createGraph() + // to create it after adding all IGNodes to the IGNodeList + InterferenceGraph(RegClass *RC); + ~InterferenceGraph(); + + void createGraph(); + + void addLRToIG(LiveRange *LR); + + void setInterference(const LiveRange *LR1, + const LiveRange *LR2); + + unsigned getInterference(const LiveRange *LR1, + const LiveRange *LR2) const ; + + void mergeIGNodesOfLRs(const LiveRange *LR1, LiveRange *LR2); + + std::vector<IGNode *> &getIGNodeList() { return IGNodeList; } + const std::vector<IGNode *> &getIGNodeList() const { return IGNodeList; } + + void setCurDegreeOfIGNodes(); + + void printIG() const; + void printIGNodeList() const; +}; + +} // End llvm namespace + +#endif |