mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 19:39:20 +02:00
+ implemented cdecl'd varargs on arm
+ -dCMEM supported by the compiler * label/goto asmsymbol type with -dextdebug fixed
This commit is contained in:
parent
3fe222fbd7
commit
c65e094bba
@ -30,7 +30,7 @@ unit cpupara;
|
||||
uses
|
||||
globtype,
|
||||
aasmtai,
|
||||
cpubase,cgbase,
|
||||
cpuinfo,cpubase,cgbase,
|
||||
symconst,symbase,symtype,symdef,paramgr;
|
||||
|
||||
type
|
||||
@ -39,16 +39,19 @@ unit cpupara;
|
||||
function get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;override;
|
||||
function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
|
||||
function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
|
||||
// procedure freeintparaloc(list: taasmoutput; nr : longint); override;
|
||||
procedure alloctempparaloc(list: taasmoutput;calloption : tproccalloption;paraitem : tparaitem;var locpara:tparalocation);override;
|
||||
function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
|
||||
function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargspara):longint;override;
|
||||
private
|
||||
procedure init_values(var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword);
|
||||
function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; firstpara: tparaitem;
|
||||
var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword):longint;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
verbose,systems,
|
||||
cpuinfo,
|
||||
rgobj,
|
||||
defutil,symsym;
|
||||
|
||||
@ -85,22 +88,6 @@ unit cpupara;
|
||||
result.size := OS_INT;
|
||||
end;
|
||||
|
||||
{
|
||||
procedure tarmparamanager.freeintparaloc(list: taasmoutput; nr : longint);
|
||||
|
||||
var
|
||||
r: tregister;
|
||||
|
||||
begin
|
||||
if nr<1 then
|
||||
internalerror(2003060401)
|
||||
else if nr<=4 then
|
||||
begin
|
||||
r:=newreg(R_INTREGISTER,RS_R0+nr,R_SUBWHOLE);
|
||||
rg.ungetregisterint(list,r);
|
||||
end;
|
||||
end;
|
||||
}
|
||||
|
||||
function getparaloc(calloption : tproccalloption; p : tdef) : tcgloc;
|
||||
begin
|
||||
@ -159,6 +146,7 @@ unit cpupara;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function tarmparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
|
||||
begin
|
||||
if varspez in [vs_var,vs_out] then
|
||||
@ -186,7 +174,17 @@ unit cpupara;
|
||||
end;
|
||||
|
||||
|
||||
function tarmparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
|
||||
procedure tarmparamanager.init_values(var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword);
|
||||
begin
|
||||
curintreg:=RS_R0;
|
||||
curfloatreg:=RS_F0;
|
||||
curmmreg:=RS_D0;
|
||||
cur_stack_offset:=0;
|
||||
end;
|
||||
|
||||
|
||||
function tarmparamanager.create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; firstpara: tparaitem;
|
||||
var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword):longint;
|
||||
|
||||
var
|
||||
nextintreg,nextfloatreg,nextmmreg : tsuperregister;
|
||||
@ -198,7 +196,6 @@ unit cpupara;
|
||||
is_64bit: boolean;
|
||||
|
||||
procedure assignintreg;
|
||||
|
||||
begin
|
||||
if nextintreg<=ord(NR_R3) then
|
||||
begin
|
||||
@ -215,18 +212,15 @@ unit cpupara;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
result:=0;
|
||||
{ zero alignment bytes }
|
||||
fillchar(nextintreg,sizeof(nextintreg),0);
|
||||
fillchar(nextfloatreg,sizeof(nextfloatreg),0);
|
||||
fillchar(nextmmreg,sizeof(nextmmreg),0);
|
||||
nextintreg:=RS_R0;
|
||||
nextfloatreg:=RS_F0;
|
||||
nextmmreg:=RS_D0;
|
||||
stack_offset:=0;
|
||||
nextintreg:=curintreg;
|
||||
nextfloatreg:=curfloatreg;
|
||||
nextmmreg:=curmmreg;
|
||||
stack_offset:=cur_stack_offset;
|
||||
|
||||
hp:=tparaitem(p.para.first);
|
||||
hp:=firstpara;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
if (hp.paratyp in [vs_var,vs_out]) then
|
||||
@ -320,6 +314,24 @@ unit cpupara;
|
||||
hp.paraloc[side]:=paraloc;
|
||||
hp:=tparaitem(hp.next);
|
||||
end;
|
||||
curintreg:=nextintreg;
|
||||
curfloatreg:=nextfloatreg;
|
||||
curmmreg:=nextmmreg;
|
||||
cur_stack_offset:=stack_offset;
|
||||
result:=cur_stack_offset;
|
||||
end;
|
||||
|
||||
|
||||
function tarmparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
|
||||
var
|
||||
paraloc : tparalocation;
|
||||
cur_stack_offset: aword;
|
||||
curintreg, curfloatreg, curmmreg: tsuperregister;
|
||||
begin
|
||||
init_values(curintreg,curfloatreg,curmmreg,cur_stack_offset);
|
||||
|
||||
result:=create_paraloc_info_intern(p,side,tparaitem(p.para.first),curintreg,curfloatreg,curmmreg,cur_stack_offset);
|
||||
|
||||
{ Function return }
|
||||
fillchar(paraloc,sizeof(tparalocation),0);
|
||||
paraloc.lochigh:=LOC_INVALID;
|
||||
@ -372,12 +384,52 @@ unit cpupara;
|
||||
end;
|
||||
|
||||
|
||||
function tarmparamanager.create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargspara):longint;
|
||||
var
|
||||
cur_stack_offset: aword;
|
||||
parasize, l: longint;
|
||||
curintreg, curfloatreg, curmmreg: tsuperregister;
|
||||
hp: tparaitem;
|
||||
paraloc: tparalocation;
|
||||
begin
|
||||
init_values(curintreg,curfloatreg,curmmreg,cur_stack_offset);
|
||||
|
||||
result:=create_paraloc_info_intern(p,callerside,tparaitem(p.para.first),curintreg,curfloatreg,curmmreg,cur_stack_offset);
|
||||
if (p.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
|
||||
{ just continue loading the parameters in the registers }
|
||||
result:=create_paraloc_info_intern(p,callerside,tparaitem(varargspara.first),curintreg,curfloatreg,curmmreg,cur_stack_offset)
|
||||
else
|
||||
begin
|
||||
hp:=tparaitem(varargspara.first);
|
||||
parasize:=cur_stack_offset;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
paraloc.size:=def_cgsize(hp.paratype.def);
|
||||
paraloc.lochigh:=LOC_INVALID;
|
||||
paraloc.loc:=LOC_REFERENCE;
|
||||
paraloc.alignment:=4;
|
||||
paraloc.reference.index:=NR_STACK_POINTER_REG;
|
||||
l:=push_size(hp.paratyp,hp.paratype.def,p.proccalloption);
|
||||
paraloc.reference.offset:=parasize;
|
||||
parasize:=parasize+l;
|
||||
hp.paraloc[callerside]:=paraloc;
|
||||
hp:=tparaitem(hp.next);
|
||||
end;
|
||||
result := parasize;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
paramanager:=tarmparamanager.create;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.15 2004-03-07 00:16:59 florian
|
||||
Revision 1.16 2004-03-20 20:55:36 florian
|
||||
+ implemented cdecl'd varargs on arm
|
||||
+ -dCMEM supported by the compiler
|
||||
* label/goto asmsymbol type with -dextdebug fixed
|
||||
|
||||
Revision 1.15 2004/03/07 00:16:59 florian
|
||||
* compilation of arm rtl fixed
|
||||
|
||||
Revision 1.14 2004/02/09 22:48:45 florian
|
||||
|
@ -258,13 +258,6 @@ implementation
|
||||
consume(_ID)
|
||||
else
|
||||
begin
|
||||
if (cs_create_smart in aktmoduleswitches) then
|
||||
begin
|
||||
objectlibrary.getdatalabel(hl);
|
||||
{ we still want a warning if unused }
|
||||
hl.decrefs;
|
||||
end
|
||||
else
|
||||
objectlibrary.getlabel(hl);
|
||||
if token=_ID then
|
||||
symtablestack.insert(tlabelsym.create(orgpattern,hl))
|
||||
@ -675,7 +668,12 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.83 2004-03-08 22:07:47 peter
|
||||
Revision 1.84 2004-03-20 20:55:36 florian
|
||||
+ implemented cdecl'd varargs on arm
|
||||
+ -dCMEM supported by the compiler
|
||||
* label/goto asmsymbol type with -dextdebug fixed
|
||||
|
||||
Revision 1.83 2004/03/08 22:07:47 peter
|
||||
* stabs updates to write stabs for def for all implictly used
|
||||
units
|
||||
|
||||
|
@ -26,6 +26,7 @@ program pp;
|
||||
possible compiler switches (* marks a currently required switch):
|
||||
-----------------------------------------------------------------
|
||||
GDB* support of the GNU Debugger
|
||||
CMEM use cmem unit for better memory debugging
|
||||
I386 generate a compiler for the Intel i386+
|
||||
x86_64 generate a compiler for the AMD x86-64 architecture
|
||||
M68K generate a compiler for the M68000
|
||||
@ -129,6 +130,9 @@ program pp;
|
||||
{$endif}
|
||||
|
||||
uses
|
||||
{$ifdef cmem}
|
||||
cmem,
|
||||
{$endif cmem}
|
||||
{$ifdef FPC}
|
||||
{$ifdef profile}
|
||||
profile,
|
||||
@ -203,7 +207,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.29 2004-01-26 17:39:12 florian
|
||||
Revision 1.30 2004-03-20 20:55:36 florian
|
||||
+ implemented cdecl'd varargs on arm
|
||||
+ -dCMEM supported by the compiler
|
||||
* label/goto asmsymbol type with -dextdebug fixed
|
||||
|
||||
Revision 1.29 2004/01/26 17:39:12 florian
|
||||
* when compiled with -dnocatch, known rtes aren't translated anymore
|
||||
and a stack dump is written
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user