mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
Move private headers into private regalloc directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5308 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4309e736c1
commit
a9dcd3cceb
@ -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 <vector>
|
||||
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;
|
||||
};
|
||||
|
||||
#endif
|
@ -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 <stack>
|
||||
class TargetRegClassInfo;
|
||||
|
||||
typedef std::vector<unsigned> 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<IGNode *> 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<bool> 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<bool> &getIsColorUsedArr() { return IsColorUsedArr; }
|
||||
|
||||
|
||||
void printIGNodeList() const;
|
||||
void printIG();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user