* create_paraloc_info() is now called separately for the caller and

callee info
  * fixed ppc cycle
This commit is contained in:
Jonas Maebe 2003-07-05 20:11:41 +00:00
parent 37d266b63d
commit 70a5d1e4c2
5 changed files with 83 additions and 39 deletions

View File

@ -47,7 +47,7 @@ unit cpupara;
function getintparaloc(list: taasmoutput; nr : longint) : tparalocation;override;
procedure freeintparaloc(list: taasmoutput; nr : longint); override;
function getparaloc(p : tdef) : tcgloc;
procedure create_paraloc_info(p : tabstractprocdef);override;
procedure create_paraloc_info(p : tabstractprocdef; side: tcallercallee);override;
function getselflocation(p : tabstractprocdef) : tparalocation;override;
end;
@ -132,7 +132,7 @@ unit cpupara;
end;
procedure ti386paramanager.create_paraloc_info(p : tabstractprocdef);
procedure ti386paramanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee);
var
hp : tparaitem;
paraloc : tparalocation;
@ -153,9 +153,11 @@ unit cpupara;
paraloc.reference.index.number:=NR_FRAME_POINTER_REG;
end;
paraloc.reference.offset:=tvarsym(hp.parasym).adjusted_address;
hp.calleeparaloc:=paraloc;
if side = callerside then
hp.callerparaloc:=paraloc
{$warning callerparaloc shall not be the same as calleeparaloc}
hp.callerparaloc:=paraloc;
else
hp.calleeparaloc:=paraloc;
hp:=tparaitem(hp.next);
end;
end;
@ -180,7 +182,12 @@ begin
end.
{
$Log$
Revision 1.20 2003-07-02 22:18:04 peter
Revision 1.21 2003-07-05 20:11:41 jonas
* create_paraloc_info() is now called separately for the caller and
callee info
* fixed ppc cycle
Revision 1.20 2003/07/02 22:18:04 peter
* paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates

View File

@ -35,6 +35,7 @@ unit paramgr;
symconst,symtype,symdef;
type
tcallercallee = (callerside,calleeside);
{# This class defines some methods to take care of routine
parameters. It should be overriden for each new processor
}
@ -95,9 +96,9 @@ unit paramgr;
procedure freeparaloc(list: taasmoutput; const loc: tparalocation); virtual;
{# This is used to populate the location information on all parameters
for the routine. This is used for normal call resolution.
for the routine as seen in either the caller or the callee. This is used for normal call resolution.
}
procedure create_paraloc_info(p : tabstractprocdef);virtual;abstract;
procedure create_paraloc_info(p : tabstractprocdef; side: tcallercallee);virtual;abstract;
{
Returns the location where the invisible parameter for structured
@ -442,7 +443,12 @@ end.
{
$Log$
Revision 1.47 2003-07-02 22:18:04 peter
Revision 1.48 2003-07-05 20:11:41 jonas
* create_paraloc_info() is now called separately for the caller and
callee info
* fixed ppc cycle
Revision 1.47 2003/07/02 22:18:04 peter
* paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates

View File

@ -1190,7 +1190,7 @@ const
end;
{ compute end of gpr save area }
a_op_const_reg(list,OP_ADD,OS_ADDR,href.offset+8,r);
a_op_const_reg(list,OP_ADD,OS_ADDR,aword(href.offset+8),r);
end;
{ save gprs and fetch GOT pointer }
@ -1238,7 +1238,7 @@ const
if (hp.calleeparaloc.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
begin
reference_reset_base(href,current_procinfo.framepointer,tvarsym(hp.parasym).adjusted_address);
reference_reset_base(href2,r,hp.calleeparaloc.reference.offset);
reference_reset_base(href2,r,hp.callerparaloc.reference.offset);
cg.a_load_ref_ref(list,hp.calleeparaloc.size,hp.calleeparaloc.size,href2,href);
end;
hp := tparaitem(hp.next);
@ -2620,8 +2620,8 @@ const
case op of
OP_AND,OP_OR,OP_XOR:
begin
cg.a_op_const_reg_reg(list,op,OS_32,cardinal(value),regsrc.reglo,regdst.reglo);
cg.a_op_const_reg_reg(list,op,OS_32,value shr 32,regsrc.reghi,
cg.a_op_const_reg_reg(list,op,OS_32,aword(value),regsrc.reglo,regdst.reglo);
cg.a_op_const_reg_reg(list,op,OS_32,aword(value shr 32),regsrc.reghi,
regdst.reghi);
end;
OP_ADD, OP_SUB:
@ -2686,7 +2686,7 @@ const
else
begin
cg.a_load_reg_reg(list,OS_INT,OS_INT,regsrc.reglo,regdst.reglo);
cg.a_op_const_reg_reg(list,op,OS_32,value shr 32,regsrc.reghi,
cg.a_op_const_reg_reg(list,op,OS_32,aword(value shr 32),regsrc.reghi,
regdst.reghi);
end;
end;
@ -2702,7 +2702,12 @@ begin
end.
{
$Log$
Revision 1.111 2003-07-02 22:18:04 peter
Revision 1.112 2003-07-05 20:11:42 jonas
* create_paraloc_info() is now called separately for the caller and
callee info
* fixed ppc cycle
Revision 1.111 2003/07/02 22:18:04 peter
* paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates

View File

@ -38,7 +38,7 @@ unit cpupara;
function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;override;
function getintparaloc(list: taasmoutput; nr : longint) : tparalocation;override;
procedure freeintparaloc(list: taasmoutput; nr : longint); override;
procedure create_paraloc_info(p : tabstractprocdef);override;
procedure create_paraloc_info(p : tabstractprocdef; side: tcallercallee);override;
function getfuncretparaloc(p : tabstractprocdef) : tparalocation;override;
end;
@ -48,7 +48,7 @@ unit cpupara;
verbose,systems,
cpuinfo,cginfo,cgbase,
rgobj,
defutil;
defutil,symsym;
function tppcparamanager.getintparaloc(list: taasmoutput; nr : longint) : tparalocation;
@ -167,7 +167,7 @@ unit cpupara;
end;
end;
procedure tppcparamanager.create_paraloc_info(p : tabstractprocdef);
procedure tppcparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee);
var
nextintreg,nextfloatreg,nextmmreg : tregister;
@ -225,10 +225,15 @@ unit cpupara;
while assigned(hp) do
begin
if (hp.paratyp in [vs_var,vs_out]) then
paradef := voidpointertype.def
begin
paradef := voidpointertype.def;
loc := LOC_REGISTER;
end
else
paradef := hp.paratype.def;
loc:=getparaloc(paradef);
begin
paradef := hp.paratype.def;
loc:=getparaloc(paradef);
end;
{ make sure all alignment bytes are 0 as well }
fillchar(paraloc,sizeof(paraloc),0);
case loc of
@ -307,12 +312,19 @@ unit cpupara;
else
internalerror(2002071002);
end;
hp.callerparaloc:=paraloc;
hp.calleeparaloc:=paraloc;
if side = callerside then
hp.callerparaloc:=paraloc
else
begin
if (paraloc.loc = LOC_REFERENCE) then
paraloc.reference.offset := tvarsym(hp.parasym).adjusted_address;
hp.calleeparaloc:=paraloc;
end;
hp:=tparaitem(hp.next);
end;
end;
function tppcparamanager.getfuncretparaloc(p : tabstractprocdef) : tparalocation;
begin
fillchar(result,sizeof(result),0);
@ -374,7 +386,12 @@ begin
end.
{
$Log$
Revision 1.40 2003-07-02 22:18:04 peter
Revision 1.41 2003-07-05 20:11:41 jonas
* create_paraloc_info() is now called separately for the caller and
callee info
* fixed ppc cycle
Revision 1.40 2003/07/02 22:18:04 peter
* paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates

View File

@ -39,7 +39,7 @@ interface
{Creates location information related to the parameter of the function}
procedure allocparaloc(list: taasmoutput; const loc: tparalocation);override;
procedure freeparaloc(list: taasmoutput; const loc: tparalocation);override;
procedure create_paraloc_info(p:TAbstractProcDef);override;
procedure create_paraloc_info(p:TAbstractProcDef; side: tcallercallee);override;
{Returns the location where the invisible parameter for structured function
results will be passed.}
function GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;override;
@ -119,7 +119,7 @@ implementation
end;
procedure TSparcParaManager.create_paraloc_info(p:TAbstractProcDef);
procedure TSparcParaManager.create_paraloc_info(p:TAbstractProcDef; side: tcallercallee);
var
nextintreg : tsuperregister;
nextfloatreg : toldregister;
@ -177,21 +177,25 @@ implementation
else
inc(stack_offset,4);
end;
hp.callerparaloc:=paraloc;
{ update callee paraloc and use Ix registers instead
of Ox registers }
hp.calleeparaloc:=paraloc;
if hp.calleeparaloc.loc=LOC_REGISTER then
begin
inc(hp.calleeparaloc.registerlow.number,(RS_I0-RS_O0) shl 8);
if is_64bit then
inc(hp.calleeparaloc.registerhigh.number,(RS_I0-RS_O0) shl 8);
end
if side = callerside then
hp.callerparaloc:=paraloc
else
begin
if hp.calleeparaloc.low_in_reg then
inc(hp.calleeparaloc.lowreg.number,(RS_I0-RS_O0) shl 8);
inc(hp.calleeparaloc.reference.index.number,(RS_I0-RS_O0) shl 8);
{ update callee paraloc and use Ix registers instead
of Ox registers }
hp.calleeparaloc:=paraloc;
if hp.calleeparaloc.loc=LOC_REGISTER then
begin
inc(hp.calleeparaloc.registerlow.number,(RS_I0-RS_O0) shl 8);
if is_64bit then
inc(hp.calleeparaloc.registerhigh.number,(RS_I0-RS_O0) shl 8);
end
else
begin
if hp.calleeparaloc.low_in_reg then
inc(hp.calleeparaloc.lowreg.number,(RS_I0-RS_O0) shl 8);
inc(hp.calleeparaloc.reference.index.number,(RS_I0-RS_O0) shl 8);
end;
end;
hp:=TParaItem(hp.Next);
end;
@ -271,7 +275,12 @@ begin
end.
{
$Log$
Revision 1.22 2003-07-02 22:18:04 peter
Revision 1.23 2003-07-05 20:11:41 jonas
* create_paraloc_info() is now called separately for the caller and
callee info
* fixed ppc cycle
Revision 1.22 2003/07/02 22:18:04 peter
* paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates