From 5a2d884fe3f3f556bec5ae3a74917d31c5ce896c Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 18 Sep 2021 19:24:37 +0200 Subject: [PATCH] * is_calljmp really means calls and jmp * is_calljmpuncondret includes ret --- compiler/x86/aoptx86.pas | 4 ++-- compiler/x86/cpubase.pas | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index 450ff87048..7f0406cfcf 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -411,7 +411,7 @@ unit aoptx86; repeat Result := GetNextInstruction(Next,Next); if Result and (Next.typ=ait_instruction) and is_calljmp(taicpu(Next).opcode) then - if is_calljmpuncond(taicpu(Next).opcode) then + if is_calljmpuncondret(taicpu(Next).opcode) then begin Result := False; Exit; @@ -3020,7 +3020,7 @@ unit aoptx86; end; { search further than the next instruction for a mov (as long as it's not a jump) } - if not is_calljmpuncond(taicpu(hp1).opcode) and + if not is_calljmpuncondret(taicpu(hp1).opcode) and { check as much as possible before the expensive GetNextInstructionUsingRegCond call } (taicpu(p).oper[1]^.typ = top_reg) and (taicpu(p).oper[0]^.typ in [top_reg,top_const]) and diff --git a/compiler/x86/cpubase.pas b/compiler/x86/cpubase.pas index cd9b0a73cd..89ce454b1a 100644 --- a/compiler/x86/cpubase.pas +++ b/compiler/x86/cpubase.pas @@ -340,7 +340,7 @@ topsize2memsize: array[topsize] of integer = function reg2opsize(r:Tregister):topsize; function reg_cgsize(const reg: tregister): tcgsize; function is_calljmp(o:tasmop):boolean; - function is_calljmpuncond(o:tasmop):boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE} + function is_calljmpuncondret(o:tasmop):boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE} procedure inverse_flags(var f: TResFlags); function flags_to_cond(const f: TResFlags) : TAsmCond; function is_segment_reg(r:tregister):boolean; @@ -570,7 +570,6 @@ implementation A_LOOPZ, A_LCALL, A_LJMP, - A_RET, A_Jcc : is_calljmp:=true; else @@ -579,7 +578,7 @@ implementation end; - function is_calljmpuncond(o:tasmop):boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE} + function is_calljmpuncondret(o:tasmop):boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE} begin case o of A_CALL, @@ -587,9 +586,9 @@ implementation A_RET, A_LCALL, A_LJMP: - is_calljmpuncond:=true; + Result:=true; else - is_calljmpuncond:=false; + Result:=false; end; end;