diff mbox

VEC re-write [patch 19/25]

Message ID 20121115215415.4FB18C0916@torture.tor.corp.google.com
State New
Headers show

Commit Message

Diego Novillo Nov. 15, 2012, 9:54 p.m. UTC
2012-11-15  Diego Novillo  <dnovillo@google.com>

	Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec)

	* config/pa/pa.c: Use new vec API in vec.h.
diff mbox

Patch

diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index afcfd1a..8b93aa9 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -469,21 +469,22 @@  pa_option_override (void)
 {
   unsigned int i;
   cl_deferred_option *opt;
-  VEC(cl_deferred_option,heap) *vec
-    = (VEC(cl_deferred_option,heap) *) pa_deferred_options;
+  vec<cl_deferred_option> *v
+    = (vec<cl_deferred_option> *) pa_deferred_options;
 
-  FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt)
-    {
-      switch (opt->opt_index)
-	{
-	case OPT_mfixed_range_:
-	  fix_range (opt->arg);
-	  break;
+  if (v)
+    FOR_EACH_VEC_ELT (*v, i, opt)
+      {
+	switch (opt->opt_index)
+	  {
+	  case OPT_mfixed_range_:
+	    fix_range (opt->arg);
+	    break;
 
-	default:
-	  gcc_unreachable ();
-	}
-    }
+	  default:
+	    gcc_unreachable ();
+	  }
+      }
 
   /* Unconditional branches in the delay slot are not compatible with dwarf2
      call frame information.  There is no benefit in using this optimization
@@ -4401,7 +4402,7 @@  hppa_pic_save_rtx (void)
 
 
 /* Vector of funcdef numbers.  */
-static VEC(int,heap) *funcdef_nos;
+static vec<int> funcdef_nos;
 
 /* Output deferred profile counters.  */
 static void
@@ -4410,20 +4411,20 @@  output_deferred_profile_counters (void)
   unsigned int i;
   int align, n;
 
-  if (VEC_empty (int, funcdef_nos))
+  if (funcdef_nos.is_empty ())
    return;
 
   switch_to_section (data_section);
   align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE);
   ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
 
-  for (i = 0; VEC_iterate (int, funcdef_nos, i, n); i++)
+  for (i = 0; funcdef_nos.iterate (i, &n); i++)
     {
       targetm.asm_out.internal_label (asm_out_file, "LP", n);
       assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1);
     }
 
-  VEC_free (int, heap, funcdef_nos);
+  funcdef_nos.release ();
 }
 
 void
@@ -4465,7 +4466,7 @@  hppa_profile_hook (int label_no)
     rtx count_label_rtx, addr, r24;
     char count_label_name[16];
 
-    VEC_safe_push (int, heap, funcdef_nos, label_no);
+    funcdef_nos.safe_push (label_no);
     ASM_GENERATE_INTERNAL_LABEL (count_label_name, "LP", label_no);
     count_label_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (count_label_name));
 
@@ -9948,11 +9949,9 @@  typedef struct GTY(()) extern_symbol
 } extern_symbol;
 
 /* Define gc'd vector type for extern_symbol.  */
-DEF_VEC_O(extern_symbol);
-DEF_VEC_ALLOC_O(extern_symbol,gc);
 
 /* Vector of extern_symbol pointers.  */
-static GTY(()) VEC(extern_symbol,gc) *extern_symbols;
+static GTY(()) vec<extern_symbol, va_gc> *extern_symbols;
 
 #ifdef ASM_OUTPUT_EXTERNAL_REAL
 /* Mark DECL (name NAME) as an external reference (assembler output
@@ -9964,7 +9963,7 @@  pa_hpux_asm_output_external (FILE *file, tree decl, const char *name)
 {
   gcc_assert (file == asm_out_file);
   extern_symbol p = {decl, name};
-  VEC_safe_push (extern_symbol, gc, extern_symbols, p);
+  vec_safe_push (extern_symbols, p);
 }
 
 /* Output text required at the end of an assembler file.
@@ -9982,7 +9981,7 @@  pa_hpux_file_end (void)
 
   output_deferred_plabels ();
 
-  for (i = 0; VEC_iterate (extern_symbol, extern_symbols, i, p); i++)
+  for (i = 0; vec_safe_iterate (extern_symbols, i, &p); i++)
     {
       tree decl = p->decl;
 
@@ -9991,7 +9990,7 @@  pa_hpux_file_end (void)
 	ASM_OUTPUT_EXTERNAL_REAL (asm_out_file, decl, p->name);
     }
 
-  VEC_free (extern_symbol, gc, extern_symbols);
+  vec_free (extern_symbols);
 }
 #endif