freeze target site when using temporary in maybeMove

This commit is contained in:
Joel Dice 2009-02-08 18:58:33 -07:00
parent 4ca45ffa41
commit 29616c4abc
2 changed files with 14 additions and 5 deletions

View File

@ -2416,14 +2416,14 @@ maybeMove(Context* c, BinaryOperation type, unsigned srcSize, Value* src,
if (srcSize != dstSize) cost = 1;
if (cost) {
addSite(c, dst, target);
if (cost) {
bool useTemporary = ((target->type(c) == MemoryOperand
and src->source->type(c) == MemoryOperand)
or (srcSize != dstSize
and target->type(c) != RegisterOperand));
addSite(c, dst, target);
if (target->match(c, dstMask) and not useTemporary) {
if (DebugMoves) {
char srcb[256]; src->source->toString(c, srcb, 256);
@ -2434,6 +2434,8 @@ maybeMove(Context* c, BinaryOperation type, unsigned srcSize, Value* src,
apply(c, type, srcSize, src->source, 0, dstSize, target, 0);
} else {
target->freeze(c, dst);
assert(c, dstMask.typeMask & (1 << RegisterOperand));
Site* tmpTarget = freeRegisterSite(c, dstMask.registerMask);
@ -2463,8 +2465,10 @@ maybeMove(Context* c, BinaryOperation type, unsigned srcSize, Value* src,
removeSite(c, dst, tmpTarget);
}
} else {
removeSite(c, dst, target);
removeSite(c, dst, target);
}
target->thaw(c, dst);
}
} else {
target = src->source;
@ -3267,7 +3271,7 @@ class MemoryEvent: public Event {
}
Site* site = memorySite
(c, baseRegister, displacement, indexRegister, scale);
(c, baseRegister, displacement, indexRegister, scale);
result->target = site;
if (live(result)) {

View File

@ -86,6 +86,11 @@ public class Misc {
}
public static void main(String[] args) {
expect(new String(new byte[] { 99, 111, 109, 46, 101, 99, 111, 118, 97,
116, 101, 46, 110, 97, 116, 46, 98, 117,
115, 46, 83, 121, 109, 98, 111, 108 })
.equals("com.ecovate.nat.bus.Symbol"));
expect(queryDefault(new Object()) != null);
{ Foo foo = new Foo();