mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-03 05:38:25 +02:00
+ DebugMsg based debugging for the mips(el) assembler optimizer
git-svn-id: trunk@35890 -
This commit is contained in:
parent
8983879aeb
commit
6af656aaed
@ -25,6 +25,8 @@ unit aoptcpu;
|
||||
|
||||
{$i fpcdefs.inc}
|
||||
|
||||
{ $define DEBUG_AOPTCPU}
|
||||
|
||||
Interface
|
||||
|
||||
uses
|
||||
@ -44,6 +46,9 @@ unit aoptcpu;
|
||||
procedure PeepHoleOptPass2; override;
|
||||
function RegLoadedWithNewValue(reg : tregister; hp : tai) : boolean; override;
|
||||
function InstructionLoadsFromReg(const reg : TRegister; const hp : tai) : boolean; override;
|
||||
|
||||
{ outputs a debug message into the assembler file }
|
||||
procedure DebugMsg(const s: string; p: tai);
|
||||
End;
|
||||
|
||||
Implementation
|
||||
@ -130,7 +135,19 @@ unit aoptcpu;
|
||||
end;
|
||||
|
||||
|
||||
function TCpuAsmOptimizer.InstructionLoadsFromReg(const reg: TRegister; const hp: tai): boolean;
|
||||
{$ifdef DEBUG_AOPTCPU}
|
||||
procedure TCpuAsmOptimizer.DebugMsg(const s: string;p : tai);
|
||||
begin
|
||||
asml.insertbefore(tai_comment.Create(strpnew(s)), p);
|
||||
end;
|
||||
{$else DEBUG_AOPTCPU}
|
||||
procedure TCpuAsmOptimizer.DebugMsg(const s: string;p : tai);inline;
|
||||
begin
|
||||
end;
|
||||
{$endif DEBUG_AOPTCPU}
|
||||
|
||||
|
||||
function TCpuAsmOptimizer.InstructionLoadsFromReg(const reg: TRegister; const hp: tai): boolean;
|
||||
var
|
||||
p: taicpu;
|
||||
i: longint;
|
||||
@ -258,6 +275,7 @@ unit aoptcpu;
|
||||
|
||||
{ finally get rid of the mov }
|
||||
taicpu(p).loadreg(0,taicpu(next).oper[0]^.reg);
|
||||
DebugMsg('Peephole: Move removed 1',next);
|
||||
asml.remove(next);
|
||||
next.free;
|
||||
result:=true;
|
||||
@ -280,6 +298,7 @@ unit aoptcpu;
|
||||
assigned(FindRegAlloc(taicpu(p).oper[0]^.reg,tai(p.next))) then
|
||||
begin
|
||||
taicpu(p).loadreg(0,taicpu(next).oper[0]^.reg);
|
||||
DebugMsg('Peephole: Move removed 2',next);
|
||||
asml.remove(next);
|
||||
next.free;
|
||||
result:=true;
|
||||
@ -299,6 +318,7 @@ unit aoptcpu;
|
||||
if result then
|
||||
begin
|
||||
next.loadreg(0,taicpu(p).oper[1]^.reg);
|
||||
DebugMsg('Peephole: Move removed 3',p);
|
||||
asml.remove(p);
|
||||
p.free;
|
||||
p:=next;
|
||||
@ -317,6 +337,7 @@ unit aoptcpu;
|
||||
if result then
|
||||
begin
|
||||
next.oper[1]^.ref^.base:=taicpu(p).oper[1]^.reg;
|
||||
DebugMsg('Peephole: Move removed 4',p);
|
||||
asml.remove(p);
|
||||
p.free;
|
||||
p:=next;
|
||||
|
Loading…
Reference in New Issue
Block a user