avoid running out of eligable source registers for writing a single byte to memory on x86

This commit is contained in:
Joel Dice 2009-03-14 16:47:26 -06:00
parent 9abc25e134
commit 073b829c79
2 changed files with 9 additions and 7 deletions

View File

@ -1013,8 +1013,6 @@ freezeResource(Context* c, Resource* r, Value* v)
fprintf(stderr, "%p freeze %s to %d\n", v, buffer, r->freezeCount + 1);
}
assert(c, r->value == 0 or buddies(r->value, v));
++ r->freezeCount;
}
@ -1046,7 +1044,6 @@ thawResource(Context* c, Resource* r, Value* v)
}
assert(c, r->freezeCount);
assert(c, r->value == 0 or buddies(r->value, v));
-- r->freezeCount;
}
@ -2455,16 +2452,20 @@ maybeMove(Context* c, BinaryOperation type, unsigned srcSize,
unsigned cost = src->source->copyCost(c, target);
if (srcSelectSize != dstSize) cost = 1;
if (srcSelectSize < dstSize) cost = 1;
if (cost) {
bool useTemporary = ((target->type(c) == MemoryOperand
and src->source->type(c) == MemoryOperand)
or (srcSelectSize != dstSize
or (srcSelectSize < dstSize
and target->type(c) != RegisterOperand));
src->source->freeze(c, src);
addSite(c, dst, target);
src->source->thaw(c, src);
bool addOffset = srcSize != srcSelectSize
and c->arch->bigEndian()
and src->source->type(c) == MemoryOperand;
@ -2486,7 +2487,8 @@ maybeMove(Context* c, BinaryOperation type, unsigned srcSize,
src->source->freeze(c, src);
apply(c, type, srcSelectSize, src->source, 0, dstSize, target, 0);
apply(c, type, min(srcSelectSize, dstSize), src->source, 0,
dstSize, target, 0);
src->source->thaw(c, src);
} else {

View File

@ -2173,7 +2173,7 @@ class MyArchitecture: public Assembler::Architecture {
*aRegisterMask = (static_cast<uint64_t>(mask) << 32) | mask;
*bRegisterMask = (static_cast<uint64_t>(1) << (rdx + 32))
| (static_cast<uint64_t>(1) << rax);
} else if (aSize == 1) {
} else if (aSize == 1 or bSize == 1) {
const uint32_t mask
= (1 << rax) | (1 << rcx) | (1 << rdx) | (1 << rbx);
*aRegisterMask = (static_cast<uint64_t>(mask) << 32) | mask;