+/* Allocate a PHI node with at least LEN arguments. If the free list
+ happens to contain a PHI node with LEN arguments or more, return
+ that one. */
+
+static inline gimple
+allocate_phi_node (size_t len)
+{
+ gimple phi;
+ size_t bucket = NUM_BUCKETS - 2;
+ size_t size = sizeof (struct gimple_statement_phi)
+ + (len - 1) * sizeof (struct phi_arg_d);
+
+ if (free_phinode_count)
+ for (bucket = len - 2; bucket < NUM_BUCKETS - 2; bucket++)
+ if (free_phinodes[bucket])
+ break;
+
+ /* If our free list has an element, then use it. */
+ if (bucket < NUM_BUCKETS - 2
+ && gimple_phi_capacity (VEC_index (gimple, free_phinodes[bucket], 0))
+ >= len)
+ {
+ free_phinode_count--;
+ phi = VEC_pop (gimple, free_phinodes[bucket]);
+ if (VEC_empty (gimple, free_phinodes[bucket]))
+ VEC_free (gimple, gc, free_phinodes[bucket]);
+#ifdef GATHER_STATISTICS
+ phi_nodes_reused++;
+#endif
+ }
+ else
+ {
+ phi = (gimple) ggc_alloc (size);
+#ifdef GATHER_STATISTICS
+ phi_nodes_created++;
+ {
+ enum gimple_alloc_kind kind = gimple_alloc_kind (GIMPLE_PHI);
+ gimple_alloc_counts[(int) kind]++;
+ gimple_alloc_sizes[(int) kind] += size;
+ }
+#endif
+ }
+
+ return phi;
+}
+