From f5dc9ad48db4d22e7d6f15e340063dc7cb14c1e1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 29 Sep 2019 23:47:52 +0200 Subject: Implicit cast from str to ?&c_char, fix use of parameters (to use sys v registers) --- src/bytecode/bytecode.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/bytecode/bytecode.c') diff --git a/src/bytecode/bytecode.c b/src/bytecode/bytecode.c index a5e3abc..b947985 100644 --- a/src/bytecode/bytecode.c +++ b/src/bytecode/bytecode.c @@ -387,7 +387,7 @@ static void add_ins1(BytecodeCompilerContext *self, AmalOpcode opcode, const cha } } -static void add_ins2(BytecodeCompilerContext *self, AmalOpcode opcode, i8 reg, const char *fmt) { +static void add_ins2(BytecodeCompilerContext *self, AmalOpcode opcode, AmalReg reg, const char *fmt) { Buffer *instructions = &self->bytecode->data; size_t index = instructions->size; @@ -398,7 +398,7 @@ static void add_ins2(BytecodeCompilerContext *self, AmalOpcode opcode, i8 reg, c fputc('\n', stderr); } -static void add_ins3(BytecodeCompilerContext *self, AmalOpcode opcode, i8 dst_reg, i8 src_reg, const char *fmt) { +static void add_ins3(BytecodeCompilerContext *self, AmalOpcode opcode, AmalReg dst_reg, AmalReg src_reg, const char *fmt) { Buffer *instructions = &self->bytecode->data; size_t index = instructions->size; @@ -421,7 +421,7 @@ static void add_ins4(BytecodeCompilerContext *self, AmalOpcode opcode, u16 data, fputc('\n', stderr); } -static void add_ins5(BytecodeCompilerContext *self, AmalOpcode opcode, i8 dst_reg, i8 reg1, i8 reg2, const char *fmt) { +static void add_ins5(BytecodeCompilerContext *self, AmalOpcode opcode, AmalReg dst_reg, AmalReg reg1, AmalReg reg2, const char *fmt) { Buffer *instructions = &self->bytecode->data; size_t index = instructions->size; @@ -434,7 +434,7 @@ static void add_ins5(BytecodeCompilerContext *self, AmalOpcode opcode, i8 dst_re fputc('\n', stderr); } -static void add_ins6(BytecodeCompilerContext *self, AmalOpcode opcode, i8 dst_reg, u16 data, const char *fmt) { +static void add_ins6(BytecodeCompilerContext *self, AmalOpcode opcode, AmalReg dst_reg, u16 data, const char *fmt) { Buffer *instructions = &self->bytecode->data; size_t index = instructions->size; @@ -525,6 +525,11 @@ static void add_instructions(BytecodeCompilerContext *self) { add_ins5(self, AMAL_OP_CMP, ssa_ins_form2.result, ssa_ins_form2.lhs, ssa_ins_form2.rhs, "cmp r%d, r%d, r%d"); break; } + case SSA_AND: { + instruction += ssa_extract_data(instruction, &ssa_ins_form2, sizeof(ssa_ins_form2)); + add_ins5(self, AMAL_OP_BIT_AND, ssa_ins_form2.result, ssa_ins_form2.lhs, ssa_ins_form2.rhs, "and r%d, r%d, r%d"); + break; + } case SSA_FUNC_START: { instruction += ssa_extract_data(instruction, &ssa_ins_func_start, sizeof(ssa_ins_func_start)); add_ins6(self, AMAL_OP_FUNC_START, ssa_ins_func_start.flags, ssa_ins_func_start.num_local_vars_regs, "func_start 0x%02x, %u"); -- cgit v1.2.3