This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ast-optimizer-branch] Enable simplification by default [patch]


This patch enables simplification by default, even when not
optimizing.  Simplification and SSA-based analysis should not be
tied to each other.

Bootstrapped on x86.  Testing in progress.  Will commit when it's
done.


Diego.


	* Makefile.in (c-decl.o): Add dependency on langhooks.h
	* c-decl.c: Include langhooks.h.
	(c_expand_body): Simplify the function.  If it succeeds and
	-ftree-ssa is enabled, call optimize_function_tree.
	* tree-optimize.c: Don't include langhooks.h.
	(optimize_function_tree): Don't call lang_hooks.simplify_function_tree.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.701.2.32
diff -d -p -d -u -p -r1.701.2.32 Makefile.in
--- Makefile.in	11 Jun 2002 13:36:32 -0000	1.701.2.32
+++ Makefile.in	13 Jun 2002 01:07:58 -0000
@@ -1172,7 +1172,7 @@ $(srcdir)/c-parse.y: c-parse.in
 c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) $(C_TREE_H) \
     $(GGC_H) $(TARGET_H) flags.h function.h output.h $(EXPR_H) \
     debug.h toplev.h intl.h $(TM_P_H) tree-inline.h $(TIMEVAR_H) c-pragma.h \
-    gt-c-decl.h tree-optimize.h
+    gt-c-decl.h tree-optimize.h langhooks.h
 c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
     $(TARGET_H) flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H)
 c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.239.2.22
diff -d -p -d -u -p -r1.239.2.22 c-decl.c
--- c-decl.c	11 Jun 2002 13:36:38 -0000	1.239.2.22
+++ c-decl.c	13 Jun 2002 01:07:59 -0000
@@ -48,6 +48,7 @@ Software Foundation, 59 Temple Place - S
 #include "c-common.h"
 #include "c-pragma.h"
 #include "tree-dchain.h"
+#include "langhooks.h"
 
 /* In grokdeclarator, distinguish syntactic contexts of declarators.  */
 enum decl_context
@@ -6841,9 +6842,14 @@ c_expand_body (fndecl, nested_p, can_def
   if (c_function_varargs)
     mark_varargs ();
 
-  /* Invoke the SSA tree optimizer.  */
-  if (flag_tree_ssa)
-    optimize_function_tree (fndecl);
+  /* Simplify the function.  Don't try to optimize the function if
+     simplification failed.  */
+  if ((*lang_hooks.simplify_function_tree) (fndecl))
+    {
+      /* Invoke the SSA tree optimizer.  */
+      if (flag_tree_ssa)
+	optimize_function_tree (fndecl);
+    }
 
   /* Set up parameters and prepare for return, for the function.  */
   expand_function_start (fndecl, 0);
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-optimize.c,v
retrieving revision 1.1.2.11
diff -d -p -d -u -p -r1.1.2.11 tree-optimize.c
--- tree-optimize.c	11 Jun 2002 17:10:46 -0000	1.1.2.11
+++ tree-optimize.c	13 Jun 2002 01:08:00 -0000
@@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "tree-optimize.h"
 #include "tree-flow.h"
-#include "langhooks.h"
 
 /* Local functions.  */
 static void init_tree_flow PARAMS ((void));
@@ -49,11 +48,6 @@ optimize_function_tree (fndecl)
   if (errorcount || sorrycount)
     return;
   
-  /* Simplify the function.  Don't try to optimize the function if
-     simplification failed.  */
-  if (!(*lang_hooks.simplify_function_tree) (fndecl))
-    return;
-
 #if 0
   /* Transform BREAK_STMTs, CONTINUE_STMTs, SWITCH_STMTs and GOTO_STMTs.  */
   double_chain_stmts (fn);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]