mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 17:19:19 +02:00
* debugging register allocation
This commit is contained in:
parent
87d602ac5b
commit
754077f199
@ -35,10 +35,10 @@ uses
|
||||
cpubase,
|
||||
symconst,symbase,symtype,symdef,paramgr;
|
||||
type
|
||||
tSparcparamanager = class(tparamanager)
|
||||
function getintparaloc(nr : longint) : tparalocation;override;
|
||||
procedure create_param_loc_info(p : tabstractprocdef);override;
|
||||
function getfuncretparaloc(p : tabstractprocdef) : tparalocation;override;
|
||||
TSparcParaManager=class(TParaManager)
|
||||
function GetIntParaLoc(nr:longint):TParaLocation;override;
|
||||
procedure create_param_loc_info(p:TAbstractProcDef);override;
|
||||
function GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;override;
|
||||
end;
|
||||
implementation
|
||||
uses
|
||||
@ -46,38 +46,38 @@ uses
|
||||
globtype,
|
||||
cpuinfo,cginfo,cgbase,
|
||||
defbase;
|
||||
function TSparcParaManager.getintparaloc(nr:longint):TParaLocation;
|
||||
function TSparcParaManager.GetIntParaLoc(nr:longint):TParaLocation;
|
||||
begin
|
||||
FillChar(result,SizeOf(TParaLocation),0);
|
||||
with Result do
|
||||
if nr<1
|
||||
then
|
||||
InternalError(2002070801)
|
||||
else if nr<=8
|
||||
then
|
||||
InternalError(2002100806);
|
||||
FillChar(Result,SizeOf(TParaLocation),0);
|
||||
Dec(nr);
|
||||
with Result do
|
||||
if nr<6
|
||||
then{The six first parameters are passed into registers}
|
||||
begin
|
||||
loc:=LOC_REGISTER;
|
||||
register:=tregister(longint(R_O0)+nr);
|
||||
register:=TRegister(LongInt(R_O0)+nr);
|
||||
WriteLn('-------------------------------------------');
|
||||
end
|
||||
else
|
||||
else{The other parameters are passed into the frame}
|
||||
begin
|
||||
loc:=LOC_REFERENCE;
|
||||
reference.index:=stack_pointer_reg;
|
||||
reference.offset:=(nr-8)*4;
|
||||
reference.index:=frame_pointer_reg;
|
||||
reference.offset:=-92-(nr-6)*4;
|
||||
WriteLn('+++++++++++++++++++++++++++++++++++++++++++');
|
||||
end;
|
||||
end;
|
||||
|
||||
function getparaloc(p : tdef) : tloc;
|
||||
|
||||
function GetParaLoc(p:TDef):TLoc;
|
||||
begin
|
||||
{ Later, the LOC_REFERENCE is in most cases changed into LOC_REGISTER
|
||||
if push_addr_param for the def is true
|
||||
}
|
||||
case p.deftype of
|
||||
orddef:
|
||||
getparaloc:=LOC_REGISTER;
|
||||
floatdef:
|
||||
getparaloc:=LOC_FPUREGISTER;
|
||||
{Later, the LOC_REFERENCE is in most cases changed into LOC_REGISTER if
|
||||
push_addr_param for the def is true}
|
||||
case p.DefType of
|
||||
OrdDef:
|
||||
GetParaLoc:=LOC_REGISTER;
|
||||
FloatDef:
|
||||
GetParaLoc:=LOC_FPUREGISTER;
|
||||
enumdef:
|
||||
getparaloc:=LOC_REGISTER;
|
||||
pointerdef:
|
||||
@ -121,51 +121,51 @@ function TSparcParaManager.getintparaloc(nr:longint):TParaLocation;
|
||||
internalerror(2002071001);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure tSparcparamanager.create_param_loc_info(p : tabstractprocdef);
|
||||
|
||||
procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef);
|
||||
var
|
||||
nextintreg,nextfloatreg,nextmmreg : tregister;
|
||||
stack_offset : aword;
|
||||
hp : tparaitem;
|
||||
loc : tloc;
|
||||
is_64bit: boolean;
|
||||
|
||||
begin
|
||||
nextintreg:=R_O3;
|
||||
nextfloatreg:=R_F1;
|
||||
nextintreg:=R_O0;
|
||||
nextfloatreg:=R_F0;
|
||||
nextmmreg:=R_NONE;
|
||||
stack_offset:=0;
|
||||
stack_offset:=92;
|
||||
{pointer for structured results ?}
|
||||
if not is_void(p.rettype.def) then
|
||||
begin
|
||||
if not(ret_in_reg(p.rettype.def)) then
|
||||
if not is_void(p.RetType.def)
|
||||
then
|
||||
if not(ret_in_reg(p.rettype.def))
|
||||
then
|
||||
inc(nextintreg);
|
||||
end;
|
||||
|
||||
{frame pointer for nested procedures?}
|
||||
{ inc(nextintreg); }
|
||||
{ constructor? }
|
||||
{ destructor? }
|
||||
hp:=tparaitem(p.para.last);
|
||||
WriteLn('***********************************************');
|
||||
hp:=TParaItem(p.para.last);
|
||||
while assigned(hp) do
|
||||
begin
|
||||
loc:=getparaloc(hp.paratype.def);
|
||||
loc:=GetParaLoc(hp.paratype.def);
|
||||
hp.paraloc.sp_fixup:=0;
|
||||
case loc of
|
||||
LOC_REGISTER:
|
||||
begin
|
||||
hp.paraloc.size := def_cgsize(hp.paratype.def);
|
||||
{ for things like formaldef }
|
||||
if hp.paraloc.size = OS_NO then
|
||||
hp.paraloc.size:=def_cgSize(hp.paratype.def);
|
||||
if hp.paraloc.size=OS_NO
|
||||
then
|
||||
hp.paraloc.size:=OS_ADDR;
|
||||
is_64bit:=hp.paraloc.size in [OS_64,OS_S64];
|
||||
if nextintreg<=tregister(ord(R_O4)-ord(is_64bit)) then
|
||||
if NextIntReg<=TRegister(ord(R_O5)-ord(is_64bit))
|
||||
then
|
||||
begin
|
||||
WriteLn('Allocating ',std_reg2str[NextIntReg]);
|
||||
hp.paraloc.loc:=LOC_REGISTER;
|
||||
hp.paraloc.registerlow:=nextintreg;
|
||||
inc(nextintreg);
|
||||
if is_64bit then
|
||||
hp.paraloc.registerlow:=NextIntReg;
|
||||
inc(NextIntReg);
|
||||
if is_64bit
|
||||
then
|
||||
begin
|
||||
hp.paraloc.registerhigh:=nextintreg;
|
||||
inc(nextintreg);
|
||||
@ -173,11 +173,12 @@ function TSparcParaManager.getintparaloc(nr:longint):TParaLocation;
|
||||
end
|
||||
else
|
||||
begin
|
||||
nextintreg := R_O5;
|
||||
nextintreg:=R_O6;
|
||||
hp.paraloc.loc:=LOC_REFERENCE;
|
||||
hp.paraloc.reference.index:=stack_pointer_reg;
|
||||
hp.paraloc.reference.offset:=stack_offset;
|
||||
if not is_64bit then
|
||||
if not is_64bit
|
||||
then
|
||||
inc(stack_offset,4)
|
||||
else
|
||||
inc(stack_offset,8);
|
||||
@ -291,12 +292,15 @@ function TSparcParaManager.getintparaloc(nr:longint):TParaLocation;
|
||||
end;
|
||||
end;
|
||||
|
||||
BEGIN
|
||||
paramanager:=TSparcParaManager.create;
|
||||
begin
|
||||
ParaManager:=TSparcParaManager.create;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2002-10-07 20:33:05 mazen
|
||||
Revision 1.4 2002-10-08 21:02:22 mazen
|
||||
* debugging register allocation
|
||||
|
||||
Revision 1.3 2002/10/07 20:33:05 mazen
|
||||
word alignement modified in g_stack_frame
|
||||
|
||||
Revision 1.2 2002/10/04 21:57:42 mazen
|
||||
|
Loading…
Reference in New Issue
Block a user