* 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;
tmpreg:TRegister;
begin
if Size<>OS_32
then
InternalError(2002100400);
case locpara.loc of
LOC_REGISTER,LOC_CREGISTER:
a_load_ref_reg(list,size,r,locpara.register);
LOC_REFERENCE:
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);
ref.base:=locpara.reference.index;
ref.offset:=locpara.reference.offset;
@ -159,9 +161,6 @@ procedure tcgSPARC.a_param_ref(list:TAasmOutput;size:tcgsize;const r:TReference;
else
internalerror(2002081103);
end;
if locpara.sp_fixup<>0
then
internalerror(2002081104);
end;
procedure tcgSPARC.a_paramaddr_ref(list:TAasmOutput;CONST r:TReference;CONST LocPara:TParaLocation);
VAR
@ -1257,7 +1256,10 @@ BEGIN
END.
{
$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 ***
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$
Copyright (c) 2002 by Florian Klaempfl
@ -89,17 +80,20 @@ push_addr_param for the def is true}
recorddef:
getparaloc:=LOC_REFERENCE;
objectdef:
if is_object(p) then
if is_object(p)
then
getparaloc:=LOC_REFERENCE
else
getparaloc:=LOC_REGISTER;
stringdef:
if is_shortstring(p) or is_longstring(p) then
if is_shortstring(p) or is_longstring(p)
then
getparaloc:=LOC_REFERENCE
else
getparaloc:=LOC_REGISTER;
procvardef:
if (po_methodpointer in tprocvardef(p).procoptions) then
if (po_methodpointer in tprocvardef(p).procoptions)
then
getparaloc:=LOC_REFERENCE
else
getparaloc:=LOC_REGISTER;
@ -108,7 +102,8 @@ push_addr_param for the def is true}
arraydef:
getparaloc:=LOC_REFERENCE;
setdef:
if is_smallset(p) then
if is_smallset(p)
then
getparaloc:=LOC_REGISTER
else
getparaloc:=LOC_REFERENCE;
@ -123,7 +118,7 @@ push_addr_param for the def is true}
end;
procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef);
var
nextintreg,nextfloatreg,nextmmreg : tregister;
nextintreg,nextfloatreg:tregister;
stack_offset : aword;
hp : tparaitem;
loc : tloc;
@ -131,24 +126,12 @@ procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef);
begin
nextintreg:=R_O0;
nextfloatreg:=R_F0;
nextmmreg:=R_NONE;
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('***********************************************');
hp:=TParaItem(p.para.last);
hp:=TParaItem(p.para.First);
while assigned(hp) do
begin
loc:=GetParaLoc(hp.paratype.def);
hp.paraloc.sp_fixup:=0;
case loc of
LOC_REGISTER:
begin
@ -246,7 +229,7 @@ WriteLn('***********************************************');
else
internalerror(2002071002);
end;
hp:=TParaItem(hp.previous);
hp:=TParaItem(hp.Next);
end;
end;
function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
@ -296,7 +279,10 @@ begin
end.
{
$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\!
Revision 1.4 2002/10/08 21:02:22 mazen

View File

@ -1,4 +1,4 @@
{
{*****************************************************************************
$Id$
Copyright (c) 2002 by Florian Klaempfl
@ -18,78 +18,66 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
****************************************************************************}
{ This unit contains the CPU specific part of tprocinfo. }
unit cpupi;
{$i fpcdefs.inc}
{$INCLUDE fpcdefs.inc}
interface
uses
cutils,
cgbase,cpuinfo;
type
TSparcprocinfo = class(tprocinfo)
TSparcprocinfo=class(TProcInfo)
{overall size of allocated stack space, currently this is used for the PowerPC only}
localsize:aword;
{max. of space need for parameters, currently used by the PowerPC port only}
maxpushedparasize:aword;
constructor create;override;
procedure after_header;override;
procedure after_pass1;override;
end;
implementation
uses
globtype,globals,
aasmtai,
tgobj;
constructor TSparcprocinfo.create;
begin
inherited create;
maxpushedparasize:=0;
localsize:=0;
end;
procedure TSparcprocinfo.after_header;
begin
{ this value is necessary for nested procedures }
procdef.localst.address_fixup:=align(procdef.parast.datasize,16);
end;
procedure TSparcprocinfo.after_pass1;
begin
procdef.parast.address_fixup:=align(maxpushedparasize,16);
if cs_asm_source in aktglobalswitches then
aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup))));
if cs_asm_source in aktglobalswitches
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);
if cs_asm_source in aktglobalswitches then
aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: r1+'+tostr(procdef.localst.address_fixup))));
if cs_asm_source in aktglobalswitches
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);
if cs_asm_source in aktglobalswitches then
aktproccode.insert(Tai_comment.Create(strpnew('Temp. space start: r1+'+tostr(procinfo.firsttemp_offset))));
//!!!! tg.setfirsttemp(procinfo.firsttemp_offset);
if cs_asm_source in aktglobalswitches
then
aktproccode.insert(Tai_comment.Create(strpnew('Temp. space start: %o6+'+tostr(procinfo.firsttemp_offset))));
tg.firsttemp:=procinfo.firsttemp_offset;
tg.lasttemp:=procinfo.firsttemp_offset;
end;
begin
cprocinfo:=TSparcprocinfo;
end.
{
$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
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
* first part of procinfo rewrite
}