|
|
@@ -38,16 +38,17 @@ unit optloadmodifystore;
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
- node;
|
|
|
+ node,nld;
|
|
|
|
|
|
procedure do_optloadmodifystore(var rootnode : tnode);
|
|
|
+ function try_opt_assignmentnode(assignmentnode : tassignmentnode): tnode;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses
|
|
|
- globtype,verbose,nutils,compinnr,
|
|
|
+ globtype,globals,verbose,nutils,compinnr,
|
|
|
defutil,defcmp,htypechk,pass_1,constexp,
|
|
|
- nadd,ncal,ncon,ncnv,ninl,nld,nmat,
|
|
|
+ nadd,ncal,ncon,ncnv,ninl,nmat,
|
|
|
symdef;
|
|
|
|
|
|
function try_opt_assignmentnode(assignmentnode: tassignmentnode): tnode;
|
|
|
@@ -57,6 +58,10 @@ unit optloadmodifystore;
|
|
|
result:=nil;
|
|
|
with assignmentnode do
|
|
|
begin
|
|
|
+ { *** Here are simple optimizations which are performed
|
|
|
+ when -O2 (via a call from tassignmentnode.simplify) or
|
|
|
+ when cs_opt_use_load_modify_store is enabled (in a separate pass).
|
|
|
+ }
|
|
|
{ replace i:=succ/pred(i) by inc/dec(i)? }
|
|
|
if (right.nodetype=inlinen) and
|
|
|
((tinlinenode(right).inlinenumber=in_succ_x) or (tinlinenode(right).inlinenumber=in_pred_x)) and
|
|
|
@@ -273,6 +278,71 @@ unit optloadmodifystore;
|
|
|
taddnode(ttypeconvnode(right).left).left:=nil;
|