PING: [3.4-bib] Make TREE_SYMBOL_REFERENCED return an rvalue

Matt Austern austern@apple.com
Fri Nov 8 16:54:00 GMT 2002


Sent out a few days ago, resending...  This patch splits
TREE_SYMBOL_REFERENCED into two macros, one to query the
flag and a different one to set the flag.  The immediate
motivation is so I can put in a hook when the flag gets
set, but I'm submitting it now because I think it's a
good cleanup on its own.

	* Change TREE_SYMBOL_REFERENCED to return an rvalue,
        introduce a new TREE_SET_SYMBOL_REFERENCED macro
        to set the flag, change all uses where the flag is
        set so that they use the new macro.

OK to commit to bib?

			--Matt


Index: gcc/c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.366.4.7
diff -c -u -r1.366.4.7 c-common.c
--- gcc/c-common.c	5 Nov 2002 19:11:51 -0000	1.366.4.7
+++ gcc/c-common.c	9 Nov 2002 00:40:08 -0000
@@ -5394,8 +5394,10 @@
       bool *no_add_attrs;
  {
    if (TREE_CODE (*node) == FUNCTION_DECL)
-    TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (*node))
-      = TREE_USED (*node) = 1;
+    {
+      TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (*node), 1);
+      TREE_USED (*node) = 1;
+    }
    else
      {
        warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
Index: gcc/dwarf2asm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2asm.c,v
retrieving revision 1.27.8.2
diff -c -u -r1.27.8.2 dwarf2asm.c
--- gcc/dwarf2asm.c	17 Sep 2002 22:58:41 -0000	1.27.8.2
+++ gcc/dwarf2asm.c	9 Nov 2002 00:40:09 -0000
@@ -777,7 +777,7 @@

        id = maybe_get_identifier (str);
        if (id)
-	TREE_SYMBOL_REFERENCED (id) = 1;
+	TREE_SET_SYMBOL_REFERENCED (id, 1);

        splay_tree_insert (indirect_pool, (splay_tree_key) str,
  			 (splay_tree_value) decl);
Index: gcc/toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.668.4.10
diff -c -u -r1.668.4.10 toplev.c
--- gcc/toplev.c	5 Nov 2002 19:11:55 -0000	1.668.4.10
+++ gcc/toplev.c	9 Nov 2002 00:40:12 -0000
@@ -2544,7 +2544,7 @@
  	 parent != NULL_TREE;
  	 parent = get_containing_scope (parent))
        if (TREE_CODE (parent) == FUNCTION_DECL)
-	TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
+	TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent), 1);
    }

    /* We are now committed to emitting code for this function.  Do any
Index: gcc/tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.349.4.11
diff -c -u -r1.349.4.11 tree.h
--- gcc/tree.h	28 Oct 2002 19:47:10 -0000	1.349.4.11
+++ gcc/tree.h	9 Nov 2002 00:40:14 -0000
@@ -532,7 +532,10 @@
  /* In an IDENTIFIER_NODE, this means that assemble_name was called with
     this string as an argument.  */
  #define TREE_SYMBOL_REFERENCED(NODE) \
-  (IDENTIFIER_NODE_CHECK (NODE)->common.static_flag)
+  (!! IDENTIFIER_NODE_CHECK (NODE)->common.static_flag)
+
+#define TREE_SET_SYMBOL_REFERENCED(NODE, VALUE) \
+  (IDENTIFIER_NODE_CHECK (NODE)->common.static_flag = (VALUE))

  /* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST, this means
     there was an overflow in folding, and no warning has been issued
Index: gcc/varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.303.2.11
diff -c -u -r1.303.2.11 varasm.c
--- gcc/varasm.c	5 Nov 2002 19:11:56 -0000	1.303.2.11
+++ gcc/varasm.c	9 Nov 2002 00:40:18 -0000
@@ -1753,7 +1753,7 @@

    id = maybe_get_identifier (real_name);
    if (id)
-    TREE_SYMBOL_REFERENCED (id) = 1;
+    TREE_SET_SYMBOL_REFERENCED (id, 1);

    if (name[0] == '*')
      fputs (&name[1], file);
Index: gcc/config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.26.2.2
diff -c -u -r1.26.2.2 darwin.c
--- gcc/config/darwin.c	1 Oct 2002 17:31:58 -0000	1.26.2.2
+++ gcc/config/darwin.c	9 Nov 2002 00:40:19 -0000
@@ -399,12 +399,12 @@
  	     original symbol as being referenced.  */
            TREE_USED (temp) = 1;
  	  if (TREE_CODE (TREE_VALUE (temp)) == IDENTIFIER_NODE)
-	    TREE_SYMBOL_REFERENCED (TREE_VALUE (temp)) = 1;
+	    TREE_SET_SYMBOL_REFERENCED (TREE_VALUE (temp), 1);
  	  real_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
  	  real_name = darwin_strip_name_encoding (real_name);
  	  id2 = maybe_get_identifier (real_name);
  	  if (id2)
-	    TREE_SYMBOL_REFERENCED (id2) = 1;
+	    TREE_SET_SYMBOL_REFERENCED (id2, 1);
  	}
  }

Index: gcc/config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.183.2.5
diff -c -u -r1.183.2.5 ia64.c
--- gcc/config/ia64/ia64.c	5 Nov 2002 19:12:05 -0000	1.183.2.5
+++ gcc/config/ia64/ia64.c	9 Nov 2002 00:40:24 -0000
@@ -4085,7 +4085,7 @@
        if (TREE_CODE (decl) == FUNCTION_DECL)
          ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
        (*targetm.asm_out.globalize_label) (file, name);
-      TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = 
save_referenced;
+      TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl), 
save_referenced);
      }
  }
  
Index: gcc/config/pa/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/elf.h,v
retrieving revision 1.13
diff -c -u -r1.13 elf.h
--- gcc/config/pa/elf.h	19 May 2002 05:23:18 -0000	1.13
+++ gcc/config/pa/elf.h	9 Nov 2002 00:40:24 -0000
@@ -78,7 +78,7 @@
  	 fputs (",ENTRY\n", FILE);				\
         else							\
  	 fputs (",DATA\n", FILE);				\
-       TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = 
save_referenced; \
+       TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL), 
save_referenced); \
       } while (0)

  /* The bogus HP assembler requires ALL external references to be
Index: gcc/config/pa/pa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.177.2.9
diff -c -u -r1.177.2.9 pa.c
--- gcc/config/pa/pa.c	5 Nov 2002 19:12:10 -0000	1.177.2.9
+++ gcc/config/pa/pa.c	9 Nov 2002 00:40:29 -0000
@@ -4765,7 +4765,7 @@
        /* Gross.  We have just implicitly taken the address of this 
function,
  	 mark it as such.  */
        real_name = (*targetm.strip_name_encoding) (fname);
-      TREE_SYMBOL_REFERENCED (get_identifier (real_name)) = 1;
+      TREE_SET_SYMBOL_REFERENCED (get_identifier (real_name), 1);
      }

    return &deferred_plabels[i];
Index: gcc/config/pa/som.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/som.h,v
retrieving revision 1.37.4.2
diff -c -u -r1.37.4.2 som.h
--- gcc/config/pa/som.h	5 Nov 2002 19:12:11 -0000	1.37.4.2
+++ gcc/config/pa/som.h	9 Nov 2002 00:40:29 -0000
@@ -313,7 +313,7 @@
  	 fputs (",CODE\n", FILE);				\
         else							\
  	 fputs (",DATA\n", FILE);				\
-       TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = 
save_referenced; \
+       TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL), 
save_referenced) \
       } while (0)

  /* The bogus HP assembler requires ALL external references to be
Index: gcc/cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.560.4.6
diff -c -u -r1.560.4.6 decl2.c
--- gcc/cp/decl2.c	5 Nov 2002 19:12:22 -0000	1.560.4.6
+++ gcc/cp/decl2.c	9 Nov 2002 00:40:32 -0000
@@ -1599,7 +1599,7 @@
      {
        DECL_COMDAT (decl) = 1;
        /* Mark it needed so we don't forget to emit it.  */
-      TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = 1;
+      TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl), 1);
      }
  }

Index: gcc/cp/method.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/method.c,v
retrieving revision 1.228.4.5
diff -c -u -r1.228.4.5 method.c
--- gcc/cp/method.c	28 Oct 2002 19:48:49 -0000	1.228.4.5
+++ gcc/cp/method.c	9 Nov 2002 00:40:34 -0000
@@ -381,7 +381,7 @@
    function = TREE_OPERAND (fnaddr, 0);
    TREE_ADDRESSABLE (function) = 1;
    mark_used (function);
-  TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (function)) = 1;
+  TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (function), 1);
    if (!emit_p)
      return;

@@ -512,7 +512,7 @@

        /* Since we want to emit the thunk, we explicitly mark its name 
as
  	 referenced.  */
-      TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (thunk_fndecl)) = 1;
+      TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (thunk_fndecl), 
1);

        /* But we don't want debugging information about it.  */
        DECL_IGNORED_P (thunk_fndecl) = 1;
Index: gcc/cp/rtti.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/rtti.c,v
retrieving revision 1.139.4.5
diff -c -u -r1.139.4.5 rtti.c
--- gcc/cp/rtti.c	15 Oct 2002 01:33:32 -0000	1.139.4.5
+++ gcc/cp/rtti.c	9 Nov 2002 00:40:34 -0000
@@ -1409,15 +1409,15 @@

        tinfo = get_tinfo_decl (bltn);
        TREE_USED (tinfo) = 1;
-      TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
+      TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo), 1);

        tinfo = get_tinfo_decl (bltn_ptr);
        TREE_USED (tinfo) = 1;
-      TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
+      TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo), 1);

        tinfo = get_tinfo_decl (bltn_const_ptr);
        TREE_USED (tinfo) = 1;
-      TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
+      TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo), 1);
      }
  }

Index: gcc/java/expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.150.4.1
diff -c -u -r1.150.4.1 expr.c
--- gcc/java/expr.c	1 Oct 2002 17:32:40 -0000	1.150.4.1
+++ gcc/java/expr.c	9 Nov 2002 00:40:36 -0000
@@ -2516,7 +2516,7 @@
  	    if (flag_hash_synchronization && POINTER_SIZE < 64)
  	      DECL_ALIGN (init_decl) = 64;
  	    rest_of_decl_compilation (init_decl, NULL, 1, 0);
-	    TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1;
+	    TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl), 1);
  	    init = build1 (ADDR_EXPR, TREE_TYPE (exp), init_decl);
  	    r = expand_expr (init, target, tmode, modifier);
  	    return r;
@@ -2539,7 +2539,7 @@
  	    DECL_IGNORED_P (init_decl) = 1;
  	    TREE_READONLY (init_decl) = 1;
  	    rest_of_decl_compilation (init_decl, NULL, 1, 0);
-	    TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1;
+	    TREE_SET_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl), 1);
  	    init = init_decl;
  	  }
  	expand_assignment (build (COMPONENT_REF, TREE_TYPE (data_fld),



More information about the Gcc-patches mailing list