mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 04:09:30 +02:00
* updated for removed lexlevel
This commit is contained in:
parent
7f14891d66
commit
a5e7f02527
@ -45,7 +45,7 @@ unit cpupi;
|
||||
{ we push Flags and CS as long
|
||||
to cope with the IRETD
|
||||
and we save 6 register + 4 selectors }
|
||||
inc(procinfo.para_offset,8+6*4+4*2);
|
||||
inc(procdef.parast.datasize,8+6*4+4*2);
|
||||
end;
|
||||
|
||||
begin
|
||||
@ -53,7 +53,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2002-08-17 09:23:44 florian
|
||||
Revision 1.2 2003-04-27 07:48:05 peter
|
||||
* updated for removed lexlevel
|
||||
|
||||
Revision 1.1 2002/08/17 09:23:44 florian
|
||||
* first part of procinfo rewrite
|
||||
}
|
||||
|
||||
|
@ -65,30 +65,9 @@ unit cpupi;
|
||||
|
||||
procedure tppcprocinfo.after_header;
|
||||
begin
|
||||
procdef.parast.address_fixup:=0;
|
||||
if assigned(procdef.parast) and (procdef.parast.symtablelevel>1) then
|
||||
begin
|
||||
procinfo.framepointer_offset:=procdef.parast.address_fixup;
|
||||
inc(procdef.parast.address_fixup,4);
|
||||
end;
|
||||
if assigned(procinfo.procdef.funcretsym) then
|
||||
procinfo.return_offset:=tvarsym(procinfo.procdef.funcretsym).address+tvarsym(procinfo.procdef.funcretsym).owner.address_fixup;
|
||||
if assigned(_class) then
|
||||
begin
|
||||
procinfo.selfpointer_offset:=procdef.parast.address_fixup;
|
||||
inc(procdef.parast.address_fixup,4);
|
||||
end;
|
||||
{ this value is necessary for nested procedures }
|
||||
if assigned(procdef.localst) then
|
||||
procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
|
||||
|
||||
{
|
||||
procdef.funcretsym isn't set here yet and besides,
|
||||
symtable.insertvardata() already sets procinfo.return_offset! (JM)
|
||||
if assigned(procdef.funcretsym) and
|
||||
not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption)) then
|
||||
procinfo.return_offset:=tg.direction*tfuncretsym(procdef.funcretsym).address+procdef.localst.address_fixup;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure tppcprocinfo.after_pass1;
|
||||
@ -134,7 +113,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 2003-04-26 11:31:00 florian
|
||||
Revision 1.11 2003-04-27 07:48:05 peter
|
||||
* updated for removed lexlevel
|
||||
|
||||
Revision 1.10 2003/04/26 11:31:00 florian
|
||||
* fixed the powerpc to work with the new function result handling
|
||||
|
||||
Revision 1.9 2003/04/24 11:24:00 florian
|
||||
|
@ -77,7 +77,7 @@ implementation
|
||||
hregister1,hregister2 : tregister;
|
||||
i : longint;
|
||||
begin
|
||||
if lexlevel=(tprocdef(procdefinition).parast.symtablelevel) then
|
||||
if aktprocdef.parast.symtablelevel=(tprocdef(procdefinition).parast.symtablelevel) then
|
||||
begin
|
||||
{ pass the same framepointer as the current procedure got }
|
||||
hregister2.enum:=R_INTREGISTER;
|
||||
@ -87,7 +87,7 @@ implementation
|
||||
end
|
||||
{ this is only true if the difference is one !!
|
||||
but it cannot be more !! }
|
||||
else if (lexlevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
|
||||
else if (aktprocdef.parast.symtablelevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
|
||||
begin
|
||||
{ pass the same framepointer as the current procedure got }
|
||||
hregister1.enum:=R_INTREGISTER;
|
||||
@ -96,17 +96,19 @@ implementation
|
||||
hregister2.number:=NR_R11;
|
||||
exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDI,hregister2,hregister1,procinfo.framepointer_offset));
|
||||
end
|
||||
else if (lexlevel>(tprocdef(procdefinition).parast.symtablelevel)) then
|
||||
else if (aktprocdef.parast.symtablelevel>(tprocdef(procdefinition).parast.symtablelevel)) then
|
||||
begin
|
||||
hregister1:=rg.getregisterint(exprasmlist,OS_ADDR);
|
||||
reference_reset_base(href,procinfo.framepointer,procinfo.framepointer_offset);
|
||||
cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister1);
|
||||
for i:=(tprocdef(procdefinition).parast.symtablelevel) to lexlevel-1 do
|
||||
i:=aktprocdef.parast.symtablelevel;
|
||||
while (i>tprocdef(procdefinition).parast.symtablelevel) do
|
||||
begin
|
||||
{we should get the correct frame_pointer_offset at each level
|
||||
how can we do this !!! }
|
||||
reference_reset_base(href,hregister2,procinfo.framepointer_offset);
|
||||
cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister1);
|
||||
dec(i);
|
||||
end;
|
||||
hregister2.enum:=R_11;
|
||||
cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,hregister1,hregister2);
|
||||
@ -121,7 +123,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 2003-04-24 11:24:00 florian
|
||||
Revision 1.8 2003-04-27 07:48:05 peter
|
||||
* updated for removed lexlevel
|
||||
|
||||
Revision 1.7 2003/04/24 11:24:00 florian
|
||||
* fixed several issues with nested procedures
|
||||
|
||||
Revision 1.6 2003/04/23 12:35:35 florian
|
||||
|
@ -172,7 +172,7 @@ interface
|
||||
if ((s[length(s)]<>'0') or (hs[1]<>'x')) and not(is_register(hs)) then
|
||||
begin
|
||||
if assigned(aktprocdef.localst) and
|
||||
(lexlevel >= normal_function_level) then
|
||||
(aktprocdef.localst.symtablelevel >= normal_function_level) then
|
||||
sym:=tsym(aktprocdef.localst.search(upper(hs)))
|
||||
else
|
||||
sym:=nil;
|
||||
@ -347,7 +347,10 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.11 2003-04-25 21:05:22 florian
|
||||
Revision 1.12 2003-04-27 07:48:05 peter
|
||||
* updated for removed lexlevel
|
||||
|
||||
Revision 1.11 2003/04/25 21:05:22 florian
|
||||
* fixed tfuncretsym stuff in powerpc specific part
|
||||
|
||||
Revision 1.10 2003/04/24 12:05:53 florian
|
||||
|
@ -24,8 +24,8 @@ unit cpupi;
|
||||
{$INCLUDE fpcdefs.inc}
|
||||
interface
|
||||
uses
|
||||
cutils,
|
||||
cgbase,cpuinfo;
|
||||
cutils,
|
||||
cgbase,cpuinfo;
|
||||
type
|
||||
TSparcProcInfo=class(TProcInfo)
|
||||
{overall size of allocated stack space, currently this is used for the
|
||||
@ -50,47 +50,31 @@ stack frame.}
|
||||
end;
|
||||
implementation
|
||||
uses
|
||||
tgobj,paramgr,symsym,systems;
|
||||
tgobj,paramgr,symsym,systems;
|
||||
|
||||
constructor TSparcprocinfo.create;
|
||||
begin
|
||||
inherited create;
|
||||
maxpushedparasize:=0;
|
||||
LocalSize:=(16+1)*4;
|
||||
{First 16 words are in the frame are used to save registers in case of a
|
||||
begin
|
||||
inherited create;
|
||||
maxpushedparasize:=0;
|
||||
LocalSize:=(16+1)*4;
|
||||
{First 16 words are in the frame are used to save registers in case of a
|
||||
register overflow/underflow.The 17th word is used to save the address of
|
||||
the variable which will receive the return value of the called function}
|
||||
Return_Offset:=16*4;
|
||||
end;
|
||||
procedure TSparcprocinfo.after_header;
|
||||
begin
|
||||
{target_info.first_parm_offset should be (16+1)*4 as the return address pointer
|
||||
is usually allocated even if return value is in register.}
|
||||
procdef.parast.address_fixup:=target_info.first_parm_offset;
|
||||
if assigned(procdef.localst)and(procdef.localst.symtablelevel>1)
|
||||
then
|
||||
// Return_Offset:=16*4;
|
||||
end;
|
||||
|
||||
procedure TSparcprocinfo.after_header;
|
||||
begin
|
||||
framepointer_offset:=procdef.parast.address_fixup;
|
||||
inc(procdef.parast.address_fixup,4);
|
||||
{ this value is necessary for nested procedures }
|
||||
if assigned(procdef.localst) then
|
||||
procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
|
||||
end;
|
||||
if assigned(_class)
|
||||
then
|
||||
begin
|
||||
selfpointer_offset:=procdef.parast.address_fixup;
|
||||
inc(procdef.parast.address_fixup,4);
|
||||
end;
|
||||
{ this value is necessary for nested procedures }
|
||||
if assigned(procdef.localst)
|
||||
then
|
||||
procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
|
||||
if assigned(aktprocdef.funcretsym) and not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption))
|
||||
then
|
||||
return_offset:=tg.direction*tfuncretsym(aktprocdef.funcretsym).address+procdef.localst.address_fixup;
|
||||
end;
|
||||
|
||||
procedure TSparcProcInfo.after_pass1;
|
||||
begin
|
||||
begin
|
||||
with ProcDef do
|
||||
begin
|
||||
{Reserve the stack for copying parameters passed into registers. By
|
||||
{Reserve the stack for copying parameters passed into registers. By
|
||||
default we reserve space for the 6 input registers if the function had
|
||||
less parameters. Otherwise, we allocate data sizeof parameters}
|
||||
if parast.datasize>6*4
|
||||
@ -98,20 +82,23 @@ procedure TSparcProcInfo.after_pass1;
|
||||
localst.address_fixup:=parast.address_fixup+parast.datasize
|
||||
else
|
||||
procdef.localst.address_fixup:=parast.address_fixup+6*4;
|
||||
firsttemp_offset:=localst.address_fixup+localst.datasize;
|
||||
firsttemp_offset:=localst.address_fixup+localst.datasize;
|
||||
with tg do
|
||||
begin
|
||||
SetFirstTemp(firsttemp_offset);
|
||||
//LastTemp:=firsttemp_offset;
|
||||
SetFirstTemp(firsttemp_offset);
|
||||
//LastTemp:=firsttemp_offset;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
begin
|
||||
cprocinfo:=TSparcProcInfo;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 2003-02-06 22:36:55 mazen
|
||||
Revision 1.13 2003-04-27 07:48:05 peter
|
||||
* updated for removed lexlevel
|
||||
|
||||
Revision 1.12 2003/02/06 22:36:55 mazen
|
||||
* fixing bug related to errornous program main entry stack frame
|
||||
|
||||
Revision 1.11 2003/01/05 21:32:35 mazen
|
||||
|
@ -88,7 +88,7 @@ end;
|
||||
{ consider it set function set if the offset was loaded }
|
||||
if assigned(aktprocdef.funcretsym) and
|
||||
(pos(retstr,upper(s))>0) then
|
||||
tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
|
||||
tvarsym(aktprocdef.funcretsym).varstate:=vs_assigned;
|
||||
s:='';
|
||||
end;
|
||||
|
||||
@ -97,7 +97,7 @@ end;
|
||||
s:='';
|
||||
if assigned(aktprocdef.funcretsym) and
|
||||
is_fpu(aktprocdef.rettype.def) then
|
||||
tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
|
||||
tvarsym(aktprocdef.funcretsym).varstate:=vs_assigned;
|
||||
if (not is_void(aktprocdef.rettype.def)) then
|
||||
retstr:=upper(tostr(procinfo.return_offset)+'('+std_reg2str[procinfo.framepointer.enum]+')')
|
||||
else
|
||||
@ -151,13 +151,13 @@ end;
|
||||
paramanager.ret_in_acc(aktprocdef.rettype.def,aktprocdef.proccalloption) and
|
||||
((pos('AX',upper(hs))>0) or
|
||||
(pos('AL',upper(hs))>0)) then
|
||||
tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
|
||||
tvarsym(aktprocdef.funcretsym).varstate:=vs_assigned;
|
||||
if (s[length(s)]<>'%') and
|
||||
(s[length(s)]<>'$') and
|
||||
((s[length(s)]<>'0') or (hs[1]<>'x')) then
|
||||
begin
|
||||
if assigned(aktprocdef.localst) and
|
||||
(lexlevel >= normal_function_level) then
|
||||
(aktprocdef.localst.symtablelevel >= normal_function_level) then
|
||||
sym:=tsym(aktprocdef.localst.search(upper(hs)))
|
||||
else
|
||||
sym:=nil;
|
||||
@ -247,7 +247,7 @@ end;
|
||||
end
|
||||
else if upper(hs)='__SELF' then
|
||||
begin
|
||||
if assigned(procinfo._class) then
|
||||
if assigned(aktprocdef._class) then
|
||||
hs:=tostr(procinfo.selfpointer_offset)+
|
||||
'('+std_reg2str[procinfo.framepointer.enum]+')'
|
||||
else
|
||||
@ -264,7 +264,7 @@ end;
|
||||
begin
|
||||
{ complicate to check there }
|
||||
{ we do it: }
|
||||
if lexlevel>normal_function_level then
|
||||
if aktprocdef.parast.symtablelevel>normal_function_level then
|
||||
hs:=tostr(procinfo.framepointer_offset)+
|
||||
'('+std_reg2str[procinfo.framepointer.enum]+')'
|
||||
else
|
||||
@ -279,7 +279,7 @@ end;
|
||||
end;
|
||||
'{',';',#10,#13 : begin
|
||||
if pos(retstr,s) > 0 then
|
||||
tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
|
||||
tvarsym(aktprocdef.funcretsym).varstate:=vs_assigned;
|
||||
writeasmline;
|
||||
c:=current_scanner.asmgetchar;
|
||||
end;
|
||||
@ -314,7 +314,10 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 2003-01-08 18:43:58 daniel
|
||||
Revision 1.6 2003-04-27 07:48:05 peter
|
||||
* updated for removed lexlevel
|
||||
|
||||
Revision 1.5 2003/01/08 18:43:58 daniel
|
||||
* Tregister changed into a record
|
||||
|
||||
Revision 1.4 2002/11/25 17:43:29 peter
|
||||
|
Loading…
Reference in New Issue
Block a user