+ arm floating point register saving implemented

* hopefully stabs generation for MacOSX fixed
  + some defines for arm added
This commit is contained in:
florian 2004-03-29 19:19:35 +00:00
parent 116b5f2483
commit aae508c277
7 changed files with 160 additions and 15 deletions

View File

@ -59,6 +59,8 @@ uses
constructor op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: tasmsymbol;_op3ofs: longint);
constructor op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister; const _op3: treference);
constructor op_reg_reg_shifterop(op : tasmop;_op1,_op2 : tregister;_op3 : tshifterop);
{ SFM/LFM }
constructor op_reg_const_ref(op : tasmop;_op1 : tregister;_op2 : aword;_op3 : treference);
{ this is for Jmp instructions }
constructor op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : tasmsymbol);
@ -218,6 +220,16 @@ implementation
end;
constructor taicpu.op_reg_const_ref(op : tasmop;_op1 : tregister;_op2 : aword;_op3 : treference);
begin
inherited create(op);
ops:=3;
loadreg(0,_op1);
loadconst(1,_op2);
loadref(2,_op3);
end;
constructor taicpu.op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: tasmsymbol;_op3ofs: longint);
begin
inherited create(op);
@ -461,7 +473,12 @@ implementation
end.
{
$Log$
Revision 1.30 2004-03-15 22:20:13 florian
Revision 1.31 2004-03-29 19:19:35 florian
+ arm floating point register saving implemented
* hopefully stabs generation for MacOSX fixed
+ some defines for arm added
Revision 1.30 2004/03/15 22:20:13 florian
* handling of spilling improved
Revision 1.29 2004/03/14 16:15:39 florian

View File

@ -220,6 +220,16 @@ unit agarmgas;
internalerror(200311292);
end;
end
{ register count of SFM and LFM is written without # }
else if (i=1) and (op in [A_SFM,A_LFM]) then
begin
case taicpu(hp).oper[1]^.typ of
top_const:
s:=s+sep+tostr(taicpu(hp).oper[1]^.val);
else
internalerror(200311292);
end;
end
else
s:=s+sep+getopstr(taicpu(hp).oper[i]^);
@ -235,7 +245,12 @@ begin
end.
{
$Log$
Revision 1.18 2004-03-06 20:35:19 florian
Revision 1.19 2004-03-29 19:19:35 florian
+ arm floating point register saving implemented
* hopefully stabs generation for MacOSX fixed
+ some defines for arm added
Revision 1.18 2004/03/06 20:35:19 florian
* fixed arm compilation
* cleaned up code generation for exported linux procedures

View File

@ -847,9 +847,19 @@ unit cgcpu;
var
ref : treference;
shift : byte;
firstfloatreg,lastfloatreg,
r : byte;
begin
LocalSize:=align(LocalSize,4);
firstfloatreg:=RS_NO;
{ save floating point registers? }
for r:=RS_F0 to RS_F7 do
if r in rg[R_FPUREGISTER].used_in_proc-paramanager.get_volatile_registers_fpu(pocall_stdcall) then
begin
if firstfloatreg=RS_NO then
firstfloatreg:=r;
lastfloatreg:=r;
end;
a_reg_alloc(list,NR_STACK_POINTER_REG);
a_reg_alloc(list,NR_FRAME_POINTER_REG);
a_reg_alloc(list,NR_R12);
@ -859,7 +869,9 @@ unit cgcpu;
reference_reset(ref);
ref.index:=NR_STACK_POINTER_REG;
ref.addressmode:=AM_PREINDEXED;
list.concat(setoppostfix(taicpu.op_ref_regset(A_STM,ref,rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall)+[RS_R11,RS_R12,RS_R14,RS_R15]),PF_FD));
list.concat(setoppostfix(taicpu.op_ref_regset(A_STM,ref,
rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall)+[RS_R11,RS_R12,RS_R14,RS_R15]),
PF_FD));
list.concat(taicpu.op_reg_reg_const(A_SUB,NR_FRAME_POINTER_REG,NR_R12,4));
@ -877,13 +889,42 @@ unit cgcpu;
a_reg_dealloc(list,NR_R12);
list.concat(taicpu.op_reg_reg_const(A_SUB,NR_STACK_POINTER_REG,NR_STACK_POINTER_REG,LocalSize));
end;
if firstfloatreg<>RS_NO then
begin
reference_reset(ref);
ref.base:=NR_FRAME_POINTER_REG;
ref.offset:=tarmprocinfo(current_procinfo).floatregstart;
list.concat(taicpu.op_reg_const_ref(A_SFM,newreg(R_FPUREGISTER,firstfloatreg,R_SUBWHOLE),
lastfloatreg-firstfloatreg+1,ref));
end;
end;
procedure tcgarm.g_return_from_proc(list : taasmoutput;parasize : aword);
var
ref : treference;
firstfloatreg,lastfloatreg,
r : byte;
begin
{ restore floating point register }
firstfloatreg:=RS_NO;
{ save floating point registers? }
for r:=RS_F0 to RS_F7 do
if r in rg[R_FPUREGISTER].used_in_proc-paramanager.get_volatile_registers_fpu(pocall_stdcall) then
begin
if firstfloatreg=RS_NO then
firstfloatreg:=r;
lastfloatreg:=r;
end;
if firstfloatreg<>RS_NO then
begin
reference_reset(ref);
ref.base:=NR_FRAME_POINTER_REG;
ref.offset:=tarmprocinfo(current_procinfo).floatregstart;
list.concat(taicpu.op_reg_const_ref(A_LFM,newreg(R_FPUREGISTER,firstfloatreg,R_SUBWHOLE),
lastfloatreg-firstfloatreg+1,ref));
end;
if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
list.concat(taicpu.op_reg_reg(A_MOV,NR_R15,NR_R14))
else
@ -1288,7 +1329,12 @@ begin
end.
{
$Log$
Revision 1.49 2004-03-14 21:42:24 florian
Revision 1.50 2004-03-29 19:19:35 florian
+ arm floating point register saving implemented
* hopefully stabs generation for MacOSX fixed
+ some defines for arm added
Revision 1.49 2004/03/14 21:42:24 florian
* optimized mul code generation
Revision 1.48 2004/03/14 16:15:40 florian

View File

@ -34,6 +34,7 @@ unit cpupi;
type
tarmprocinfo = class(tcgprocinfo)
floatregstart : aword;
constructor create(aparent:tprocinfo);override;
// procedure handle_body_start;override;
// procedure after_pass1;override;
@ -50,7 +51,9 @@ unit cpupi;
cpubase,
aasmtai,
tgobj,
symconst,symsym,paramgr;
symconst,symsym,paramgr,
cgbase,
cgobj;
constructor tarmprocinfo.create(aparent:tprocinfo);
@ -124,9 +127,28 @@ unit cpupi;
function tarmprocinfo.calc_stackframe_size:longint;
var
firstfloatreg,lastfloatreg,
r : byte;
floatsavesize : aword;
begin
{ align to 4 bytes at least }
result:=Align(tg.direction*tg.lasttemp+maxpushedparasize,max(aktalignment.localalignmin,4));
maxpushedparasize:=align(maxpushedparasize,max(aktalignment.localalignmin,4));
firstfloatreg:=RS_NO;
{ save floating point registers? }
for r:=RS_F0 to RS_F7 do
if r in cg.rg[R_FPUREGISTER].used_in_proc-paramanager.get_volatile_registers_fpu(pocall_stdcall) then
begin
if firstfloatreg=RS_NO then
firstfloatreg:=r;
lastfloatreg:=r;
end;
if firstfloatreg<>RS_NO then
floatsavesize:=(lastfloatreg-firstfloatreg+1)*12
else
floatsavesize:=0;
floatsavesize:=align(floatsavesize,max(aktalignment.localalignmin,4));
result:=Align(tg.direction*tg.lasttemp,max(aktalignment.localalignmin,4))+maxpushedparasize+floatsavesize;
floatregstart:=-result+maxpushedparasize;
end;
@ -135,7 +157,12 @@ begin
end.
{
$Log$
Revision 1.6 2004-03-06 20:35:20 florian
Revision 1.7 2004-03-29 19:19:35 florian
+ arm floating point register saving implemented
* hopefully stabs generation for MacOSX fixed
+ some defines for arm added
Revision 1.6 2004/03/06 20:35:20 florian
* fixed arm compilation
* cleaned up code generation for exported linux procedures

View File

@ -77,6 +77,7 @@ interface
}
function ispowerof2(value : int64;var power : longint) : boolean;
function backspace_quote(const s:string;const qchars:Tcharset):string;
function octal_quote(const s:string;const qchars:Tcharset):string;
function maybequoted(const s:string):string;
function CompareText(S1, S2: string): longint;
@ -206,9 +207,9 @@ uses
begin
if i<0 then
result:=((i-a+1) div a) * a
else
else
result:=((i+a-1) div a) * a;
end;
end;
end;
@ -647,6 +648,26 @@ uses
end;
end;
function octal_quote(const s:string;const qchars:Tcharset):string;
var i:byte;
begin
octal_quote:='';
for i:=1 to length(s) do
begin
if s[i] in qchars then
begin
if ord(s[i])<64 then
octal_quote:=octal_quote+'\'+octstr(ord(s[i]),3)
else
octal_quote:=octal_quote+'\'+octstr(ord(s[i]),4);
end
else
octal_quote:=octal_quote+s[i];
end;
end;
function maybequoted(const s:string):string;
var
s1 : string;
@ -1141,7 +1162,12 @@ initialization
end.
{
$Log$
Revision 1.37 2004-03-22 09:28:34 michael
Revision 1.38 2004-03-29 19:19:35 florian
+ arm floating point register saving implemented
* hopefully stabs generation for MacOSX fixed
+ some defines for arm added
Revision 1.37 2004/03/22 09:28:34 michael
+ Patch from peter for stack overflow
Revision 1.36 2004/02/27 10:21:05 florian

View File

@ -1776,6 +1776,7 @@ begin
def_symbol('CPU32');
def_symbol('FPC_HAS_TYPE_DOUBLE');
def_symbol('FPC_HAS_TYPE_SINGLE');
def_symbol('FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE');
def_symbol('FPC_CURRENCY_IS_INT64');
def_symbol('FPC_COMP_IS_INT64');
def_symbol('FPC_REQUIRES_PROPER_ALIGNMENT');
@ -2039,7 +2040,12 @@ finalization
end.
{
$Log$
Revision 1.131 2004-03-27 23:23:03 florian
Revision 1.132 2004-03-29 19:19:35 florian
+ arm floating point register saving implemented
* hopefully stabs generation for MacOSX fixed
+ some defines for arm added
Revision 1.131 2004/03/27 23:23:03 florian
+ added FPC_COMP_IS_INT64 define
Revision 1.130 2004/03/23 22:34:49 peter

View File

@ -1903,7 +1903,10 @@ implementation
{even GDB v4.16 only now 'i' 'r' and 'e' !!!}
case consttyp of
conststring:
st:='s'''+backspace_quote(strpas(pchar(value.valueptr)),['''','"','\',#10,#13])+'''';
if target_info.system in [system_powerpc_macos,system_powerpc_darwin] then
st:='s'''+backspace_quote(octal_quote(strpas(pchar(value.valueptr)),['''']),['"','\',#10,#13])+''''
else
st:='s'''+backspace_quote(strpas(pchar(value.valueptr)),['''','"','\',#10,#13])+'''';
constord:
st:='i'+int64tostr(value.valueord);
constpointer:
@ -2200,7 +2203,12 @@ implementation
end.
{
$Log$
Revision 1.168 2004-03-23 22:34:49 peter
Revision 1.169 2004-03-29 19:19:35 florian
+ arm floating point register saving implemented
* hopefully stabs generation for MacOSX fixed
+ some defines for arm added
Revision 1.168 2004/03/23 22:34:49 peter
* constants ordinals now always have a type assigned
* integer constants have the smallest type, unsigned prefered over
signed