fix word order when pushing 64-bit values as arguments to helper thunks in appendCombine

This commit is contained in:
Joel Dice 2009-05-24 00:31:53 -06:00
parent 364f31b785
commit 18ec68c7b7

View File

@ -2377,7 +2377,7 @@ class CallEvent: public Event {
((flags & Compiler::Aligned) ? AlignedCall : Call, BytesPerWord, ((flags & Compiler::Aligned) ? AlignedCall : Call, BytesPerWord,
&typeMask, &planRegisterMask, &thunk); &typeMask, &planRegisterMask, &thunk);
assert(c, thunk == 0); assert(c, not thunk);
addRead(c, this, address, read addRead(c, this, address, read
(c, SiteMask (c, SiteMask
@ -3300,15 +3300,15 @@ pushWord(Context* c, Value* v)
} }
Value* Value*
push(Context* c, unsigned footprint, Value* v) push(Context* c, unsigned footprint, Value* v, bool reverse)
{ {
assert(c, footprint); assert(c, footprint);
bool bigEndian = c->arch->bigEndian(); bool lowFirst = reverse xor c->arch->bigEndian();
Value* low = v; Value* low = v;
if (not bigEndian) { if (lowFirst) {
v = pushWord(c, v); v = pushWord(c, v);
} }
@ -3327,7 +3327,7 @@ push(Context* c, unsigned footprint, Value* v)
high = 0; high = 0;
} }
if (bigEndian) { if (not lowFirst) {
v = pushWord(c, v); v = pushWord(c, v);
} }
@ -3493,8 +3493,8 @@ appendCombine(Context* c, TernaryOperation type,
if (thunk) { if (thunk) {
Stack* oldStack = c->stack; Stack* oldStack = c->stack;
::push(c, ceiling(secondSize, BytesPerWord), second); ::push(c, ceiling(secondSize, BytesPerWord), second, false);
::push(c, ceiling(firstSize, BytesPerWord), first); ::push(c, ceiling(firstSize, BytesPerWord), first, false);
Stack* argumentStack = c->stack; Stack* argumentStack = c->stack;
c->stack = oldStack; c->stack = oldStack;
@ -3724,7 +3724,7 @@ class BranchEvent: public Event {
c->arch->plan(type, BytesPerWord, &typeMask, &registerMask, &thunk); c->arch->plan(type, BytesPerWord, &typeMask, &registerMask, &thunk);
assert(c, thunk == 0); assert(c, not thunk);
addRead(c, this, address, read addRead(c, this, address, read
(c, SiteMask(typeMask, registerMask, AnyFrameIndex))); (c, SiteMask(typeMask, registerMask, AnyFrameIndex)));
@ -5111,7 +5111,7 @@ class MyCompiler: public Compiler {
} }
virtual void push(unsigned footprint, Operand* value) { virtual void push(unsigned footprint, Operand* value) {
::push(&c, footprint, static_cast<Value*>(value)); ::push(&c, footprint, static_cast<Value*>(value), true);
} }
virtual void save(unsigned footprint, Operand* value) { virtual void save(unsigned footprint, Operand* value) {