aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_proc.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-11-23 23:54:12 +0000
committergingerBill <bill@gingerbill.org>2022-11-23 23:54:12 +0000
commitaef8b25a8e8787759839eb6f02fea61390dc25bc (patch)
tree60bb7da0ae28d1174d6432da3c61795e888196ef /src/llvm_backend_proc.cpp
parentae81117f70ec2a7c7e99afd35f791e17ad267134 (diff)
Listen to past Bill's wisdom
Diffstat (limited to 'src/llvm_backend_proc.cpp')
-rw-r--r--src/llvm_backend_proc.cpp34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp
index b47168541..d330c90a5 100644
--- a/src/llvm_backend_proc.cpp
+++ b/src/llvm_backend_proc.cpp
@@ -588,30 +588,16 @@ void lb_begin_procedure_body(lbProcedure *p) {
if (e->token.string != "") {
GB_ASSERT(!is_blank_ident(e->token));
- lbAddr res = {};
-
- lbFunctionType *ft = p->abi_function_type;
- if (ft->multiple_return_original_type &&
- i < results->variables.count-1) {
- isize ret_offset = param_offset + ft->original_arg_count + i;
- lbValue ptr = {};
- ptr.value = LLVMGetParam(p->value, cast(unsigned)ret_offset);
- ptr.type = alloc_type_pointer(e->type);
- res = lb_addr(ptr);
-
- 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);
- }
+ // 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.
+ //
+ // IMPORTANT NOTE(bill): REALLY, don't even bother!!!!!!
+ lbAddr res = lb_add_local(p, e->type, e);
if (e->Variable.param_value.kind != ParameterValue_Invalid) {
lbValue c = lb_handle_param_value(p, e->type, e->Variable.param_value, e->token.pos);