浏览代码

* Added optimization option cs_opt_unused_para. It is enabled for -O2 and higher. The parentfp optimization is tied to cs_opt_unused_para.

git-svn-id: trunk@45666 -
yury 5 年之前
父节点
当前提交
4e1e35aef5
共有 2 个文件被更改,包括 7 次插入5 次删除
  1. 5 3
      compiler/globtype.pas
  2. 2 2
      compiler/paramgr.pas

+ 5 - 3
compiler/globtype.pas

@@ -342,7 +342,8 @@ interface
          cs_opt_constant_propagate,
          cs_opt_dead_store_eliminate,
          cs_opt_forcenostackframe,
-         cs_opt_use_load_modify_store
+         cs_opt_use_load_modify_store,
+         cs_opt_unused_para
        );
        toptimizerswitches = set of toptimizerswitch;
 
@@ -400,7 +401,8 @@ interface
          'DFA','STRENGTH','SCHEDULE','AUTOINLINE','USEEBP','USERBP',
          'ORDERFIELDS','FASTMATH','DEADVALUES','REMOVEEMPTYPROCS',
          'CONSTPROP',
-         'DEADSTORE','FORCENOSTACKFRAME','USELOADMODIFYSTORE'
+         'DEADSTORE','FORCENOSTACKFRAME','USELOADMODIFYSTORE',
+         'UNUSEDPARA'
        );
        WPOptimizerSwitchStr : array [twpoptimizerswitch] of string[14] = (
          'DEVIRTCALLS','OPTVMTS','SYMBOLLIVENESS'
@@ -425,7 +427,7 @@ interface
 
        { switches being applied to all CPUs at the given level }
        genericlevel1optimizerswitches = [cs_opt_level1,cs_opt_peephole];
-       genericlevel2optimizerswitches = [cs_opt_level2,cs_opt_remove_empty_proc];
+       genericlevel2optimizerswitches = [cs_opt_level2,cs_opt_remove_empty_proc,cs_opt_unused_para];
        genericlevel3optimizerswitches = [cs_opt_level3,cs_opt_constant_propagate,cs_opt_nodedfa{$ifndef llvm},cs_opt_use_load_modify_store{$endif},cs_opt_loopunroll];
        genericlevel4optimizerswitches = [cs_opt_level4,cs_opt_reorder_fields,cs_opt_dead_values,cs_opt_fastmath];
 

+ 2 - 2
compiler/paramgr.pas

@@ -841,13 +841,13 @@ implementation
         pd: tprocdef;
       begin
         { The parameter can be optimized as unused when:
-            optimization level 1 and higher
+            this optimization is enabled
             this is a direct call to a routine, not a procvar
             and the routine is not an exception filter
             and the parameter is not used by the routine
             and implementation of the routine is already processed.
         }
-        result:=(cs_opt_level1 in current_settings.optimizerswitches) and
+        result:=(cs_opt_unused_para in current_settings.optimizerswitches) and
           assigned(parasym.Owner) and
           (parasym.Owner.defowner.typ=procdef);
         if not result then