* fixed concat_string optimization and enabled it when

-dnewoptimizations is used
This commit is contained in:
Jonas Maebe 2000-04-08 16:22:11 +00:00
parent d9fa8acff8
commit cde0d7d084
2 changed files with 43 additions and 7 deletions

View File

@ -201,10 +201,10 @@ implementation
*****************************************************************************}
procedure firstassignment(var p : ptree);
{$ifdef dummyi386}
{$ifdef newoptimizations}
var
hp : ptree;
{$endif}
{$endif newoptimizations}
begin
{ must be made unique }
set_unique(p^.left);
@ -273,8 +273,11 @@ implementation
{ the problem is for
s:=s+s+s;
this is broken here !! }
{ while hp^.treetype=addn do hp:=hp^.left;
if equal_trees(p^.left,hp) then
{$ifdef newoptimizations}
hp := p^.right;
while hp^.treetype=addn do hp:=hp^.left;
if equal_trees(p^.left,hp) and
not multiple_uses(p^.left,p^.right) then
begin
p^.concat_string:=true;
hp:=p^.right;
@ -283,7 +286,8 @@ implementation
hp^.use_strconcat:=true;
hp:=hp^.left;
end;
end; }
end;
{$endif newoptimizations}
end
else
begin
@ -486,7 +490,11 @@ implementation
end.
{
$Log$
Revision 1.61 2000-02-24 18:41:39 peter
Revision 1.62 2000-04-08 16:22:11 jonas
* fixed concat_string optimization and enabled it when
-dnewoptimizations is used
Revision 1.61 2000/02/24 18:41:39 peter
* removed warnings/notes
Revision 1.60 2000/02/17 14:53:43 florian

View File

@ -307,6 +307,10 @@ unit tree;
function getcopy(p : ptree) : ptree;
function equal_trees(t1,t2 : ptree) : boolean;
{$ifdef newoptimizations}
{ checks if t1 is loaded more than once in t2 and its sub-trees }
function multiple_uses(t1,t2: ptree): boolean;
{$endif newoptimizations}
procedure swaptree(p:Ptree);
procedure disposetree(p : ptree);
@ -1731,6 +1735,26 @@ unit tree;
equal_trees:=false;
end;
{$ifdef newoptimizations}
function multiple_uses(t1,t2: ptree): boolean;
var nr: longint;
procedure check_tree(t: ptree);
begin
inc(nr,ord(equal_trees(t1,t)));
if (nr < 2) and assigned(t^.left) then
check_tree(t^.left);
if (nr < 2) and assigned(t^.right) then
check_tree(t^.right);
end;
begin
nr := 0;
check_tree(t2);
multiple_uses := nr > 1;
end;
{$endif newoptimizations}
procedure set_unique(p : ptree);
begin
@ -2066,7 +2090,11 @@ unit tree;
end.
{
$Log$
Revision 1.116 2000-03-01 15:36:12 florian
Revision 1.117 2000-04-08 16:22:11 jonas
* fixed concat_string optimization and enabled it when
-dnewoptimizations is used
Revision 1.116 2000/03/01 15:36:12 florian
* some new stuff for the new cg
Revision 1.115 2000/03/01 11:43:55 daniel