From bf73fcdb64c36f97e36440ee4307f544100b5b23 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 2 Oct 2016 14:44:21 +0200 Subject: [PATCH] Add inl and del opcodes. --- mach/proto/mcg/treebuilder.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mach/proto/mcg/treebuilder.c b/mach/proto/mcg/treebuilder.c index f4c481457..e8675e613 100644 --- a/mach/proto/mcg/treebuilder.c +++ b/mach/proto/mcg/treebuilder.c @@ -340,6 +340,24 @@ static struct ir* extract_block_refs(struct basicblock* bb) return outir; } +static void change_by(struct ir* address, int amount) +{ + appendir( + new_ir2( + IR_STORE, EM_wordsize, + address, + new_ir2( + IR_ADD, EM_wordsize, + new_ir1( + IR_LOAD, EM_wordsize, + address + ), + new_wordir(amount) + ) + ) + ); +} + static void insn_ivalue(int opcode, arith value) { switch (opcode) @@ -387,6 +405,14 @@ static void insn_ivalue(int opcode, arith value) ); break; + case op_inl: + change_by(new_localir(value), 1); + break; + + case op_del: + change_by(new_localir(value), -1); + break; + case op_loc: push( new_wordir(value) -- 2.34.1