* 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; function getintparaloc(list: taasmoutput; nr : longint) : tparalocation;override;
procedure freeintparaloc(list: taasmoutput; nr : longint); override; procedure freeintparaloc(list: taasmoutput; nr : longint); override;
function getparaloc(p : tdef) : tcgloc; 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; function getselflocation(p : tabstractprocdef) : tparalocation;override;
end; end;
@ -132,7 +132,7 @@ unit cpupara;
end; end;
procedure ti386paramanager.create_paraloc_info(p : tabstractprocdef); procedure ti386paramanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee);
var var
hp : tparaitem; hp : tparaitem;
paraloc : tparalocation; paraloc : tparalocation;
@ -153,9 +153,11 @@ unit cpupara;
paraloc.reference.index.number:=NR_FRAME_POINTER_REG; paraloc.reference.index.number:=NR_FRAME_POINTER_REG;
end; end;
paraloc.reference.offset:=tvarsym(hp.parasym).adjusted_address; 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} {$warning callerparaloc shall not be the same as calleeparaloc}
hp.callerparaloc:=paraloc; else
hp.calleeparaloc:=paraloc;
hp:=tparaitem(hp.next); hp:=tparaitem(hp.next);
end; end;
end; end;
@ -180,7 +182,12 @@ begin
end. end.
{ {
$Log$ $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 * paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates * sparc calling convention updates

View File

@ -35,6 +35,7 @@ unit paramgr;
symconst,symtype,symdef; symconst,symtype,symdef;
type type
tcallercallee = (callerside,calleeside);
{# This class defines some methods to take care of routine {# This class defines some methods to take care of routine
parameters. It should be overriden for each new processor parameters. It should be overriden for each new processor
} }
@ -95,9 +96,9 @@ unit paramgr;
procedure freeparaloc(list: taasmoutput; const loc: tparalocation); virtual; procedure freeparaloc(list: taasmoutput; const loc: tparalocation); virtual;
{# This is used to populate the location information on all parameters {# 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 Returns the location where the invisible parameter for structured
@ -442,7 +443,12 @@ end.
{ {
$Log$ $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 * paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates * sparc calling convention updates

View File

@ -1190,7 +1190,7 @@ const
end; end;
{ compute end of gpr save area } { 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; end;
{ save gprs and fetch GOT pointer } { save gprs and fetch GOT pointer }
@ -1238,7 +1238,7 @@ const
if (hp.calleeparaloc.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then if (hp.calleeparaloc.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
begin begin
reference_reset_base(href,current_procinfo.framepointer,tvarsym(hp.parasym).adjusted_address); 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); cg.a_load_ref_ref(list,hp.calleeparaloc.size,hp.calleeparaloc.size,href2,href);
end; end;
hp := tparaitem(hp.next); hp := tparaitem(hp.next);
@ -2620,8 +2620,8 @@ const
case op of case op of
OP_AND,OP_OR,OP_XOR: OP_AND,OP_OR,OP_XOR:
begin 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,aword(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 shr 32),regsrc.reghi,
regdst.reghi); regdst.reghi);
end; end;
OP_ADD, OP_SUB: OP_ADD, OP_SUB:
@ -2686,7 +2686,7 @@ const
else else
begin begin
cg.a_load_reg_reg(list,OS_INT,OS_INT,regsrc.reglo,regdst.reglo); 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); regdst.reghi);
end; end;
end; end;
@ -2702,7 +2702,12 @@ begin
end. end.
{ {
$Log$ $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 * paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates * sparc calling convention updates

View File

@ -38,7 +38,7 @@ unit cpupara;
function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;override; function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;override;
function getintparaloc(list: taasmoutput; nr : longint) : tparalocation;override; function getintparaloc(list: taasmoutput; nr : longint) : tparalocation;override;
procedure freeintparaloc(list: taasmoutput; nr : longint); 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; function getfuncretparaloc(p : tabstractprocdef) : tparalocation;override;
end; end;
@ -48,7 +48,7 @@ unit cpupara;
verbose,systems, verbose,systems,
cpuinfo,cginfo,cgbase, cpuinfo,cginfo,cgbase,
rgobj, rgobj,
defutil; defutil,symsym;
function tppcparamanager.getintparaloc(list: taasmoutput; nr : longint) : tparalocation; function tppcparamanager.getintparaloc(list: taasmoutput; nr : longint) : tparalocation;
@ -167,7 +167,7 @@ unit cpupara;
end; end;
end; end;
procedure tppcparamanager.create_paraloc_info(p : tabstractprocdef); procedure tppcparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee);
var var
nextintreg,nextfloatreg,nextmmreg : tregister; nextintreg,nextfloatreg,nextmmreg : tregister;
@ -225,10 +225,15 @@ unit cpupara;
while assigned(hp) do while assigned(hp) do
begin begin
if (hp.paratyp in [vs_var,vs_out]) then if (hp.paratyp in [vs_var,vs_out]) then
paradef := voidpointertype.def begin
paradef := voidpointertype.def;
loc := LOC_REGISTER;
end
else else
paradef := hp.paratype.def; begin
loc:=getparaloc(paradef); paradef := hp.paratype.def;
loc:=getparaloc(paradef);
end;
{ make sure all alignment bytes are 0 as well } { make sure all alignment bytes are 0 as well }
fillchar(paraloc,sizeof(paraloc),0); fillchar(paraloc,sizeof(paraloc),0);
case loc of case loc of
@ -307,12 +312,19 @@ unit cpupara;
else else
internalerror(2002071002); internalerror(2002071002);
end; end;
hp.callerparaloc:=paraloc; if side = callerside then
hp.calleeparaloc:=paraloc; 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); hp:=tparaitem(hp.next);
end; end;
end; end;
function tppcparamanager.getfuncretparaloc(p : tabstractprocdef) : tparalocation; function tppcparamanager.getfuncretparaloc(p : tabstractprocdef) : tparalocation;
begin begin
fillchar(result,sizeof(result),0); fillchar(result,sizeof(result),0);
@ -374,7 +386,12 @@ begin
end. end.
{ {
$Log$ $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 * paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates * sparc calling convention updates

View File

@ -39,7 +39,7 @@ interface
{Creates location information related to the parameter of the function} {Creates location information related to the parameter of the function}
procedure allocparaloc(list: taasmoutput; const loc: tparalocation);override; procedure allocparaloc(list: taasmoutput; const loc: tparalocation);override;
procedure freeparaloc(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 {Returns the location where the invisible parameter for structured function
results will be passed.} results will be passed.}
function GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;override; function GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;override;
@ -119,7 +119,7 @@ implementation
end; end;
procedure TSparcParaManager.create_paraloc_info(p:TAbstractProcDef); procedure TSparcParaManager.create_paraloc_info(p:TAbstractProcDef; side: tcallercallee);
var var
nextintreg : tsuperregister; nextintreg : tsuperregister;
nextfloatreg : toldregister; nextfloatreg : toldregister;
@ -177,21 +177,25 @@ implementation
else else
inc(stack_offset,4); inc(stack_offset,4);
end; end;
hp.callerparaloc:=paraloc; if side = callerside then
{ update callee paraloc and use Ix registers instead hp.callerparaloc:=paraloc
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 else
begin begin
if hp.calleeparaloc.low_in_reg then { update callee paraloc and use Ix registers instead
inc(hp.calleeparaloc.lowreg.number,(RS_I0-RS_O0) shl 8); of Ox registers }
inc(hp.calleeparaloc.reference.index.number,(RS_I0-RS_O0) shl 8); 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; end;
hp:=TParaItem(hp.Next); hp:=TParaItem(hp.Next);
end; end;
@ -271,7 +275,12 @@ begin
end. end.
{ {
$Log$ $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 * paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates * sparc calling convention updates