* fixed memory leaks in ppc peephole optimizer

git-svn-id: trunk@5569 -
This commit is contained in:
Jonas Maebe 2006-12-11 15:53:30 +00:00
parent 1f3dffbd1c
commit 32e06e7a7a
2 changed files with 18 additions and 13 deletions

View File

@ -593,6 +593,7 @@ interface
procedure loadreg(opidx:longint;r:tregister);
procedure loadoper(opidx:longint;o:toper);
procedure clearop(opidx:longint);
procedure freeop(opidx:longint);
{ register allocator }
function is_same_reg_move(regtype: Tregistertype):boolean;virtual;
function spilling_get_operation_type(opnr: longint): topertype;virtual;
@ -1992,10 +1993,7 @@ implementation
i : integer;
begin
for i:=0 to opercnt-1 do
begin
clearop(i);
dispose(oper[i]);
end;
freeop(i);
inherited destroy;
end;
@ -2182,6 +2180,13 @@ implementation
end;
procedure tai_cpu_abstract.freeop(opidx:longint);
begin
clearop(opidx);
dispose(oper[opidx]);
end;
{ ---------------------------------------------------------------------
Miscellaneous methods.
---------------------------------------------------------------------}

View File

@ -374,9 +374,9 @@ const
// masks have no bits in common
taicpu(p).opcode := A_LI;
taicpu(p).loadconst(1,0);
taicpu(p).clearop(2);
taicpu(p).clearop(3);
taicpu(p).clearop(4);
taicpu(p).freeop(2);
taicpu(p).freeop(3);
taicpu(p).freeop(4);
taicpu(p).ops := 2;
taicpu(p).opercnt := 2;
asml.remove(next1);
@ -480,20 +480,20 @@ const
taicpu(p).oper[2]^.val := word(
((1 shl (16-taicpu(p).oper[3]^.val)) - 1) xor
((1 shl (15-taicpu(p).oper[4]^.val)) - 1));
taicpu(p).clearop(3);
taicpu(p).clearop(4);
taicpu(p).freeop(3);
taicpu(p).freeop(4);
taicpu(p).ops := 3;
taicpu(p).opercnt := 2;
taicpu(p).opercnt := 3;
end
else if (taicpu(p).oper[3]^.val >= 16) and
(taicpu(p).oper[4]^.val >= 16) then
begin
taicpu(p).opcode := A_ANDI_;
taicpu(p).oper[2]^.val := word(rlwinm2mask(taicpu(p).oper[3]^.val,taicpu(p).oper[4]^.val));
taicpu(p).clearop(3);
taicpu(p).clearop(4);
taicpu(p).freeop(3);
taicpu(p).freeop(4);
taicpu(p).ops := 3;
taicpu(p).opercnt := 2;
taicpu(p).opercnt := 3;
end;
end;
end;