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]

Remove unnecesarry parts of C++ analyze_expr


Hi,
cxx_callgraph_analyze_expr langhooks was invented for analyzing language
dependent nodes in function bodies and initializers.  Since we gimplify function
bodies it remained needed only for initializers that we now lower too.

The hook should be completely redundant if varpool was able to understand the
grouping of virtual tables, I will probably implement next.  However this patch
removes handling of PTRMEM_CST and BASELINK that should no longer exist at
cgraph time and also hack making functions needed when static is used.

I will install the patch at monday if there are no complains.
Bootstrapped/regtested x86_64-linux.

Honza

	* cp/decl2.c (cxx_callgraph_analyze_expr): Remove BASELINK, PTRMEM_CST
	handling; static var no longer makes containing function neccesary.
Index: cp/decl2.c
===================================================================
*** cp/decl2.c	(revision 154406)
--- cp/decl2.c	(working copy)
*************** cxx_callgraph_analyze_expr (tree *tp, in
*** 3306,3317 ****
    switch (TREE_CODE (t))
      {
      case PTRMEM_CST:
-       if (TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
- 	cgraph_mark_address_taken_node (cgraph_node (PTRMEM_CST_MEMBER (t)));
-       break;
      case BASELINK:
!       if (TREE_CODE (BASELINK_FUNCTIONS (t)) == FUNCTION_DECL)
! 	cgraph_mark_address_taken_node (cgraph_node (BASELINK_FUNCTIONS (t)));
        break;
      case VAR_DECL:
        if (DECL_VTABLE_OR_VTT_P (t))
--- 3306,3313 ----
    switch (TREE_CODE (t))
      {
      case PTRMEM_CST:
      case BASELINK:
!       gcc_unreachable ();
        break;
      case VAR_DECL:
        if (DECL_VTABLE_OR_VTT_P (t))
*************** cxx_callgraph_analyze_expr (tree *tp, in
*** 3324,3335 ****
  	       vtbl = TREE_CHAIN (vtbl))
  	    mark_decl_referenced (vtbl);
  	}
-       else if (DECL_CONTEXT (t)
- 	       && flag_use_repository
- 	       && TREE_CODE (DECL_CONTEXT (t)) == FUNCTION_DECL)
- 	/* If we need a static variable in a function, then we
- 	   need the containing function.  */
- 	mark_decl_referenced (DECL_CONTEXT (t));
        break;
      default:
        break;
--- 3320,3325 ----


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