diff options
| -rw-r--r-- | main.c | 30 | 
1 files changed, 29 insertions, 1 deletions
@@ -19,7 +19,7 @@  #endif  #ifndef TRACE_PARSER -#define TRACE_PARSER 1 +#define TRACE_PARSER 0  #endif  #if defined(__GNUC__) || defined(__clang__) @@ -2947,6 +2947,22 @@ static void emit_arg(      }  } +static void emit_directive_same( +        const struct lex *const lex, +        const struct directive *const dir, +        FILE *const s) +{ +    const struct token name_token = lex->tokbuf[dir->name_token]; +    fprintf(s, "\t%.*s", (int)name_token.length, lex->input + name_token.offset); +    if (dir->num_tokens) { +        fprintf(s, "\t"); +    } +    for (size_t i = 0; i < dir->num_tokens; i++) { +        const struct token token = lex->tokbuf[dir->first_token + i]; +        fprintf(s, "%.*s ", (int)token.length, lex->input + token.offset); +    } +} +  static int assem_emit(struct assem *const self, FILE *const stream)  {      const struct lex *const lex = self->pars->lex; @@ -2978,6 +2994,18 @@ static int assem_emit(struct assem *const self, FILE *const stream)                      emit_arg(lex, &instr.arg2, stream);                  }              } +        } else if (stmt->type == ST_DIRECTIVE) { +            const struct directive *dir = &stmt->directive; +            switch (dir->type) { +            case DT_ALIGN: +            case DT_FILE: +            case DT_GLOBL: +            case DT_TEXT: +                emit_directive_same(lex, dir, stream); +                break; +            default: +                break; +            }          }          if (stmt->comment_token) {              const struct token token = lex->tokbuf[stmt->comment_token];  | 
