* use the def of the paraloc rather than the parasym's vardef in

gen_load_para_value(), as this may be different depending on
    the calling conventions
  * adapt llvm's gen_load_cgpara_loc() to use this passed def rather
    than hardcoding the para's def (although these will normally match)

git-svn-id: trunk@31050 -
This commit is contained in:
Jonas Maebe 2015-06-13 22:48:08 +00:00
parent b9c9422fa7
commit 1019a6b090
2 changed files with 9 additions and 7 deletions

View File

@ -4863,7 +4863,9 @@ implementation
for i:=0 to current_procinfo.procdef.paras.count-1 do
begin
currpara:=tparavarsym(current_procinfo.procdef.paras[i]);
gen_load_cgpara_loc(list,currpara.vardef,currpara.paraloc[calleeside],currpara.initialloc,paramanager.param_use_paraloc(currpara.paraloc[calleeside]));
{ don't use currpara.vardef, as this will be wrong in case of
call-by-reference parameters (it won't contain the pointer) }
gen_load_cgpara_loc(list,currpara.paraloc[calleeside].def,currpara.paraloc[calleeside],currpara.initialloc,paramanager.param_use_paraloc(currpara.paraloc[calleeside]));
end;
{ generate copies of call by value parameters, must be done before

View File

@ -1382,26 +1382,26 @@ implementation
case def2regtyp(llvmparadef) of
R_INTREGISTER,
R_ADDRESSREGISTER:
a_load_loc_ref(list,llvmparadef,para.def,hloc,destloc.reference);
a_load_loc_ref(list,llvmparadef,vardef,hloc,destloc.reference);
R_FPUREGISTER:
a_loadfpu_loc_ref(list,llvmparadef,para.def,hloc,destloc.reference);
a_loadfpu_loc_ref(list,llvmparadef,vardef,hloc,destloc.reference);
R_MMREGISTER:
a_loadmm_loc_ref(list,llvmparadef,para.def,hloc,destloc.reference,nil);
a_loadmm_loc_ref(list,llvmparadef,vardef,hloc,destloc.reference,nil);
else
internalerror(2014080801);
end;
end;
LOC_REGISTER:
begin
a_load_loc_reg(list,llvmparadef,para.def,hloc,destloc.register);
a_load_loc_reg(list,llvmparadef,vardef,hloc,destloc.register);
end;
LOC_FPUREGISTER:
begin
a_loadfpu_loc_reg(list,llvmparadef,para.def,hloc,destloc.register);
a_loadfpu_loc_reg(list,llvmparadef,vardef,hloc,destloc.register);
end;
LOC_MMREGISTER:
begin
a_loadmm_loc_reg(list,llvmparadef,para.def,hloc,destloc.register,nil);
a_loadmm_loc_reg(list,llvmparadef,vardef,hloc,destloc.register,nil);
end;
{ TODO other possible locations }
else