support absolute operands on virtual stack and absolute to memory movs

This commit is contained in:
Joel Dice 2007-12-11 17:27:04 -07:00
parent 740e86a084
commit 33b2a4a1e8
2 changed files with 29 additions and 1 deletions

View File

@ -262,6 +262,8 @@ class AbsoluteOperand: public MyOperand {
value(value) value(value)
{ } { }
virtual StackOperand* logicalPush(Context* c);
virtual void apply(Context* c, Operation operation); virtual void apply(Context* c, Operation operation);
virtual void apply(Context* c, Operation operation, MyOperand* operand) { virtual void apply(Context* c, Operation operation, MyOperand* operand) {
@ -295,6 +297,7 @@ class MemoryOperand: public MyOperand {
virtual void accept(Context*, Operation, RegisterOperand*); virtual void accept(Context*, Operation, RegisterOperand*);
virtual void accept(Context*, Operation, ImmediateOperand*); virtual void accept(Context*, Operation, ImmediateOperand*);
virtual void accept(Context*, Operation, AbsoluteOperand*);
MyOperand* base; MyOperand* base;
int displacement; int displacement;
@ -851,6 +854,13 @@ ImmediateOperand::apply(Context* c, Operation operation)
} }
} }
StackOperand*
AbsoluteOperand::logicalPush(Context* c)
{
return c->stack = new (c->zone.allocate(sizeof(StackOperand)))
StackOperand(this, c->stack);
}
void void
AbsoluteOperand::apply(Context* c, Operation operation) AbsoluteOperand::apply(Context* c, Operation operation)
{ {
@ -914,6 +924,24 @@ MemoryOperand::accept(Context* c, Operation operation,
} }
} }
void
MemoryOperand::accept(Context* c, Operation operation,
AbsoluteOperand* operand)
{
switch (operation) {
case mov: {
RegisterOperand* tmp = temporary(c, true);
tmp->accept(c, mov, operand);
accept(c, mov, tmp);
tmp->release(c);
} break;
default: abort(c);
}
}
unsigned unsigned
PoolPromise::value(Context* c) PoolPromise::value(Context* c)
{ {

View File

@ -24,7 +24,7 @@ public class Misc {
int c = a + b; int c = a + b;
Misc m = new Misc(); Misc m = new Misc();
// String s = "hello"; String s = "hello";
// m.foo(s); // m.foo(s);
// m.bar(s); // m.bar(s);
// baz(s); // baz(s);