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]

Small cgraph cleanups


Hi,
this patch fixes few minor problems I noticed while re-reviewing cgraph
code before reorganizing it.  The ipa-inline hunk is redundant since we
changed inline plan representation to have clone node for each inline
copy.

Honza

	* cgraph.c: Update overall comment; fix vertical spacing.
	* ipa-inline.c (cgraph_decide_inlining): Remove now redundant check.
Index: cgraph.c
===================================================================
*** cgraph.c	(revision 120017)
--- cgraph.c	(working copy)
*************** The callgraph:
*** 28,46 ****
      sharing.
  
      The call-graph consist of nodes and edges represented via linked lists.
!     Each function (external or not) corresponds to the unique node (in
!     contrast to tree DECL nodes where we can have multiple nodes for each
!     function).
  
      The mapping from declarations to call-graph nodes is done using hash table
!     based on DECL_ASSEMBLER_NAME, so it is essential for assembler name to
!     not change once the declaration is inserted into the call-graph.
!     The call-graph nodes are created lazily using cgraph_node function when
!     called for unknown declaration.
! 
!     When built, there is one edge for each direct call.  It is possible that
!     the reference will be later optimized out.  The call-graph is built
!     conservatively in order to make conservative data flow analysis possible.
  
      The callgraph at the moment does not represent indirect calls or calls
      from other compilation unit.  Flag NEEDED is set for each node that may
--- 28,38 ----
      sharing.
  
      The call-graph consist of nodes and edges represented via linked lists.
!     Each function (external or not) corresponds to the unique node.
  
      The mapping from declarations to call-graph nodes is done using hash table
!     based on DECL_UID.  The call-graph nodes are created lazily using
!     cgraph_node function when called for unknown declaration.
  
      The callgraph at the moment does not represent indirect calls or calls
      from other compilation unit.  Flag NEEDED is set for each node that may
*************** eq_node (const void *p1, const void *p2)
*** 156,161 ****
--- 148,154 ----
  }
  
  /* Allocate new callgraph node and insert it into basic data structures.  */
+ 
  static struct cgraph_node *
  cgraph_create_node (void)
  {
*************** cgraph_create_node (void)
*** 175,180 ****
--- 168,174 ----
  }
  
  /* Return cgraph node assigned to DECL.  Create new one when needed.  */
+ 
  struct cgraph_node *
  cgraph_node (tree decl)
  {
*************** cgraph_edge (struct cgraph_node *node, t
*** 295,300 ****
--- 289,295 ----
  }
  
  /* Change call_smtt of edge E to NEW_STMT.  */
+ 
  void
  cgraph_set_call_stmt (struct cgraph_edge *e, tree new_stmt)
  {
Index: ipa-inline.c
===================================================================
*** ipa-inline.c	(revision 120017)
--- ipa-inline.c	(working copy)
*************** cgraph_decide_inlining (void)
*** 1041,1088 ****
  	      && node->local.inlinable && node->callers->inline_failed
  	      && !DECL_EXTERNAL (node->decl) && !DECL_COMDAT (node->decl))
  	    {
! 	      bool ok = true;
! 	      struct cgraph_node *node1;
  
! 	      /* Verify that we won't duplicate the caller.  */
! 	      for (node1 = node->callers->caller;
! 		   node1->callers && !node1->callers->inline_failed
! 		   && ok; node1 = node1->callers->caller)
! 		if (node1->callers->next_caller || node1->needed)
! 		  ok = false;
! 	      if (ok)
  		{
  		  if (dump_file)
! 		    {
! 		      fprintf (dump_file,
! 			       "\nConsidering %s %i insns.\n",
! 			       cgraph_node_name (node), node->global.insns);
! 		      fprintf (dump_file,
! 			       " Called once from %s %i insns.\n",
! 			       cgraph_node_name (node->callers->caller),
! 			       node->callers->caller->global.insns);
! 		    }
! 
! 		  old_insns = overall_insns;
! 
! 		  if (cgraph_check_inline_limits (node->callers->caller, node,
! 					  	  NULL, false))
! 		    {
! 		      cgraph_mark_inline (node->callers);
! 		      if (dump_file)
! 			fprintf (dump_file,
! 				 " Inlined into %s which now has %i insns"
! 				 " for a net change of %+i insns.\n",
! 				 cgraph_node_name (node->callers->caller),
! 				 node->callers->caller->global.insns,
! 				 overall_insns - old_insns);
! 		    }
! 		  else
! 		    {
! 		      if (dump_file)
! 			fprintf (dump_file,
! 				 " Inline limit reached, not inlined.\n");
! 		    }
  		}
  	    }
  	}
--- 1041,1076 ----
  	      && node->local.inlinable && node->callers->inline_failed
  	      && !DECL_EXTERNAL (node->decl) && !DECL_COMDAT (node->decl))
  	    {
! 	      if (dump_file)
! 		{
! 		  fprintf (dump_file,
! 			   "\nConsidering %s %i insns.\n",
! 			   cgraph_node_name (node), node->global.insns);
! 		  fprintf (dump_file,
! 			   " Called once from %s %i insns.\n",
! 			   cgraph_node_name (node->callers->caller),
! 			   node->callers->caller->global.insns);
! 		}
! 
! 	      old_insns = overall_insns;
  
! 	      if (cgraph_check_inline_limits (node->callers->caller, node,
! 					      NULL, false))
! 		{
! 		  cgraph_mark_inline (node->callers);
! 		  if (dump_file)
! 		    fprintf (dump_file,
! 			     " Inlined into %s which now has %i insns"
! 			     " for a net change of %+i insns.\n",
! 			     cgraph_node_name (node->callers->caller),
! 			     node->callers->caller->global.insns,
! 			     overall_insns - old_insns);
! 		}
! 	      else
  		{
  		  if (dump_file)
! 		    fprintf (dump_file,
! 			     " Inline limit reached, not inlined.\n");
  		}
  	    }
  	}


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