* Internal error fixed, but usually i386 parameter model used

This commit is contained in:
mazen 2002-10-10 15:10:39 +00:00
parent 1c642c2002
commit de41a87b82
3 changed files with 491 additions and 517 deletions

View File

@ -131,14 +131,16 @@ procedure tcgSPARC.a_param_ref(list:TAasmOutput;size:tcgsize;const r:TReference;
ref: treference; ref: treference;
tmpreg:TRegister; tmpreg:TRegister;
begin begin
if Size<>OS_32
then
InternalError(2002100400);
case locpara.loc of case locpara.loc of
LOC_REGISTER,LOC_CREGISTER: LOC_REGISTER,LOC_CREGISTER:
a_load_ref_reg(list,size,r,locpara.register); a_load_ref_reg(list,size,r,locpara.register);
LOC_REFERENCE: LOC_REFERENCE:
begin begin
{Code conventions need the parameters being allocated in %o6+92. See
comment on g_stack_frame}
if locpara.sp_fixup<92
then
InternalError(2002081104);
reference_reset(ref); reference_reset(ref);
ref.base:=locpara.reference.index; ref.base:=locpara.reference.index;
ref.offset:=locpara.reference.offset; ref.offset:=locpara.reference.offset;
@ -159,9 +161,6 @@ procedure tcgSPARC.a_param_ref(list:TAasmOutput;size:tcgsize;const r:TReference;
else else
internalerror(2002081103); internalerror(2002081103);
end; end;
if locpara.sp_fixup<>0
then
internalerror(2002081104);
end; end;
procedure tcgSPARC.a_paramaddr_ref(list:TAasmOutput;CONST r:TReference;CONST LocPara:TParaLocation); procedure tcgSPARC.a_paramaddr_ref(list:TAasmOutput;CONST r:TReference;CONST LocPara:TParaLocation);
VAR VAR
@ -1257,7 +1256,10 @@ BEGIN
END. END.
{ {
$Log$ $Log$
Revision 1.12 2002-10-08 17:17:03 mazen Revision 1.13 2002-10-10 15:10:39 mazen
* Internal error fixed, but usually i386 parameter model used
Revision 1.12 2002/10/08 17:17:03 mazen
*** empty log message *** *** empty log message ***
Revision 1.11 2002/10/07 20:33:04 mazen Revision 1.11 2002/10/07 20:33:04 mazen

View File

@ -1,13 +1,4 @@
{*****************************************************************************} {******************************************************************************
{ File : cpupara.pas }
{ Author : Mazen NEIFER }
{ Project : Free Pascal Compiler (FPC) }
{ Creation date : 2002\07\13 }
{ Last modification date : 2002\08\20 }
{ Licence : GPL }
{ Bug report : mazen.neifer.01@supaero.org }
{*****************************************************************************}
{
$Id$ $Id$
Copyright (c) 2002 by Florian Klaempfl Copyright (c) 2002 by Florian Klaempfl
@ -89,17 +80,20 @@ push_addr_param for the def is true}
recorddef: recorddef:
getparaloc:=LOC_REFERENCE; getparaloc:=LOC_REFERENCE;
objectdef: objectdef:
if is_object(p) then if is_object(p)
then
getparaloc:=LOC_REFERENCE getparaloc:=LOC_REFERENCE
else else
getparaloc:=LOC_REGISTER; getparaloc:=LOC_REGISTER;
stringdef: stringdef:
if is_shortstring(p) or is_longstring(p) then if is_shortstring(p) or is_longstring(p)
then
getparaloc:=LOC_REFERENCE getparaloc:=LOC_REFERENCE
else else
getparaloc:=LOC_REGISTER; getparaloc:=LOC_REGISTER;
procvardef: procvardef:
if (po_methodpointer in tprocvardef(p).procoptions) then if (po_methodpointer in tprocvardef(p).procoptions)
then
getparaloc:=LOC_REFERENCE getparaloc:=LOC_REFERENCE
else else
getparaloc:=LOC_REGISTER; getparaloc:=LOC_REGISTER;
@ -108,7 +102,8 @@ push_addr_param for the def is true}
arraydef: arraydef:
getparaloc:=LOC_REFERENCE; getparaloc:=LOC_REFERENCE;
setdef: setdef:
if is_smallset(p) then if is_smallset(p)
then
getparaloc:=LOC_REGISTER getparaloc:=LOC_REGISTER
else else
getparaloc:=LOC_REFERENCE; getparaloc:=LOC_REFERENCE;
@ -123,7 +118,7 @@ push_addr_param for the def is true}
end; end;
procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef); procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef);
var var
nextintreg,nextfloatreg,nextmmreg : tregister; nextintreg,nextfloatreg:tregister;
stack_offset : aword; stack_offset : aword;
hp : tparaitem; hp : tparaitem;
loc : tloc; loc : tloc;
@ -131,24 +126,12 @@ procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef);
begin begin
nextintreg:=R_O0; nextintreg:=R_O0;
nextfloatreg:=R_F0; nextfloatreg:=R_F0;
nextmmreg:=R_NONE;
stack_offset:=92; stack_offset:=92;
{pointer for structured results ?}
if not is_void(p.RetType.def)
then
if not(ret_in_reg(p.rettype.def))
then
inc(nextintreg);
{frame pointer for nested procedures?}
{ inc(nextintreg); }
{ constructor? }
{ destructor? }
WriteLn('***********************************************'); WriteLn('***********************************************');
hp:=TParaItem(p.para.last); hp:=TParaItem(p.para.First);
while assigned(hp) do while assigned(hp) do
begin begin
loc:=GetParaLoc(hp.paratype.def); loc:=GetParaLoc(hp.paratype.def);
hp.paraloc.sp_fixup:=0;
case loc of case loc of
LOC_REGISTER: LOC_REGISTER:
begin begin
@ -246,7 +229,7 @@ WriteLn('***********************************************');
else else
internalerror(2002071002); internalerror(2002071002);
end; end;
hp:=TParaItem(hp.previous); hp:=TParaItem(hp.Next);
end; end;
end; end;
function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation; function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
@ -296,7 +279,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.5 2002-10-09 13:52:19 mazen Revision 1.6 2002-10-10 15:10:39 mazen
* Internal error fixed, but usually i386 parameter model used
Revision 1.5 2002/10/09 13:52:19 mazen
just incase some one wolud help me debugging that\! just incase some one wolud help me debugging that\!
Revision 1.4 2002/10/08 21:02:22 mazen Revision 1.4 2002/10/08 21:02:22 mazen

View File

@ -1,4 +1,4 @@
{ {*****************************************************************************
$Id$ $Id$
Copyright (c) 2002 by Florian Klaempfl Copyright (c) 2002 by Florian Klaempfl
@ -18,78 +18,66 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**************************************************************************** ****************************************************************************}
}
{ This unit contains the CPU specific part of tprocinfo. } { This unit contains the CPU specific part of tprocinfo. }
unit cpupi; unit cpupi;
{$INCLUDE fpcdefs.inc}
{$i fpcdefs.inc}
interface interface
uses uses
cutils, cutils,
cgbase,cpuinfo; cgbase,cpuinfo;
type type
TSparcprocinfo = class(tprocinfo) TSparcprocinfo=class(TProcInfo)
{overall size of allocated stack space, currently this is used for the PowerPC only} {overall size of allocated stack space, currently this is used for the PowerPC only}
localsize:aword; localsize:aword;
{max. of space need for parameters, currently used by the PowerPC port only} {max. of space need for parameters, currently used by the PowerPC port only}
maxpushedparasize:aword; maxpushedparasize:aword;
constructor create;override; constructor create;override;
procedure after_header;override; procedure after_header;override;
procedure after_pass1;override; procedure after_pass1;override;
end; end;
implementation implementation
uses uses
globtype,globals, globtype,globals,
aasmtai, aasmtai,
tgobj; tgobj;
constructor TSparcprocinfo.create; constructor TSparcprocinfo.create;
begin begin
inherited create; inherited create;
maxpushedparasize:=0; maxpushedparasize:=0;
localsize:=0; localsize:=0;
end; end;
procedure TSparcprocinfo.after_header; procedure TSparcprocinfo.after_header;
begin begin
{ this value is necessary for nested procedures } { this value is necessary for nested procedures }
procdef.localst.address_fixup:=align(procdef.parast.datasize,16); procdef.localst.address_fixup:=align(procdef.parast.datasize,16);
end; end;
procedure TSparcprocinfo.after_pass1; procedure TSparcprocinfo.after_pass1;
begin begin
procdef.parast.address_fixup:=align(maxpushedparasize,16); procdef.parast.address_fixup:=align(maxpushedparasize,16);
if cs_asm_source in aktglobalswitches then if cs_asm_source in aktglobalswitches
aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup)))); then
aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: %i6+'+tostr(procdef.parast.address_fixup))));
procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16); procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
if cs_asm_source in aktglobalswitches then if cs_asm_source in aktglobalswitches
aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: r1+'+tostr(procdef.localst.address_fixup)))); then
aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: %o6+'+tostr(procdef.localst.address_fixup))));
procinfo.firsttemp_offset:=align(procdef.localst.address_fixup+procdef.localst.datasize,16); procinfo.firsttemp_offset:=align(procdef.localst.address_fixup+procdef.localst.datasize,16);
if cs_asm_source in aktglobalswitches then if cs_asm_source in aktglobalswitches
aktproccode.insert(Tai_comment.Create(strpnew('Temp. space start: r1+'+tostr(procinfo.firsttemp_offset)))); then
aktproccode.insert(Tai_comment.Create(strpnew('Temp. space start: %o6+'+tostr(procinfo.firsttemp_offset))));
//!!!! tg.setfirsttemp(procinfo.firsttemp_offset);
tg.firsttemp:=procinfo.firsttemp_offset; tg.firsttemp:=procinfo.firsttemp_offset;
tg.lasttemp:=procinfo.firsttemp_offset; tg.lasttemp:=procinfo.firsttemp_offset;
end; end;
begin begin
cprocinfo:=TSparcprocinfo; cprocinfo:=TSparcprocinfo;
end. end.
{ {
$Log$ $Log$
Revision 1.2 2002-08-29 11:02:36 mazen Revision 1.3 2002-10-10 15:10:39 mazen
* Internal error fixed, but usually i386 parameter model used
Revision 1.2 2002/08/29 11:02:36 mazen
added support for SPARC processors added support for SPARC processors
Revision 1.1 2002/08/23 10:08:28 mazen Revision 1.1 2002/08/23 10:08:28 mazen
@ -104,5 +92,3 @@ end.
Revision 1.1 2002/08/17 09:23:49 florian Revision 1.1 2002/08/17 09:23:49 florian
* first part of procinfo rewrite * first part of procinfo rewrite
} }