use upper 32 bits of mask in pickRegisterTarget when picking register for high word; set Target::Impossible to 5 since 4 is a valid cost

This commit is contained in:
Joel Dice 2009-01-11 16:42:41 -07:00
parent 04bc58fd95
commit 05bd86e2ed

View File

@ -1032,7 +1032,7 @@ FrameResource::thaw(Context* c, Value* v)
class Target { class Target {
public: public:
static const int FrameIndex = -2; static const int FrameIndex = -2;
static const unsigned Impossible = 4; static const unsigned Impossible = 5;
Target(): cost(Impossible) { } Target(): cost(Impossible) { }
@ -1078,6 +1078,7 @@ pickRegisterTarget(Context* c, Value* v, uint32_t mask, unsigned* cost)
RegisterResource* r = c->registerResources + i; RegisterResource* r = c->registerResources + i;
unsigned myCost = resourceCost(c, v, r); unsigned myCost = resourceCost(c, v, r);
if ((static_cast<uint32_t>(1) << i) == mask) { if ((static_cast<uint32_t>(1) << i) == mask) {
fprintf(stderr, "%d costs %d\n", i, myCost);
*cost = myCost; *cost = myCost;
return i; return i;
} else if (myCost < bestCost) { } else if (myCost < bestCost) {
@ -1105,7 +1106,7 @@ pickRegisterTarget(Context* c, Value* v, uint64_t mask, unsigned size)
if (size > BytesPerWord) { if (size > BytesPerWord) {
increment(c, c->registerResources + low); increment(c, c->registerResources + low);
high = pickRegisterTarget(c, v, mask, &highCost); high = pickRegisterTarget(c, v, mask >> 32, &highCost);
decrement(c, c->registerResources + low); decrement(c, c->registerResources + low);