Infer asm #side_effects where possible from the mnemonics

This commit is contained in:
gingerBill
2026-08-12 14:52:37 +01:00
parent ecb4495e81
commit 43f078aedc
3 changed files with 27 additions and 8 deletions

View File

@@ -480,21 +480,18 @@ struct lbAsmGenerate_amd64 : lbAsmGenerate {
LLVMTypeRef fn_ty = LLVMFunctionType(ret_ty, param_types.data, cast(unsigned)param_types.count, /*vararg*/false);
// TODO(bill): determine all the cases when side-effects happen
bool has_side_effects = tmpl_node->has_side_effects;
LLVMValueRef ia = LLVMGetInlineAsm(
fn_ty,
asm_string, cast(size_t)gb_string_length(asm_string),
constraints, cast(size_t)gb_string_length(constraints),
/*HasSideEffects*/ has_side_effects,
/*IsAlignStack*/ tmpl_node->is_align_stack,
/*HasSideEffects*/ tmpl_entity->AsmTemplate.has_side_effects,
/*IsAlignStack*/ tmpl_entity->AsmTemplate.is_align_stack,
LLVMInlineAsmDialectATT,
/*CanThrow*/ false);
LLVMValueRef call = LLVMBuildCall2(p->builder, fn_ty, ia, call_args.data, cast(unsigned)call_args.count, "");
if (false) {
if (true) {
// DEBUG PRINT!!!
// DEBUG PRINT!!!
// DEBUG PRINT!!!