summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.c b/main.c
index 5e07ac0..e9983ba 100644
--- a/main.c
+++ b/main.c
@@ -1360,6 +1360,19 @@ static const char *opsize_to_string(const enum opsize s)
return "_unknown";
}
+static char opsize_to_char(const enum opsize s)
+{
+ switch (s) {
+ case OPSIZE_NONE: return '_';
+ case OPSIZE_S: return 's';
+ case OPSIZE_B: return 'b';
+ case OPSIZE_W: return 'w';
+ case OPSIZE_L: return 'l';
+ }
+ UNREACHABLE();
+ return '?';
+}
+
static enum mnemonic get_mnemonic_from_identifier(
const char *const str, const size_t str_length)
{
@@ -2986,6 +2999,9 @@ static int assem_emit(struct assem *const self, FILE *const stream)
if (stmt->type == ST_INSTRUCTION) {
const struct instruction instr = stmt->instruction;
fprintf(stream, "\t%s", mnemonic_to_string(instr.mnemonic));
+ if (instr.opsize != OPSIZE_NONE) {
+ fprintf(stream, ".%c", opsize_to_char(instr.opsize));
+ }
if (instr.arg1.type != ARG_NONE) {
fprintf(stream, " ");
emit_arg(lex, &instr.arg1, stream);