* add debug statements

* avoid possible problems with unknown ra_ types

git-svn-id: trunk@21304 -
This commit is contained in:
florian 2012-05-15 18:07:08 +00:00
parent 748694a325
commit 75e62e42e4

View File

@ -59,8 +59,10 @@ Unit aopt;
Implementation Implementation
uses uses
cutils,
globtype, globals, globtype, globals,
verbose, verbose,
cpubase,
cgbase, cgbase,
aoptda,aoptcpu,aoptcpud; aoptda,aoptcpu,aoptcpud;
@ -145,6 +147,9 @@ Unit aopt;
Else Else
Begin Begin
hp1 := tai(p.previous); 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); AsmL.remove(p);
p.free; p.free;
p := hp1; p := hp1;
@ -162,7 +167,7 @@ Unit aopt;
} }
End; End;
End End
else else if tai_regalloc(p).ratype=ra_dealloc then
Begin Begin
ExcludeRegFromUsedRegs(tai_regalloc(p).Reg,Regs); ExcludeRegFromUsedRegs(tai_regalloc(p).Reg,Regs);
hp1 := p; hp1 := p;
@ -174,14 +179,23 @@ Unit aopt;
If hp2 <> nil Then If hp2 <> nil Then
Begin Begin
hp1 := tai(p.previous); 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); AsmL.Remove(p);
InsertLLItem(hp2, tai(hp2.Next), 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; p := hp1;
End End
else if findregalloc(tai_regalloc(p).reg, tai(p.next)) else if findregalloc(tai_regalloc(p).reg, tai(p.next))
and getnextinstruction(p,hp1) then and getnextinstruction(p,hp1) then
begin begin
hp1 := tai(p.previous); 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); AsmL.remove(p);
p.free; p.free;
p := hp1; p := hp1;