Browse Source

Listen to past Bill's wisdom

gingerBill 2 years ago
parent
commit
aef8b25a8e
1 changed files with 10 additions and 24 deletions
  1. 10 24
      src/llvm_backend_proc.cpp

+ 10 - 24
src/llvm_backend_proc.cpp

@@ -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 = {};
-
-					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) {
 					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);