From 70ffaba9019def499ca3b6a175539e5e26b08e1a Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 25 Apr 2015 15:51:04 +0000 Subject: [PATCH] * ensure that the loading of the uninitialised function result for llvm doesn't result in a temp allocation, since this can happen while generating the exit code git-svn-id: trunk@30711 - --- compiler/llvm/hlcgllvm.pas | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/llvm/hlcgllvm.pas b/compiler/llvm/hlcgllvm.pas index dba5b60f64..679ed48d08 100644 --- a/compiler/llvm/hlcgllvm.pas +++ b/compiler/llvm/hlcgllvm.pas @@ -1114,14 +1114,20 @@ implementation procedure thlcgllvm.gen_load_uninitialized_function_result(list: TAsmList; pd: tprocdef; resdef: tdef; const resloc: tcgpara); - var - reg: tregister; begin if not paramanager.ret_in_param(resdef,pd) then begin - reg:=getregisterfordef(list,resdef); - list.concat(taillvm.op_reg_size_undef(la_bitcast,reg,resdef)); - a_load_reg_cgpara(list,resdef,reg,resloc); + case resloc.location^.loc of + LOC_REGISTER, + LOC_FPUREGISTER, + LOC_MMREGISTER: + begin + resloc.check_simple_location; + list.concat(taillvm.op_reg_size_undef(la_bitcast,resloc.location^.register,resloc.location^.def)); + end; + else + internalerror(2015042301); + end; end; end;