mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 17:29:11 +02:00
* patch by J. Gareth Moreton: x86 JccMovJmpMov2MovSetcc improvement, resolves #38761
git-svn-id: trunk@49402 -
This commit is contained in:
parent
73448deda6
commit
bae583118a
@ -35,6 +35,10 @@ unit aoptutils;
|
|||||||
function MatchOpType(const p : taicpu; type0,type1,type2 : toptype) : Boolean;
|
function MatchOpType(const p : taicpu; type0,type1,type2 : toptype) : Boolean;
|
||||||
{$endif max_operands>2}
|
{$endif max_operands>2}
|
||||||
|
|
||||||
|
{ skips all alignment fields and returns the next label (or non-align).
|
||||||
|
returns immediately with true if hp is a label }
|
||||||
|
function SkipAligns(hp: tai; out hp2: tai): boolean;
|
||||||
|
|
||||||
{ skips all labels and returns the next "real" instruction }
|
{ skips all labels and returns the next "real" instruction }
|
||||||
function SkipLabels(hp: tai; out hp2: tai): boolean;
|
function SkipLabels(hp: tai; out hp2: tai): boolean;
|
||||||
|
|
||||||
@ -67,6 +71,21 @@ unit aoptutils;
|
|||||||
{$endif max_operands>2}
|
{$endif max_operands>2}
|
||||||
|
|
||||||
|
|
||||||
|
{ skips all alignment fields and returns the next label (or non-align).
|
||||||
|
Returns immediately with True if hp is a label }
|
||||||
|
function SkipAligns(hp: tai; out hp2: tai): boolean;
|
||||||
|
begin
|
||||||
|
while assigned(hp) and
|
||||||
|
(hp.typ in SkipInstr + [ait_label,ait_align]) Do
|
||||||
|
begin
|
||||||
|
{ Check that the label is actually live }
|
||||||
|
if (hp.typ = ait_label) and tai_label(hp).labsym.is_used then
|
||||||
|
Break;
|
||||||
|
hp := tai(hp.next);
|
||||||
|
end;
|
||||||
|
SkipAligns := SetAndTest(hp, hp2);
|
||||||
|
end;
|
||||||
|
|
||||||
{ skips all labels and returns the next "real" instruction }
|
{ skips all labels and returns the next "real" instruction }
|
||||||
function SkipLabels(hp: tai; out hp2: tai): boolean;
|
function SkipLabels(hp: tai; out hp2: tai): boolean;
|
||||||
begin
|
begin
|
||||||
|
@ -189,6 +189,8 @@ unit aoptcpu;
|
|||||||
Result:=OptPass1SHLSAL(p);
|
Result:=OptPass1SHLSAL(p);
|
||||||
A_SUB:
|
A_SUB:
|
||||||
Result:=OptPass1Sub(p);
|
Result:=OptPass1Sub(p);
|
||||||
|
A_Jcc:
|
||||||
|
Result:=OptPass1Jcc(p);
|
||||||
A_MOVAPD,
|
A_MOVAPD,
|
||||||
A_MOVAPS,
|
A_MOVAPS,
|
||||||
A_MOVUPD,
|
A_MOVUPD,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -340,6 +340,7 @@ topsize2memsize: array[topsize] of integer =
|
|||||||
function reg2opsize(r:Tregister):topsize;
|
function reg2opsize(r:Tregister):topsize;
|
||||||
function reg_cgsize(const reg: tregister): tcgsize;
|
function reg_cgsize(const reg: tregister): tcgsize;
|
||||||
function is_calljmp(o:tasmop):boolean;
|
function is_calljmp(o:tasmop):boolean;
|
||||||
|
function is_calljmpuncond(o:tasmop):boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
||||||
procedure inverse_flags(var f: TResFlags);
|
procedure inverse_flags(var f: TResFlags);
|
||||||
function flags_to_cond(const f: TResFlags) : TAsmCond;
|
function flags_to_cond(const f: TResFlags) : TAsmCond;
|
||||||
function is_segment_reg(r:tregister):boolean;
|
function is_segment_reg(r:tregister):boolean;
|
||||||
@ -577,6 +578,20 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function is_calljmpuncond(o:tasmop):boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
||||||
|
begin
|
||||||
|
case o of
|
||||||
|
A_CALL,
|
||||||
|
A_JMP,
|
||||||
|
A_LCALL,
|
||||||
|
A_LJMP:
|
||||||
|
is_calljmpuncond:=true;
|
||||||
|
else
|
||||||
|
is_calljmpuncond:=false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure inverse_flags(var f: TResFlags);
|
procedure inverse_flags(var f: TResFlags);
|
||||||
const
|
const
|
||||||
inv_flags: array[TResFlags] of TResFlags =
|
inv_flags: array[TResFlags] of TResFlags =
|
||||||
|
@ -145,6 +145,8 @@ uses
|
|||||||
Result:=OptPass1PXor(p);
|
Result:=OptPass1PXor(p);
|
||||||
A_TEST:
|
A_TEST:
|
||||||
Result:=OptPass1Test(p);
|
Result:=OptPass1Test(p);
|
||||||
|
A_Jcc:
|
||||||
|
Result:=OptPass1Jcc(p);
|
||||||
else
|
else
|
||||||
;
|
;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user