4 static void _setupPointer(REG *reg, asmop *into, int offset)
6 iemit("; _setupPointer for %s", reg->name);
9 void izt_putAop(asmop *into, const char *sz, int size, int offset)
15 iemit("mov %s,%s", into->u.reg->name, sz);
22 case AOP_TYPE_SCRATCH_PTR:
23 _setupPointer(izt_port->scratch, into, offset);
24 iemit("mov a,%s", sz);
25 iemit("mov %s,a", izt_port->scratch->name);
29 iemit("mov a,%s", sz);
30 iemit("mov (%s+%d),a", izt_port->base_ptr->name, into->u.stack);
33 case AOP_TYPE_LITERAL:
34 case AOP_TYPE_IMMEDIATE:
40 char *izt_getAop(asmop *from, int size, int offset)
45 /** Perform a generic move operation.
47 static void _mov(asmop *into, asmop *from)
49 int size = into->size;
50 izt_putAop(into, izt_getAop(from, size, 0), size, 0);
53 static void _genLabel(iCode *ic)
55 iemit("!tlabeldef", IC_LABEL(ic)->key + 100);
58 static void _genGoto(iCode *ic)
60 iemit("jp !tlabel", IC_LABEL(ic)->key+100);
63 static void _genFunction(iCode *ic)
65 symbol *sym = OP_SYMBOL(IC_LEFT(ic));
67 // Create the function header
68 iemit("!functionheader", sym->name);
69 iemit("!functionlabeldef", sym->rname);
72 iemit("!enterx", sym->stack);
80 static void _genEndFunction(iCode *ic)
82 // symbol *sym = OP_SYMBOL(IC_LEFT(ic));
84 /* PENDING: calleeSave */
91 _genReturn (iCode * ic)
94 // Has a return value. Load it up.
95 izt_bindAop(IC_LEFT(ic), ic);
96 _mov(izt_getAopForReturn(AOP_SIZE(IC_LEFT(ic))), AOP(IC_LEFT(ic)));
99 if (ic->next && ic->next->op == LABEL && IC_LABEL (ic->next) == returnLabel)
101 // The next label is the return label. Dont bother emitting a jump.
105 iemit ("jp !tlabel", returnLabel->key + 100);
109 static EMITTER _base_emitters[] = {
110 { LABEL, _genLabel },
112 { FUNCTION, _genFunction },
113 { RETURN, _genReturn },
114 { ENDFUNCTION, _genEndFunction },
119 izt_initBaseEmitters (hTab ** into)
121 izt_addEmittersToHTab (into, _base_emitters);