* fixed another couple of arm bugs

This commit is contained in:
florian 2004-01-28 15:36:46 +00:00
parent 9b33343e90
commit de4fa4e7e7
7 changed files with 159 additions and 45 deletions

View File

@ -108,7 +108,7 @@ unit cgcpu;
const
OpCmp2AsmCond : Array[topcmp] of TAsmCond = (C_NONE,C_EQ,C_GT,
C_LT,C_GE,C_LE,C_NE,C_LE,C_LT,C_GE,C_GT);
C_LT,C_GE,C_LE,C_NE,C_LS,C_CC,C_CS,C_HI);
function is_shifter_const(d : dword;var imm_shift : byte) : boolean;
@ -321,28 +321,43 @@ unit cgcpu;
begin
if a>32 then
internalerror(200308291);
shifterop_reset(so);
so.shiftmode:=SM_LSL;
so.shiftimm:=a;
list.concat(taicpu.op_reg_reg_shifterop(A_MOV,dst,src,so));
if a<>0 then
begin
shifterop_reset(so);
so.shiftmode:=SM_LSL;
so.shiftimm:=a;
list.concat(taicpu.op_reg_reg_shifterop(A_MOV,dst,src,so));
end
else
list.concat(taicpu.op_reg_reg(A_MOV,dst,src));
end;
OP_SHR:
begin
if a>32 then
internalerror(200308292);
shifterop_reset(so);
so.shiftmode:=SM_LSR;
so.shiftimm:=a;
list.concat(taicpu.op_reg_reg_shifterop(A_MOV,dst,src,so));
if a<>0 then
begin
so.shiftmode:=SM_LSR;
so.shiftimm:=a;
list.concat(taicpu.op_reg_reg_shifterop(A_MOV,dst,src,so));
end
else
list.concat(taicpu.op_reg_reg(A_MOV,dst,src));
end;
OP_SAR:
begin
if a>32 then
internalerror(200308291);
shifterop_reset(so);
so.shiftmode:=SM_ASR;
so.shiftimm:=a;
list.concat(taicpu.op_reg_reg_shifterop(A_MOV,dst,src,so));
if a<>0 then
begin
shifterop_reset(so);
so.shiftmode:=SM_ASR;
so.shiftimm:=a;
list.concat(taicpu.op_reg_reg_shifterop(A_MOV,dst,src,so));
end
else
list.concat(taicpu.op_reg_reg(A_MOV,dst,src));
end;
else
list.concat(taicpu.op_reg_reg_const(op_reg_reg_opcg2asmop[op],dst,src,a));
@ -1253,7 +1268,10 @@ begin
end.
{
$Log$
Revision 1.41 2004-01-27 15:04:06 florian
Revision 1.42 2004-01-28 15:36:47 florian
* fixed another couple of arm bugs
Revision 1.41 2004/01/27 15:04:06 florian
* fixed code generation for math inl. nodes
* more code generator improvements

View File

@ -80,12 +80,10 @@ implementation
location_copy(location,left.location);
inverse_flags(location.resflags);
end;
LOC_REGISTER, LOC_CREGISTER, LOC_REFERENCE, LOC_CREFERENCE :
LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE :
begin
location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true);
ins:=taicpu.op_reg_reg(A_MVN,left.location.register,left.location.register);
ins.oppostfix:=PF_S;
exprasmlist.concat(ins);
exprasmlist.concat(taicpu.op_reg_const(A_CMP,left.location.register,0));
location_release(exprasmlist,left.location);
location_reset(location,LOC_FLAGS,OS_NO);
location.resflags:=F_EQ;
@ -102,9 +100,12 @@ begin
end.
{
$Log$
Revision 1.4 2003-11-02 14:30:03 florian
Revision 1.5 2004-01-28 15:36:47 florian
* fixed another couple of arm bugs
Revision 1.4 2003/11/02 14:30:03 florian
* fixed ARM for new reg. allocation scheme
Revision 1.3 2003/08/27 00:27:56 florian
+ same procedure as very day: today's work on arm
}
}

View File

@ -49,6 +49,7 @@ unit rgcpu;
uses
cgobj, verbose, cutils,
procinfo,
aasmcpu;
@ -66,16 +67,58 @@ unit rgcpu;
const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
var
helpins: tai;
ref : treference;
tmpref,ref : treference;
helplist : taasmoutput;
l : tasmlabel;
tmpreg : tregister;
begin
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)
if abs(ref.offset)>4095 then
begin
helplist:=taasmoutput.create;
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(helplist,nil,defaultsub,tmpreg);
tmpref.symbol:=l;
tmpref.base:=NR_R15;
helplist.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
if ref.index<>NR_NO then
internalerror(200401263);
ref.index:=tmpreg;
ref.offset:=0;
helpins:=taicpu.op_reg_ref(A_LDR,regs[regidx].tempreg,ref);
helplist.concat(helpins);
if pos=nil then
list.insertlistafter(list.first,helplist)
else
list.insertlistafter(pos.next,helplist);
ungetregisterinline(helplist,tai(helplist.last),regs[regidx].tempreg);
ungetregisterinline(list,instr,regs[regidx].tempreg);
forward_allocation(tai(helpins.next),instr);
helplist.free;
end
else
list.insertafter(helpins,pos.next);
ungetregisterinline(list,instr,regs[regidx].tempreg);
forward_allocation(tai(helpins.next),instr);
begin
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;
end;
@ -83,12 +126,48 @@ unit rgcpu;
const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
var
helpins: tai;
ref : treference;
ref,tmpref : treference;
helplist : taasmoutput;
l : tasmlabel;
tmpreg : tregister;
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);
if abs(ref.offset)>4095 then
begin
helplist:=taasmoutput.create;
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(helplist,nil,defaultsub,tmpreg);
tmpref.symbol:=l;
tmpref.base:=NR_R15;
helplist.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
if ref.index<>NR_NO then
internalerror(200401263);
ref.index:=tmpreg;
ref.offset:=0;
helplist.concat(taicpu.op_reg_ref(A_STR,regs[regidx].tempreg,ref));
ungetregisterinline(helplist,tai(helplist.last),regs[regidx].tempreg);
ungetregisterinline(helplist,tai(helplist.last),tmpreg);
list.insertlistafter(instr,helplist);
helplist.free;
end
else
begin
helpins:=taicpu.op_reg_ref(A_STR,regs[regidx].tempreg,ref);
list.insertafter(helpins,instr);
ungetregisterinline(list,helpins,regs[regidx].tempreg);
end;
end;
@ -141,7 +220,10 @@ end.
{
$Log$
Revision 1.6 2004-01-26 19:05:56 florian
Revision 1.7 2004-01-28 15:36:47 florian
* fixed another couple of arm bugs
Revision 1.6 2004/01/26 19:05:56 florian
* fixed several arm issues
Revision 1.5 2003/11/02 14:30:03 florian

View File

@ -206,7 +206,7 @@ var
begin
LoadExtern:=false;
getmem(buf,bufsize);
{Read the message file}
{ Read the message file }
assign(f,fn);
{$I-}
reset(f);
@ -217,7 +217,7 @@ begin
exit;
end;
settextbuf(f,buf^,bufsize);
{ First parse the file and count bytes needed }
{ First parse the file and count bytes needed }
error:=false;
line:=0;
multiline:=false;
@ -271,7 +271,7 @@ begin
close(f);
exit;
end;
{ now read the buffer in mem }
{ now read the buffer in mem }
msgallocsize:=msgsize;
getmem(msgtxt,msgallocsize);
ptxt:=msgtxt;
@ -346,7 +346,7 @@ var
i : longint;
begin
{ clear }
for i:=1to msgparts do
for i:=1 to msgparts do
fillchar(msgidx[i]^,msgidxmax[i]*4,0);
end;
@ -368,7 +368,7 @@ begin
while (hp<hpend) do
begin
hp1:=hp;
for i:=1to 5 do
for i:=1 to 5 do
begin
number[i]:=hp1^;
inc(hp1);
@ -461,7 +461,10 @@ end;
end.
{
$Log$
Revision 1.8 2003-05-10 23:57:23 florian
Revision 1.9 2004-01-28 15:36:46 florian
* fixed another couple of arm bugs
Revision 1.8 2003/05/10 23:57:23 florian
* vmtpointer_offset must be adjusted in after_pass1 as well
Revision 1.7 2003/04/22 14:33:38 peter

View File

@ -448,7 +448,7 @@ implementation
{ emit bit test operation }
emit_bit_test_reg_reg(exprasmlist,left.location.register,hr2,hr2);
{ if left > 31 then hr := 0 else hr := $ffffffff }
cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,32,left.location.register,hr);
cg.a_op_const_reg(exprasmlist,OP_SAR,OS_INT,31,hr);
@ -475,10 +475,10 @@ implementation
else
{ adjust for endianess differences }
inc(right.location.reference.offset,(tordconstnode(left).value shr 3) xor 3);
location_release(exprasmlist,right.location);
{ allocate a register for the result }
location.register := cg.getintregister(exprasmlist,location.size);
cg.a_load_ref_reg(exprasmlist,OS_8,location.size,right.location.reference, location.register);
location_release(exprasmlist,right.location);
cg.a_op_const_reg(exprasmlist,OP_SHR,location.size,tordconstnode(left).value and 7,
location.register);
cg.a_op_const_reg(exprasmlist,OP_AND,location.size,1,location.register);
@ -1010,7 +1010,10 @@ begin
end.
{
$Log$
Revision 1.54 2003-12-09 19:14:50 jonas
Revision 1.55 2004-01-28 15:36:46 florian
* fixed another couple of arm bugs
Revision 1.54 2003/12/09 19:14:50 jonas
* fixed and optimized in-node with constant smallset
* some register usage optimisations.

View File

@ -230,7 +230,8 @@ interface
);
psysteminfo = ^tsysteminfo;
tsysteminfo = packed record
{ using packed causes bus errors on processors which require alignment }
tsysteminfo = record
system : tsystem;
name : string[34];
shortname : string[9];
@ -649,7 +650,10 @@ finalization
end.
{
$Log$
Revision 1.80 2004-01-21 20:53:50 marco
Revision 1.81 2004-01-28 15:36:46 florian
* fixed another couple of arm bugs
Revision 1.80 2004/01/21 20:53:50 marco
* Copy and pasted some structures from Net- to OpenBSD (3.4+ ELF!)
Revision 1.79 2004/01/14 23:39:05 florian

View File

@ -457,8 +457,8 @@ unit i_linux;
constalignmax : 4;
varalignmin : 0;
varalignmax : 4;
localalignmin : 0;
localalignmax : 4;
localalignmin : 4;
localalignmax : 8;
recordalignmin : 0;
recordalignmax : 4;
maxCrecordalign : 4
@ -514,7 +514,10 @@ initialization
end.
{
$Log$
Revision 1.21 2004-01-26 19:05:56 florian
Revision 1.22 2004-01-28 15:36:47 florian
* fixed another couple of arm bugs
Revision 1.21 2004/01/26 19:05:56 florian
* fixed several arm issues
Revision 1.20 2004/01/12 22:11:39 peter