mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Listen to past Bill's wisdom
This commit is contained in:
+10
-24
@@ -588,30 +588,16 @@ void lb_begin_procedure_body(lbProcedure *p) {
|
|||||||
if (e->token.string != "") {
|
if (e->token.string != "") {
|
||||||
GB_ASSERT(!is_blank_ident(e->token));
|
GB_ASSERT(!is_blank_ident(e->token));
|
||||||
|
|
||||||
lbAddr res = {};
|
// NOTE(bill): Don't even bother trying to optimize this with the return ptr value
|
||||||
|
// This will violate the defer rules if you do:
|
||||||
lbFunctionType *ft = p->abi_function_type;
|
// foo :: proc() -> (x, y: T) {
|
||||||
if (ft->multiple_return_original_type &&
|
// defer x = ... // defer is executed after the `defer`
|
||||||
i < results->variables.count-1) {
|
// return // the values returned should be zeroed
|
||||||
isize ret_offset = param_offset + ft->original_arg_count + i;
|
// }
|
||||||
lbValue ptr = {};
|
// NOTE(bill): REALLY, don't even bother.
|
||||||
ptr.value = LLVMGetParam(p->value, cast(unsigned)ret_offset);
|
//
|
||||||
ptr.type = alloc_type_pointer(e->type);
|
// IMPORTANT NOTE(bill): REALLY, don't even bother!!!!!!
|
||||||
res = lb_addr(ptr);
|
lbAddr res = lb_add_local(p, e->type, e);
|
||||||
|
|
||||||
lb_add_entity(p->module, e, ptr);
|
|
||||||
lb_add_debug_local_variable(p, ptr.value, e->type, e->token);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// NOTE(bill): Don't even bother trying to optimize this with the return ptr value
|
|
||||||
// This will violate the defer rules if you do:
|
|
||||||
// foo :: proc() -> (x, y: T) {
|
|
||||||
// defer x = ... // defer is executed after the `defer`
|
|
||||||
// return // the values returned should be zeroed
|
|
||||||
// }
|
|
||||||
// NOTE(bill): REALLY, don't even bother.
|
|
||||||
res = lb_add_local(p, e->type, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e->Variable.param_value.kind != ParameterValue_Invalid) {
|
if (e->Variable.param_value.kind != ParameterValue_Invalid) {
|
||||||
lbValue c = lb_handle_param_value(p, e->type, e->Variable.param_value, e->token.pos);
|
lbValue c = lb_handle_param_value(p, e->type, e->Variable.param_value, e->token.pos);
|
||||||
|
|||||||
Reference in New Issue
Block a user