diff --git a/tools/qfcc/include/opcodes.h b/tools/qfcc/include/opcodes.h index fa100fb6b..055066f4b 100644 --- a/tools/qfcc/include/opcodes.h +++ b/tools/qfcc/include/opcodes.h @@ -40,5 +40,6 @@ pr_ushort_t opcode_get (instruction_t *inst) __attribute__((pure)); instruction_t *opcode_find (const char *name, struct operand_s *op_a, struct operand_s *op_b, struct operand_s *op_c); void opcode_init (void); +void opcode_print_statement (pr_uint_t addr, dstatement_t *st); #endif//__opcodes_h diff --git a/tools/qfcc/source/emit.c b/tools/qfcc/source/emit.c index dc5bb4b2d..ceb67622a 100644 --- a/tools/qfcc/source/emit.c +++ b/tools/qfcc/source/emit.c @@ -217,6 +217,10 @@ emit_statement (statement_t *statement) s->b = def_b ? def_b->offset : 0; s->c = def_c ? def_c->offset : 0; + if (options.verbosity >= 2) { + opcode_print_statement (pr.code->size - 1, s); + } + add_statement_def_ref (def_a, s, 0); add_statement_def_ref (def_b, s, 1); add_statement_def_ref (def_c, s, 2); diff --git a/tools/qfcc/source/opcodes.c b/tools/qfcc/source/opcodes.c index f0cc4e358..3815c54e1 100644 --- a/tools/qfcc/source/opcodes.c +++ b/tools/qfcc/source/opcodes.c @@ -351,3 +351,15 @@ opcode_init (void) rua_opcode_init (); } } + +void +opcode_print_statement (pr_uint_t addr, dstatement_t *st) +{ + const char *mnemonic; + if (options.code.progsversion < PROG_VERSION) { + mnemonic = v6p_opcode_map[st->op].opname; + } else { + mnemonic = pr_opcodes[st->op].mnemonic; + } + printf ("%04x %8s %04x %04x %04x\n", addr, mnemonic, st->a, st->b, st->c); +}