mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-02 21:18:26 +02:00
* asm condition generation modified by TAiCpu.SetCondition
This commit is contained in:
parent
15419c49a6
commit
ed1ba5dc1c
@ -75,6 +75,7 @@ type
|
||||
procedure ResetPass2;
|
||||
function CheckIfValid:boolean;
|
||||
function Pass1(offset:longint):longint;virtual;
|
||||
procedure SetCondition(const c:TAsmCond);
|
||||
private
|
||||
{ next fields are filled in pass1, so pass2 is faster }
|
||||
insentry : PInsEntry;
|
||||
@ -722,9 +723,6 @@ begin
|
||||
insentry:=nil;
|
||||
inssize:=-1;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function taicpu.Pass1(offset:longint):longint;
|
||||
begin
|
||||
Pass1:=0;
|
||||
@ -762,6 +760,20 @@ begin
|
||||
end;
|
||||
LastInsOffset:=-1;
|
||||
end;
|
||||
procedure TAiCpu.SetCondition(const c:TAsmCond);
|
||||
begin
|
||||
inherited SetCondition(c);
|
||||
if Opcode=A_BA
|
||||
then
|
||||
begin
|
||||
is_jmp:=true;
|
||||
case c of
|
||||
C_NE:Opcode:=A_BNE;
|
||||
else
|
||||
InternalError(2003021800);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
function taicpu.NeedAddrPrefix(opidx:byte):boolean;
|
||||
var
|
||||
i,b:tregister;
|
||||
@ -1081,7 +1093,10 @@ procedure InitAsm;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.16 2003-01-08 18:43:58 daniel
|
||||
Revision 1.17 2003-02-18 22:00:20 mazen
|
||||
* asm condition generation modified by TAiCpu.SetCondition
|
||||
|
||||
Revision 1.16 2003/01/08 18:43:58 daniel
|
||||
* Tregister changed into a record
|
||||
|
||||
Revision 1.15 2003/01/05 21:32:35 mazen
|
||||
|
@ -827,18 +827,15 @@ procedure TCgSparc.a_op_const_reg(list:TAasmOutput;Op:TOpCG;a:AWord;reg:TRegiste
|
||||
end;
|
||||
|
||||
{*************** compare instructructions ****************}
|
||||
|
||||
procedure TCgSparc.a_cmp_const_reg_label(list:TAasmOutput;size:tcgsize;cmp_op:topcmp;a:aword;reg:tregister;
|
||||
l:tasmlabel);
|
||||
|
||||
begin
|
||||
if (a = 0) then
|
||||
list.concat(taicpu.op_reg_reg(A_CMP,reg,reg))
|
||||
else
|
||||
list.concat(taicpu.op_const_reg(A_CMP,a,reg));
|
||||
a_jmp_cond(list,cmp_op,l);
|
||||
end;
|
||||
|
||||
procedure TCgSparc.a_cmp_const_reg_label(list:TAasmOutput;size:tcgsize;cmp_op:topcmp;a:aword;reg:tregister;l:tasmlabel);
|
||||
begin
|
||||
if(a=0)
|
||||
then
|
||||
list.concat(taicpu.op_reg_reg(A_CMP,reg,reg))
|
||||
else
|
||||
list.concat(taicpu.op_const_reg(A_CMP,a,reg));
|
||||
a_jmp_cond(list,cmp_op,l);
|
||||
end;
|
||||
procedure TCgSparc.a_cmp_const_ref_label(list:TAasmOutput;size:tcgsize;cmp_op:topcmp;a:aword;const ref:TReference;l:tasmlabel);
|
||||
begin
|
||||
with List do
|
||||
@ -869,24 +866,15 @@ procedure TCgSparc.a_cmp_ref_reg_label(list:TAasmOutput;size:tcgsize;cmp_op:topc
|
||||
a_jmp_cond(list,cmp_op,l);
|
||||
cg.free_scratch_reg(exprasmlist,TempReg);
|
||||
end;
|
||||
procedure TCgSparc.a_jmp_cond(list:TAasmOutput;cond:TOpCmp;l:tasmlabel);
|
||||
|
||||
var
|
||||
ai:taicpu;
|
||||
|
||||
begin
|
||||
if cond=OC_None then
|
||||
ai := Taicpu.Op_sym(A_JMPL,S_NO,l)
|
||||
else
|
||||
begin
|
||||
ai:=Taicpu.Op_sym(A_JMPL,S_NO,l);
|
||||
ai.SetCondition(TOpCmp2AsmCond[cond]);
|
||||
end;
|
||||
ai.is_jmp:=true;
|
||||
list.concat(ai);
|
||||
end;
|
||||
|
||||
procedure TCgSparc.a_jmp_flags(list:TAasmOutput;CONST f:TResFlags;l:tasmlabel);
|
||||
procedure TCgSparc.a_jmp_cond(list:TAasmOutput;cond:TOpCmp;l:TAsmLabel);
|
||||
var
|
||||
ai:TAiCpu;
|
||||
begin
|
||||
ai:=TAiCpu.Op_sym(A_BA,S_NO,l);
|
||||
ai.SetCondition(TOpCmp2AsmCond[cond]);
|
||||
list.concat(ai);
|
||||
end;
|
||||
procedure TCgSparc.a_jmp_flags(list:TAasmOutput;CONST f:TResFlags;l:tasmlabel);
|
||||
var
|
||||
ai:taicpu;
|
||||
begin
|
||||
@ -1415,7 +1403,10 @@ BEGIN
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.37 2003-02-05 21:48:34 mazen
|
||||
Revision 1.38 2003-02-18 22:00:20 mazen
|
||||
* asm condition generation modified by TAiCpu.SetCondition
|
||||
|
||||
Revision 1.37 2003/02/05 21:48:34 mazen
|
||||
* fixing run time errors related to unimplemented abstract methods in CG
|
||||
+ giving empty emplementations for some RTL functions
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user