Skip to content

Commit

Permalink
Fixed compiler issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cheng-alvin committed Jun 16, 2024
1 parent ba7e31c commit 1a35df5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion libjas/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,20 @@ buffer_t codegen(enum modes mode, instruction_t *instr_arr, size_t arr_size) {

for (size_t i = 0; i < arr_size; i++) {
instruction_t current = instr_arr[i];
enum op_ident ident = op_ident_identify(current.operands);

enum operands operand_list[4] = {

current.operands[0].type,
current.operands[1].type,
current.operands[2].type,
current.operands[3].type

};

enum op_ident ident = op_ident_identify(operand_list);
const instr_encode_table_t ref = instr_table[instr_arr[i].instr][ident];

// TODO Please check if this NULL pointer conditional expression is correct :)
if (ref.opcode == NULL) {
err("Instruction opcode not found. (Suggests an invalid instruction)");
free(buf.data);
Expand Down

0 comments on commit 1a35df5

Please sign in to comment.