]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/lto-streamer.h
This patch rewrites the old VEC macro-based interface into a new one
[thirdparty/gcc.git] / gcc / lto-streamer.h
index 4ad2bc98c85ce3516c7d9374f83bc8b17624d687..befebcabd8e764b347a1b170c2b1c65bf6809e9a 100644 (file)
@@ -29,7 +29,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "cgraph.h"
 #include "vec.h"
-#include "vecprim.h"
 #include "alloc-pool.h"
 #include "gcov-io.h"
 #include "diagnostic.h"
@@ -266,8 +265,6 @@ typedef enum
 } lto_decl_stream_e_t;
 
 typedef enum ld_plugin_symbol_resolution ld_plugin_symbol_resolution_t;
-DEF_VEC_I(ld_plugin_symbol_resolution_t);
-DEF_VEC_ALLOC_I(ld_plugin_symbol_resolution_t, heap);
 
 
 /* Macro to define convenience functions for type and decl streams
@@ -439,13 +436,11 @@ typedef struct
   unsigned int initializer:1;
 } lto_encoder_entry;
 
-DEF_VEC_O(lto_encoder_entry);
-DEF_VEC_ALLOC_O(lto_encoder_entry, heap);
 
 /* Encoder data structure used to stream callgraph nodes.  */
 struct lto_symtab_encoder_d
 {
-  VEC(lto_encoder_entry,heap) *nodes;
+  vec<lto_encoder_entry> nodes;
   pointer_map_t *map;
 };
 
@@ -486,7 +481,7 @@ struct lto_tree_ref_encoder
 {
   htab_t tree_hash_table;      /* Maps pointers to indices. */
   unsigned int next_index;     /* Next available index. */
-  VEC(tree,heap) *trees;       /* Maps indices to pointers. */
+  vec<tree> trees;     /* Maps indices to pointers. */
 };
 
 
@@ -522,8 +517,6 @@ struct lto_out_decl_state
 
 typedef struct lto_out_decl_state *lto_out_decl_state_ptr;
 
-DEF_VEC_P(lto_out_decl_state_ptr);
-DEF_VEC_ALLOC_P(lto_out_decl_state_ptr, heap);
 
 /* Compact representation of a index <-> resolution pair. Unpacked to an 
    vector later. */
@@ -534,8 +527,6 @@ struct res_pair
 };
 typedef struct res_pair res_pair;
 
-DEF_VEC_O(res_pair);
-DEF_VEC_ALLOC_O(res_pair, heap);
 
 /* One of these is allocated for each object file that being compiled
    by lto.  This structure contains the tables that are needed by the
@@ -572,7 +563,7 @@ struct GTY(()) lto_file_decl_data
   unsigned HOST_WIDE_INT id;
 
   /* Symbol resolutions for this file */
-  VEC(res_pair, heap) * GTY((skip)) respairs;
+  vec<res_pair>  GTY((skip)) respairs;
   unsigned max_index;
 
   struct gcov_ctr_summary GTY((skip)) profile_info;
@@ -705,7 +696,7 @@ struct data_in
   int current_col;
 
   /* Maps each reference number to the resolution done by the linker. */
-  VEC(ld_plugin_symbol_resolution_t,heap) *globals_resolution;
+  vec<ld_plugin_symbol_resolution_t> globals_resolution;
 
   /* Cache of pickled nodes.  */
   struct streamer_tree_cache_d *reader_cache;
@@ -810,7 +801,7 @@ extern void lto_input_constructors_and_inits (struct lto_file_decl_data *,
 extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int);
 extern struct data_in *lto_data_in_create (struct lto_file_decl_data *,
                                    const char *, unsigned,
-                                   VEC(ld_plugin_symbol_resolution_t,heap) *);
+                                   vec<ld_plugin_symbol_resolution_t> );
 extern void lto_data_in_delete (struct data_in *);
 extern void lto_input_data_block (struct lto_input_block *, void *, size_t);
 location_t lto_input_location (struct bitpack_d *, struct data_in *);
@@ -867,7 +858,7 @@ lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder);
 extern void lto_symtab_merge_decls (void);
 extern void lto_symtab_merge_cgraph_nodes (void);
 extern tree lto_symtab_prevailing_decl (tree decl);
-extern GTY(()) VEC(tree,gc) *lto_global_var_decls;
+extern GTY(()) vec<tree, va_gc> *lto_global_var_decls;
 
 
 /* In lto-opts.c.  */
@@ -882,7 +873,7 @@ extern const char *lto_section_name[];
 
 /* Holds all the out decl states of functions output so far in the
    current output file.  */
-extern VEC(lto_out_decl_state_ptr, heap) *lto_function_decl_states;
+extern vec<lto_out_decl_state_ptr> lto_function_decl_states;
 
 /* Return true if LTO tag TAG corresponds to a tree code.  */
 static inline bool
@@ -967,7 +958,7 @@ lto_init_tree_ref_encoder (struct lto_tree_ref_encoder *encoder,
 {
   encoder->tree_hash_table = htab_create (37, hash_fn, eq_fn, free);
   encoder->next_index = 0;
-  encoder->trees = NULL;
+  encoder->trees.create (0);
 }
 
 
@@ -979,14 +970,14 @@ lto_destroy_tree_ref_encoder (struct lto_tree_ref_encoder *encoder)
   /* Hash table may be delete already.  */
   if (encoder->tree_hash_table)
     htab_delete (encoder->tree_hash_table);
-  VEC_free (tree, heap, encoder->trees);
+  encoder->trees.release ();
 }
 
 /* Return the number of trees encoded in ENCODER. */
 static inline unsigned int
 lto_tree_ref_encoder_size (struct lto_tree_ref_encoder *encoder)
 {
-  return VEC_length (tree, encoder->trees);
+  return encoder->trees.length ();
 }
 
 /* Return the IDX-th tree in ENCODER. */
@@ -994,7 +985,7 @@ static inline tree
 lto_tree_ref_encoder_get_tree (struct lto_tree_ref_encoder *encoder,
                               unsigned int idx)
 {
-  return VEC_index (tree, encoder->trees, idx);
+  return encoder->trees[idx];
 }
 
 
@@ -1009,7 +1000,7 @@ emit_label_in_global_context_p (tree label)
 static inline int
 lto_symtab_encoder_size (lto_symtab_encoder_t encoder)
 {
-  return VEC_length (lto_encoder_entry, encoder->nodes);
+  return encoder->nodes.length ();
 }
 
 /* Value used to represent failure of lto_symtab_encoder_lookup.  */
@@ -1044,24 +1035,21 @@ lsei_next (lto_symtab_encoder_iterator *lsei)
 static inline symtab_node
 lsei_node (lto_symtab_encoder_iterator lsei)
 {
-  return VEC_index (lto_encoder_entry,
-                   lsei.encoder->nodes, lsei.index).node;
+  return lsei.encoder->nodes[lsei.index].node;
 }
 
 /* Return the node pointed to by LSI.  */
 static inline struct cgraph_node *
 lsei_cgraph_node (lto_symtab_encoder_iterator lsei)
 {
-  return cgraph (VEC_index (lto_encoder_entry,
-                           lsei.encoder->nodes, lsei.index).node);
+  return cgraph (lsei.encoder->nodes[lsei.index].node);
 }
 
 /* Return the node pointed to by LSI.  */
 static inline struct varpool_node *
 lsei_varpool_node (lto_symtab_encoder_iterator lsei)
 {
-  return varpool (VEC_index (lto_encoder_entry,
-                            lsei.encoder->nodes, lsei.index).node);
+  return varpool (lsei.encoder->nodes[lsei.index].node);
 }
 
 /* Return the cgraph node corresponding to REF using ENCODER.  */
@@ -1072,7 +1060,7 @@ lto_symtab_encoder_deref (lto_symtab_encoder_t encoder, int ref)
   if (ref == LCC_NOT_FOUND)
     return NULL;
 
-  return VEC_index (lto_encoder_entry, encoder->nodes, ref).node;
+  return encoder->nodes[ref].node;
 }
 
 /* Return an iterator to the first node in LSI.  */