mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
typdef Register
This commit is contained in:
parent
45cc85829a
commit
61e79d4f3b
@ -85,7 +85,7 @@ class Architecture {
|
|||||||
virtual bool argumentAlignment() = 0;
|
virtual bool argumentAlignment() = 0;
|
||||||
virtual bool argumentRegisterAlignment() = 0;
|
virtual bool argumentRegisterAlignment() = 0;
|
||||||
virtual unsigned argumentRegisterCount() = 0;
|
virtual unsigned argumentRegisterCount() = 0;
|
||||||
virtual int argumentRegister(unsigned index) = 0;
|
virtual Register argumentRegister(unsigned index) = 0;
|
||||||
|
|
||||||
virtual bool hasLinkRegister() = 0;
|
virtual bool hasLinkRegister() = 0;
|
||||||
|
|
||||||
|
@ -53,10 +53,10 @@ class Assembler {
|
|||||||
public:
|
public:
|
||||||
class Client {
|
class Client {
|
||||||
public:
|
public:
|
||||||
virtual int acquireTemporary(RegisterMask mask = ~static_cast<RegisterMask>(0)) = 0;
|
virtual Register acquireTemporary(RegisterMask mask = ~static_cast<RegisterMask>(0)) = 0;
|
||||||
virtual void releaseTemporary(int r) = 0;
|
virtual void releaseTemporary(Register r) = 0;
|
||||||
|
|
||||||
virtual void save(int r) = 0;
|
virtual void save(Register r) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Block {
|
class Block {
|
||||||
|
@ -17,6 +17,7 @@ namespace avian {
|
|||||||
namespace codegen {
|
namespace codegen {
|
||||||
|
|
||||||
typedef uint64_t RegisterMask;
|
typedef uint64_t RegisterMask;
|
||||||
|
typedef int Register;
|
||||||
|
|
||||||
class BoundedRegisterMask {
|
class BoundedRegisterMask {
|
||||||
public:
|
public:
|
||||||
@ -62,7 +63,7 @@ class RegisterIterator {
|
|||||||
return index < mask.limit;
|
return index < mask.limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int next()
|
inline Register next()
|
||||||
{
|
{
|
||||||
int r = index;
|
int r = index;
|
||||||
do {
|
do {
|
||||||
|
@ -2210,22 +2210,22 @@ class Client : public Assembler::Client {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int acquireTemporary(RegisterMask mask)
|
virtual Register acquireTemporary(RegisterMask mask)
|
||||||
{
|
{
|
||||||
unsigned cost;
|
unsigned cost;
|
||||||
int r = pickRegisterTarget(c, 0, mask, &cost);
|
Register r = pickRegisterTarget(c, 0, mask, &cost);
|
||||||
expect(c, cost < Target::Impossible);
|
expect(c, cost < Target::Impossible);
|
||||||
save(r);
|
save(r);
|
||||||
c->registerResources[r].increment(c);
|
c->registerResources[r].increment(c);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void releaseTemporary(int r)
|
virtual void releaseTemporary(Register r)
|
||||||
{
|
{
|
||||||
c->registerResources[r].decrement(c);
|
c->registerResources[r].decrement(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void save(int r)
|
virtual void save(Register r)
|
||||||
{
|
{
|
||||||
RegisterResource* reg = c->registerResources + r;
|
RegisterResource* reg = c->registerResources + r;
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ class CallEvent : public Event {
|
|||||||
SiteMask targetMask;
|
SiteMask targetMask;
|
||||||
if (index + (c->arch->argumentRegisterAlignment() ? footprint : 1)
|
if (index + (c->arch->argumentRegisterAlignment() ? footprint : 1)
|
||||||
<= c->arch->argumentRegisterCount()) {
|
<= c->arch->argumentRegisterCount()) {
|
||||||
int number = c->arch->argumentRegister(index);
|
Register number = c->arch->argumentRegister(index);
|
||||||
|
|
||||||
if (DebugReads) {
|
if (DebugReads) {
|
||||||
fprintf(stderr, "reg %d arg read %p\n", number, v);
|
fprintf(stderr, "reg %d arg read %p\n", number, v);
|
||||||
|
@ -57,10 +57,10 @@ unsigned resourceCost(Context* c,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool pickRegisterTarget(Context* c,
|
bool pickRegisterTarget(Context* c,
|
||||||
int i,
|
Register i,
|
||||||
Value* v,
|
Value* v,
|
||||||
RegisterMask mask,
|
RegisterMask mask,
|
||||||
int* target,
|
Register* target,
|
||||||
unsigned* cost,
|
unsigned* cost,
|
||||||
CostCalculator* costCalculator)
|
CostCalculator* costCalculator)
|
||||||
{
|
{
|
||||||
@ -85,17 +85,17 @@ bool pickRegisterTarget(Context* c,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pickRegisterTarget(Context* c,
|
Register pickRegisterTarget(Context* c,
|
||||||
Value* v,
|
Value* v,
|
||||||
RegisterMask mask,
|
RegisterMask mask,
|
||||||
unsigned* cost,
|
unsigned* cost,
|
||||||
CostCalculator* costCalculator)
|
CostCalculator* costCalculator)
|
||||||
{
|
{
|
||||||
int target = lir::NoRegister;
|
Register target = lir::NoRegister;
|
||||||
*cost = Target::Impossible;
|
*cost = Target::Impossible;
|
||||||
|
|
||||||
if (mask & c->regFile->generalRegisters.mask) {
|
if (mask & c->regFile->generalRegisters.mask) {
|
||||||
for (int i = c->regFile->generalRegisters.limit - 1;
|
for (Register i = c->regFile->generalRegisters.limit - 1;
|
||||||
i >= c->regFile->generalRegisters.start;
|
i >= c->regFile->generalRegisters.start;
|
||||||
--i) {
|
--i) {
|
||||||
if (pickRegisterTarget(c, i, v, mask, &target, cost, costCalculator)) {
|
if (pickRegisterTarget(c, i, v, mask, &target, cost, costCalculator)) {
|
||||||
@ -105,8 +105,8 @@ int pickRegisterTarget(Context* c,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mask & c->regFile->floatRegisters.mask) {
|
if (mask & c->regFile->floatRegisters.mask) {
|
||||||
for (int i = c->regFile->floatRegisters.start;
|
for (Register i = c->regFile->floatRegisters.start;
|
||||||
i < static_cast<int>(c->regFile->floatRegisters.limit);
|
i < static_cast<Register>(c->regFile->floatRegisters.limit);
|
||||||
++i) {
|
++i) {
|
||||||
if (pickRegisterTarget(c, i, v, mask, &target, cost, costCalculator)) {
|
if (pickRegisterTarget(c, i, v, mask, &target, cost, costCalculator)) {
|
||||||
return i;
|
return i;
|
||||||
@ -123,7 +123,7 @@ Target pickRegisterTarget(Context* c,
|
|||||||
CostCalculator* costCalculator)
|
CostCalculator* costCalculator)
|
||||||
{
|
{
|
||||||
unsigned cost;
|
unsigned cost;
|
||||||
int number = pickRegisterTarget(c, v, mask, &cost, costCalculator);
|
Register number = pickRegisterTarget(c, v, mask, &cost, costCalculator);
|
||||||
return Target(number, lir::RegisterOperand, cost);
|
return Target(number, lir::RegisterOperand, cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class Target {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Target(int index, lir::OperandType type, unsigned cost)
|
Target(Register index, lir::OperandType type, unsigned cost)
|
||||||
: index(index), type(type), cost(cost)
|
: index(index), type(type), cost(cost)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user