Add zrl opcode. Keep track of local sizes as well as offsets.

This commit is contained in:
David Given 2016-10-02 16:08:46 +02:00
parent bf73fcdb64
commit 79d4ab1d96
2 changed files with 14 additions and 0 deletions

View file

@ -3,6 +3,8 @@
struct local
{
int size;
int offset;
bool is_register;
};
@ -16,6 +18,7 @@ struct procedure
};
extern void procedure_compile(struct procedure* proc);
extern void procedure_update_bb_graph(struct procedure* proc);
#endif

View file

@ -111,6 +111,7 @@ void tb_regvar(struct procedure* procedure, arith offset, int size, int type, in
{
struct local* local = calloc(1, sizeof(*local));
local->size = size;
local->offset = offset;
local->is_register = true;
imap_put(&procedure->locals, offset, local);
}
@ -413,6 +414,16 @@ static void insn_ivalue(int opcode, arith value)
change_by(new_localir(value), -1);
break;
case op_zrl:
appendir(
new_ir2(
IR_STORE, EM_wordsize,
new_localir(value),
new_wordir(0)
)
);
break;
case op_loc:
push(
new_wordir(value)