mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 03:25:23 +00:00
Add CopyCost to TargetRegisterClass. This specifies the cost of copying a value
between two registers in the specific class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42123 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -70,6 +70,7 @@ private:
|
|||||||
const sc_iterator SubRegClasses;
|
const sc_iterator SubRegClasses;
|
||||||
const sc_iterator SuperRegClasses;
|
const sc_iterator SuperRegClasses;
|
||||||
const unsigned RegSize, Alignment; // Size & Alignment of register in bytes
|
const unsigned RegSize, Alignment; // Size & Alignment of register in bytes
|
||||||
|
const int CopyCost;
|
||||||
const iterator RegsBegin, RegsEnd;
|
const iterator RegsBegin, RegsEnd;
|
||||||
public:
|
public:
|
||||||
TargetRegisterClass(unsigned id,
|
TargetRegisterClass(unsigned id,
|
||||||
@@ -78,10 +79,11 @@ public:
|
|||||||
const TargetRegisterClass * const *supcs,
|
const TargetRegisterClass * const *supcs,
|
||||||
const TargetRegisterClass * const *subregcs,
|
const TargetRegisterClass * const *subregcs,
|
||||||
const TargetRegisterClass * const *superregcs,
|
const TargetRegisterClass * const *superregcs,
|
||||||
unsigned RS, unsigned Al, iterator RB, iterator RE)
|
unsigned RS, unsigned Al, int CC,
|
||||||
|
iterator RB, iterator RE)
|
||||||
: ID(id), VTs(vts), SubClasses(subcs), SuperClasses(supcs),
|
: ID(id), VTs(vts), SubClasses(subcs), SuperClasses(supcs),
|
||||||
SubRegClasses(subregcs), SuperRegClasses(superregcs),
|
SubRegClasses(subregcs), SuperRegClasses(superregcs),
|
||||||
RegSize(RS), Alignment(Al), RegsBegin(RB), RegsEnd(RE) {}
|
RegSize(RS), Alignment(Al), CopyCost(CC), RegsBegin(RB), RegsEnd(RE) {}
|
||||||
virtual ~TargetRegisterClass() {} // Allow subclasses
|
virtual ~TargetRegisterClass() {} // Allow subclasses
|
||||||
|
|
||||||
/// getID() - Return the register class ID number.
|
/// getID() - Return the register class ID number.
|
||||||
@@ -258,6 +260,10 @@ public:
|
|||||||
/// getAlignment - Return the minimum required alignment for a register of
|
/// getAlignment - Return the minimum required alignment for a register of
|
||||||
/// this class.
|
/// this class.
|
||||||
unsigned getAlignment() const { return Alignment; }
|
unsigned getAlignment() const { return Alignment; }
|
||||||
|
|
||||||
|
/// getCopyCost - Return the cost of copying a value between two registers in
|
||||||
|
/// this class.
|
||||||
|
int getCopyCost() const { return CopyCost; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -104,6 +104,12 @@ class RegisterClass<string namespace, list<ValueType> regTypes, int alignment,
|
|||||||
//
|
//
|
||||||
int Alignment = alignment;
|
int Alignment = alignment;
|
||||||
|
|
||||||
|
// CopyCost - This value is used to specify the cost of copying a value
|
||||||
|
// between two registers in this register class. The default value is one
|
||||||
|
// meaning it takes a single instruction to perform the copying. A negative
|
||||||
|
// value means copying is extremely expensive or impossible.
|
||||||
|
int CopyCost = 1;
|
||||||
|
|
||||||
// MemberList - Specify which registers are in this class. If the
|
// MemberList - Specify which registers are in this class. If the
|
||||||
// allocation_order_* method are not specified, this also defines the order of
|
// allocation_order_* method are not specified, this also defines the order of
|
||||||
// allocation used by the register allocator.
|
// allocation used by the register allocator.
|
||||||
|
@@ -38,6 +38,7 @@ namespace llvm {
|
|||||||
std::vector<MVT::ValueType> VTs;
|
std::vector<MVT::ValueType> VTs;
|
||||||
unsigned SpillSize;
|
unsigned SpillSize;
|
||||||
unsigned SpillAlignment;
|
unsigned SpillAlignment;
|
||||||
|
int CopyCost;
|
||||||
std::vector<Record*> SubRegClasses;
|
std::vector<Record*> SubRegClasses;
|
||||||
std::string MethodProtos, MethodBodies;
|
std::string MethodProtos, MethodBodies;
|
||||||
|
|
||||||
|
@@ -221,6 +221,7 @@ CodeGenRegisterClass::CodeGenRegisterClass(Record *R) : TheDef(R) {
|
|||||||
Namespace = R->getValueAsString("Namespace");
|
Namespace = R->getValueAsString("Namespace");
|
||||||
SpillSize = Size ? Size : MVT::getSizeInBits(VTs[0]);
|
SpillSize = Size ? Size : MVT::getSizeInBits(VTs[0]);
|
||||||
SpillAlignment = R->getValueAsInt("Alignment");
|
SpillAlignment = R->getValueAsInt("Alignment");
|
||||||
|
CopyCost = R->getValueAsInt("CopyCost");
|
||||||
MethodBodies = R->getValueAsCode("MethodBodies");
|
MethodBodies = R->getValueAsCode("MethodBodies");
|
||||||
MethodProtos = R->getValueAsCode("MethodProtos");
|
MethodProtos = R->getValueAsCode("MethodProtos");
|
||||||
}
|
}
|
||||||
|
@@ -384,8 +384,10 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
|||||||
<< RC.getName() + "SubRegClasses" << ", "
|
<< RC.getName() + "SubRegClasses" << ", "
|
||||||
<< RC.getName() + "SuperRegClasses" << ", "
|
<< RC.getName() + "SuperRegClasses" << ", "
|
||||||
<< RC.SpillSize/8 << ", "
|
<< RC.SpillSize/8 << ", "
|
||||||
<< RC.SpillAlignment/8 << ", " << RC.getName() << ", "
|
<< RC.SpillAlignment/8 << ", "
|
||||||
<< RC.getName() << " + " << RC.Elements.size() << ") {}\n";
|
<< RC.CopyCost << ", "
|
||||||
|
<< RC.getName() << ", " << RC.getName() << " + " << RC.Elements.size()
|
||||||
|
<< ") {}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << "}\n";
|
OS << "}\n";
|
||||||
|
Reference in New Issue
Block a user