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]

[cgraph] move eh marking to except.c


One, moves it out of language code, which is good.  Two, moves it to
where we know if the data is actually used, which is also good.

Tested on alpha-linux.


r~


        * except.c: Include cgraph.h.
        (output_function_exception_table): Invoke
        cgraph_varpool_mark_needed_node.
        * Makefile.in (except.o): Update.

        * decl2.c (mark_member_pointers): Rename from
        mark_member_pointers_and_eh_handlers and don't check eh handlers.

Index: except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/except.c,v
retrieving revision 1.249
diff -c -p -d -r1.249 except.c
*** except.c	1 Aug 2003 22:17:44 -0000	1.249
--- except.c	10 Sep 2003 00:02:57 -0000
*************** Software Foundation, 59 Temple Place - S
*** 73,78 ****
--- 73,79 ----
  #include "tm_p.h"
  #include "target.h"
  #include "langhooks.h"
+ #include "cgraph.h"
  
  /* Provide defaults for stuff that may not be defined when using
     sjlj exceptions.  */
*************** output_function_exception_table (void)
*** 3704,3714 ****
        rtx value;
  
        if (type == NULL_TREE)
! 	type = integer_zero_node;
        else
! 	type = lookup_type_for_runtime (type);
  
-       value = expand_expr (type, NULL_RTX, VOIDmode, EXPAND_INITIALIZER);
        if (tt_format == DW_EH_PE_absptr || tt_format == DW_EH_PE_aligned)
  	assemble_integer (value, tt_format_size,
  			  tt_format_size * BITS_PER_UNIT, 1);
--- 3705,3729 ----
        rtx value;
  
        if (type == NULL_TREE)
! 	value = const0_rtx;
        else
! 	{
! 	  struct cgraph_varpool_node *node;
! 
! 	  type = lookup_type_for_runtime (type);
! 	  value = expand_expr (type, NULL_RTX, VOIDmode, EXPAND_INITIALIZER);
! 
! 	  /* Let cgraph know that the rtti decl is used.  Not all of the
! 	     paths below go through assemble_integer, which would take
! 	     care of this for us.  */
! 	  if (TREE_CODE (type) != ADDR_EXPR)
! 	    abort ();
! 	  type = TREE_OPERAND (type, 0);
! 	  node = cgraph_varpool_node (type);
! 	  if (node)
! 	    cgraph_varpool_mark_needed_node (node);
! 	}
  
        if (tt_format == DW_EH_PE_absptr || tt_format == DW_EH_PE_aligned)
  	assemble_integer (value, tt_format_size,
  			  tt_format_size * BITS_PER_UNIT, 1);
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.670
diff -c -p -d -r1.670 decl2.c
*** cp/decl2.c	8 Sep 2003 18:46:15 -0000	1.670
--- cp/decl2.c	10 Sep 2003 00:02:57 -0000
*************** generate_ctor_and_dtor_functions_for_pri
*** 2560,2608 ****
  /* Callgraph code does not understand the member pointers.  Mark the methods
     referenced as used.  */
  static tree
! mark_member_pointers_and_eh_handlers (tree *tp,
! 				      int *walk_subtrees,
! 		      		      void *data ATTRIBUTE_UNUSED)
  {
!   /* Avoid useless walking of complex type and declaration nodes.  */
!   if (TYPE_P (*tp) || DECL_P (*tp))
!     {
!       *walk_subtrees = 0;
!       return 0;
!     }
!   switch (TREE_CODE (*tp))
      {
      case PTRMEM_CST:
!       if (TYPE_PTRMEMFUNC_P (TREE_TYPE (*tp)))
! 	cgraph_mark_needed_node (cgraph_node (PTRMEM_CST_MEMBER (*tp)));
!       break;
! 
!     /* EH handlers will emit EH tables referencing typeinfo.  */
!     case HANDLER:
!       if (HANDLER_TYPE (*tp))
! 	{
! 	  tree tinfo = eh_type_info (HANDLER_TYPE (*tp));
! 
! 	  cgraph_varpool_mark_needed_node (cgraph_varpool_node (tinfo));
! 	}
        break;
  
-     case EH_SPEC_BLOCK:
- 	{
- 	  tree type;
- 
- 	  for (type = EH_SPEC_RAISES ((*tp)); type;
- 	       type = TREE_CHAIN (type))
- 	    {
- 	       tree tinfo = eh_type_info (TREE_VALUE (type));
- 
- 	       cgraph_varpool_mark_needed_node (cgraph_varpool_node (tinfo));
- 	    }
- 	}
-       break;
      default:
        break;
      }
    return 0;
  }
  
--- 2560,2583 ----
  /* Callgraph code does not understand the member pointers.  Mark the methods
     referenced as used.  */
  static tree
! mark_member_pointers (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
  {
!   tree t = *tp;
! 
!   switch (TREE_CODE (t))
      {
      case PTRMEM_CST:
!       if (TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
! 	cgraph_mark_needed_node (cgraph_node (PTRMEM_CST_MEMBER (t)));
        break;
  
      default:
+       /* Avoid useless walking of complex type and declaration nodes.  */
+       if (TYPE_P (t) || DECL_P (t))
+ 	*walk_subtrees = 0;
        break;
      }
+ 
    return 0;
  }
  
*************** void
*** 2612,2619 ****
  lower_function (tree fn)
  {
    walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
! 		  		mark_member_pointers_and_eh_handlers,
! 				NULL);
  }
  
  /* This routine is called from the last rule in yyparse ().
--- 2587,2593 ----
  lower_function (tree fn)
  {
    walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
! 		  		mark_member_pointers, NULL);
  }
  
  /* This routine is called from the last rule in yyparse ().
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1154
diff -c -p -d -r1.1154 Makefile.in
*** Makefile.in	9 Sep 2003 22:19:56 -0000	1.1154
--- Makefile.in	10 Sep 2003 00:08:39 -0000
*************** stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) 
*** 1535,1545 ****
     function.h insn-config.h hard-reg-set.h $(EXPR_H) libfuncs.h except.h \
     $(LOOP_H) $(RECOG_H) toplev.h output.h varray.h $(GGC_H) $(TM_P_H) \
     langhooks.h $(PREDICT_H) gt-stmt.h $(OPTABS_H) $(TARGET_H)
! except.o : except.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
!    flags.h except.h function.h $(EXPR_H) libfuncs.h $(INTEGRATE_H) langhooks.h \
!    insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \
     dwarf2asm.h dwarf2out.h toplev.h $(HASHTAB_H) intl.h $(GGC_H) \
!    gt-except.h
  expr.o : expr.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) flags.h \
     function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) libfuncs.h $(INSN_ATTR_H) insn-config.h \
     $(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \
--- 1535,1545 ----
     function.h insn-config.h hard-reg-set.h $(EXPR_H) libfuncs.h except.h \
     $(LOOP_H) $(RECOG_H) toplev.h output.h varray.h $(GGC_H) $(TM_P_H) \
     langhooks.h $(PREDICT_H) gt-stmt.h $(OPTABS_H) $(TARGET_H)
! except.o : except.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
!    $(TREE_H) flags.h except.h function.h $(EXPR_H) libfuncs.h $(INTEGRATE_H) \
!    langhooks.h insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \
     dwarf2asm.h dwarf2out.h toplev.h $(HASHTAB_H) intl.h $(GGC_H) \
!    gt-except.h cgraph.h
  expr.o : expr.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) flags.h \
     function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) libfuncs.h $(INSN_ATTR_H) insn-config.h \
     $(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \


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