2004-08-16 03:09:52 +02:00
|
|
|
//===- CodeGenRegisters.h - Register and RegisterClass Info -----*- C++ -*-===//
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2004-08-16 03:09:52 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:37:13 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2004-08-16 03:09:52 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines structures to encapsulate information gleaned from the
|
|
|
|
// target register and register class definitions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef CODEGEN_REGISTERS_H
|
|
|
|
#define CODEGEN_REGISTERS_H
|
|
|
|
|
2011-06-15 07:09:20 +02:00
|
|
|
#include "SetTheory.h"
|
2011-10-01 18:41:13 +02:00
|
|
|
#include "llvm/TableGen/Record.h"
|
2008-02-20 12:08:44 +01:00
|
|
|
#include "llvm/CodeGen/ValueTypes.h"
|
2011-06-15 06:50:36 +02:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
2011-09-30 02:10:40 +02:00
|
|
|
#include "llvm/ADT/BitVector.h"
|
2010-05-24 23:46:58 +02:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2011-06-12 05:05:52 +02:00
|
|
|
#include "llvm/ADT/SetVector.h"
|
2012-02-05 08:21:30 +01:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2011-06-11 02:28:06 +02:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <map>
|
2004-08-16 03:09:52 +02:00
|
|
|
#include <string>
|
2010-08-25 02:41:18 +02:00
|
|
|
#include <set>
|
2011-06-11 02:28:06 +02:00
|
|
|
#include <vector>
|
2004-08-16 03:09:52 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
2011-06-11 02:28:06 +02:00
|
|
|
class CodeGenRegBank;
|
2004-08-16 03:09:52 +02:00
|
|
|
|
2012-01-31 21:57:55 +01:00
|
|
|
/// CodeGenSubRegIndex - Represents a sub-register index.
|
|
|
|
class CodeGenSubRegIndex {
|
|
|
|
Record *const TheDef;
|
|
|
|
const unsigned EnumValue;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CodeGenSubRegIndex(Record *R, unsigned Enum);
|
|
|
|
|
|
|
|
const std::string &getName() const;
|
|
|
|
std::string getNamespace() const;
|
|
|
|
std::string getQualifiedName() const;
|
|
|
|
|
|
|
|
// Order CodeGenSubRegIndex pointers by EnumValue.
|
|
|
|
struct Less {
|
|
|
|
bool operator()(const CodeGenSubRegIndex *A,
|
|
|
|
const CodeGenSubRegIndex *B) const {
|
|
|
|
assert(A && B);
|
|
|
|
return A->EnumValue < B->EnumValue;
|
|
|
|
}
|
|
|
|
};
|
2012-01-31 22:44:11 +01:00
|
|
|
|
|
|
|
// Map of composite subreg indices.
|
|
|
|
typedef std::map<CodeGenSubRegIndex*, CodeGenSubRegIndex*, Less> CompMap;
|
|
|
|
|
|
|
|
// Returns the subreg index that results from composing this with Idx.
|
|
|
|
// Returns NULL if this and Idx don't compose.
|
|
|
|
CodeGenSubRegIndex *compose(CodeGenSubRegIndex *Idx) const {
|
|
|
|
CompMap::const_iterator I = Composed.find(Idx);
|
|
|
|
return I == Composed.end() ? 0 : I->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add a composite subreg index: this+A = B.
|
|
|
|
// Return a conflicting composite, or NULL
|
|
|
|
CodeGenSubRegIndex *addComposite(CodeGenSubRegIndex *A,
|
|
|
|
CodeGenSubRegIndex *B) {
|
|
|
|
std::pair<CompMap::iterator, bool> Ins =
|
|
|
|
Composed.insert(std::make_pair(A, B));
|
|
|
|
return (Ins.second || Ins.first->second == B) ? 0 : Ins.first->second;
|
|
|
|
}
|
|
|
|
|
2012-02-02 00:16:41 +01:00
|
|
|
// Update the composite maps of components specified in 'ComposedOf'.
|
|
|
|
void updateComponents(CodeGenRegBank&);
|
|
|
|
|
2012-01-31 22:44:11 +01:00
|
|
|
// Clean out redundant composite mappings.
|
|
|
|
void cleanComposites();
|
|
|
|
|
|
|
|
// Return the map of composites.
|
|
|
|
const CompMap &getComposites() const { return Composed; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
CompMap Composed;
|
2012-01-31 21:57:55 +01:00
|
|
|
};
|
|
|
|
|
2004-08-16 03:09:52 +02:00
|
|
|
/// CodeGenRegister - Represents a register definition.
|
|
|
|
struct CodeGenRegister {
|
|
|
|
Record *TheDef;
|
2011-03-11 02:33:54 +01:00
|
|
|
unsigned EnumValue;
|
2011-04-20 20:19:48 +02:00
|
|
|
unsigned CostPerUse;
|
2012-01-18 01:16:39 +01:00
|
|
|
bool CoveredBySubRegs;
|
2011-06-11 02:28:06 +02:00
|
|
|
|
|
|
|
// Map SubRegIndex -> Register.
|
2012-01-31 21:57:55 +01:00
|
|
|
typedef std::map<CodeGenSubRegIndex*, CodeGenRegister*,
|
|
|
|
CodeGenSubRegIndex::Less> SubRegMap;
|
2011-06-11 02:28:06 +02:00
|
|
|
|
|
|
|
CodeGenRegister(Record *R, unsigned Enum);
|
|
|
|
|
|
|
|
const std::string &getName() const;
|
|
|
|
|
|
|
|
// Get a map of sub-registers computed lazily.
|
|
|
|
// This includes unique entries for all sub-sub-registers.
|
|
|
|
const SubRegMap &getSubRegs(CodeGenRegBank&);
|
|
|
|
|
|
|
|
const SubRegMap &getSubRegs() const {
|
|
|
|
assert(SubRegsComplete && "Must precompute sub-registers");
|
|
|
|
return SubRegs;
|
|
|
|
}
|
|
|
|
|
2011-06-12 05:05:52 +02:00
|
|
|
// Add sub-registers to OSet following a pre-order defined by the .td file.
|
2012-01-31 21:57:55 +01:00
|
|
|
void addSubRegsPreOrder(SetVector<CodeGenRegister*> &OSet,
|
|
|
|
CodeGenRegBank&) const;
|
2011-06-12 05:05:52 +02:00
|
|
|
|
|
|
|
// List of super-registers in topological order, small to large.
|
|
|
|
typedef std::vector<CodeGenRegister*> SuperRegList;
|
|
|
|
|
|
|
|
// Get the list of super-registers.
|
|
|
|
// This is only valid after computeDerivedInfo has visited all registers.
|
|
|
|
const SuperRegList &getSuperRegs() const {
|
|
|
|
assert(SubRegsComplete && "Must precompute sub-registers");
|
|
|
|
return SuperRegs;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Order CodeGenRegister pointers by EnumValue.
|
|
|
|
struct Less {
|
2011-06-15 06:50:36 +02:00
|
|
|
bool operator()(const CodeGenRegister *A,
|
|
|
|
const CodeGenRegister *B) const {
|
2011-10-04 17:28:49 +02:00
|
|
|
assert(A && B);
|
2011-06-12 05:05:52 +02:00
|
|
|
return A->EnumValue < B->EnumValue;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Canonically ordered set.
|
2011-06-15 06:50:36 +02:00
|
|
|
typedef std::set<const CodeGenRegister*, Less> Set;
|
2011-06-12 05:05:52 +02:00
|
|
|
|
2011-06-11 02:28:06 +02:00
|
|
|
private:
|
|
|
|
bool SubRegsComplete;
|
|
|
|
SubRegMap SubRegs;
|
2011-06-12 05:05:52 +02:00
|
|
|
SuperRegList SuperRegs;
|
2004-08-16 03:09:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-06-15 06:50:36 +02:00
|
|
|
class CodeGenRegisterClass {
|
|
|
|
CodeGenRegister::Set Members;
|
2011-10-04 17:28:44 +02:00
|
|
|
// Allocation orders. Order[0] always contains all registers in Members.
|
|
|
|
std::vector<SmallVector<Record*, 16> > Orders;
|
2011-09-30 02:10:40 +02:00
|
|
|
// Bit mask of sub-classes including this, indexed by their EnumValue.
|
|
|
|
BitVector SubClasses;
|
2011-10-01 00:18:45 +02:00
|
|
|
// List of super-classes, topologocally ordered to have the larger classes
|
|
|
|
// first. This is the same as sorting by EnumValue.
|
|
|
|
SmallVector<CodeGenRegisterClass*, 4> SuperClasses;
|
2004-08-21 06:05:00 +02:00
|
|
|
Record *TheDef;
|
2011-10-04 17:28:08 +02:00
|
|
|
std::string Name;
|
2011-10-04 17:28:49 +02:00
|
|
|
|
|
|
|
// For a synthesized class, inherit missing properties from the nearest
|
|
|
|
// super-class.
|
|
|
|
void inheritProperties(CodeGenRegBank&);
|
|
|
|
|
2011-12-19 17:53:34 +01:00
|
|
|
// Map SubRegIndex -> sub-class. This is the largest sub-class where all
|
|
|
|
// registers have a SubRegIndex sub-register.
|
2012-01-31 21:57:55 +01:00
|
|
|
DenseMap<CodeGenSubRegIndex*, CodeGenRegisterClass*> SubClassWithSubReg;
|
2011-10-05 02:35:49 +02:00
|
|
|
|
2011-12-19 17:53:34 +01:00
|
|
|
// Map SubRegIndex -> set of super-reg classes. This is all register
|
|
|
|
// classes SuperRC such that:
|
|
|
|
//
|
|
|
|
// R:SubRegIndex in this RC for all R in SuperRC.
|
|
|
|
//
|
2012-01-31 21:57:55 +01:00
|
|
|
DenseMap<CodeGenSubRegIndex*,
|
|
|
|
SmallPtrSet<CodeGenRegisterClass*, 8> > SuperRegClasses;
|
2011-10-04 17:28:08 +02:00
|
|
|
public:
|
2011-09-30 02:10:36 +02:00
|
|
|
unsigned EnumValue;
|
2005-08-19 20:45:20 +02:00
|
|
|
std::string Namespace;
|
2009-08-11 22:47:22 +02:00
|
|
|
std::vector<MVT::SimpleValueType> VTs;
|
2004-08-21 06:05:00 +02:00
|
|
|
unsigned SpillSize;
|
|
|
|
unsigned SpillAlignment;
|
2007-09-19 03:35:01 +02:00
|
|
|
int CopyCost;
|
2011-06-03 01:07:20 +02:00
|
|
|
bool Allocatable;
|
2010-05-24 23:46:58 +02:00
|
|
|
// Map SubRegIndex -> RegisterClass
|
|
|
|
DenseMap<Record*,Record*> SubRegClasses;
|
2011-06-18 05:08:20 +02:00
|
|
|
std::string AltOrderSelect;
|
2004-08-21 06:05:00 +02:00
|
|
|
|
2011-10-04 17:28:08 +02:00
|
|
|
// Return the Record that defined this class, or NULL if the class was
|
|
|
|
// created by TableGen.
|
|
|
|
Record *getDef() const { return TheDef; }
|
|
|
|
|
|
|
|
const std::string &getName() const { return Name; }
|
|
|
|
std::string getQualifiedName() const;
|
2009-08-11 22:47:22 +02:00
|
|
|
const std::vector<MVT::SimpleValueType> &getValueTypes() const {return VTs;}
|
2005-12-05 03:35:08 +01:00
|
|
|
unsigned getNumValueTypes() const { return VTs.size(); }
|
2011-03-11 02:19:05 +01:00
|
|
|
|
2009-08-11 22:47:22 +02:00
|
|
|
MVT::SimpleValueType getValueTypeNum(unsigned VTNum) const {
|
2005-12-01 05:51:06 +01:00
|
|
|
if (VTNum < VTs.size())
|
|
|
|
return VTs[VTNum];
|
2012-02-05 08:21:30 +01:00
|
|
|
llvm_unreachable("VTNum greater than number of ValueTypes in RegClass!");
|
2005-12-01 05:51:06 +01:00
|
|
|
}
|
2011-03-11 02:19:05 +01:00
|
|
|
|
2011-06-15 06:50:36 +02:00
|
|
|
// Return true if this this class contains the register.
|
|
|
|
bool contains(const CodeGenRegister*) const;
|
2011-03-11 02:19:05 +01:00
|
|
|
|
2011-06-15 06:50:36 +02:00
|
|
|
// Returns true if RC is a subclass.
|
2010-08-25 02:41:18 +02:00
|
|
|
// RC is a sub-class of this class if it is a valid replacement for any
|
2011-03-11 02:19:05 +01:00
|
|
|
// instruction operand where a register of this classis required. It must
|
2010-08-25 02:41:18 +02:00
|
|
|
// satisfy these conditions:
|
|
|
|
//
|
|
|
|
// 1. All RC registers are also in this.
|
|
|
|
// 2. The RC spill size must not be smaller than our spill size.
|
|
|
|
// 3. RC spill alignment must be compatible with ours.
|
|
|
|
//
|
2011-10-01 01:47:05 +02:00
|
|
|
bool hasSubClass(const CodeGenRegisterClass *RC) const {
|
|
|
|
return SubClasses.test(RC->EnumValue);
|
|
|
|
}
|
2010-08-25 02:41:18 +02:00
|
|
|
|
2011-10-05 02:35:49 +02:00
|
|
|
// getSubClassWithSubReg - Returns the largest sub-class where all
|
|
|
|
// registers have a SubIdx sub-register.
|
2012-01-31 21:57:55 +01:00
|
|
|
CodeGenRegisterClass*
|
|
|
|
getSubClassWithSubReg(CodeGenSubRegIndex *SubIdx) const {
|
2011-10-05 02:35:49 +02:00
|
|
|
return SubClassWithSubReg.lookup(SubIdx);
|
|
|
|
}
|
|
|
|
|
2012-01-31 21:57:55 +01:00
|
|
|
void setSubClassWithSubReg(CodeGenSubRegIndex *SubIdx,
|
|
|
|
CodeGenRegisterClass *SubRC) {
|
2011-10-05 02:35:49 +02:00
|
|
|
SubClassWithSubReg[SubIdx] = SubRC;
|
|
|
|
}
|
|
|
|
|
2011-12-19 17:53:34 +01:00
|
|
|
// getSuperRegClasses - Returns a bit vector of all register classes
|
|
|
|
// containing only SubIdx super-registers of this class.
|
2012-01-31 21:57:55 +01:00
|
|
|
void getSuperRegClasses(CodeGenSubRegIndex *SubIdx, BitVector &Out) const;
|
2011-12-19 17:53:34 +01:00
|
|
|
|
|
|
|
// addSuperRegClass - Add a class containing only SudIdx super-registers.
|
2012-01-31 21:57:55 +01:00
|
|
|
void addSuperRegClass(CodeGenSubRegIndex *SubIdx,
|
|
|
|
CodeGenRegisterClass *SuperRC) {
|
2011-12-19 17:53:34 +01:00
|
|
|
SuperRegClasses[SubIdx].insert(SuperRC);
|
|
|
|
}
|
|
|
|
|
2011-10-01 00:18:45 +02:00
|
|
|
// getSubClasses - Returns a constant BitVector of subclasses indexed by
|
|
|
|
// EnumValue.
|
|
|
|
// The SubClasses vector includs an entry for this class.
|
2011-10-11 21:53:40 +02:00
|
|
|
const BitVector &getSubClasses() const { return SubClasses; }
|
2011-10-01 00:18:45 +02:00
|
|
|
|
|
|
|
// getSuperClasses - Returns a list of super classes ordered by EnumValue.
|
|
|
|
// The array does not include an entry for this class.
|
|
|
|
ArrayRef<CodeGenRegisterClass*> getSuperClasses() const {
|
|
|
|
return SuperClasses;
|
|
|
|
}
|
|
|
|
|
2011-06-15 06:50:36 +02:00
|
|
|
// Returns an ordered list of class members.
|
|
|
|
// The order of registers is the same as in the .td file.
|
2011-06-18 02:50:49 +02:00
|
|
|
// No = 0 is the default allocation order, No = 1 is the first alternative.
|
|
|
|
ArrayRef<Record*> getOrder(unsigned No = 0) const {
|
2011-10-04 17:28:44 +02:00
|
|
|
return Orders[No];
|
2010-08-25 02:41:18 +02:00
|
|
|
}
|
2005-12-01 05:51:06 +01:00
|
|
|
|
2011-06-18 02:50:49 +02:00
|
|
|
// Return the total number of allocation orders available.
|
2011-10-04 17:28:44 +02:00
|
|
|
unsigned getNumOrders() const { return Orders.size(); }
|
2011-06-18 02:50:49 +02:00
|
|
|
|
2011-10-01 01:47:05 +02:00
|
|
|
// Get the set of registers. This set contains the same registers as
|
|
|
|
// getOrder(0).
|
|
|
|
const CodeGenRegister::Set &getMembers() const { return Members; }
|
|
|
|
|
2011-06-15 06:50:36 +02:00
|
|
|
CodeGenRegisterClass(CodeGenRegBank&, Record *R);
|
2011-09-30 02:10:40 +02:00
|
|
|
|
2011-10-04 17:28:49 +02:00
|
|
|
// A key representing the parts of a register class used for forming
|
|
|
|
// sub-classes. Note the ordering provided by this key is not the same as
|
|
|
|
// the topological order used for the EnumValues.
|
|
|
|
struct Key {
|
|
|
|
const CodeGenRegister::Set *Members;
|
|
|
|
unsigned SpillSize;
|
|
|
|
unsigned SpillAlignment;
|
|
|
|
|
|
|
|
Key(const Key &O)
|
|
|
|
: Members(O.Members),
|
|
|
|
SpillSize(O.SpillSize),
|
|
|
|
SpillAlignment(O.SpillAlignment) {}
|
|
|
|
|
|
|
|
Key(const CodeGenRegister::Set *M, unsigned S = 0, unsigned A = 0)
|
|
|
|
: Members(M), SpillSize(S), SpillAlignment(A) {}
|
|
|
|
|
|
|
|
Key(const CodeGenRegisterClass &RC)
|
|
|
|
: Members(&RC.getMembers()),
|
|
|
|
SpillSize(RC.SpillSize),
|
|
|
|
SpillAlignment(RC.SpillAlignment) {}
|
|
|
|
|
|
|
|
// Lexicographical order of (Members, SpillSize, SpillAlignment).
|
|
|
|
bool operator<(const Key&) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Create a non-user defined register class.
|
|
|
|
CodeGenRegisterClass(StringRef Name, Key Props);
|
|
|
|
|
2011-09-30 02:10:40 +02:00
|
|
|
// Called by CodeGenRegBank::CodeGenRegBank().
|
2011-10-04 17:28:49 +02:00
|
|
|
static void computeSubClasses(CodeGenRegBank&);
|
2004-08-16 03:09:52 +02:00
|
|
|
};
|
2011-06-10 20:40:00 +02:00
|
|
|
|
|
|
|
// CodeGenRegBank - Represent a target's registers and the relations between
|
|
|
|
// them.
|
|
|
|
class CodeGenRegBank {
|
|
|
|
RecordKeeper &Records;
|
2011-06-15 07:09:20 +02:00
|
|
|
SetTheory Sets;
|
|
|
|
|
2012-01-31 21:57:55 +01:00
|
|
|
// SubRegIndices.
|
|
|
|
std::vector<CodeGenSubRegIndex*> SubRegIndices;
|
|
|
|
DenseMap<Record*, CodeGenSubRegIndex*> Def2SubRegIdx;
|
2011-06-10 20:40:00 +02:00
|
|
|
unsigned NumNamedIndices;
|
2012-01-31 21:57:55 +01:00
|
|
|
|
|
|
|
// Registers.
|
2011-06-18 06:26:06 +02:00
|
|
|
std::vector<CodeGenRegister*> Registers;
|
2011-06-11 02:28:06 +02:00
|
|
|
DenseMap<Record*, CodeGenRegister*> Def2Reg;
|
|
|
|
|
2011-10-04 17:28:49 +02:00
|
|
|
// Register classes.
|
2011-09-30 00:28:37 +02:00
|
|
|
std::vector<CodeGenRegisterClass*> RegClasses;
|
2011-06-15 02:20:40 +02:00
|
|
|
DenseMap<Record*, CodeGenRegisterClass*> Def2RC;
|
2011-10-04 17:28:49 +02:00
|
|
|
typedef std::map<CodeGenRegisterClass::Key, CodeGenRegisterClass*> RCKeyMap;
|
|
|
|
RCKeyMap Key2RC;
|
|
|
|
|
|
|
|
// Add RC to *2RC maps.
|
|
|
|
void addToMaps(CodeGenRegisterClass*);
|
|
|
|
|
2011-12-12 17:16:24 +01:00
|
|
|
// Create a synthetic sub-class if it is missing.
|
|
|
|
CodeGenRegisterClass *getOrCreateSubClass(const CodeGenRegisterClass *RC,
|
|
|
|
const CodeGenRegister::Set *Membs,
|
|
|
|
StringRef Name);
|
|
|
|
|
2011-10-04 17:28:49 +02:00
|
|
|
// Infer missing register classes.
|
|
|
|
void computeInferredRegisterClasses();
|
2011-12-15 17:48:55 +01:00
|
|
|
void inferCommonSubClass(CodeGenRegisterClass *RC);
|
2011-12-16 01:12:05 +01:00
|
|
|
void inferSubClassWithSubReg(CodeGenRegisterClass *RC);
|
2011-12-19 17:53:28 +01:00
|
|
|
void inferMatchingSuperRegClass(CodeGenRegisterClass *RC,
|
|
|
|
unsigned FirstSubRegRC = 0);
|
2011-06-15 02:20:40 +02:00
|
|
|
|
2011-06-11 02:28:06 +02:00
|
|
|
// Populate the Composite map from sub-register relationships.
|
|
|
|
void computeComposites();
|
2011-06-10 20:40:00 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
CodeGenRegBank(RecordKeeper&);
|
|
|
|
|
2011-06-15 07:09:20 +02:00
|
|
|
SetTheory &getSets() { return Sets; }
|
|
|
|
|
2011-06-11 02:28:06 +02:00
|
|
|
// Sub-register indices. The first NumNamedIndices are defined by the user
|
|
|
|
// in the .td files. The rest are synthesized such that all sub-registers
|
|
|
|
// have a unique name.
|
2012-01-31 21:57:55 +01:00
|
|
|
ArrayRef<CodeGenSubRegIndex*> getSubRegIndices() { return SubRegIndices; }
|
2011-06-10 20:40:00 +02:00
|
|
|
unsigned getNumNamedIndices() { return NumNamedIndices; }
|
|
|
|
|
2012-01-31 21:57:55 +01:00
|
|
|
// Find a SubRegIndex form its Record def.
|
|
|
|
CodeGenSubRegIndex *getSubRegIdx(Record*);
|
2011-06-10 20:40:00 +02:00
|
|
|
|
2011-06-11 02:28:06 +02:00
|
|
|
// Find or create a sub-register index representing the A+B composition.
|
2012-01-31 21:57:55 +01:00
|
|
|
CodeGenSubRegIndex *getCompositeSubRegIndex(CodeGenSubRegIndex *A,
|
2012-01-31 22:44:11 +01:00
|
|
|
CodeGenSubRegIndex *B);
|
2011-06-11 02:28:06 +02:00
|
|
|
|
2011-06-18 06:26:06 +02:00
|
|
|
const std::vector<CodeGenRegister*> &getRegisters() { return Registers; }
|
2011-06-11 02:28:06 +02:00
|
|
|
|
|
|
|
// Find a register from its Record def.
|
|
|
|
CodeGenRegister *getReg(Record*);
|
|
|
|
|
2011-09-30 00:28:37 +02:00
|
|
|
ArrayRef<CodeGenRegisterClass*> getRegClasses() const {
|
2011-06-15 02:20:40 +02:00
|
|
|
return RegClasses;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Find a register class from its def.
|
|
|
|
CodeGenRegisterClass *getRegClass(Record*);
|
|
|
|
|
|
|
|
/// getRegisterClassForRegister - Find the register class that contains the
|
|
|
|
/// specified physical register. If the register is not in a register
|
|
|
|
/// class, return null. If the register is in multiple classes, and the
|
|
|
|
/// classes have a superset-subset relationship and the same set of types,
|
|
|
|
/// return the superclass. Otherwise return null.
|
|
|
|
const CodeGenRegisterClass* getRegClassForRegister(Record *R);
|
|
|
|
|
2011-06-11 02:28:06 +02:00
|
|
|
// Computed derived records such as missing sub-register indices.
|
|
|
|
void computeDerivedInfo();
|
2011-06-12 05:05:52 +02:00
|
|
|
|
|
|
|
// Compute full overlap sets for every register. These sets include the
|
|
|
|
// rarely used aliases that are neither sub nor super-registers.
|
|
|
|
//
|
|
|
|
// Map[R1].count(R2) is reflexive and symmetric, but not transitive.
|
|
|
|
//
|
|
|
|
// If R1 is a sub-register of R2, Map[R1] is a subset of Map[R2].
|
|
|
|
void computeOverlaps(std::map<const CodeGenRegister*,
|
|
|
|
CodeGenRegister::Set> &Map);
|
2012-01-17 23:46:58 +01:00
|
|
|
|
|
|
|
// Compute the set of registers completely covered by the registers in Regs.
|
|
|
|
// The returned BitVector will have a bit set for each register in Regs,
|
|
|
|
// all sub-registers, and all super-registers that are covered by the
|
|
|
|
// registers in Regs.
|
|
|
|
//
|
|
|
|
// This is used to compute the mask of call-preserved registers from a list
|
|
|
|
// of callee-saves.
|
|
|
|
BitVector computeCoveredRegisters(ArrayRef<Record*> Regs);
|
2011-06-10 20:40:00 +02:00
|
|
|
};
|
2004-08-16 03:09:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|