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]

[c++ patch] avoid inlining twice


Hi,
I've sent this few times already, but this time I really need it.
Inlining is currently performced twice - once in optimize_function in
C++ frontend, later in cgraph_optimize_function in the backend.  This
kills the first.  It is needed for my cgraph code changes where inlining
must happent after original body has been saved.

Bootstrapped/regtested i686-pc-gnu-linux, OK?

Honza

	* tree.h (optimize_function): Kill prototype.
	* optimize.c (dump_function, optimize_function, dump_finction): Kill.
	* semantics.c (expand_body): Kill.
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.949
diff -c -3 -p -r1.949 cp-tree.h
*** cp/cp-tree.h	2 Feb 2004 16:53:01 -0000	1.949
--- cp/cp-tree.h	5 Feb 2004 11:55:26 -0000
*************** extern tree implicitly_declare_fn (speci
*** 3854,3860 ****
  extern tree skip_artificial_parms_for (tree, tree);
  
  /* In optimize.c */
- extern void optimize_function (tree);
  extern bool calls_setjmp_p (tree);
  extern bool maybe_clone_body (tree);
  
--- 3854,3859 ----
Index: cp/optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/optimize.c,v
retrieving revision 1.104
diff -c -3 -p -r1.104 optimize.c
*** cp/optimize.c	22 Jan 2004 00:03:52 -0000	1.104
--- cp/optimize.c	5 Feb 2004 11:55:26 -0000
*************** Software Foundation, 59 Temple Place - S
*** 41,68 ****
  
  static tree calls_setjmp_r (tree *, int *, void *);
  static void update_cloned_parm (tree, tree);
- static void dump_function (enum tree_dump_index, tree);
- 
- /* Optimize the body of FN.  */
- 
- void
- optimize_function (tree fn)
- {
-   dump_function (TDI_original, fn);
- 
-   if (flag_inline_trees
-       /* We do not inline thunks, as (a) the backend tries to optimize
-          the call to the thunkee, (b) tree based inlining breaks that
-          optimization, (c) virtual functions are rarely inlineable,
-          and (d) TARGET_ASM_OUTPUT_MI_THUNK is there to DTRT anyway.  */
-       && !DECL_THUNK_P (fn))
-     {
-       optimize_inline_calls (fn);
-       dump_function (TDI_inlined, fn);
-     }
-   
-   dump_function (TDI_optimized, fn);
- }
  
  /* Called from calls_setjmp_p via walk_tree.  */
  
--- 41,46 ----
*************** maybe_clone_body (tree fn)
*** 251,277 ****
  
    /* We don't need to process the original function any further.  */
    return 1;
- }
- 
- /* Dump FUNCTION_DECL FN as tree dump PHASE.  */
- 
- static void
- dump_function (enum tree_dump_index phase, tree fn)
- {
-   FILE *stream;
-   int flags;
- 
-   stream = dump_begin (phase, &flags);
-   if (stream)
-     {
-       fprintf (stream, "\n;; Function %s",
- 	       decl_as_string (fn, TFF_DECL_SPECIFIERS));
-       fprintf (stream, " (%s)\n",
- 	       decl_as_string (DECL_ASSEMBLER_NAME (fn), 0));
-       fprintf (stream, ";; enabled by -fdump-%s\n", dump_flag_name (phase));
-       fprintf (stream, "\n");
-       
-       dump_node (fn, TDF_SLIM | flags, stream);
-       dump_end (phase, stream);
-     }
  }
--- 229,232 ----
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.388
diff -c -3 -p -r1.388 semantics.c
*** cp/semantics.c	3 Feb 2004 17:59:54 -0000	1.388
--- cp/semantics.c	5 Feb 2004 11:55:27 -0000
*************** expand_body (tree fn)
*** 2894,2903 ****
    /* Emit any thunks that should be emitted at the same time as FN.  */
    emit_associated_thunks (fn);
  
-   timevar_push (TV_INTEGRATION);
-   optimize_function (fn);
-   timevar_pop (TV_INTEGRATION);
- 
    tree_rest_of_compilation (fn, function_depth > 1);
  
    current_function_decl = saved_function;
--- 2894,2899 ----


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