From a9dcd3cceb644934b5182990be5044745734e885 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 15 Jan 2003 20:26:32 +0000 Subject: [PATCH] Move private headers into private regalloc directory git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5308 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/InterferenceGraph.h | 62 ------------ include/llvm/CodeGen/RegClass.h | 115 ----------------------- 2 files changed, 177 deletions(-) delete mode 100644 include/llvm/CodeGen/InterferenceGraph.h delete mode 100644 include/llvm/CodeGen/RegClass.h diff --git a/include/llvm/CodeGen/InterferenceGraph.h b/include/llvm/CodeGen/InterferenceGraph.h deleted file mode 100644 index e9cb6107877..00000000000 --- a/include/llvm/CodeGen/InterferenceGraph.h +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 INTERFERENCE_GRAPH_H -#define INTERFERENCE_GRAPH_H - -#include -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 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 &getIGNodeList() { return IGNodeList; } - const std::vector &getIGNodeList() const { return IGNodeList; } - - void setCurDegreeOfIGNodes(); - - void printIG() const; - void printIGNodeList() const; -}; - -#endif diff --git a/include/llvm/CodeGen/RegClass.h b/include/llvm/CodeGen/RegClass.h deleted file mode 100644 index 7e2103c10e0..00000000000 --- a/include/llvm/CodeGen/RegClass.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Title: RegClass.h -*- C++ -*- - Author: Ruchira Sasanka - Date: Aug 20, 01 - Purpose: Contains machine independent methods for register coloring. - -*/ - -#ifndef REG_CLASS_H -#define REG_CLASS_H - -#include "llvm/CodeGen/InterferenceGraph.h" -#include "llvm/Target/TargetRegInfo.h" -#include -class TargetRegClassInfo; - -typedef std::vector ReservedColorListType; - - -//----------------------------------------------------------------------------- -// Class RegClass -// -// Implements a machine independant register class. -// -// This is the class that contains all data structures and common algos -// for coloring a particular register class (e.g., int class, fp class). -// This class is hardware independent. This class accepts a hardware -// dependent description of machine registers (TargetRegInfo class) to -// get hardware specific info and to color an individual IG node. -// -// This class contains the InterferenceGraph (IG). -// Also it contains an IGNode stack that can be used for coloring. -// The class provides some easy access methods to the IG methods, since these -// methods are called thru a register class. -// -//----------------------------------------------------------------------------- -class RegClass { - const Function *const Meth; // Function we are working on - const TargetRegClassInfo *const MRC; // corresponding MRC - const unsigned RegClassID; // my int ID - - InterferenceGraph IG; // Interference graph - constructed by - // buildInterferenceGraph - std::stack IGNodeStack; // the stack used for coloring - - // ReservedColorList - for passing registers that are pre-allocated and cannot - // be used by the register allocator for this function. - // - const ReservedColorListType *const ReservedColorList; - - // IsColorUsedArr - An array used for coloring each node. This array must be - // of size MRC->getNumOfAllRegs(). Allocated once in the constructor for - // efficiency. - // - std::vector IsColorUsedArr; - - - - //--------------------------- private methods ------------------------------ - - void pushAllIGNodes(); - - bool pushUnconstrainedIGNodes(); - - IGNode * getIGNodeWithMinSpillCost(); - - void colorIGNode(IGNode *const Node); - - - public: - - RegClass(const Function *M, - const TargetRegClassInfo *MRC, - const ReservedColorListType *RCL = 0); - - inline void createInterferenceGraph() { IG.createGraph(); } - - inline InterferenceGraph &getIG() { return IG; } - - inline const unsigned getID() const { return RegClassID; } - - // main method called for coloring regs - // - void colorAllRegs(); - - inline unsigned getNumOfAvailRegs() const - { return MRC->getNumOfAvailRegs(); } - - - // --- following methods are provided to access the IG contained within this - // ---- RegClass easilly. - - inline void addLRToIG(LiveRange *const LR) - { IG.addLRToIG(LR); } - - inline void setInterference(const LiveRange *const LR1, - const LiveRange *const LR2) - { IG.setInterference(LR1, LR2); } - - inline unsigned getInterference(const LiveRange *const LR1, - const LiveRange *const LR2) const - { return IG.getInterference(LR1, LR2); } - - inline void mergeIGNodesOfLRs(const LiveRange *const LR1, - LiveRange *const LR2) - { IG.mergeIGNodesOfLRs(LR1, LR2); } - - - inline std::vector &getIsColorUsedArr() { return IsColorUsedArr; } - - - void printIGNodeList() const; - void printIG(); -}; - -#endif