mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 09:53:09 +02:00
+ added a correct implementation of TAOptBase.SuperRegistersEqual for the Z80
git-svn-id: trunk@45337 -
This commit is contained in:
parent
50261464da
commit
5947adcd7b
@ -335,7 +335,13 @@ unit aoptbase;
|
|||||||
|
|
||||||
as SuperRegistersEqual is used a lot
|
as SuperRegistersEqual is used a lot
|
||||||
}
|
}
|
||||||
|
{$ifdef Z80}
|
||||||
|
{ Z80 registers are indexed in an incompatible way (without R_SUBH), so it
|
||||||
|
needs a special check. }
|
||||||
|
Result:=super_registers_equal(reg1,reg2);
|
||||||
|
{$else Z80}
|
||||||
Result:=(DWord(reg1) and $ff00ffff)=(DWord(reg2) and $ff00ffff);
|
Result:=(DWord(reg1) and $ff00ffff)=(DWord(reg2) and $ff00ffff);
|
||||||
|
{$endif Z80}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ ******************* Processor dependent stuff *************************** }
|
{ ******************* Processor dependent stuff *************************** }
|
||||||
|
@ -284,6 +284,7 @@ unit cpubase;
|
|||||||
procedure split_regpair(regpair:Tregister;out reglo,reghi:Tregister);
|
procedure split_regpair(regpair:Tregister;out reglo,reghi:Tregister);
|
||||||
{ Checks if sreg is a subset of reg (e.g. NR_H is a subset of NR_HL }
|
{ Checks if sreg is a subset of reg (e.g. NR_H is a subset of NR_HL }
|
||||||
function register_in(sreg,reg:Tregister):boolean;
|
function register_in(sreg,reg:Tregister):boolean;
|
||||||
|
function super_registers_equal(reg1,reg2 : TRegister) : Boolean;
|
||||||
|
|
||||||
function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
||||||
function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
||||||
@ -455,6 +456,31 @@ unit cpubase;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function super_registers_equal(reg1, reg2: TRegister): Boolean;
|
||||||
|
begin
|
||||||
|
case reg1 of
|
||||||
|
NR_A,NR_F,NR_AF:
|
||||||
|
result:=(reg2=NR_A) or (reg2=NR_F) or (reg2=NR_AF);
|
||||||
|
NR_B,NR_C,NR_BC:
|
||||||
|
result:=(reg2=NR_B) or (reg2=NR_C) or (reg2=NR_BC);
|
||||||
|
NR_D,NR_E,NR_DE:
|
||||||
|
result:=(reg2=NR_D) or (reg2=NR_E) or (reg2=NR_DE);
|
||||||
|
NR_H,NR_L,NR_HL:
|
||||||
|
result:=(reg2=NR_H) or (reg2=NR_L) or (reg2=NR_HL);
|
||||||
|
NR_A_,NR_F_,NR_AF_:
|
||||||
|
result:=(reg2=NR_A_) or (reg2=NR_F_) or (reg2=NR_AF_);
|
||||||
|
NR_B_,NR_C_,NR_BC_:
|
||||||
|
result:=(reg2=NR_B_) or (reg2=NR_C_) or (reg2=NR_BC_);
|
||||||
|
NR_D_,NR_E_,NR_DE_:
|
||||||
|
result:=(reg2=NR_D_) or (reg2=NR_E_) or (reg2=NR_DE_);
|
||||||
|
NR_H_,NR_L_,NR_HL_:
|
||||||
|
result:=(reg2=NR_H_) or (reg2=NR_L_) or (reg2=NR_HL_);
|
||||||
|
else
|
||||||
|
result:=reg1=reg2;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
||||||
const
|
const
|
||||||
inverse: array[TAsmCond] of TAsmCond=(C_None,
|
inverse: array[TAsmCond] of TAsmCond=(C_None,
|
||||||
|
Loading…
Reference in New Issue
Block a user