* moved count_locals from pstatmnt to symutils

* use count_locals in powerpc/cpupi to check whether we should set the
    first temp offset (and as such generate a stackframe)
This commit is contained in:
Jonas Maebe 2003-12-07 16:40:45 +00:00
parent 24fe6134a0
commit 62394e45d7
3 changed files with 43 additions and 20 deletions

View File

@ -52,7 +52,7 @@ unit cpupi;
cpubase,
aasmtai,
tgobj,
symconst,symsym,paramgr;
symconst,symsym,paramgr,symutil;
constructor tppcprocinfo.create(aparent:tprocinfo);
@ -65,6 +65,7 @@ unit cpupi;
procedure tppcprocinfo.set_first_temp_offset;
var
ofs : aword;
locals: longint;
begin
if not(po_assembler in procdef.procoptions) then
begin
@ -77,9 +78,13 @@ unit cpupi;
tg.setfirsttemp(ofs);
end
else
if assigned(procdef.localst) then
{ at 0(r1), the previous value of r1 will be stored }
tg.setfirsttemp(4);
begin
locals := 0;
current_procinfo.procdef.localst.foreach_static({$ifdef FPCPROCVAR}@{$endif}count_locals,@locals);
if locals <> 0 then
{ at 0(r1), the previous value of r1 will be stored }
tg.setfirsttemp(4);
end;
end;
@ -128,7 +133,12 @@ begin
end.
{
$Log$
Revision 1.31 2003-11-29 22:54:32 jonas
Revision 1.32 2003-12-07 16:40:45 jonas
* moved count_locals from pstatmnt to symutils
* use count_locals in powerpc/cpupi to check whether we should set the
first temp offset (and as such generate a stackframe)
Revision 1.31 2003/11/29 22:54:32 jonas
* more ppc fixes, hello world works again under linuxppc
Revision 1.30 2003/11/29 16:27:19 jonas

View File

@ -48,7 +48,7 @@ implementation
cpubase,aasmbase,aasmtai,
{ symtable }
symconst,symbase,symtype,symdef,symsym,symtable,defutil,defcmp,
paramgr,
paramgr,symutil,
{ pass 1 }
pass_1,htypechk,
nutils,nbas,nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,
@ -1028,17 +1028,6 @@ implementation
end;
procedure count_locals(p:tnamedindexitem;arg:pointer);
begin
{ Count only varsyms, but ignore the funcretsym }
if (tsym(p).typ=varsym) and
(tsym(p)<>current_procinfo.procdef.funcretsym) and
(not(vo_is_parentfp in tvarsym(p).varoptions) or
(tvarsym(p).refs>0)) then
inc(plongint(arg)^);
end;
function assembler_block : tnode;
var
p : tnode;
@ -1106,7 +1095,12 @@ implementation
end.
{
$Log$
Revision 1.123 2003-12-03 17:39:04 florian
Revision 1.124 2003-12-07 16:40:45 jonas
* moved count_locals from pstatmnt to symutils
* use count_locals in powerpc/cpupi to check whether we should set the
first temp offset (and as such generate a stackframe)
Revision 1.123 2003/12/03 17:39:04 florian
* fixed several arm calling conventions issues
* fixed reference reading in the assembler reader
* fixed a_loadaddr_ref_reg

View File

@ -27,7 +27,7 @@ unit symutil;
interface
uses
symbase,symtype,symsym;
symbase,symtype,symsym,cclasses;
function is_funcret_sym(p:tsymentry):boolean;
@ -36,12 +36,14 @@ interface
function equal_constsym(sym1,sym2:tconstsym):boolean;
procedure count_locals(p:tnamedindexitem;arg:pointer);
implementation
uses
globtype,
cpuinfo,
procinfo,
symconst;
@ -102,10 +104,27 @@ implementation
end;
end;
procedure count_locals(p:tnamedindexitem;arg:pointer);
begin
{ Count only varsyms, but ignore the funcretsym }
if (tsym(p).typ=varsym) and
(tsym(p)<>current_procinfo.procdef.funcretsym) and
(not(vo_is_parentfp in tvarsym(p).varoptions) or
(tvarsym(p).refs>0)) then
inc(plongint(arg)^);
end;
end.
{
$Log$
Revision 1.2 2003-04-25 20:59:35 peter
Revision 1.3 2003-12-07 16:40:45 jonas
* moved count_locals from pstatmnt to symutils
* use count_locals in powerpc/cpupi to check whether we should set the
first temp offset (and as such generate a stackframe)
Revision 1.2 2003/04/25 20:59:35 peter
* removed funcretn,funcretsym, function result is now in varsym
and aliases for result and function name are added using absolutesym
* vs_hidden parameter for funcret passed in parameter