* fixed several arm issues

This commit is contained in:
florian 2004-01-26 19:05:56 +00:00
parent 8ef2f96215
commit 35110d8ef5
5 changed files with 142 additions and 78 deletions

View File

@ -95,7 +95,7 @@ uses
implementation
uses
cutils,rgobj;
cutils,rgobj,itcpugas;
procedure taicpu.loadshifterop(opidx:longint;const so:tshifterop);
@ -313,13 +313,13 @@ implementation
function taicpu.spilling_create_load(const ref:treference;r:tregister): tai;
begin
result:=taicpu.op_reg_ref(A_LDR,r,ref);
internalerror(200401261);
end;
function taicpu.spilling_create_store(r:tregister; const ref:treference): tai;
begin
result:=taicpu.op_reg_ref(A_STR,r,ref);
internalerror(200401262);
end;
@ -427,7 +427,10 @@ implementation
end.
{
$Log$
Revision 1.24 2004-01-24 20:19:46 florian
Revision 1.25 2004-01-26 19:05:56 florian
* fixed several arm issues
Revision 1.24 2004/01/24 20:19:46 florian
* fixed some spilling stuff
+ not(<int64>) implemented
+ small set comparisations implemented

View File

@ -369,24 +369,17 @@ unit cgcpu;
if dst=src2 then
begin
if dst<>src1 then
begin
rg[R_INTREGISTER].add_edge(getsupreg(dst),getsupreg(src1));
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src1,src2));
end
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src1,src2))
else
begin
tmpreg:=getintregister(list,size);
a_load_reg_reg(list,size,size,src2,dst);
rg[R_INTREGISTER].add_edge(getsupreg(dst),getsupreg(tmpreg));
ungetregister(list,tmpreg);
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,tmpreg,src1));
end;
end
else
begin
rg[R_INTREGISTER].add_edge(getsupreg(dst),getsupreg(src2));
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src2,src1));
end;
list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src2,src1));
end;
else
list.concat(setoppostfix(taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmop[op],dst,src2,src1),toppostfix(ord(setflags)*ord(PF_S))));
@ -718,7 +711,7 @@ unit cgcpu;
end;
{ comparison operations }
{ comparison operations }
procedure tcgarm.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword;reg : tregister;
l : tasmlabel);
var
@ -749,20 +742,20 @@ unit cgcpu;
end;
procedure tcgarm.a_jmp_always(list : taasmoutput;l: tasmlabel);
begin
list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(l.name)));
end;
procedure tcgarm.a_jmp_always(list : taasmoutput;l: tasmlabel);
begin
list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(l.name)));
end;
procedure tcgarm.a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel);
var
ai : taicpu;
begin
ai:=setcondition(taicpu.op_sym(A_B,l),flags_to_cond(f));
ai.is_jmp:=true;
list.concat(ai);
end;
procedure tcgarm.a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel);
var
ai : taicpu;
begin
ai:=setcondition(taicpu.op_sym(A_B,l),flags_to_cond(f));
ai.is_jmp:=true;
list.concat(ai);
end;
procedure tcgarm.g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; reg: TRegister);
@ -1228,7 +1221,10 @@ begin
end.
{
$Log$
Revision 1.39 2004-01-24 20:19:46 florian
Revision 1.40 2004-01-26 19:05:56 florian
* fixed several arm issues
Revision 1.39 2004/01/24 20:19:46 florian
* fixed some spilling stuff
+ not(<int64>) implemented
+ small set comparisations implemented

View File

@ -281,12 +281,24 @@ interface
exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,tmpreg,right.location.register64.reglo,left.location.register64.reglo),PF_S));
exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SBC,tmpreg,right.location.register64.reghi,left.location.register64.reghi),PF_S));
cg.ungetregister(exprasmlist,tmpreg);
if location.resflags=F_GT then
location.resflags:=F_LT
else if location.resflags=F_LE then
location.resflags:=F_GE
if nf_swaped in flags then
begin
if location.resflags=F_LT then
location.resflags:=F_GT
else if location.resflags=F_GE then
location.resflags:=F_LE
else
internalerror(200401221);
end
else
internalerror(200401221);
begin
if location.resflags=F_GT then
location.resflags:=F_LT
else if location.resflags=F_LE then
location.resflags:=F_GE
else
internalerror(200401221);
end;
end;
release_reg_left_right;
@ -332,7 +344,10 @@ begin
end.
{
$Log$
Revision 1.10 2004-01-24 20:19:46 florian
Revision 1.11 2004-01-26 19:05:56 florian
* fixed several arm issues
Revision 1.10 2004/01/24 20:19:46 florian
* fixed some spilling stuff
+ not(<int64>) implemented
+ small set comparisations implemented

View File

@ -36,68 +36,115 @@ unit rgcpu;
type
trgcpu = class(trgobj)
{
function getexplicitregisterfpu(list : taasmoutput; r : Toldregister) : tregister;override;
procedure ungetregisterfpu(list: taasmoutput; r : tregister; size:TCGsize);override;
procedure cleartempgen; override;
private
usedpararegs: Tsupregset;
usedparafpuregs: tregisterset;
}
procedure add_cpu_interferences(p : tai);override;
procedure DoSpillRead(list : taasmoutput;instr : taicpu_abstract;pos: tai; regidx: longint;
const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override;
procedure DoSpillWritten(list : taasmoutput;instr : taicpu_abstract;pos: tai; regidx: longint;
const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override;
procedure DoSpillReadWritten(list : taasmoutput;instr : taicpu_abstract;pos: tai; regidx: longint;
const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override;
end;
implementation
uses
cgobj, verbose, cutils;
cgobj, verbose, cutils,
aasmcpu;
{
function trgcpu.getexplicitregisterfpu(list : taasmoutput; r : Toldregister) : tregister;
procedure trgcpu.add_cpu_interferences(p : tai);
begin
if (r in [R_F0..R_F3]) and
not is_reg_var_other[r] then
if p.typ=ait_instruction then
begin
if r in usedparafpuregs then
internalerror(2003060902);
include(usedparafpuregs,r);
result.enum := r;
cg.a_reg_alloc(list,result);
end
else
result:=inherited getexplicitregisterfpu(list,r);
if (taicpu(p).opcode=A_MUL) then
add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(taicpu(p).oper[1]^.reg));
end;
end;
procedure trgcpu.ungetregisterfpu(list: taasmoutput; r : tregister; size:TCGsize);
procedure trgcpu.DoSpillRead(list : taasmoutput;instr : taicpu_abstract;pos: tai; regidx: longint;
const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
var
helpins: tai;
ref : treference;
begin
if (r.enum in [R_F0..R_F3]) and
not is_reg_var_other[r.enum] then
ref:=spilltemplist[regs[regidx].orgreg];
helpins:=taicpu.op_reg_ref(A_LDR,regs[regidx].tempreg,ref);
if pos=nil then
list.insertafter(helpins,list.first)
else
list.insertafter(helpins,pos.next);
ungetregisterinline(list,instr,regs[regidx].tempreg);
forward_allocation(tai(helpins.next),instr);
end;
procedure trgcpu.DoSpillWritten(list : taasmoutput;instr : taicpu_abstract;pos: tai; regidx: longint;
const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
var
helpins: tai;
ref : treference;
begin
ref:=spilltemplist[regs[regidx].orgreg];
helpins:=taicpu.op_reg_ref(A_STR,regs[regidx].tempreg,ref);
list.insertafter(helpins,instr);
ungetregisterinline(list,helpins,regs[regidx].tempreg);
end;
procedure trgcpu.DoSpillReadWritten(list : taasmoutput;instr : taicpu_abstract;pos: tai; regidx: longint;
const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
var
helpins1, helpins2: tai;
tmpref,ref : treference;
tmpreg : tregister;
begin
ref:=spilltemplist[regs[regidx].orgreg];
{
if abs(ref.offset)>4095 then
begin
if not(r.enum in usedparafpuregs) then
internalerror(2003060903);
exclude(usedparafpuregs,r.enum);
cg.a_reg_dealloc(list,r);
end
reference_reset(tmpref);
{ create consts entry }
objectlibrary.getlabel(l);
cg.a_label(current_procinfo.aktlocaldata,l);
tmpref.symboldata:=current_procinfo.aktlocaldata.last;
current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(ref.offset));
{ load consts entry }
getregisterinline(list,pos,defaultsub,tmpreg);
tmpref.symbol:=l;
tmpref.base:=NR_R15;
list.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
if ref.index<>NR_NO then
internalerror(200401263);
ref.index:=tmpreg;
ref.offset:=0;
end;
}
helpins1:=taicpu.op_reg_ref(A_LDR,regs[regidx].tempreg,ref);
if pos=nil then
list.insertafter(helpins1,list.first)
else
inherited ungetregisterfpu(list,r,size);
list.insertafter(helpins1,pos.next);
ref:=spilltemplist[regs[regidx].orgreg];
ref.symboldata:=nil;
helpins2:=taicpu.op_reg_ref(A_STR,regs[regidx].tempreg,ref);
list.insertafter(helpins2,instr);
ungetregisterinline(list,helpins2,regs[regidx].tempreg);
forward_allocation(tai(helpins1.next),instr);
end;
procedure trgcpu.cleartempgen;
begin
inherited cleartempgen;
usedpararegs := [];
usedparafpuregs := [];
end;
}
end.
{
$Log$
Revision 1.5 2003-11-02 14:30:03 florian
Revision 1.6 2004-01-26 19:05:56 florian
* fixed several arm issues
Revision 1.5 2003/11/02 14:30:03 florian
* fixed ARM for new reg. allocation scheme
Revision 1.4 2003/09/11 11:55:00 florian

View File

@ -457,9 +457,9 @@ unit i_linux;
constalignmax : 4;
varalignmin : 0;
varalignmax : 4;
localalignmin : 4;
localalignmin : 0;
localalignmax : 4;
recordalignmin : 4;
recordalignmin : 0;
recordalignmax : 4;
maxCrecordalign : 4
);
@ -514,7 +514,10 @@ initialization
end.
{
$Log$
Revision 1.20 2004-01-12 22:11:39 peter
Revision 1.21 2004-01-26 19:05:56 florian
* fixed several arm issues
Revision 1.20 2004/01/12 22:11:39 peter
* use localalign info for alignment for locals and temps
* sparc fpu flags branching added
* moved powerpc copy_valye_openarray to generic