mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-06 23:47:23 +01:00
* improved arm code generation
* move some protected and private field around
* the temp. register for register parameters/arguments are now released
before the move to the parameter register is done. This improves
the code in a lot of cases.
This commit is contained in:
parent
079751b894
commit
8f66389b46
@ -293,7 +293,7 @@ implementation
|
||||
|
||||
function taicpu.is_move:boolean;
|
||||
begin
|
||||
is_move := opcode = A_MOV;
|
||||
is_move := opcode=A_MOV;
|
||||
end;
|
||||
|
||||
|
||||
@ -366,7 +366,14 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.11 2003-09-06 11:21:49 florian
|
||||
Revision 1.12 2003-09-11 11:54:59 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.11 2003/09/06 11:21:49 florian
|
||||
* fixed stm and ldm to be usable with preindex operand
|
||||
|
||||
Revision 1.10 2003/09/04 21:07:03 florian
|
||||
|
||||
@ -37,6 +37,9 @@ unit cgcpu;
|
||||
|
||||
type
|
||||
tcgarm = class(tcg)
|
||||
procedure init_register_allocators;override;
|
||||
procedure done_register_allocators;override;
|
||||
|
||||
procedure a_param_const(list : taasmoutput;size : tcgsize;a : aword;const locpara : tparalocation);override;
|
||||
procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);override;
|
||||
procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);override;
|
||||
@ -112,7 +115,19 @@ unit cgcpu;
|
||||
|
||||
|
||||
uses
|
||||
globtype,globals,verbose,systems,cutils,symconst,symdef,symsym,rgobj,tgobj,cpupi;
|
||||
globtype,globals,verbose,systems,cutils,symconst,symdef,symsym,rgobj,rgcpu,tgobj,cpupi;
|
||||
|
||||
|
||||
procedure tcgarm.init_register_allocators;
|
||||
begin
|
||||
rg:=trgcpu.create(11,#0#1#2#3#4#5#6#7#8#9#10);
|
||||
end;
|
||||
|
||||
|
||||
procedure tcgarm.done_register_allocators;
|
||||
begin
|
||||
rg.free;
|
||||
end;
|
||||
|
||||
|
||||
procedure tcgarm.a_param_const(list : taasmoutput;size : tcgsize;a : aword;const locpara : tparalocation);
|
||||
@ -254,7 +269,7 @@ unit cgcpu;
|
||||
tmpreg : tregister;
|
||||
so : tshifterop;
|
||||
begin
|
||||
if is_shifter_const(a,shift) and (not(op in [OP_IMUL,OP_MUL])) then
|
||||
if is_shifter_const(a,shift) and not(op in [OP_IMUL,OP_MUL]) then
|
||||
case op of
|
||||
OP_NEG,OP_NOT,
|
||||
OP_DIV,OP_IDIV:
|
||||
@ -300,7 +315,7 @@ unit cgcpu;
|
||||
a_op_reg_reg(list,OP_NEG,size,src,dst)
|
||||
else
|
||||
begin
|
||||
tmpreg := rg.getregisterint(list,size);
|
||||
tmpreg:=rg.getregisterint(list,size);
|
||||
a_load_const_reg(list,size,a,tmpreg);
|
||||
a_op_reg_reg_reg(list,op,size,tmpreg,src,dst);
|
||||
rg.ungetregisterint(list,tmpreg);
|
||||
@ -344,18 +359,8 @@ unit cgcpu;
|
||||
OP_MUL:
|
||||
begin
|
||||
{ the arm doesn't allow that rd and rm are the same }
|
||||
if dst=src2 then
|
||||
begin
|
||||
if src1<>src2 then
|
||||
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src1,src2))
|
||||
else
|
||||
begin
|
||||
writeln('Warning: Fix MUL');
|
||||
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src2,src1));
|
||||
end;
|
||||
end
|
||||
else
|
||||
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src2,src1));
|
||||
rg.add_edge(dst,src2);
|
||||
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src2,src1));
|
||||
end;
|
||||
else
|
||||
list.concat(taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmop[op],dst,src2,src1));
|
||||
@ -785,6 +790,7 @@ unit cgcpu;
|
||||
list.concat(instr);
|
||||
end;
|
||||
end;
|
||||
reference_release(list,tmpref);
|
||||
end;
|
||||
|
||||
|
||||
@ -817,8 +823,8 @@ unit cgcpu;
|
||||
current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(ref.offset));
|
||||
|
||||
{ load consts entry }
|
||||
tmpreg:=rg.getregisterint(list,OS_INT);
|
||||
reference_reset(tmpref);
|
||||
tmpreg:=rg.getregisterint(list,OS_INT);
|
||||
tmpref.symbol:=l;
|
||||
tmpref.base:=NR_PC;
|
||||
list.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
|
||||
@ -828,7 +834,6 @@ unit cgcpu;
|
||||
if ref.index<>NR_NO then
|
||||
begin
|
||||
list.concat(taicpu.op_reg_reg_reg(A_ADD,tmpreg,ref.base,tmpreg));
|
||||
rg.ungetregisterint(list,ref.base);
|
||||
ref.base:=tmpreg;
|
||||
end
|
||||
else
|
||||
@ -841,6 +846,7 @@ unit cgcpu;
|
||||
end
|
||||
else
|
||||
ref.base:=tmpreg;
|
||||
|
||||
ref.offset:=0;
|
||||
ref.symbol:=nil;
|
||||
end;
|
||||
@ -1112,7 +1118,14 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.18 2003-09-09 12:53:40 florian
|
||||
Revision 1.19 2003-09-11 11:55:00 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.18 2003/09/09 12:53:40 florian
|
||||
* some assembling problems fixed
|
||||
* improved loadaddr_ref_reg
|
||||
|
||||
|
||||
@ -36,8 +36,8 @@ unit cpupara;
|
||||
type
|
||||
tarmparamanager = class(tparamanager)
|
||||
function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;override;
|
||||
function getintparaloc(list: taasmoutput; nr : longint) : tparalocation;override;
|
||||
procedure freeintparaloc(list: taasmoutput; nr : longint); override;
|
||||
function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
|
||||
// procedure freeintparaloc(list: taasmoutput; nr : longint); override;
|
||||
procedure create_paraloc_info(p : tabstractprocdef; side: tcallercallee);override;
|
||||
end;
|
||||
|
||||
@ -49,8 +49,7 @@ unit cpupara;
|
||||
rgobj,
|
||||
defutil,symsym;
|
||||
|
||||
function tarmparamanager.getintparaloc(list: taasmoutput; nr : longint) : tparalocation;
|
||||
|
||||
function tarmparamanager.getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;
|
||||
begin
|
||||
fillchar(result,sizeof(tparalocation),0);
|
||||
if nr<1 then
|
||||
@ -59,7 +58,6 @@ unit cpupara;
|
||||
begin
|
||||
result.loc:=LOC_REGISTER;
|
||||
result.register:=newreg(R_INTREGISTER,RS_R0+nr,R_SUBWHOLE);
|
||||
rg.getexplicitregisterint(list,result.register);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -70,7 +68,7 @@ unit cpupara;
|
||||
result.size := OS_INT;
|
||||
end;
|
||||
|
||||
|
||||
{
|
||||
procedure tarmparamanager.freeintparaloc(list: taasmoutput; nr : longint);
|
||||
|
||||
var
|
||||
@ -85,10 +83,9 @@ unit cpupara;
|
||||
rg.ungetregisterint(list,r);
|
||||
end;
|
||||
end;
|
||||
|
||||
}
|
||||
|
||||
function getparaloc(p : tdef) : tcgloc;
|
||||
|
||||
begin
|
||||
{ Later, the LOC_REFERENCE is in most cases changed into LOC_REGISTER
|
||||
if push_addr_param for the def is true
|
||||
@ -328,7 +325,14 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2003-09-09 12:53:40 florian
|
||||
Revision 1.7 2003-09-11 11:55:00 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.6 2003/09/09 12:53:40 florian
|
||||
* some assembling problems fixed
|
||||
* improved loadaddr_ref_reg
|
||||
|
||||
|
||||
@ -36,15 +36,28 @@ interface
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
paramgr;
|
||||
|
||||
|
||||
procedure tarmcallnode.push_framepointer;
|
||||
begin
|
||||
framepointer_paraloc:=paramanager.getintparaloc(procdefinition.proccalloption,1);
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
ccallnode:=tarmcallnode;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2003-08-27 00:27:56 florian
|
||||
Revision 1.2 2003-09-11 11:55:00 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.1 2003/08/27 00:27:56 florian
|
||||
+ same procedure as very day: today's work on arm
|
||||
}
|
||||
|
||||
@ -93,13 +93,18 @@ unit rgcpu;
|
||||
|
||||
}
|
||||
|
||||
initialization
|
||||
rg := trgcpu.create(last_int_supreg-first_int_supreg+1);
|
||||
end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2003-09-04 00:15:29 florian
|
||||
Revision 1.4 2003-09-11 11:55:00 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.3 2003/09/04 00:15:29 florian
|
||||
* first bunch of adaptions of arm compiler for new register type
|
||||
|
||||
Revision 1.2 2003/08/25 23:20:38 florian
|
||||
|
||||
@ -239,13 +239,17 @@ unit rgcpu;
|
||||
add_constraints(result);
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.34 2003-09-09 20:59:27 daniel
|
||||
Revision 1.35 2003-09-11 11:55:00 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.34 2003/09/09 20:59:27 daniel
|
||||
* Adding register allocation order
|
||||
|
||||
Revision 1.33 2003/09/07 22:09:35 peter
|
||||
|
||||
@ -42,11 +42,11 @@ interface
|
||||
|
||||
tcgcallnode = class(tcallnode)
|
||||
private
|
||||
framepointer_paraloc : tparalocation;
|
||||
procedure release_para_temps;
|
||||
procedure normal_pass_2;
|
||||
procedure inlined_pass_2;
|
||||
protected
|
||||
framepointer_paraloc : tparalocation;
|
||||
refcountedtemp : treference;
|
||||
procedure handle_return_value;
|
||||
{# This routine is used to push the current frame pointer
|
||||
@ -566,6 +566,7 @@ implementation
|
||||
begin
|
||||
if ppn.tempparaloc.loc=LOC_REGISTER then
|
||||
begin
|
||||
paramanager.freeparaloc(exprasmlist,ppn.tempparaloc);
|
||||
paramanager.allocparaloc(exprasmlist,ppn.paraitem.paraloc[callerside]);
|
||||
{$ifdef sparc}
|
||||
case ppn.tempparaloc.size of
|
||||
@ -1334,7 +1335,14 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.112 2003-09-10 08:31:47 marco
|
||||
Revision 1.113 2003-09-11 11:54:59 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.112 2003/09/10 08:31:47 marco
|
||||
* Patch from Peter for paraloc
|
||||
|
||||
Revision 1.111 2003/09/07 22:09:35 peter
|
||||
|
||||
@ -1824,7 +1824,14 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.141 2003-09-10 08:31:47 marco
|
||||
Revision 1.142 2003-09-11 11:54:59 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.141 2003/09/10 08:31:47 marco
|
||||
* Patch from Peter for paraloc
|
||||
|
||||
Revision 1.140 2003/09/07 22:09:35 peter
|
||||
@ -1853,7 +1860,6 @@ end.
|
||||
Revision 1.137.2.1 2003/08/27 19:55:54 peter
|
||||
* first tregister patch
|
||||
|
||||
>>>>>>> 1.137.2.4
|
||||
Revision 1.137 2003/08/20 20:29:06 daniel
|
||||
* Some more R_NO changes
|
||||
* Preventive code to loadref added
|
||||
|
||||
@ -339,6 +339,7 @@ unit rgobj;
|
||||
procedure epilogue_colouring;
|
||||
procedure colour_registers;
|
||||
function spill_registers(list:Taasmoutput;const regs_to_spill:string):boolean;
|
||||
procedure add_edge(u,v:Tsuperregister);
|
||||
protected
|
||||
cpu_registers:byte;
|
||||
igraph:Tinterferencegraph;
|
||||
@ -366,7 +367,6 @@ unit rgobj;
|
||||
procedure getregisterintinline(list:Taasmoutput;position:Tai;subreg:Tsubregister;var result:Tregister);
|
||||
procedure ungetregisterintinline(list:Taasmoutput;position:Tai;r:Tregister);
|
||||
|
||||
procedure add_edge(u,v:Tsuperregister);
|
||||
procedure add_edges_used(u:Tsuperregister);
|
||||
procedure add_to_movelist(u:Tsuperregister;data:Tlinkedlistitem);
|
||||
function move_related(n:Tsuperregister):boolean;
|
||||
@ -2221,7 +2221,14 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.73 2003-09-09 20:59:27 daniel
|
||||
Revision 1.74 2003-09-11 11:54:59 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.73 2003/09/09 20:59:27 daniel
|
||||
* Adding register allocation order
|
||||
|
||||
Revision 1.72 2003/09/09 15:55:44 peter
|
||||
|
||||
@ -36,7 +36,6 @@ unit cgx86;
|
||||
|
||||
type
|
||||
tcgx86 = class(tcg)
|
||||
|
||||
procedure init_register_allocators;override;
|
||||
procedure done_register_allocators;override;
|
||||
|
||||
@ -162,10 +161,6 @@ unit cgx86;
|
||||
C_E,C_G,C_L,C_GE,C_LE,C_NE,C_BE,C_B,C_AE,C_A);
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
This is private property, keep out! :)
|
||||
****************************************************************************}
|
||||
|
||||
procedure Tcgx86.init_register_allocators;
|
||||
|
||||
begin
|
||||
@ -178,6 +173,10 @@ unit cgx86;
|
||||
rg.free;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
This is private property, keep out! :)
|
||||
****************************************************************************}
|
||||
|
||||
procedure tcgx86.sizes2load(s1,s2 : tcgsize; var op: tasmop; var s3: topsize);
|
||||
|
||||
begin
|
||||
@ -1623,7 +1622,14 @@ unit cgx86;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.63 2003-09-09 21:03:17 peter
|
||||
Revision 1.64 2003-09-11 11:55:00 florian
|
||||
* improved arm code generation
|
||||
* move some protected and private field around
|
||||
* the temp. register for register parameters/arguments are now released
|
||||
before the move to the parameter register is done. This improves
|
||||
the code in a lot of cases.
|
||||
|
||||
Revision 1.63 2003/09/09 21:03:17 peter
|
||||
* basics for x86 register calling
|
||||
|
||||
Revision 1.62 2003/09/09 20:59:27 daniel
|
||||
|
||||
Loading…
Reference in New Issue
Block a user