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]

[PATCH] Rename DECL_DEBUG_EXPR_IS_FROM to DECL_HAS_DEBUG_EXPR_P


As discussed previously on IRC this patch does the renaming from
the confusing DECL_DEBUG_EXPR_IS_FROM to DECL_HAS_DEBUG_EXPR_P
which matches DECL_HAS_VALUE_EXPR_P (and it's behavior).

Bootstrap / regtest pending on x86_64-unknown-linux-gnu.

Ok if it passes?

Thanks,
Richard.

2013-03-20  Richard Biener  <rguenther@suse.de>

	* tree.h (DECL_DEBUG_EXPR_IS_FROM): Rename to ...
	(DECL_HAS_DEBUG_EXPR_P): ... this.  Guard properly.
	* dwarf2out.c (add_var_loc_to_decl): Use DECL_HAS_DEBUG_EXPR_P
	instead of DECL_DEBUG_EXPR_IS_FROM.
	* gimplify.c (gimplify_modify_expr): Likewise.
	* tree-cfg.c (verify_expr_location_1): Likewise.
	* tree-complex.c (create_one_component_var): Likewise.
	* tree-inline.c (add_local_variables): Likewise.
	* tree-sra.c (create_access_replacement): Likewise.
	* tree-ssa-live.c (clear_unused_block_pointer_1): Likewise.
	(clear_unused_block_pointer): Likewise.
	* tree-streamer-in.c (unpack_ts_decl_common_value_fields): Likewise.
	* tree-streamer-out.c (pack_ts_decl_common_value_fields): Likewise.
	* var-tracking.c (var_debug_decl): Likewise.
	(track_expr_p): Likewise.
	* tree-diagnostic.c (default_tree_printer): Use DECL_HAS_DEBUG_EXPR_P
	instead of DECL_DEBUG_EXPR_IS_FROM.  Guard properly.

	c/
	* c-objc-common.c (c_tree_printer): Use DECL_HAS_DEBUG_EXPR_P
	instead of DECL_DEBUG_EXPR_IS_FROM.  Guard properly.

	cp/
	* error.c (cp_printer): Use DECL_HAS_DEBUG_EXPR_P instead of
	DECL_DEBUG_EXPR_IS_FROM.  Guard properly.

Index: trunk/gcc/c/c-objc-common.c
===================================================================
*** trunk.orig/gcc/c/c-objc-common.c	2013-01-11 10:54:27.000000000 +0100
--- trunk/gcc/c/c-objc-common.c	2013-03-20 13:45:50.493148334 +0100
*************** c_tree_printer (pretty_printer *pp, text
*** 112,118 ****
    switch (*spec)
      {
      case 'D':
!       if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t))
  	{
  	  t = DECL_DEBUG_EXPR (t);
  	  if (!DECL_P (t))
--- 112,118 ----
    switch (*spec)
      {
      case 'D':
!       if (TREE_CODE (t) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (t))
  	{
  	  t = DECL_DEBUG_EXPR (t);
  	  if (!DECL_P (t))
Index: trunk/gcc/cp/error.c
===================================================================
*** trunk.orig/gcc/cp/error.c	2013-03-18 09:55:06.000000000 +0100
--- trunk/gcc/cp/error.c	2013-03-20 13:46:12.833394584 +0100
*************** cp_printer (pretty_printer *pp, text_inf
*** 3283,3290 ****
      case 'D':
        {
  	tree temp = next_tree;
! 	if (DECL_P (temp)
! 	    && DECL_DEBUG_EXPR_IS_FROM (temp) && DECL_DEBUG_EXPR (temp))
  	  {
  	    temp = DECL_DEBUG_EXPR (temp);
  	    if (!DECL_P (temp))
--- 3283,3290 ----
      case 'D':
        {
  	tree temp = next_tree;
! 	if (TREE_CODE (temp) == VAR_DECL
! 	    && DECL_HAS_DEBUG_EXPR_P (temp))
  	  {
  	    temp = DECL_DEBUG_EXPR (temp);
  	    if (!DECL_P (temp))
Index: trunk/gcc/dwarf2out.c
===================================================================
*** trunk.orig/gcc/dwarf2out.c	2013-03-18 09:55:07.000000000 +0100
--- trunk/gcc/dwarf2out.c	2013-03-20 13:42:10.108689198 +0100
*************** add_var_loc_to_decl (tree decl, rtx loc_
*** 5020,5026 ****
    struct var_loc_node *loc = NULL;
    HOST_WIDE_INT bitsize = -1, bitpos = -1;
  
!   if (DECL_DEBUG_EXPR_IS_FROM (decl))
      {
        tree realdecl = DECL_DEBUG_EXPR (decl);
        if (realdecl
--- 5020,5026 ----
    struct var_loc_node *loc = NULL;
    HOST_WIDE_INT bitsize = -1, bitpos = -1;
  
!   if (DECL_HAS_DEBUG_EXPR_P (decl))
      {
        tree realdecl = DECL_DEBUG_EXPR (decl);
        if (realdecl
Index: trunk/gcc/gimplify.c
===================================================================
*** trunk.orig/gcc/gimplify.c	2013-02-13 11:54:28.000000000 +0100
--- trunk/gcc/gimplify.c	2013-03-20 13:42:29.761908693 +0100
*************** gimplify_modify_expr (tree *expr_p, gimp
*** 4947,4953 ****
        if (!DECL_NAME (*from_p) && DECL_NAME (*to_p))
  	DECL_NAME (*from_p)
  	  = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p)));
!       DECL_DEBUG_EXPR_IS_FROM (*from_p) = 1;
        SET_DECL_DEBUG_EXPR (*from_p, *to_p);
     }
  
--- 4947,4953 ----
        if (!DECL_NAME (*from_p) && DECL_NAME (*to_p))
  	DECL_NAME (*from_p)
  	  = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p)));
!       DECL_HAS_DEBUG_EXPR_P (*from_p) = 1;
        SET_DECL_DEBUG_EXPR (*from_p, *to_p);
     }
  
Index: trunk/gcc/tree-cfg.c
===================================================================
*** trunk.orig/gcc/tree-cfg.c	2013-03-19 16:35:23.000000000 +0100
--- trunk/gcc/tree-cfg.c	2013-03-20 13:42:33.816953991 +0100
*************** verify_expr_location_1 (tree *tp, int *w
*** 4544,4550 ****
    struct pointer_set_t *blocks = (struct pointer_set_t *) data;
  
    if (TREE_CODE (*tp) == VAR_DECL
!       && DECL_DEBUG_EXPR_IS_FROM (*tp))
      {
        tree t = DECL_DEBUG_EXPR (*tp);
        tree addr = walk_tree (&t, verify_expr_location_1, blocks, NULL);
--- 4544,4550 ----
    struct pointer_set_t *blocks = (struct pointer_set_t *) data;
  
    if (TREE_CODE (*tp) == VAR_DECL
!       && DECL_HAS_DEBUG_EXPR_P (*tp))
      {
        tree t = DECL_DEBUG_EXPR (*tp);
        tree addr = walk_tree (&t, verify_expr_location_1, blocks, NULL);
Index: trunk/gcc/tree-complex.c
===================================================================
*** trunk.orig/gcc/tree-complex.c	2013-03-20 09:59:51.000000000 +0100
--- trunk/gcc/tree-complex.c	2013-03-20 13:42:37.088990528 +0100
*************** create_one_component_var (tree type, tre
*** 428,434 ****
        DECL_NAME (r) = get_identifier (ACONCAT ((name, suffix, NULL)));
  
        SET_DECL_DEBUG_EXPR (r, build1 (code, type, orig));
!       DECL_DEBUG_EXPR_IS_FROM (r) = 1;
        DECL_IGNORED_P (r) = 0;
        TREE_NO_WARNING (r) = TREE_NO_WARNING (orig);
      }
--- 428,434 ----
        DECL_NAME (r) = get_identifier (ACONCAT ((name, suffix, NULL)));
  
        SET_DECL_DEBUG_EXPR (r, build1 (code, type, orig));
!       DECL_HAS_DEBUG_EXPR_P (r) = 1;
        DECL_IGNORED_P (r) = 0;
        TREE_NO_WARNING (r) = TREE_NO_WARNING (orig);
      }
Index: trunk/gcc/tree-diagnostic.c
===================================================================
*** trunk.orig/gcc/tree-diagnostic.c	2013-01-11 10:54:30.000000000 +0100
--- trunk/gcc/tree-diagnostic.c	2013-03-20 13:51:28.218874204 +0100
*************** default_tree_printer (pretty_printer *pp
*** 268,274 ****
  
      case 'D':
        t = va_arg (*text->args_ptr, tree);
!       if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t))
  	t = DECL_DEBUG_EXPR (t);
        break;
  
--- 268,274 ----
  
      case 'D':
        t = va_arg (*text->args_ptr, tree);
!       if (TREE_CODE (t) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (t))
  	t = DECL_DEBUG_EXPR (t);
        break;
  
Index: trunk/gcc/tree-inline.c
===================================================================
*** trunk.orig/gcc/tree-inline.c	2013-03-19 16:35:23.000000000 +0100
--- trunk/gcc/tree-inline.c	2013-03-20 13:42:43.583063061 +0100
*************** add_local_variables (struct function *ca
*** 3762,3768 ****
  
          /* Remap debug-expressions.  */
  	if (TREE_CODE (new_var) == VAR_DECL
! 	    && DECL_DEBUG_EXPR_IS_FROM (new_var)
  	    && new_var != var)
  	  {
  	    tree tem = DECL_DEBUG_EXPR (var);
--- 3762,3768 ----
  
          /* Remap debug-expressions.  */
  	if (TREE_CODE (new_var) == VAR_DECL
! 	    && DECL_HAS_DEBUG_EXPR_P (new_var)
  	    && new_var != var)
  	  {
  	    tree tem = DECL_DEBUG_EXPR (var);
Index: trunk/gcc/tree-sra.c
===================================================================
*** trunk.orig/gcc/tree-sra.c	2013-03-20 09:59:51.000000000 +0100
--- trunk/gcc/tree-sra.c	2013-03-20 13:42:46.661097440 +0100
*************** create_access_replacement (struct access
*** 1961,1967 ****
        if (!fail)
  	{
  	  SET_DECL_DEBUG_EXPR (repl, debug_expr);
! 	  DECL_DEBUG_EXPR_IS_FROM (repl) = 1;
  	}
        if (access->grp_no_warning)
  	TREE_NO_WARNING (repl) = 1;
--- 1961,1967 ----
        if (!fail)
  	{
  	  SET_DECL_DEBUG_EXPR (repl, debug_expr);
! 	  DECL_HAS_DEBUG_EXPR_P (repl) = 1;
  	}
        if (access->grp_no_warning)
  	TREE_NO_WARNING (repl) = 1;
Index: trunk/gcc/tree-ssa-live.c
===================================================================
*** trunk.orig/gcc/tree-ssa-live.c	2013-02-20 16:19:27.000000000 +0100
--- trunk/gcc/tree-ssa-live.c	2013-03-20 13:42:50.312138219 +0100
*************** clear_unused_block_pointer_1 (tree *tp,
*** 620,626 ****
    if (EXPR_P (*tp) && TREE_BLOCK (*tp)
        && !TREE_USED (TREE_BLOCK (*tp)))
      TREE_SET_BLOCK (*tp, NULL);
!   if (TREE_CODE (*tp) == VAR_DECL && DECL_DEBUG_EXPR_IS_FROM (*tp))
      {
        tree debug_expr = DECL_DEBUG_EXPR (*tp);
        walk_tree (&debug_expr, clear_unused_block_pointer_1, NULL, NULL);
--- 620,626 ----
    if (EXPR_P (*tp) && TREE_BLOCK (*tp)
        && !TREE_USED (TREE_BLOCK (*tp)))
      TREE_SET_BLOCK (*tp, NULL);
!   if (TREE_CODE (*tp) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (*tp))
      {
        tree debug_expr = DECL_DEBUG_EXPR (*tp);
        walk_tree (&debug_expr, clear_unused_block_pointer_1, NULL, NULL);
*************** clear_unused_block_pointer (void)
*** 640,646 ****
    unsigned i;
  
    FOR_EACH_LOCAL_DECL (cfun, i, t)
!     if (TREE_CODE (t) == VAR_DECL && DECL_DEBUG_EXPR_IS_FROM (t))
        {
  	tree debug_expr = DECL_DEBUG_EXPR (t);
  	walk_tree (&debug_expr, clear_unused_block_pointer_1, NULL, NULL);
--- 640,646 ----
    unsigned i;
  
    FOR_EACH_LOCAL_DECL (cfun, i, t)
!     if (TREE_CODE (t) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (t))
        {
  	tree debug_expr = DECL_DEBUG_EXPR (t);
  	walk_tree (&debug_expr, clear_unused_block_pointer_1, NULL, NULL);
Index: trunk/gcc/tree-streamer-in.c
===================================================================
*** trunk.orig/gcc/tree-streamer-in.c	2013-01-11 10:54:56.000000000 +0100
--- trunk/gcc/tree-streamer-in.c	2013-03-20 13:44:17.305109972 +0100
*************** unpack_ts_decl_common_value_fields (stru
*** 203,209 ****
    DECL_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);
    DECL_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1);
    DECL_PRESERVE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
-   DECL_DEBUG_EXPR_IS_FROM (expr) = (unsigned) bp_unpack_value (bp, 1);
    DECL_EXTERNAL (expr) = (unsigned) bp_unpack_value (bp, 1);
    DECL_GIMPLE_REG_P (expr) = (unsigned) bp_unpack_value (bp, 1);
    DECL_ALIGN (expr) = (unsigned) bp_unpack_var_len_unsigned (bp);
--- 203,208 ----
*************** unpack_ts_decl_common_value_fields (stru
*** 226,232 ****
      }
  
    if (TREE_CODE (expr) == VAR_DECL)
!     DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1);
  
    if (TREE_CODE (expr) == RESULT_DECL
        || TREE_CODE (expr) == PARM_DECL
--- 225,234 ----
      }
  
    if (TREE_CODE (expr) == VAR_DECL)
!     {
!       DECL_HAS_DEBUG_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
!       DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1);
!     }
  
    if (TREE_CODE (expr) == RESULT_DECL
        || TREE_CODE (expr) == PARM_DECL
Index: trunk/gcc/tree-streamer-out.c
===================================================================
*** trunk.orig/gcc/tree-streamer-out.c	2013-01-11 10:54:52.000000000 +0100
--- trunk/gcc/tree-streamer-out.c	2013-03-20 13:44:33.472290591 +0100
*************** pack_ts_decl_common_value_fields (struct
*** 170,176 ****
    bp_pack_value (bp, DECL_ARTIFICIAL (expr), 1);
    bp_pack_value (bp, DECL_USER_ALIGN (expr), 1);
    bp_pack_value (bp, DECL_PRESERVE_P (expr), 1);
-   bp_pack_value (bp, DECL_DEBUG_EXPR_IS_FROM (expr), 1);
    bp_pack_value (bp, DECL_EXTERNAL (expr), 1);
    bp_pack_value (bp, DECL_GIMPLE_REG_P (expr), 1);
    bp_pack_var_len_unsigned (bp, DECL_ALIGN (expr));
--- 170,175 ----
*************** pack_ts_decl_common_value_fields (struct
*** 192,198 ****
      }
  
    if (TREE_CODE (expr) == VAR_DECL)
!     bp_pack_value (bp, DECL_NONLOCAL_FRAME (expr), 1);
  
    if (TREE_CODE (expr) == RESULT_DECL
        || TREE_CODE (expr) == PARM_DECL
--- 191,200 ----
      }
  
    if (TREE_CODE (expr) == VAR_DECL)
!     {
!       bp_pack_value (bp, DECL_HAS_DEBUG_EXPR_P (expr), 1);
!       bp_pack_value (bp, DECL_NONLOCAL_FRAME (expr), 1);
!     }
  
    if (TREE_CODE (expr) == RESULT_DECL
        || TREE_CODE (expr) == PARM_DECL
Index: trunk/gcc/tree.h
===================================================================
*** trunk.orig/gcc/tree.h	2013-03-11 11:00:38.000000000 +0100
--- trunk/gcc/tree.h	2013-03-20 13:55:44.525706299 +0100
*************** struct GTY(()) tree_decl_minimal {
*** 2709,2716 ****
     checked before any access to the former.  */
  #define DECL_FUNCTION_CODE(NODE) \
    (FUNCTION_DECL_CHECK (NODE)->function_decl.function_code)
- #define DECL_DEBUG_EXPR_IS_FROM(NODE) \
-   (DECL_COMMON_CHECK (NODE)->decl_common.debug_expr_is_from)
  
  #define DECL_FUNCTION_PERSONALITY(NODE) \
    (FUNCTION_DECL_CHECK (NODE)->function_decl.personality)
--- 2709,2714 ----
*************** struct GTY(()) tree_decl_with_vis {
*** 3223,3231 ****
  
  extern tree decl_debug_expr_lookup (tree);
  extern void decl_debug_expr_insert (tree, tree);
! /* For VAR_DECL, this is set to either an expression that it was split
!    from (if DECL_DEBUG_EXPR_IS_FROM is true), otherwise a tree_list of
!    subexpressions that it was split into.  */
  #define DECL_DEBUG_EXPR(NODE) \
    (decl_debug_expr_lookup (VAR_DECL_CHECK (NODE)))
  
--- 3221,3229 ----
  
  extern tree decl_debug_expr_lookup (tree);
  extern void decl_debug_expr_insert (tree, tree);
! /* For VAR_DECL, this is set to an expression that it was split from.  */
! #define DECL_HAS_DEBUG_EXPR_P(NODE) \
!   (VAR_DECL_CHECK (NODE)->decl_common.debug_expr_is_from)
  #define DECL_DEBUG_EXPR(NODE) \
    (decl_debug_expr_lookup (VAR_DECL_CHECK (NODE)))
  
Index: trunk/gcc/var-tracking.c
===================================================================
*** trunk.orig/gcc/var-tracking.c	2013-02-08 10:09:57.000000000 +0100
--- trunk/gcc/var-tracking.c	2013-03-20 13:54:49.220094894 +0100
*************** vars_copy (htab_t dst, htab_t src)
*** 1780,1790 ****
  static inline tree
  var_debug_decl (tree decl)
  {
!   if (decl && DECL_P (decl)
!       && DECL_DEBUG_EXPR_IS_FROM (decl))
      {
        tree debugdecl = DECL_DEBUG_EXPR (decl);
!       if (debugdecl && DECL_P (debugdecl))
  	decl = debugdecl;
      }
  
--- 1780,1790 ----
  static inline tree
  var_debug_decl (tree decl)
  {
!   if (decl && TREE_CODE (decl) == VAR_DECL
!       && DECL_HAS_DEBUG_EXPR_P (decl))
      {
        tree debugdecl = DECL_DEBUG_EXPR (decl);
!       if (DECL_P (debugdecl))
  	decl = debugdecl;
      }
  
*************** track_expr_p (tree expr, bool need_rtl)
*** 5041,5052 ****
       don't need to track this expression if the ultimate declaration is
       ignored.  */
    realdecl = expr;
!   if (DECL_DEBUG_EXPR_IS_FROM (realdecl))
      {
        realdecl = DECL_DEBUG_EXPR (realdecl);
!       if (realdecl == NULL_TREE)
! 	realdecl = expr;
!       else if (!DECL_P (realdecl))
  	{
  	  if (handled_component_p (realdecl)
  	      || (TREE_CODE (realdecl) == MEM_REF
--- 5041,5050 ----
       don't need to track this expression if the ultimate declaration is
       ignored.  */
    realdecl = expr;
!   if (TREE_CODE (realdecl) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (realdecl))
      {
        realdecl = DECL_DEBUG_EXPR (realdecl);
!       if (!DECL_P (realdecl))
  	{
  	  if (handled_component_p (realdecl)
  	      || (TREE_CODE (realdecl) == MEM_REF


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