From 75e62e42e40eb41b90cf0a79c9e93e8d6e29a674 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 15 May 2012 18:07:08 +0000 Subject: [PATCH] * add debug statements * avoid possible problems with unknown ra_ types git-svn-id: trunk@21304 - --- compiler/aopt.pas | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/compiler/aopt.pas b/compiler/aopt.pas index 418da663e2..8ec4644130 100644 --- a/compiler/aopt.pas +++ b/compiler/aopt.pas @@ -59,8 +59,10 @@ Unit aopt; Implementation uses + cutils, globtype, globals, verbose, + cpubase, cgbase, aoptda,aoptcpu,aoptcpud; @@ -145,9 +147,12 @@ Unit aopt; Else Begin hp1 := tai(p.previous); +{$ifdef DEBUG_OPTALLOC} + AsmL.InsertAfter(tai_comment.Create(strpnew('Removed allocation of '+std_regname(tai_regalloc(p).Reg))),p); +{$endif DEBUG_OPTALLOC} AsmL.remove(p); p.free; - p := hp1; + p := hp1; { not sure if this is useful, it even skips previous deallocs of the register (FK) hp1 := p; hp2 := nil; @@ -160,9 +165,9 @@ Unit aopt; InsertLLItem(tai(hp2.previous), hp2, hp1); End; } - End; + End; End - else + else if tai_regalloc(p).ratype=ra_dealloc then Begin ExcludeRegFromUsedRegs(tai_regalloc(p).Reg,Regs); hp1 := p; @@ -174,14 +179,23 @@ Unit aopt; If hp2 <> nil Then Begin hp1 := tai(p.previous); +{$ifdef DEBUG_OPTALLOC} + AsmL.InsertAfter(tai_comment.Create(strpnew('Moved deallocation of '+std_regname(tai_regalloc(p).Reg))),p); +{$endif DEBUG_OPTALLOC} AsmL.Remove(p); InsertLLItem(hp2, tai(hp2.Next), p); +{$ifdef DEBUG_OPTALLOC} + AsmL.InsertAfter(tai_comment.Create(strpnew('Moved deallocation of '+std_regname(tai_regalloc(p).Reg)+' here')),hp2); +{$endif DEBUG_OPTALLOC} p := hp1; End else if findregalloc(tai_regalloc(p).reg, tai(p.next)) and getnextinstruction(p,hp1) then begin hp1 := tai(p.previous); +{$ifdef DEBUG_OPTALLOC} + AsmL.InsertAfter(tai_comment.Create(strpnew('Removed deallocation of '+std_regname(tai_regalloc(p).Reg))),p); +{$endif DEBUG_OPTALLOC} AsmL.remove(p); p.free; p := hp1;