From 03c627f646eaaa20f17c594cf1b564163a69e8e5 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 13 Sep 2022 19:15:17 +0200 Subject: [PATCH] Fix asm string bug. --- src/compiler/compiler_internal.h | 2 +- src/compiler/copying.c | 2 +- src/compiler/llvm_codegen_stmt.c | 4 ++-- src/compiler/parse_stmt.c | 4 ++-- src/compiler/sema_stmts.c | 4 ++-- src/version.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/compiler_internal.h b/src/compiler/compiler_internal.h index 66b98d146..7cdc3cda1 100644 --- a/src/compiler/compiler_internal.h +++ b/src/compiler/compiler_internal.h @@ -1328,7 +1328,7 @@ typedef struct bool is_volatile : 1; bool is_inline : 1; bool is_goto : 1; - bool string : 1; + bool is_string : 1; union { AsmInlineBlock *block; diff --git a/src/compiler/copying.c b/src/compiler/copying.c index c466e7883..4a557a68b 100644 --- a/src/compiler/copying.c +++ b/src/compiler/copying.c @@ -417,7 +417,7 @@ RETRY: doc_ast_copy(c, &source->doc_stmt); break; case AST_ASM_BLOCK_STMT: - if (ast->asm_block_stmt.string) + if (ast->asm_block_stmt.is_string) { MACRO_COPY_EXPRID(ast->asm_block_stmt.asm_string); } diff --git a/src/compiler/llvm_codegen_stmt.c b/src/compiler/llvm_codegen_stmt.c index 9fd686381..f8e9662cc 100644 --- a/src/compiler/llvm_codegen_stmt.c +++ b/src/compiler/llvm_codegen_stmt.c @@ -1060,7 +1060,7 @@ static inline void llvm_emit_asm_block_stmt(GenContext *c, Ast *ast) unsigned result_count = 0; unsigned param_count = 0; AsmInlineBlock *block = ast->asm_block_stmt.block; - if (ast->asm_block_stmt.string) + if (ast->asm_block_stmt.is_string) { data = exprptr(ast->asm_block_stmt.asm_string)->const_expr.string.chars; } @@ -1187,7 +1187,7 @@ static inline void llvm_emit_asm_block_stmt(GenContext *c, Ast *ast) strlen(clobbers), ast->asm_block_stmt.is_volatile, true, - ast->asm_block_stmt.string ? LLVMInlineAsmDialectIntel : LLVMInlineAsmDialectATT + ast->asm_block_stmt.is_string ? LLVMInlineAsmDialectIntel : LLVMInlineAsmDialectATT #if LLVM_VERSION_MAJOR > 12 , /* can throw */ false #endif diff --git a/src/compiler/parse_stmt.c b/src/compiler/parse_stmt.c index 4284bcf99..8ec646c10 100644 --- a/src/compiler/parse_stmt.c +++ b/src/compiler/parse_stmt.c @@ -308,10 +308,10 @@ static inline Ast* parse_asm_block_stmt(ParseContext *c) ast->asm_block_stmt.block = block; return ast; } - ast->asm_block_stmt.string = true; + ast->asm_block_stmt.is_string = true; // TODO use attributes, like volatile CONSUME_OR_RET(TOKEN_LPAREN, poisoned_ast); - ASSIGN_EXPRID_OR_RET(ast->asm_block_stmt.string, parse_expr(c), poisoned_ast); + ASSIGN_EXPRID_OR_RET(ast->asm_block_stmt.asm_string, parse_expr(c), poisoned_ast); ast->asm_block_stmt.is_volatile = true; CONSUME_OR_RET(TOKEN_RPAREN, poisoned_ast); RANGE_EXTEND_PREV(ast); diff --git a/src/compiler/sema_stmts.c b/src/compiler/sema_stmts.c index 1652e6f17..a276fde47 100644 --- a/src/compiler/sema_stmts.c +++ b/src/compiler/sema_stmts.c @@ -1348,7 +1348,7 @@ static inline bool sema_analyse_if_stmt(SemaContext *context, Ast *statement) static bool sema_analyse_asm_string_stmt(SemaContext *context, Ast *stmt) { - Expr *body = exprptr(stmt->asm_block_stmt.string); + Expr *body = exprptr(stmt->asm_block_stmt.asm_string); if (!sema_analyse_expr(context, body)) return false; if (!expr_is_const_string(body)) { @@ -1360,7 +1360,7 @@ static bool sema_analyse_asm_string_stmt(SemaContext *context, Ast *stmt) static bool sema_analyse_asm_stmt(SemaContext *context, Ast *stmt) { - if (stmt->asm_block_stmt.string) return sema_analyse_asm_string_stmt(context, stmt); + if (stmt->asm_block_stmt.is_string) return sema_analyse_asm_string_stmt(context, stmt); AsmInlineBlock *block = stmt->asm_block_stmt.block; AstId ast_id = block->asm_stmt; scratch_buffer_clear(); diff --git a/src/version.h b/src/version.h index d6259dea1..54443ef6e 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.3.39" \ No newline at end of file +#define COMPILER_VERSION "0.3.40" \ No newline at end of file