* don't generate entry/exit code for assembler procedures

This commit is contained in:
Jonas Maebe 2003-04-06 16:39:11 +00:00
parent 2f1df38019
commit f51a189be0
2 changed files with 48 additions and 27 deletions

View File

@ -150,7 +150,7 @@ const
implementation
uses
globtype,globals,verbose,systems,cutils,symconst,symdef,rgobj,tgobj,cpupi;
globtype,globals,verbose,systems,cutils,symconst,symdef,symsym,rgobj,tgobj,cpupi;
{ parameter passing... Still needs extra support from the processor }
{ independent code generator }
@ -913,6 +913,11 @@ const
procedure tcgppc.g_stackframe_entry(list : taasmoutput;localsize : longint);
begin
{ if you program in assembler, you have to take care of everything }
{ yourself. Some things just don't work otherwise (e.g. the linux }
{ syscall code) (JM) }
if (po_assembler in aktprocdef.procoptions) then
exit;
case target_info.system of
system_powerpc_macos:
g_stackframe_entry_mac(list,localsize);
@ -926,6 +931,14 @@ const
procedure tcgppc.g_return_from_proc(list : taasmoutput;parasize : aword);
begin
{ if you program in assembler, you have to take care of everything }
{ yourself. Some things just don't work otherwise (e.g. the linux }
{ syscall code) (JM) }
if (po_assembler in aktprocdef.procoptions) then
begin
list.concat(taicpu.op_none(A_BLR));
exit;
end;
case target_info.system of
system_powerpc_macos:
g_return_from_proc_mac(list,parasize);
@ -2199,7 +2212,10 @@ begin
end.
{
$Log$
Revision 1.76 2003-03-22 18:01:13 jonas
Revision 1.77 2003-04-06 16:39:11 jonas
* don't generate entry/exit code for assembler procedures
Revision 1.76 2003/03/22 18:01:13 jonas
* fixed linux entry/exit code generation
Revision 1.75 2003/03/19 14:26:26 jonas

View File

@ -53,7 +53,7 @@ unit cpupi;
cpubase,
aasmtai,
tgobj,
symsym,paramgr;
symconst, symsym,paramgr;
constructor tppcprocinfo.create;
@ -98,35 +98,37 @@ unit cpupi;
var
ofs : aword;
begin
ofs:=align(maxpushedparasize+LinkageAreaSize,16);
inc(procdef.parast.address_fixup,ofs);
inc(procinfo.return_offset,ofs);
inc(procinfo.framepointer_offset,ofs);
inc(procinfo.selfpointer_offset,ofs);
inc(procdef.localst.address_fixup,ofs);
if cs_asm_source in aktglobalswitches then
aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup))));
if not(po_assembler in procdef.procoptions) then
begin
ofs:=align(maxpushedparasize+LinkageAreaSize,16);
inc(procdef.parast.address_fixup,ofs);
inc(procinfo.return_offset,ofs);
inc(procinfo.framepointer_offset,ofs);
inc(procinfo.selfpointer_offset,ofs);
if cs_asm_source in aktglobalswitches then
aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup))));
// 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;
{
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;
Already done with an "inc" above, should be correct (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;
Already done with an "inc" above, should be correct (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;
}
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: r1+'+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))));
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);
tg.firsttemp:=procinfo.firsttemp_offset;
tg.lasttemp:=procinfo.firsttemp_offset;
//!!!! tg.setfirsttemp(procinfo.firsttemp_offset);
tg.firsttemp:=procinfo.firsttemp_offset;
tg.lasttemp:=procinfo.firsttemp_offset;
end;
end;
begin
@ -134,7 +136,10 @@ begin
end.
{
$Log$
Revision 1.7 2003-04-05 21:09:32 jonas
Revision 1.8 2003-04-06 16:39:11 jonas
* don't generate entry/exit code for assembler procedures
Revision 1.7 2003/04/05 21:09:32 jonas
* several ppc/generic result offset related fixes. The "normal" result
offset seems now to be calculated correctly and a lot of duplicate
calculations have been removed. Nested functions accessing the parent's