* do not generate moves unncesssarily in tcgloadparentfpnode.pass_generate_code

git-svn-id: trunk@45162 -
This commit is contained in:
florian 2020-04-28 21:25:42 +00:00
parent 8aacea8850
commit 50c221670f

View File

@ -167,29 +167,34 @@ implementation
end end
else else
begin begin
currpi:=current_procinfo;
location_reset(location,LOC_REGISTER,def_cgsize(parentfpvoidpointertype)); location_reset(location,LOC_REGISTER,def_cgsize(parentfpvoidpointertype));
location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,parentfpvoidpointertype); currpi:=current_procinfo;
{ load framepointer of current proc } { load framepointer of current proc }
hsym:=tparavarsym(currpi.procdef.parast.Find('parentfp')); hsym:=tparavarsym(currpi.procdef.parast.Find('parentfp'));
if not assigned(hsym) then if not assigned(hsym) then
internalerror(200309281); internalerror(200309281);
hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,parentfpvoidpointertype,parentfpvoidpointertype,hsym.localloc,location.register); if (currpi.procdef.owner.symtablelevel=parentpd.parast.symtablelevel) and (hsym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER]) then
{ walk parents } location.register:=hsym.localloc.register
while (currpi.procdef.owner.symtablelevel>parentpd.parast.symtablelevel) do else
begin begin
currpi:=currpi.parent; location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,parentfpvoidpointertype);
if not assigned(currpi) then hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,parentfpvoidpointertype,parentfpvoidpointertype,hsym.localloc,location.register);
internalerror(200311201); { walk parents }
hsym:=tparavarsym(currpi.procdef.parast.Find('parentfp')); while (currpi.procdef.owner.symtablelevel>parentpd.parast.symtablelevel) do
if not assigned(hsym) then begin
internalerror(200309282); currpi:=currpi.parent;
if not assigned(currpi) then
internalerror(200311201);
hsym:=tparavarsym(currpi.procdef.parast.Find('parentfp'));
if not assigned(hsym) then
internalerror(200309282);
if hsym.localloc.loc<>LOC_REFERENCE then if hsym.localloc.loc<>LOC_REFERENCE then
internalerror(200309283); internalerror(200309283);
hlcg.reference_reset_base(href,parentfpvoidpointertype,location.register,hsym.localloc.reference.offset,ctempposinvalid,parentfpvoidpointertype.alignment,[]); hlcg.reference_reset_base(href,parentfpvoidpointertype,location.register,hsym.localloc.reference.offset,ctempposinvalid,parentfpvoidpointertype.alignment,[]);
hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,parentfpvoidpointertype,parentfpvoidpointertype,href,location.register); hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,parentfpvoidpointertype,parentfpvoidpointertype,href,location.register);
end;
end; end;
end; end;
end; end;