+2013-12-20 Trevor saunders <tsaunders@mozilla.com>
+
+ * vec.h (stack_vec): Convert to a templaate specialization of
+ auto_vec.
+ * config/i386/i386.c, df-scan.c, function.c, genautomata.c,
+ gimplify.c, graphite-clast-to-gimple.c, graphite-dependences.c,
+ graphite-scop-detection.c, graphite-sese-to-poly.c, hw-doloop.c,
+ trans-mem.c, tree-call-cdce.c, tree-data-ref.c, tree-dfa.c,
+ tree-if-conv.c, tree-inline.c, tree-loop-distribution.c,
+ tree-parloops.c, tree-predcom.c, tree-ssa-alias.c,
+ tree-ssa-loop-ivcanon.c, tree-ssa-phiopt.c, tree-ssa-threadedge.c,
+ tree-ssa-uncprop.c, tree-vect-loop.c, tree-vect-patterns.c,
+ tree-vect-slp.c, tree-vect-stmts.c, var-tracking.c: Adjust.
+
2013-12-20 Eric Botcazou <ebotcazou@adacore.com>
* config/arm/arm.c (arm_expand_prologue): In a nested APCS frame with
+2013-12-20 Trevor saunders <tsaunders@mozilla.com>
+
+ * gcc-interface/decl.c (components_to_record): Replace stack_vec with
+ auto_vec.
+
2013-12-12 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/Makefile.in (ARM linux, GNU eabi): Tweak regexp.
tree gnu_union_type, gnu_union_name;
tree this_first_free_pos, gnu_variant_list = NULL_TREE;
bool union_field_needs_strict_alignment = false;
- stack_vec <vinfo_t, 16> variant_types;
+ auto_vec <vinfo_t, 16> variant_types;
vinfo_t *gnu_variant;
unsigned int variants_align = 0;
unsigned int i;
push_cfun (DECL_STRUCT_FUNCTION (resolver_decl));
- stack_vec<tree, 2> fn_ver_vec;
+ auto_vec<tree, 2> fn_ver_vec;
for (versn_info = node_version_info->next; versn_info;
versn_info = versn_info->next)
+2013-12-20 Trevor saunders <tsaunders@mozilla.com>
+
+ * semantics.c (build_anon_member_initialization): Replace
+ stack_vec<T, N> with auto_vec<T, N>.
+
2013-12-18 Balaji V. Iyer <balaji.v.iyer@intel.com>
* parser.c (cp_parser_cilk_simd_clause_name): Changed cilk_clause_name
to build up the initializer from the outside in so that we can reuse
previously built CONSTRUCTORs if this is, say, the second field in an
anonymous struct. So we use a vec as a stack. */
- stack_vec<tree, 2> fields;
+ auto_vec<tree, 2> fields;
do
{
fields.safe_push (TREE_OPERAND (member, 1));
struct df_collection_rec
{
- stack_vec<df_ref, 128> def_vec;
- stack_vec<df_ref, 32> use_vec;
- stack_vec<df_ref, 32> eq_use_vec;
- stack_vec<df_mw_hardreg_ptr, 32> mw_vec;
+ auto_vec<df_ref, 128> def_vec;
+ auto_vec<df_ref, 32> use_vec;
+ auto_vec<df_ref, 32> eq_use_vec;
+ auto_vec<df_mw_hardreg_ptr, 32> mw_vec;
};
static df_ref df_null_ref_rec[1];
if (block == NULL_TREE)
return;
- stack_vec<tree, 10> block_stack;
+ auto_vec<tree, 10> block_stack;
/* Reset the TREE_ASM_WRITTEN bit for all blocks. */
clear_block_marks (block);
if (alt_states_list->next_alt_state == 0)
return alt_states_list;
- stack_vec<alt_state_t, 150> alt_states;
+ auto_vec<alt_state_t, 150> alt_states;
for (curr_alt_state = alt_states_list;
curr_alt_state != NULL;
curr_alt_state = curr_alt_state->next_alt_state)
{
ainsn_t curr_ainsn;
size_t i;
- stack_vec<ainsn_t, 150> last_insns;
+ auto_vec<ainsn_t, 150> last_insns;
for (curr_ainsn = automaton->ainsn_list;
curr_ainsn != NULL;
state_t state;
state_t start_state;
state_t state2;
- stack_vec<state_t, 150> state_stack;
+ auto_vec<state_t, 150> state_stack;
int states_n;
reserv_sets_t reservs_matter = form_reservs_matter (automaton);
/* Create a stack of the subexpressions so later we can walk them in
order from inner to outer. */
- stack_vec<tree, 10> expr_stack;
+ auto_vec<tree, 10> expr_stack;
/* We can handle anything that get_inner_reference can deal with. */
for (p = expr_p; ; p = &TREE_OPERAND (*p, 0))
bool
gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping)
{
- stack_vec<tree, 10> newivs;
+ auto_vec<tree, 10> newivs;
loop_p context_loop;
sese region = SCOP_REGION (scop);
ifsese if_region = NULL;
scop_p scop;
timevar_push (TV_GRAPHITE_DATA_DEPS);
- stack_vec<poly_bb_p, 3> body;
+ auto_vec<poly_bb_p, 3> body;
scop = get_loop_body_pbbs (loop, bb_pbb_mapping, &body);
dependences = loop_level_carries_dependences (scop, body, depth);
timevar_pop (TV_GRAPHITE_DATA_DEPS);
case GBB_LOOP_SING_EXIT_HEADER:
{
- stack_vec<sd_region, 3> regions;
+ auto_vec<sd_region, 3> regions;
struct scopdet_info sinfo;
edge exit_e = single_exit (loop);
{
/* XXX: For now we just do not join loops with multiple exits. If the
exits lead to the same bb it may be possible to join the loop. */
- stack_vec<sd_region, 3> regions;
+ auto_vec<sd_region, 3> regions;
vec<edge> exits = get_loop_exit_edges (loop);
edge e;
int i;
}
case GBB_COND_HEADER:
{
- stack_vec<sd_region, 3> regions;
+ auto_vec<sd_region, 3> regions;
struct scopdet_info sinfo;
vec<basic_block> dominated;
int i;
static void
limit_scops (vec<scop_p> *scops)
{
- stack_vec<sd_region, 3> regions;
+ auto_vec<sd_region, 3> regions;
int i;
scop_p scop;
build_scops (vec<scop_p> *scops)
{
struct loop *loop = current_loops->tree_root;
- stack_vec<sd_region, 3> regions;
+ auto_vec<sd_region, 3> regions;
canonicalize_loop_closed_ssa_form ();
build_scops_1 (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)),
DEBUG_FUNCTION void
dot_scop (scop_p scop)
{
- stack_vec<scop_p, 1> scops;
+ auto_vec<scop_p, 1> scops;
if (scop)
scops.safe_push (scop);
virtual void after_dom_children (basic_block);
private:
- stack_vec<gimple, 3> m_conditions, m_cases;
+ auto_vec<gimple, 3> m_conditions, m_cases;
sese m_region;
};
int i, j;
poly_bb_p pbb;
data_reference_p dr;
- stack_vec<data_reference_p, 3> drs;
+ auto_vec<data_reference_p, 3> drs;
/* Remove all the PBBs that do not have data references: these basic
blocks are not handled in the polyhedral representation. */
gimple_stmt_iterator insert_gsi)
{
gimple_stmt_iterator gsi;
- stack_vec<gimple, 3> x;
+ auto_vec<gimple, 3> x;
gimple_seq_add_stmt (&stmts, stmt);
for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
gimple_stmt_iterator gsi;
tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
gimple stmt = gimple_build_assign (unshare_expr (res), var);
- stack_vec<gimple, 3> x;
+ auto_vec<gimple, 3> x;
gimple_seq_add_stmt (&stmts, stmt);
for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
gimple stmt = gimple_build_assign (unshare_expr (res), var);
basic_block bb;
- stack_vec<gimple, 3> x;
+ auto_vec<gimple, 3> x;
gimple_seq_add_stmt (&stmts, stmt);
for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
tree def;
use_operand_p use_p;
gimple_stmt_iterator gsi;
- stack_vec<gimple, 3> update;
+ auto_vec<gimple, 3> update;
unsigned int i;
gimple stmt;
gimple close_phi)
{
bool res;
- stack_vec<gimple, 10> in;
- stack_vec<gimple, 10> out;
+ auto_vec<gimple, 10> in;
+ auto_vec<gimple, 10> out;
detect_commutative_reduction (scop, close_phi, &in, &out);
res = in.length () > 1;
loop->head = BRANCH_EDGE (tail_bb)->dest;
loop->successor = FALLTHRU_EDGE (tail_bb)->dest;
- stack_vec<basic_block, 20> works;
+ auto_vec<basic_block, 20> works;
works.safe_push (loop->head);
found_tail = false;
calculate_dominance_info (CDI_DOMINATORS);
d = get_cg_data (&node, true);
- stack_vec<basic_block, 10> queue;
+ auto_vec<basic_block, 10> queue;
new_irr = BITMAP_ALLOC (&tm_obstack);
/* Scan each tm region, propagating irrevocable status through the tree. */
tree bi_call_label_decl;
gimple bi_call_label;
- stack_vec<gimple, 12> conds;
+ auto_vec<gimple, 12> conds;
gen_shrink_wrap_conditions (bi_call, conds, &nconds);
/* This can happen if the condition generator decides
vec<data_reference_p> *datarefs)
{
unsigned i;
- stack_vec<data_ref_loc, 2> references;
+ auto_vec<data_ref_loc, 2> references;
data_ref_loc *ref;
bool ret = true;
data_reference_p dr;
vec<data_reference_p> *datarefs)
{
unsigned i;
- stack_vec<data_ref_loc, 2> references;
+ auto_vec<data_ref_loc, 2> references;
data_ref_loc *ref;
bool ret = true;
data_reference_p dr;
{
basic_block bb;
struct walk_stmt_info wi;
- stack_vec<numbered_tree, 40> decl_list;
+ auto_vec<numbered_tree, 40> decl_list;
memset (&wi, '\0', sizeof (wi));
wi.info = (void *) &decl_list;
refs.create (5);
ddrs.create (25);
- stack_vec<loop_p, 3> loop_nest;
+ auto_vec<loop_p, 3> loop_nest;
res = if_convertible_loop_p_1 (loop, &loop_nest, &refs, &ddrs,
any_mask_load_store);
unsigned i;
struct ipa_replace_map *replace_info;
basic_block old_entry_block, bb;
- stack_vec<gimple, 10> init_stmts;
+ auto_vec<gimple, 10> init_stmts;
tree vars = NULL_TREE;
gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL
vec<data_reference_p> datarefs;
/* Create the RDG vertices from the stmts of the loop nest. */
- stack_vec<gimple, 10> stmts;
+ auto_vec<gimple, 10> stmts;
stmts_from_loop (loop_nest[0], &stmts);
rdg = new_graph (stmts.length ());
datarefs.create (10);
build_rdg_partition_for_vertex (struct graph *rdg, int v)
{
partition_t partition = partition_alloc (NULL, NULL);
- stack_vec<int, 3> nodes;
+ auto_vec<int, 3> nodes;
unsigned i;
int x;
int num_sccs = 1;
*nb_calls = 0;
- stack_vec<loop_p, 3> loop_nest;
+ auto_vec<loop_p, 3> loop_nest;
if (!find_loop_nest (loop, &loop_nest))
return 0;
if (dump_file && (dump_flags & TDF_DETAILS))
dump_rdg (dump_file, rdg);
- stack_vec<partition_t, 3> partitions;
+ auto_vec<partition_t, 3> partitions;
rdg_build_partitions (rdg, stmts, &partitions);
any_builtin = false;
/* Check for problems with dependences. If the loop can be reversed,
the iterations are independent. */
- stack_vec<loop_p, 3> loop_nest;
+ auto_vec<loop_p, 3> loop_nest;
datarefs.create (10);
dependence_relations.create (100);
if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
eliminate_local_variables (edge entry, edge exit)
{
basic_block bb;
- stack_vec<basic_block, 3> body;
+ auto_vec<basic_block, 3> body;
unsigned i;
gimple_stmt_iterator gsi;
bool has_debug_stmt = false;
tree type, type_name, nvar;
gimple_stmt_iterator gsi;
struct clsn_data clsn_data;
- stack_vec<basic_block, 3> body;
+ auto_vec<basic_block, 3> body;
basic_block bb;
basic_block entry_bb = bb1;
basic_block exit_bb = exit->dest;
/* Find the data references and split them into components according to their
dependence relations. */
- stack_vec<loop_p, 3> loop_nest;
+ auto_vec<loop_p, 3> loop_nest;
dependences.create (10);
datarefs.create (10);
if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
static bool
nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2)
{
- stack_vec<tree, 16> component_refs1;
- stack_vec<tree, 16> component_refs2;
+ auto_vec<tree, 16> component_refs1;
+ auto_vec<tree, 16> component_refs2;
/* Create the stack of handled components for REF1. */
while (handled_component_p (ref1))
unsigned int
tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer)
{
- stack_vec<loop_p, 16> father_stack;
+ auto_vec<loop_p, 16> father_stack;
bool changed;
int iteration = 0;
bool irred_invalidated = false;
}
/* Find pairs of stores with equal LHS. */
- stack_vec<gimple, 1> then_stores, else_stores;
+ auto_vec<gimple, 1> then_stores, else_stores;
FOR_EACH_VEC_ELT (then_datarefs, i, then_dr)
{
if (DR_IS_READ (then_dr))
i++;
}
- stack_vec<tree, alloc_count> fewvars;
+ auto_vec<tree, alloc_count> fewvars;
pointer_set_t *vars = NULL;
/* If we're already starting with 3/4 of alloc_count, go for a
leading to this block. If no such edge equivalency exists, then we
record NULL. These equivalences are live until we leave the dominator
subtree rooted at the block where we record the equivalency. */
- stack_vec<tree, 2> m_equiv_stack;
+ auto_vec<tree, 2> m_equiv_stack;
};
/* Main driver for un-cprop. */
{
basic_block bb = loop->header;
tree init, step;
- stack_vec<gimple, 64> worklist;
+ auto_vec<gimple, 64> worklist;
gimple_stmt_iterator gsi;
bool double_reduc;
gimple_stmt_iterator si;
unsigned int i, j;
vect_recog_func_ptr vect_recog_func;
- stack_vec<gimple, 1> stmts_to_replace;
+ auto_vec<gimple, 1> stmts_to_replace;
gimple stmt;
if (dump_enabled_p ())
/* Calculate scalar cost. */
FOR_EACH_VEC_ELT (slp_instances, i, instance)
{
- stack_vec<bool, 20> life;
+ auto_vec<bool, 20> life;
life.safe_grow_cleared (SLP_INSTANCE_GROUP_SIZE (instance));
scalar_cost += vect_bb_slp_scalar_cost (BB_VINFO_BB (bb_vinfo),
SLP_INSTANCE_TREE (instance),
dump_printf_loc (MSG_NOTE, vect_location,
"=== vect_mark_stmts_to_be_vectorized ===\n");
- stack_vec<gimple, 64> worklist;
+ auto_vec<gimple, 64> worklist;
/* 1. Init worklist. */
for (i = 0; i < nbbs; i++)
{
if (slp_node)
{
- stack_vec<tree, 4> ops;
- stack_vec<vec<tree>, 4> vec_defs;
+ auto_vec<tree, 4> ops;
+ auto_vec<vec<tree>, 4> vec_defs;
ops.safe_push (TREE_OPERAND (cond_expr, 0));
ops.safe_push (TREE_OPERAND (cond_expr, 1));
/* Stack of values and debug_exprs under expansion, and their
children. */
- stack_vec<rtx, 4> expanding;
+ auto_vec<rtx, 4> expanding;
/* Stack of values and debug_exprs whose expansion hit recursion
cycles. They will have VALUE_RECURSED_INTO marked when added to
resolves to a valid location. So, if the flag remains set at the
end of the search, we know no valid location for this one can
possibly exist. */
- stack_vec<rtx, 4> pending;
+ auto_vec<rtx, 4> pending;
/* The maximum depth among the sub-expressions under expansion.
Zero indicates no expansion so far. */
{
int i, n;
rtx val;
- stack_vec<rtx, 20> changed_values_stack;
+ auto_vec<rtx, 20> changed_values_stack;
/* Move values from changed_variables to changed_values_stack. */
changed_variables
};
-/* auto_vec is a sub class of vec whose storage is released when it is
- destroyed. */
-template<typename T>
+/* auto_vec is a subclass of vec that automatically manages creating and
+ releasing the internal vector. If N is non zero then it has N elements of
+ internal storage. The default is no internal storage, and you probably only
+ want to ask for internal storage for vectors on the stack because if the
+ size of the vector is larger than the internal storage that space is wasted.
+ */
+template<typename T, size_t N = 0>
class auto_vec : public vec<T, va_heap>
{
public:
- auto_vec () { this->m_vec = NULL; }
- auto_vec (size_t n) { this->create (n); }
- ~auto_vec () { this->release (); }
-};
-
-/* stack_vec is a subclass of vec containing N elements of internal storage.
- You probably only want to allocate this on the stack because if the array
- ends up being larger or much smaller than N it will be wasting space. */
-template<typename T, size_t N>
-class stack_vec : public vec<T, va_heap>
-{
-public:
- stack_vec ()
+ auto_vec ()
{
m_header.m_alloc = N;
m_header.m_has_auto_buf = 1;
this->m_vec = reinterpret_cast<vec<T, va_heap, vl_embed> *> (&m_header);
}
- ~stack_vec ()
+ ~auto_vec ()
{
this->release ();
}
T m_data[N];
};
+/* auto_vec is a sub class of vec whose storage is released when it is
+ destroyed. */
+template<typename T>
+class auto_vec<T, 0> : public vec<T, va_heap>
+{
+public:
+ auto_vec () { this->m_vec = NULL; }
+ auto_vec (size_t n) { this->create (n); }
+ ~auto_vec () { this->release (); }
+};
+
/* Allocate heap memory for pointer V and create the internal vector
with space for NELEMS elements. If NELEMS is 0, the internal
if (using_auto_storage ())
{
- static_cast<stack_vec<T, 1> *> (this)->m_header.m_num = 0;
+ static_cast<auto_vec<T, 1> *> (this)->m_header.m_num = 0;
return;
}
return false;
const vec_prefix *auto_header
- = &static_cast<const stack_vec<T, 1> *> (this)->m_header;
+ = &static_cast<const auto_vec<T, 1> *> (this)->m_header;
return reinterpret_cast<vec_prefix *> (m_vec) == auto_header;
}