]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ipa-inline.h
This patch rewrites the old VEC macro-based interface into a new one
[thirdparty/gcc.git] / gcc / ipa-inline.h
index 1e9658c3b96186aefcc220c4ec23904956591a23..729ea5698d7791c3504022315c89213b623bfcf9 100644 (file)
@@ -73,10 +73,8 @@ enum inline_hints_vals {
 };
 typedef int inline_hints;
 
-DEF_VEC_O (condition);
-DEF_VEC_ALLOC_O (condition, gc);
 
-typedef VEC(condition,gc) *conditions;
+typedef vec<condition, va_gc> *conditions;
 
 /* Representation of predicates i.e. formulas using conditions defined
    above.  Predicates are simple logical formulas in conjunctive-disjunctive
@@ -108,8 +106,6 @@ typedef struct GTY(()) size_time_entry
   int size;
   int time;
 } size_time_entry;
-DEF_VEC_O (size_time_entry);
-DEF_VEC_ALLOC_O (size_time_entry, gc);
 
 /* Function inlining information.  */
 struct GTY(()) inline_summary
@@ -141,7 +137,7 @@ struct GTY(()) inline_summary
   /* Conditional size/time information.  The summaries are being
      merged during inlining.  */
   conditions conds;
-  VEC(size_time_entry,gc) *entry;
+  vec<size_time_entry, va_gc> *entry;
 
   /* Predicate on when some loop in the function becomes to have known
      bounds.   */
@@ -163,9 +159,7 @@ struct GTY(()) inline_summary
 
 
 typedef struct inline_summary inline_summary_t;
-DEF_VEC_O(inline_summary_t);
-DEF_VEC_ALLOC_O(inline_summary_t,gc);
-extern GTY(()) VEC(inline_summary_t,gc) *inline_summary_vec;
+extern GTY(()) vec<inline_summary_t, va_gc> *inline_summary_vec;
 
 /* Information kept about parameter of call site.  */
 struct inline_param_summary
@@ -180,8 +174,6 @@ struct inline_param_summary
   int change_prob;
 };
 typedef struct inline_param_summary inline_param_summary_t;
-DEF_VEC_O(inline_param_summary_t);
-DEF_VEC_ALLOC_O(inline_param_summary_t,heap);
 
 /* Information kept about callgraph edges.  */
 struct inline_edge_summary
@@ -195,24 +187,20 @@ struct inline_edge_summary
   /* Array indexed by parameters.
      0 means that parameter change all the time, REG_BR_PROB_BASE means
      that parameter is constant.  */
-  VEC (inline_param_summary_t, heap) *param;
+  vec<inline_param_summary_t> param;
 };
 
 typedef struct inline_edge_summary inline_edge_summary_t;
-DEF_VEC_O(inline_edge_summary_t);
-DEF_VEC_ALLOC_O(inline_edge_summary_t,heap);
-extern VEC(inline_edge_summary_t,heap) *inline_edge_summary_vec;
+extern vec<inline_edge_summary_t> inline_edge_summary_vec;
 
 typedef struct edge_growth_cache_entry
 {
   int time, size;
   inline_hints hints;
 } edge_growth_cache_entry;
-DEF_VEC_O(edge_growth_cache_entry);
-DEF_VEC_ALLOC_O(edge_growth_cache_entry,heap);
 
-extern VEC(int,heap) *node_growth_cache;
-extern VEC(edge_growth_cache_entry,heap) *edge_growth_cache;
+extern vec<int> node_growth_cache;
+extern vec<edge_growth_cache_entry> edge_growth_cache;
 
 /* In ipa-inline-analysis.c  */
 void debug_inline_summary (struct cgraph_node *);
@@ -227,8 +215,8 @@ void initialize_inline_failed (struct cgraph_edge *);
 int estimate_time_after_inlining (struct cgraph_node *, struct cgraph_edge *);
 int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *);
 void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
-                                       VEC (tree, heap) *, VEC (tree, heap) *,
-                                       VEC (ipa_agg_jump_function_p, heap) *,
+                                       vec<tree>,  vec<tree>,
+                                       vec<ipa_agg_jump_function_p>,
                                        int *, int *, inline_hints *);
 int do_estimate_growth (struct cgraph_node *);
 void inline_merge_summary (struct cgraph_edge *edge);
@@ -241,7 +229,7 @@ void free_growth_caches (void);
 void compute_inline_parameters (struct cgraph_node *, bool);
 
 /* In ipa-inline-transform.c  */
-bool inline_call (struct cgraph_edge *, bool, VEC (cgraph_edge_p, heap) **, int *, bool);
+bool inline_call (struct cgraph_edge *, bool, vec<cgraph_edge_p> *, int *, bool);
 unsigned int inline_transform (struct cgraph_node *);
 void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *);
 
@@ -251,14 +239,13 @@ extern int nfunctions_inlined;
 static inline struct inline_summary *
 inline_summary (struct cgraph_node *node)
 {
-  return &VEC_index (inline_summary_t, inline_summary_vec, node->uid);
+  return &(*inline_summary_vec)[node->uid];
 }
 
 static inline struct inline_edge_summary *
 inline_edge_summary (struct cgraph_edge *edge)
 {
-  return &VEC_index (inline_edge_summary_t,
-                   inline_edge_summary_vec, edge->uid);
+  return &inline_edge_summary_vec[edge->uid];
 }
 
 /* Return estimated unit growth after inlning all calls to NODE.
@@ -270,8 +257,8 @@ static inline int
 estimate_growth (struct cgraph_node *node)
 {
   int ret;
-  if ((int)VEC_length (int, node_growth_cache) <= node->uid
-      || !(ret = VEC_index (int, node_growth_cache, node->uid)))
+  if ((int)node_growth_cache.length () <= node->uid
+      || !(ret = node_growth_cache[node->uid]))
     return do_estimate_growth (node);
   return ret - (ret > 0);
 }
@@ -283,10 +270,8 @@ static inline int
 estimate_edge_size (struct cgraph_edge *edge)
 {
   int ret;
-  if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache) <= edge->uid
-      || !(ret = VEC_index (edge_growth_cache_entry,
-                           edge_growth_cache,
-                           edge->uid).size))
+  if ((int)edge_growth_cache.length () <= edge->uid
+      || !(ret = edge_growth_cache[edge->uid].size))
     return do_estimate_edge_size (edge);
   return ret - (ret > 0);
 }
@@ -310,10 +295,8 @@ static inline int
 estimate_edge_time (struct cgraph_edge *edge)
 {
   int ret;
-  if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache) <= edge->uid
-      || !(ret = VEC_index (edge_growth_cache_entry,
-                           edge_growth_cache,
-                           edge->uid).time))
+  if ((int)edge_growth_cache.length () <= edge->uid
+      || !(ret =  edge_growth_cache[edge->uid].time))
     return do_estimate_edge_time (edge);
   return ret - (ret > 0);
 }
@@ -326,10 +309,8 @@ static inline inline_hints
 estimate_edge_hints (struct cgraph_edge *edge)
 {
   inline_hints ret;
-  if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache) <= edge->uid
-      || !(ret = VEC_index (edge_growth_cache_entry,
-                           edge_growth_cache,
-                           edge->uid).hints))
+  if ((int)edge_growth_cache.length () <= edge->uid
+      || !(ret = edge_growth_cache[edge->uid].hints))
     return do_estimate_edge_hints (edge);
   return ret - 1;
 }
@@ -340,8 +321,8 @@ estimate_edge_hints (struct cgraph_edge *edge)
 static inline void
 reset_node_growth_cache (struct cgraph_node *node)
 {
-  if ((int)VEC_length (int, node_growth_cache) > node->uid)
-    VEC_replace (int, node_growth_cache, node->uid, 0);
+  if ((int)node_growth_cache.length () > node->uid)
+    node_growth_cache[node->uid] = 0;
 }
 
 /* Reset cached value for EDGE.  */
@@ -349,9 +330,9 @@ reset_node_growth_cache (struct cgraph_node *node)
 static inline void
 reset_edge_growth_cache (struct cgraph_edge *edge)
 {
-  if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache) > edge->uid)
+  if ((int)edge_growth_cache.length () > edge->uid)
     {
       struct edge_growth_cache_entry zero = {0, 0, 0};
-      VEC_replace (edge_growth_cache_entry, edge_growth_cache, edge->uid, zero);
+      edge_growth_cache[edge->uid] = zero;
     }
 }