instructions.add(new AsmOPER("ldr `d0, =" + constValue, def, new LinkedList<Temp>()));
}
}
else if (move.dst instanceof ImcTEMP && move.src instanceof ImcExpr)
{
Temp val = munch(move.src);
instructions.add(new AsmMOVE("mov `d0, [`s0]", ((ImcTEMP)move.dst).temp, val));
}
// STR
else if (move.dst instanceof ImcMEM)
{
Temp value = munch((ImcExpr)move.src);
ImcMEM mem = (ImcMEM)move.dst;
// Check if it's a label or a register with offset
// NAME
if (mem.expr instanceof ImcNAME)
{
LinkedList<Temp> src = new LinkedList<Temp>();
src.add(value);
instructions.add(new AsmOPER("str `s0, =" + ((ImcNAME)mem.expr).label.name(), new LinkedList<Temp>(), src));
}
else if (mem.expr instanceof ImcBINOP && ((ImcBINOP)mem.expr).rimc instanceof ImcCONST)
{
LinkedList<Temp> src = new LinkedList<Temp>();
src.add(value);
src.add(munch(((ImcBINOP)mem.expr).limc));
int offset = ((ImcCONST)((ImcBINOP)mem.expr).rimc).value;
instructions.add(new AsmOPER("str `s0, [`s1, #" + offset + "]", new LinkedList<Temp>(), src));
}
// Address that evaluates
else if (((ImcBINOP)mem.expr).rimc instanceof ImcCONST)
{
Temp addr = munch((ImcExpr)mem.expr);
LinkedList<Temp> src = new LinkedList<Temp>();
src.add(addr);
src.add(munch(((ImcBINOP)mem.expr).limc));