From 77bedf9947ed1c6c77e0ddb67a5d135ba448f4fb Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 17 Aug 2026 21:37:03 +0100 Subject: [PATCH] Fix scratch register pinning --- src/check_asm.cpp | 2 ++ src/llvm_backend_asm.cpp | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/check_asm.cpp b/src/check_asm.cpp index 50515a490..f124168f3 100644 --- a/src/check_asm.cpp +++ b/src/check_asm.cpp @@ -1050,6 +1050,8 @@ gb_internal void check_asm_instruction_operand(AsmCtx *asm_ctx, CheckerContext * check_expr(ctx, operand, expr); if (operand->mode != Addressing_Constant) { error(expr, "Asm operands within parentheses can only compile time constants"); + } else { + error(expr, "Asm operands with parentheses are not currently supported"); } return; case_end; diff --git a/src/llvm_backend_asm.cpp b/src/llvm_backend_asm.cpp index 215d0e7d5..2fc957377 100644 --- a/src/llvm_backend_asm.cpp +++ b/src/llvm_backend_asm.cpp @@ -92,7 +92,7 @@ struct lbAsmGenerate { } - gbString write_operand(gbString asm_string, Array op_number, Ast *op, u32 flags) { + gbString write_operand(gbString asm_string, Array const &op_number, Ast *op, u32 flags) { if (op->tav.mode == Addressing_Constant) { return write_constant_operand(asm_string, op, flags); } @@ -387,14 +387,13 @@ struct lbAsmGenerate_amd64 : lbAsmGenerate { array_add(&ret_types, LLVMInt8TypeInContext(ctx)); // Counted in $N even though never referenced in the body. - op_number[i] = next_op++; + op_number[i] = next_op++; continue; } bool is_output = e.param_group == AsmTemplateEntityDeclParamGroup_Output; bool is_alloc_scratch = e.param_group == AsmTemplateEntityDeclParamGroup_Scratch - && e.kind == AsmTemplateEntityDecl_Register - && e.pin.len == 0; + && e.kind == AsmTemplateEntityDecl_Register; if (!is_output && !is_alloc_scratch) { continue; }