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]

[RFC] deferring debug info


Richard,
thinking more about the way functions are deferred, it seems to me that
we should call debug info hook each time function is not going to be
expanded very first in cgraph_expand_pending_functions, but I don't
quite understand it.  Does the attached patch looks meaningfull to you?


Tue Sep  9 20:54:29 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* cgraphunit.c (cgraph_assemble_pending_functions_in_progress): New
	static variable.
	(cgraph_assemble_pending_functions): Guard recursion.
	(cgraph_finalize_function): Fix defering of output.
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.25
diff -c -3 -p -r1.25 cgraphunit.c
*** cgraphunit.c	9 Sep 2003 00:31:39 -0000	1.25
--- cgraphunit.c	9 Sep 2003 18:53:57 -0000
*************** decide_is_function_needed (struct cgraph
*** 120,125 ****
--- 120,130 ----
    return false;
  }
  
+ /* In non-unit-at-a-time mnode it is possible that cgraph_expand_function
+    recurse into cgraph_finalize_function.  Reduce the recursion depth and
+    avoid two expansions at once.  */
+ static bool cgraph_assemble_pending_functions_in_progress;
+ 
  /* When not doing unit-at-a-time, output all functions enqueued.
     Return true when such a functions were found.  */
  static bool
*************** cgraph_assemble_pending_functions (void)
*** 127,135 ****
  {
    bool output = false;
  
!   if (flag_unit_at_a_time)
      return false;
  
    while (cgraph_nodes_queue)
      {
        struct cgraph_node *n = cgraph_nodes_queue;
--- 132,142 ----
  {
    bool output = false;
  
!   if (flag_unit_at_a_time || cgraph_assemble_pending_functions_in_progress)
      return false;
  
+   cgraph_assemble_pending_functions_in_progress = true;
+ 
    while (cgraph_nodes_queue)
      {
        struct cgraph_node *n = cgraph_nodes_queue;
*************** cgraph_assemble_pending_functions (void)
*** 139,144 ****
--- 146,154 ----
  	cgraph_expand_function (n);
        output = true;
      }
+ 
+   cgraph_assemble_pending_functions_in_progress = false;
+ 
    return output;
  }
  
*************** cgraph_finalize_function (tree decl, tre
*** 193,206 ****
    if (decide_is_function_needed (node, decl))
      cgraph_mark_needed_node (node);
  
    /* If not unit at a time, go ahead and emit everything we've
       found to be reachable at this time.  Do this only at top-level.  */
    if (!node->origin)
      cgraph_assemble_pending_functions ();
- 
-   /* If we've not yet emitted decl, tell the debug info about it.  */
-   if (flag_unit_at_a_time || !node->reachable)
-     (*debug_hooks->deferred_inline_function) (decl);
  }
  
  /* Walk tree and record all calls.  Called via walk_tree.  */
--- 203,217 ----
    if (decide_is_function_needed (node, decl))
      cgraph_mark_needed_node (node);
  
+   /* If we've not yet emitted decl, tell the debug info about it.  */
+   if (flag_unit_at_a_time || cgraph_nodes_queue != node
+       || cgraph_assemble_pending_functions_in_progress)
+     (*debug_hooks->deferred_inline_function) (decl);
+ 
    /* If not unit at a time, go ahead and emit everything we've
       found to be reachable at this time.  Do this only at top-level.  */
    if (!node->origin)
      cgraph_assemble_pending_functions ();
  }
  
  /* Walk tree and record all calls.  Called via walk_tree.  */


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