aboutsummaryrefslogtreecommitdiff
path: root/src/bytecode
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-09-29 23:47:52 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commitf5dc9ad48db4d22e7d6f15e340063dc7cb14c1e1 (patch)
tree4465a81a77e936dc2ed6ecd90183ba6af9cc2dae /src/bytecode
parentc811a743a1528db1d05970e1aa14162ef7c70b75 (diff)
Implicit cast from str to ?&c_char, fix use of parameters (to use sys v registers)
Diffstat (limited to 'src/bytecode')
-rw-r--r--src/bytecode/bytecode.c13
1 files changed, 9 insertions, 4 deletions
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");