Browse Source

* some debugging infrastructure

git-svn-id: trunk@25900 -
florian 11 years ago
parent
commit
d575a435c3
1 changed files with 21 additions and 2 deletions
  1. 21 2
      compiler/i386/popt386.pas

+ 21 - 2
compiler/i386/popt386.pas

@@ -23,6 +23,8 @@ unit popt386;
 
 {$i fpcdefs.inc}
 
+{ $define DEBUG_AOPTCPU}
+
 interface
 
 uses Aasmbase,aasmtai,aasmdata,aasmcpu,verbose;
@@ -35,7 +37,7 @@ procedure PostPeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai);
 implementation
 
 uses
-  globtype,systems,
+  cutils,globtype,systems,
   globals,cgbase,procinfo,
   symsym,
 {$ifdef finaldestdebug}
@@ -502,8 +504,25 @@ function MatchOperand(const oper1: TOper; const oper2: TOper): boolean; inline;
   end;
 
 
+{ First pass of peephole optimizations }
 procedure PeepHoleOptPass1(Asml: TAsmList; BlockStart, BlockEnd: tai);
-{First pass of peepholeoptimizations}
+
+{$ifdef DEBUG_AOPTCPU}
+  procedure DebugMsg(const s: string;p : tai);
+    begin
+      asml.insertbefore(tai_comment.Create(strpnew(s)), p);
+    end;
+{$else DEBUG_AOPTCPU}
+  procedure DebugMsg(const s: string;p : tai);inline;
+    begin
+    end;
+{$endif DEBUG_AOPTCPU}
+
+function WriteOk : Boolean;
+  begin
+    writeln('Ok');
+    Result:=True;
+  end;
 
 var
   l : longint;