[22/50] final.c:mark_symbol_refs_as_used
diff mbox

Message ID 87bns1acnw.fsf@googlemail.com
State New
Headers show

Commit Message

Richard Sandiford Aug. 3, 2014, 2:08 p.m. UTC
gcc/
	* final.c: Include rtl-iter.h.
	(mark_symbol_ref_as_used): Delete.
	(mark_symbol_refs_as_used): Use FOR_EACH_SUBRTX instead of
	for_each_rtx.

Comments

Jeff Law Aug. 5, 2014, 9:10 p.m. UTC | #1
On 08/03/14 08:08, Richard Sandiford wrote:
> gcc/
> 	* final.c: Include rtl-iter.h.
> 	(mark_symbol_ref_as_used): Delete.
> 	(mark_symbol_refs_as_used): Use FOR_EACH_SUBRTX instead of
> 	for_each_rtx.
OK.
jeff

Patch
diff mbox

Index: gcc/final.c
===================================================================
--- gcc/final.c	2014-08-03 11:25:10.029955339 +0100
+++ gcc/final.c	2014-08-03 11:25:26.329116482 +0100
@@ -81,6 +81,7 @@  Software Foundation; either version 3, o
 #include "tree-pretty-print.h" /* for dump_function_header */
 #include "asan.h"
 #include "wide-int-print.h"
+#include "rtl-iter.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"		/* Needed for external data
@@ -3774,38 +3775,19 @@  output_asm_label (rtx x)
   assemble_name (asm_out_file, buf);
 }
 
-/* Helper rtx-iteration-function for mark_symbol_refs_as_used and
-   output_operand.  Marks SYMBOL_REFs as referenced through use of
-   assemble_external.  */
-
-static int
-mark_symbol_ref_as_used (rtx *xp, void *dummy ATTRIBUTE_UNUSED)
-{
-  rtx x = *xp;
-
-  /* If we have a used symbol, we may have to emit assembly
-     annotations corresponding to whether the symbol is external, weak
-     or has non-default visibility.  */
-  if (GET_CODE (x) == SYMBOL_REF)
-    {
-      tree t;
-
-      t = SYMBOL_REF_DECL (x);
-      if (t)
-	assemble_external (t);
-
-      return -1;
-    }
-
-  return 0;
-}
-
 /* Marks SYMBOL_REFs in x as referenced through use of assemble_external.  */
 
 void
 mark_symbol_refs_as_used (rtx x)
 {
-  for_each_rtx (&x, mark_symbol_ref_as_used, NULL);
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, x, ALL)
+    {
+      const_rtx x = *iter;
+      if (GET_CODE (x) == SYMBOL_REF)
+	if (tree t = SYMBOL_REF_DECL (x))
+	  assemble_external (t);
+    }
 }
 
 /* Print operand X using machine-dependent assembler syntax.
@@ -3831,7 +3813,7 @@  output_operand (rtx x, int code ATTRIBUT
   if (x == NULL_RTX)
     return;
 
-  for_each_rtx (&x, mark_symbol_ref_as_used, NULL);
+  mark_symbol_refs_as_used (x);
 }
 
 /* Print a memory reference operand for address X using