* CallRet2Jmp works with PIC

git-svn-id: trunk@43371 -
This commit is contained in:
florian 2019-11-02 22:37:29 +00:00
parent 3487c34ed9
commit 6842c5784d

View File

@ -4244,19 +4244,16 @@ unit aoptx86;
by by
jmp procname jmp procname
this should never hurt except when pic is used, not sure
how to handle it then
but do it only on level 4 because it destroys stack back traces but do it only on level 4 because it destroys stack back traces
} }
if (cs_opt_level4 in current_settings.optimizerswitches) and if (cs_opt_level4 in current_settings.optimizerswitches) and
not(cs_create_pic in current_settings.moduleswitches) and
GetNextInstruction(p, hp1) and GetNextInstruction(p, hp1) and
MatchInstruction(hp1,A_RET,[S_NO]) and MatchInstruction(hp1,A_RET,[S_NO]) and
(taicpu(hp1).ops=0) then (taicpu(hp1).ops=0) then
begin begin
taicpu(p).opcode := A_JMP; taicpu(p).opcode := A_JMP;
taicpu(p).is_jmp := true; taicpu(p).is_jmp := true;
DebugMsg(SPeepholeOptimization + 'CallRet2Jmp done',p);
asml.remove(hp1); asml.remove(hp1);
hp1.free; hp1.free;
Result:=true; Result:=true;