mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 05:59:27 +02:00
* properly set regvarability of parameters and local variables of inlined
functions * fixed setting of expectloc for fields of regvar'ed records git-svn-id: trunk@3607 -
This commit is contained in:
parent
adec4cdcfa
commit
84d1fc929f
@ -2068,7 +2068,7 @@ type
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
tempnode := ctempcreatenode.create(tabstractvarsym(p).vartype,tabstractvarsym(p).vartype.def.size,tt_persistent,not(tabstractvarsym(p).varregable in [vr_none,vr_addr]));
|
tempnode := ctempcreatenode.create(tabstractvarsym(p).vartype,tabstractvarsym(p).vartype.def.size,tt_persistent,tabstractvarsym(p).is_regvar(false));
|
||||||
addstatement(tempinfo^.createstatement,tempnode);
|
addstatement(tempinfo^.createstatement,tempnode);
|
||||||
if assigned(tlocalvarsym(p).defaultconstsym) then
|
if assigned(tlocalvarsym(p).defaultconstsym) then
|
||||||
begin
|
begin
|
||||||
@ -2151,6 +2151,7 @@ type
|
|||||||
{ substitute the dereferenced temp in the inlined function }
|
{ substitute the dereferenced temp in the inlined function }
|
||||||
{ We can't do this if we can't take the address of the }
|
{ We can't do this if we can't take the address of the }
|
||||||
{ parameter expression, so in that case assign to a temp }
|
{ parameter expression, so in that case assign to a temp }
|
||||||
|
(para.left.expectloc in [LOC_CSUBSETREG,LOC_SUBSETREG]) or
|
||||||
((paracomplexity > 1) and
|
((paracomplexity > 1) and
|
||||||
(not valid_for_addr(para.left,false) or
|
(not valid_for_addr(para.left,false) or
|
||||||
(para.left.nodetype = calln) or
|
(para.left.nodetype = calln) or
|
||||||
@ -2205,7 +2206,7 @@ type
|
|||||||
)
|
)
|
||||||
) then
|
) then
|
||||||
begin
|
begin
|
||||||
tempnode := ctempcreatenode.create(para.parasym.vartype,para.parasym.vartype.def.size,tt_persistent,not(tparavarsym(para.parasym).varregable in [vr_none,vr_addr]));
|
tempnode := ctempcreatenode.create(para.parasym.vartype,para.parasym.vartype.def.size,tt_persistent,tparavarsym(para.parasym).is_regvar(false));
|
||||||
addstatement(createstatement,tempnode);
|
addstatement(createstatement,tempnode);
|
||||||
{ assign the value of the parameter to the temp, except in case of the function result }
|
{ assign the value of the parameter to the temp, except in case of the function result }
|
||||||
{ (in that case, para.left is a block containing the creation of a new temp, while we }
|
{ (in that case, para.left is a block containing the creation of a new temp, while we }
|
||||||
@ -2233,7 +2234,7 @@ type
|
|||||||
{ temp }
|
{ temp }
|
||||||
else if (paracomplexity > 1) then
|
else if (paracomplexity > 1) then
|
||||||
begin
|
begin
|
||||||
tempnode := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent,not(tparavarsym(para.parasym).varregable in [vr_none,vr_addr]));
|
tempnode := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent,tparavarsym(para.parasym).is_regvar(true));
|
||||||
addstatement(createstatement,tempnode);
|
addstatement(createstatement,tempnode);
|
||||||
addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
|
addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
|
||||||
caddrnode.create_internal(para.left)));
|
caddrnode.create_internal(para.left)));
|
||||||
@ -2424,13 +2425,6 @@ type
|
|||||||
expectloc:=LOC_REFERENCE;
|
expectloc:=LOC_REFERENCE;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{ for win32 records returned in EDX:EAX, we
|
|
||||||
move them to memory after ... }
|
|
||||||
if (resulttype.def.deftype=recorddef) then
|
|
||||||
begin
|
|
||||||
expectloc:=LOC_REFERENCE;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
{ ansi/widestrings must be registered, so we can dispose them }
|
{ ansi/widestrings must be registered, so we can dispose them }
|
||||||
if is_ansistring(resulttype.def) or
|
if is_ansistring(resulttype.def) or
|
||||||
is_widestring(resulttype.def) then
|
is_widestring(resulttype.def) then
|
||||||
@ -2477,8 +2471,16 @@ type
|
|||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
expectloc:=LOC_REGISTER;
|
expectloc:=procdefinition.funcretloc[callerside].loc;
|
||||||
registersint:=1;
|
if (expectloc = LOC_REGISTER) then
|
||||||
|
{$ifndef cpu64bit}
|
||||||
|
if (resulttype.def.size > sizeof(aint)) then
|
||||||
|
registersint:=2
|
||||||
|
else
|
||||||
|
{$endif cpu64bit}
|
||||||
|
registersint:=1
|
||||||
|
else
|
||||||
|
registersint:=0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
@ -313,17 +313,22 @@ implementation
|
|||||||
LOC_REGISTER,
|
LOC_REGISTER,
|
||||||
LOC_CREGISTER:
|
LOC_CREGISTER:
|
||||||
begin
|
begin
|
||||||
if (left.location.loc = LOC_REGISTER) then
|
if (left.resulttype.def.size > sizeof(aint)) then
|
||||||
location.loc := LOC_SUBSETREG
|
location_force_mem(current_asmdata.CurrAsmList,location)
|
||||||
else
|
else
|
||||||
location.loc := LOC_CSUBSETREG;
|
begin
|
||||||
location.size:=def_cgsize(resulttype.def);
|
if (left.location.loc = LOC_REGISTER) then
|
||||||
location.subsetreg := left.location.register;
|
location.loc := LOC_SUBSETREG
|
||||||
location.subsetregsize := left.location.size;
|
else
|
||||||
if (target_info.endian = ENDIAN_BIG) then
|
location.loc := LOC_CSUBSETREG;
|
||||||
location.startbit := (tcgsize2size[location.subsetregsize] - tcgsize2size[location.size] - vs.fieldoffset) * 8
|
location.size:=def_cgsize(resulttype.def);
|
||||||
else
|
location.subsetreg := left.location.register;
|
||||||
location.startbit := (vs.fieldoffset * 8);
|
location.subsetregsize := left.location.size;
|
||||||
|
if (target_info.endian = ENDIAN_BIG) then
|
||||||
|
location.startbit := (tcgsize2size[location.subsetregsize] - tcgsize2size[location.size] - vs.fieldoffset) * 8
|
||||||
|
else
|
||||||
|
location.startbit := (vs.fieldoffset * 8);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
LOC_SUBSETREG,
|
LOC_SUBSETREG,
|
||||||
LOC_CSUBSETREG:
|
LOC_CSUBSETREG:
|
||||||
|
@ -613,7 +613,20 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
expectloc:=left.expectloc;
|
case left.expectloc of
|
||||||
|
LOC_REGISTER:
|
||||||
|
// can happen for function results on win32 and darwin/x86
|
||||||
|
if (left.resulttype.def.size > sizeof(aint)) then
|
||||||
|
expectloc:=LOC_REFERENCE
|
||||||
|
else
|
||||||
|
expectloc:=LOC_SUBSETREG;
|
||||||
|
LOC_CREGISTER:
|
||||||
|
expectloc:=LOC_CSUBSETREG;
|
||||||
|
LOC_REFERENCE,
|
||||||
|
LOC_CREFERENCE:
|
||||||
|
expectloc:=left.expectloc;
|
||||||
|
else internalerror(20060521);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user