mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 06:19:28 +02:00
+ CallRet2Call optimization
git-svn-id: trunk@44192 -
This commit is contained in:
parent
ef3155c2ef
commit
42324235bd
@ -5742,15 +5742,23 @@ unit aoptx86;
|
|||||||
jmp procname
|
jmp procname
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
else if the subroutine is marked as no return, remove the ret
|
||||||
}
|
}
|
||||||
if (cs_opt_level4 in current_settings.optimizerswitches) and
|
if ((cs_opt_level4 in current_settings.optimizerswitches) or
|
||||||
|
(po_noreturn in current_procinfo.procdef.procoptions)) 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;
|
if cs_opt_level4 in current_settings.optimizerswitches then
|
||||||
taicpu(p).is_jmp := true;
|
begin
|
||||||
DebugMsg(SPeepholeOptimization + 'CallRet2Jmp done',p);
|
taicpu(p).opcode := A_JMP;
|
||||||
|
taicpu(p).is_jmp := true;
|
||||||
|
DebugMsg(SPeepholeOptimization + 'CallRet2Jmp done',p);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
DebugMsg(SPeepholeOptimization + 'CallRet2Call done',p);
|
||||||
asml.remove(hp1);
|
asml.remove(hp1);
|
||||||
hp1.free;
|
hp1.free;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
|
Loading…
Reference in New Issue
Block a user