* fixed the powerpc to work with the new function result handling

This commit is contained in:
florian 2003-04-26 11:30:59 +00:00
parent 063979bcae
commit 15c0b633ab
3 changed files with 67 additions and 58 deletions

View File

@ -157,12 +157,6 @@ unit cpupara;
nextfloatreg.enum:=R_F1; nextfloatreg.enum:=R_F1;
nextmmreg.enum:=R_M1; nextmmreg.enum:=R_M1;
stack_offset:=0; stack_offset:=0;
{ pointer for structured results ? }
if not is_void(p.rettype.def) then
begin
if not(ret_in_reg(p.rettype.def,p.proccalloption)) then
inc(nextintreg.number,NR_R1-NR_R0);
end;
{ frame pointer for nested procedures? } { frame pointer for nested procedures? }
{ inc(nextintreg); } { inc(nextintreg); }
@ -301,7 +295,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.26 2003-04-23 12:35:35 florian Revision 1.27 2003-04-26 11:30:59 florian
* fixed the powerpc to work with the new function result handling
Revision 1.26 2003/04/23 12:35:35 florian
* fixed several issues with powerpc * fixed several issues with powerpc
+ applied a patch from Jonas for nested function calls (PowerPC only) + applied a patch from Jonas for nested function calls (PowerPC only)
* ... * ...

View File

@ -71,11 +71,8 @@ unit cpupi;
procinfo.framepointer_offset:=procdef.parast.address_fixup; procinfo.framepointer_offset:=procdef.parast.address_fixup;
inc(procdef.parast.address_fixup,4); inc(procdef.parast.address_fixup,4);
end; end;
if paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption) then if assigned(procinfo.procdef.funcretsym) then
begin procinfo.return_offset:=tvarsym(procinfo.procdef.funcretsym).address+tvarsym(procinfo.procdef.funcretsym).owner.address_fixup;
procinfo.return_offset:=procdef.parast.address_fixup;
inc(procdef.parast.address_fixup,4);
end;
if assigned(_class) then if assigned(_class) then
begin begin
procinfo.selfpointer_offset:=procdef.parast.address_fixup; procinfo.selfpointer_offset:=procdef.parast.address_fixup;
@ -102,7 +99,6 @@ unit cpupi;
begin begin
ofs:=align(maxpushedparasize+LinkageAreaSize,16); ofs:=align(maxpushedparasize+LinkageAreaSize,16);
inc(procdef.parast.address_fixup,ofs); inc(procdef.parast.address_fixup,ofs);
inc(procinfo.return_offset,ofs);
inc(procinfo.framepointer_offset,ofs); inc(procinfo.framepointer_offset,ofs);
inc(procinfo.selfpointer_offset,ofs); inc(procinfo.selfpointer_offset,ofs);
if cs_asm_source in aktglobalswitches then if cs_asm_source in aktglobalswitches then
@ -110,6 +106,8 @@ unit cpupi;
// Already done with an "inc" above now, not sure if it's correct (JM) // Already done with an "inc" above now, not sure if it's correct (JM)
procdef.localst.address_fixup:=procdef.parast.address_fixup+procdef.parast.datasize; procdef.localst.address_fixup:=procdef.parast.address_fixup+procdef.parast.datasize;
if assigned(procinfo.procdef.funcretsym) then
procinfo.return_offset:=tvarsym(procinfo.procdef.funcretsym).address+tvarsym(procinfo.procdef.funcretsym).owner.address_fixup;
{ {
Already done with an "inc" above, should be correct (JM) Already done with an "inc" above, should be correct (JM)
@ -136,7 +134,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.9 2003-04-24 11:24:00 florian 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
* fixed several issues with nested procedures * fixed several issues with nested procedures
Revision 1.8 2003/04/06 16:39:11 jonas Revision 1.8 2003/04/06 16:39:11 jonas

View File

@ -398,41 +398,43 @@ implementation
(p.resulttype.def.deftype in [objectdef,recorddef]) then (p.resulttype.def.deftype in [objectdef,recorddef]) then
begin begin
case p.resulttype.def.deftype of case p.resulttype.def.deftype of
objectdef : begin objectdef :
obj:=tobjectdef(p.resulttype.def); begin
symtab:=twithsymtable.Create(obj,obj.symtable.symsearch); obj:=tobjectdef(p.resulttype.def);
withsymtable:=symtab; symtab:=twithsymtable.Create(obj,obj.symtable.symsearch);
if (p.nodetype=loadn) and withsymtable:=symtab;
(tloadnode(p).symtable=aktprocdef.localst) then if (p.nodetype=loadn) and
twithsymtable(symtab).direct_with:=true; (tloadnode(p).symtable=aktprocdef.localst) then
twithsymtable(symtab).withrefnode:=p; twithsymtable(symtab).direct_with:=true;
levelcount:=1; twithsymtable(symtab).withrefnode:=p;
obj:=obj.childof; levelcount:=1;
while assigned(obj) do obj:=obj.childof;
begin while assigned(obj) do
symtab.next:=twithsymtable.create(obj,obj.symtable.symsearch); begin
symtab:=symtab.next; symtab.next:=twithsymtable.create(obj,obj.symtable.symsearch);
if (p.nodetype=loadn) and symtab:=symtab.next;
(tloadnode(p).symtable=aktprocdef.localst) then if (p.nodetype=loadn) and
twithsymtable(symtab).direct_with:=true; (tloadnode(p).symtable=aktprocdef.localst) then
twithsymtable(symtab).withrefnode:=p; twithsymtable(symtab).direct_with:=true;
obj:=obj.childof; twithsymtable(symtab).withrefnode:=p;
inc(levelcount); obj:=obj.childof;
end; inc(levelcount);
symtab.next:=symtablestack; end;
symtablestack:=withsymtable; symtab.next:=symtablestack;
end; symtablestack:=withsymtable;
recorddef : begin end;
symtab:=trecorddef(p.resulttype.def).symtable; recorddef :
levelcount:=1; begin
withsymtable:=twithsymtable.create(trecorddef(p.resulttype.def),symtab.symsearch); symtab:=trecorddef(p.resulttype.def).symtable;
if (p.nodetype=loadn) and levelcount:=1;
(tloadnode(p).symtable=aktprocdef.localst) then withsymtable:=twithsymtable.create(trecorddef(p.resulttype.def),symtab.symsearch);
twithsymtable(withsymtable).direct_with:=true; if (p.nodetype=loadn) and
twithsymtable(withsymtable).withrefnode:=p; (tloadnode(p).symtable=aktprocdef.localst) then
withsymtable.next:=symtablestack; twithsymtable(withsymtable).direct_with:=true;
symtablestack:=withsymtable; twithsymtable(withsymtable).withrefnode:=p;
end; withsymtable.next:=symtablestack;
symtablestack:=withsymtable;
end;
end; end;
if token=_COMMA then if token=_COMMA then
begin begin
@ -1011,9 +1013,6 @@ implementation
parafixup, parafixup,
i : longint; i : longint;
begin begin
{ we don't need to allocate space for the locals }
aktprocdef.localst.datasize:=0;
procinfo.firsttemp_offset:=0;
{ replace framepointer with stackpointer } { replace framepointer with stackpointer }
procinfo.framepointer.enum:=R_INTREGISTER; procinfo.framepointer.enum:=R_INTREGISTER;
procinfo.framepointer.number:=NR_STACK_POINTER_REG; procinfo.framepointer.number:=NR_STACK_POINTER_REG;
@ -1095,18 +1094,27 @@ implementation
(vm, i386, vm only currently) (vm, i386, vm only currently)
} }
if (po_assembler in aktprocdef.procoptions) and if (po_assembler in aktprocdef.procoptions) and
{$ifndef powerpc}
{ is this really necessary??? }
(aktprocdef.parast.datasize=0) and (aktprocdef.parast.datasize=0) and
{$endif powerpc}
(aktprocdef.localst.datasize=aktprocdef.rettype.def.size) and (aktprocdef.localst.datasize=aktprocdef.rettype.def.size) and
(aktprocdef.owner.symtabletype<>objectsymtable) and (aktprocdef.owner.symtabletype<>objectsymtable) and
(not assigned(aktprocdef.funcretsym) or (not assigned(aktprocdef.funcretsym) or
(tvarsym(aktprocdef.funcretsym).refcount<=1)) and (tvarsym(aktprocdef.funcretsym).refcount<=1)) and
not(paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption)) and not(paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption)) then
(target_cpu in [cpu_i386,cpu_m68k,cpu_vm]) begin
{ we don't need to allocate space for the locals }
aktprocdef.localst.datasize:=0;
procinfo.firsttemp_offset:=0;
{ only for cpus with different frame- and stack pointer the code must be changed }
if (NR_STACK_POINTER_REG<>NR_FRAME_POINTER_REG)
{$ifdef CHECKFORPUSH} {$ifdef CHECKFORPUSH}
and not(UsesPush(tasmnode(p))) and not(UsesPush(tasmnode(p)))
{$endif CHECKFORPUSH} {$endif CHECKFORPUSH}
then then
OptimizeFramePointer(tasmnode(p)); OptimizeFramePointer(tasmnode(p));
end;
{ Flag the result as assigned when it is returned in a { Flag the result as assigned when it is returned in a
register. register.
@ -1125,7 +1133,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.91 2003-04-25 20:59:34 peter Revision 1.92 2003-04-26 11:30:59 florian
* fixed the powerpc to work with the new function result handling
Revision 1.91 2003/04/25 20:59:34 peter
* removed funcretn,funcretsym, function result is now in varsym * removed funcretn,funcretsym, function result is now in varsym
and aliases for result and function name are added using absolutesym and aliases for result and function name are added using absolutesym
* vs_hidden parameter for funcret passed in parameter * vs_hidden parameter for funcret passed in parameter