* Moved SkipEntryExitMarker method from ARM optimizer to the base one, since it is not target-dependent. Now it can be reused by other targets.

git-svn-id: trunk@25738 -
This commit is contained in:
sergei 2013-10-10 21:12:49 +00:00
parent a3364a4b80
commit a5ae26da7e
2 changed files with 16 additions and 18 deletions

View File

@ -67,6 +67,7 @@ unit aoptbase;
{ false and sets last to nil }
Function GetLastInstruction(Current: tai; Var Last: tai): Boolean;
function SkipEntryExitMarker(current: tai; var next: tai): boolean;
{ processor dependent methods }
@ -246,6 +247,21 @@ unit aoptbase;
End;
function TAOptBase.SkipEntryExitMarker(current: tai; var next: tai): boolean;
begin
result:=true;
if current.typ<>ait_marker then
exit;
next:=current;
while GetNextInstruction(next,next) do
begin
if (next.typ<>ait_marker) or not(tai_marker(next).Kind in [mark_Position,mark_BlockStart]) then
exit;
end;
result:=false;
end;
Function TAOptBase.RegUsedBetween(reg : TRegister;p1,p2 : tai) : Boolean;
Begin
Result:=false;

View File

@ -54,8 +54,6 @@ Type
{ outputs a debug message into the assembler file }
procedure DebugMsg(const s: string; p: tai);
private
function SkipEntryExitMarker(current: tai; var next: tai): boolean;
protected
function LookForPreindexedPattern(p: taicpu): boolean;
function LookForPostindexedPattern(p: taicpu): boolean;
@ -525,22 +523,6 @@ Implementation
end;
{ skip harmless marker marking entry/exit code, so it can be optimized as well }
function TCpuAsmOptimizer.SkipEntryExitMarker(current : tai;var next : tai) : boolean;
begin
result:=true;
if current.typ<>ait_marker then
exit;
next:=current;
while GetNextInstruction(next,next) do
begin
if (next.typ<>ait_marker) or not(tai_marker(next).Kind in [mark_Position,mark_BlockStart]) then
exit;
end;
result:=false;
end;
function TCpuAsmOptimizer.PeepHoleOptPass1Cpu(var p: tai): boolean;
var
hp1,hp2,hp3,hp4: tai;