mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-18 03:12:10 +00:00
Fix scratch register pinning
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -92,7 +92,7 @@ struct lbAsmGenerate {
|
||||
}
|
||||
|
||||
|
||||
gbString write_operand(gbString asm_string, Array<i32> op_number, Ast *op, u32 flags) {
|
||||
gbString write_operand(gbString asm_string, Array<i32> 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user