mirror of
https://github.com/odin-lang/Odin.git
synced 2026-09-03 18:50:20 +00:00
Merge pull request #7271 from odin-lang/bill/inline-asm
`asm` templates
This commit is contained in:
@@ -5127,6 +5127,7 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr, lbVal
|
||||
|
||||
// NOTE(bill): Regular call
|
||||
lbValue value = {};
|
||||
Entity *asm_template = nullptr;
|
||||
|
||||
if (proc_entity != nullptr) {
|
||||
if (proc_entity->flags & EntityFlag_Disabled) {
|
||||
@@ -5160,15 +5161,25 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr, lbVal
|
||||
}
|
||||
}
|
||||
}
|
||||
Type *proc_value_type = nullptr;
|
||||
|
||||
if (is_objc_call) {
|
||||
value.type = proc_tv.type;
|
||||
proc_value_type = value.type;
|
||||
} else if (value.value == nullptr) {
|
||||
value = lb_build_expr(p, proc_expr);
|
||||
Entity *found = entity_of_node(proc_expr);
|
||||
if (found && found->kind == Entity_AsmTemplate) {
|
||||
asm_template = found;
|
||||
proc_value_type = asm_template->type;
|
||||
} else {
|
||||
value = lb_build_expr(p, proc_expr);
|
||||
proc_value_type = value.type;
|
||||
}
|
||||
}
|
||||
|
||||
GB_ASSERT(value.value != nullptr || is_objc_call);
|
||||
Type *proc_type_ = base_type(value.type);
|
||||
|
||||
GB_ASSERT(value.value != nullptr || is_objc_call || asm_template != nullptr);
|
||||
Type *proc_type_ = base_type(proc_value_type);
|
||||
GB_ASSERT(proc_type_->kind == Type_Proc);
|
||||
TypeProc *pt = &proc_type_->Proc;
|
||||
|
||||
@@ -5387,6 +5398,11 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr, lbVal
|
||||
}
|
||||
}
|
||||
|
||||
return lb_emit_call(p, value, call_args, inlining, tailing, sret_dst);
|
||||
if (asm_template != nullptr) {
|
||||
GB_ASSERT(value.value == nullptr);
|
||||
return lb_emit_asm_template_call(p, asm_template, call_args);
|
||||
} else {
|
||||
return lb_emit_call(p, value, call_args, inlining, tailing, sret_dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user