Browse Source

* 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 -

Jonas Maebe 10 years ago
parent
commit
70ffaba901
1 changed files with 11 additions and 5 deletions
  1. 11 5
      compiler/llvm/hlcgllvm.pas

+ 11 - 5
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;