public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [3.2-BIB] make TREE_SYMBOL_REFERENCED return an rvalue
@ 2002-11-06  8:57 Matt Austern
  2002-11-25 15:08 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Austern @ 2002-11-06  8:57 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

As discussed: change TREE_SYMBOL_REFERENCED so it returns
an rvalue, introduce a new TREE_SET_SYMBOL_REFERENCED to
change the value of this flag, and change every place
where the old macro was used as an lvalue so it uses the
new macro instead.

I haven't added any langhooks.  I'm not 100% sure yet that
I need one, and I'd rather not waste the time and space on
something that might be unnecessary.  But this patch will
make it easy to add one in the future if we ever decide we
do need it.


			--Matt



[-- Attachment #2: refpatch --]
[-- Type: application/octet-stream, Size: 10515 bytes --]

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	6 Nov 2002 16:35: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	6 Nov 2002 16:35: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	6 Nov 2002 16:35:10 -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	6 Nov 2002 16:35:11 -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	6 Nov 2002 16:35:14 -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	6 Nov 2002 16:35:14 -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	6 Nov 2002 16:35:16 -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);
     }
 }
 \f
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	6 Nov 2002 16:35:16 -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	6 Nov 2002 16:35:18 -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	6 Nov 2002 16:35:18 -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	6 Nov 2002 16:35:19 -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	6 Nov 2002 16:35:19 -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	6 Nov 2002 16:35:20 -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	6 Nov 2002 16:35:21 -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),

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [3.2-BIB] make TREE_SYMBOL_REFERENCED return an rvalue
  2002-11-06  8:57 [3.2-BIB] make TREE_SYMBOL_REFERENCED return an rvalue Matt Austern
@ 2002-11-25 15:08 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2002-11-25 15:08 UTC (permalink / raw)
  To: Matt Austern; +Cc: gcc-patches

On Wed, Nov 06, 2002 at 08:57:49AM -0800, Matt Austern wrote:
> As discussed: change TREE_SYMBOL_REFERENCED so it returns
> an rvalue, introduce a new TREE_SET_SYMBOL_REFERENCED to
> change the value of this flag, and change every place
> where the old macro was used as an lvalue so it uses the
> new macro instead.

Ok.

You should be including changelog entries, even to the list.


r~

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-25 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-06  8:57 [3.2-BIB] make TREE_SYMBOL_REFERENCED return an rvalue Matt Austern
2002-11-25 15:08 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).