tree-vn.c (vn_add): Use XNEW.

* tree-vn.c (vn_add): Use XNEW.
        * tree-ssa-ccp.c (ccp_initialize): Use XNEWVEC.
        (ccp_fold): Likewise.
        (fold_stmt_r): Use explicit cast to convert from void *.
        * tree-outof-ssa.c (new_temp_expr_table): Use XCNEWVEC.
        (new_temp_expr_table): Likewise.
        * gimplify.c (lookup_tmp_var): Use XNEW.
        (gimplify_asm_expr): Use explcit cast to convert from void *.
        * tree-into-ssa.c (get_ssa_name_ann): Likewise.
        (get_def_blocks_for): Use XNEW.
        (add_to_repl_tbl): Likewise.
        (mark_def_sites): Use explicit cast to convert from void *.
        (def_blocks_free): Likewise.
        (mark_def_sites_initialize_block): Likewise.
        (update_ssa): Use XNEWVEC.
        * tree-dfa.c (create_var_ann): Use GGC_NEW.
        (create_stmt_ann): Likewise.
        (create_tree_ann): Likewise.
        (referenced_var_insert): Likewise.
        (set_default_def): Likewise.
        (referenced_var_lookup_if_exists): Use explicit cast to
        * convert
        from void *.
        (referenced_var_lookup): Likewise.
        (default_def): Likewise.
        (set_default_def): Likewise.
        * tree-cfg.c (create_bb): Likewise.
        (edge_to_cases_cleanup): Likewise.
        (verify_node_sharing): Likewise.
        (record_switch_edge): Use XNEW.
        (cleanup_dead_labels): Use XCNEWVEC.
        (tree_duplicate_sese_region): Use XNEWVEC.
        * tree-scalar-evolution.c (get_instantiated_value): Likewise.
        * tree-ssa.c (verify_ssa): Use XCNEWVEC.
        (int_tree_map_eq): Use explicit cast to convert from void *.
        * libgcov.c (gcov_exit): Use explicit cast to convert from
        * void *.
        (__gcov_execl): Likewise.
        (__gcov_execlp): Likewise.
        (__gcov_execle): Likewise.
        * tree-eh.c (struct_ptr_eq): Likewise.
        (struct_ptr_hash): Likewise.
        (lookup_stmt_eh_region_fn): Likewise.
        (outside_finally_tree): Likewise.
        (find_goto_replacement): Likewise.
        (make_eh_edge): Likewise.
        (mark_eh_edge): Likewise.
        (add_stmt_to_eh_region_fn): Use GGC_NEW.
        (record_in_finally_tree): Use XNEW.
        (maybe_record_in_goto_queue): Use XRESIZEVEC.
        (lower_try_finally_copy): Use XCNEWVEC.

From-SVN: r108736
This commit is contained in:
Gabriel Dos Reis 2005-12-18 01:19:20 +00:00 committed by Gabriel Dos Reis
parent 0e27ef71a5
commit 858904db9e
12 changed files with 111 additions and 53 deletions

View File

@ -4,6 +4,58 @@
dwarf2out_def_cfa. Only add space for frame pointer to cfa_offset
when frame_pointer_needed.
2005-12-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
* tree-vn.c (vn_add): Use XNEW.
* tree-ssa-ccp.c (ccp_initialize): Use XNEWVEC.
(ccp_fold): Likewise.
(fold_stmt_r): Use explicit cast to convert from void *.
* tree-outof-ssa.c (new_temp_expr_table): Use XCNEWVEC.
(new_temp_expr_table): Likewise.
* gimplify.c (lookup_tmp_var): Use XNEW.
(gimplify_asm_expr): Use explcit cast to convert from void *.
* tree-into-ssa.c (get_ssa_name_ann): Likewise.
(get_def_blocks_for): Use XNEW.
(add_to_repl_tbl): Likewise.
(mark_def_sites): Use explicit cast to convert from void *.
(def_blocks_free): Likewise.
(mark_def_sites_initialize_block): Likewise.
(update_ssa): Use XNEWVEC.
* tree-dfa.c (create_var_ann): Use GGC_NEW.
(create_stmt_ann): Likewise.
(create_tree_ann): Likewise.
(referenced_var_insert): Likewise.
(set_default_def): Likewise.
(referenced_var_lookup_if_exists): Use explicit cast to convert
from void *.
(referenced_var_lookup): Likewise.
(default_def): Likewise.
(set_default_def): Likewise.
* tree-cfg.c (create_bb): Likewise.
(edge_to_cases_cleanup): Likewise.
(verify_node_sharing): Likewise.
(record_switch_edge): Use XNEW.
(cleanup_dead_labels): Use XCNEWVEC.
(tree_duplicate_sese_region): Use XNEWVEC.
* tree-scalar-evolution.c (get_instantiated_value): Likewise.
* tree-ssa.c (verify_ssa): Use XCNEWVEC.
(int_tree_map_eq): Use explicit cast to convert from void *.
* libgcov.c (gcov_exit): Use explicit cast to convert from void *.
(__gcov_execl): Likewise.
(__gcov_execlp): Likewise.
(__gcov_execle): Likewise.
* tree-eh.c (struct_ptr_eq): Likewise.
(struct_ptr_hash): Likewise.
(lookup_stmt_eh_region_fn): Likewise.
(outside_finally_tree): Likewise.
(find_goto_replacement): Likewise.
(make_eh_edge): Likewise.
(mark_eh_edge): Likewise.
(add_stmt_to_eh_region_fn): Use GGC_NEW.
(record_in_finally_tree): Use XNEW.
(maybe_record_in_goto_queue): Use XRESIZEVEC.
(lower_try_finally_copy): Use XCNEWVEC.
2005-12-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
* tree-inline.c (copy_body_r): Use explicit cast when converting

View File

@ -473,7 +473,7 @@ lookup_tmp_var (tree val, bool is_formal)
slot = htab_find_slot (gimplify_ctxp->temp_htab, (void *)&elt, INSERT);
if (*slot == NULL)
{
elt_p = xmalloc (sizeof (*elt_p));
elt_p = XNEW (elt_t);
elt_p->val = val;
elt_p->temp = ret = create_tmp_from_val (val);
*slot = (void *) elt_p;
@ -3705,7 +3705,7 @@ gimplify_asm_expr (tree *expr_p, tree *pre_p, tree *post_p)
break;
}
str = alloca (len);
str = (char *) alloca (len);
for (beg = p + 1, dst = str;;)
{
const char *tem;

View File

@ -218,7 +218,7 @@ gcov_exit (void)
prefix_length = 0;
/* Allocate and initialize the filename scratch space. */
gi_filename = alloca (prefix_length + gcov_max_filename + 1);
gi_filename = (char *) alloca (prefix_length + gcov_max_filename + 1);
if (prefix_length)
memcpy (gi_filename, gcov_prefix, prefix_length);
gi_filename_up = gi_filename + prefix_length;
@ -786,7 +786,7 @@ __gcov_execl (const char *path, const char *arg, ...)
length++;
va_end (ap);
args = alloca (length * sizeof (void *));
args = (char **) alloca (length * sizeof (void *));
args[0] = (char *) arg;
for (i = 1; i < length; i++)
args[i] = va_arg (aq, char *);
@ -817,7 +817,7 @@ __gcov_execlp (const char *path, const char *arg, ...)
length++;
va_end (ap);
args = alloca (length * sizeof (void *));
args = (char **) alloca (length * sizeof (void *));
args[0] = (char *) arg;
for (i = 1; i < length; i++)
args[i] = va_arg (aq, char *);
@ -849,7 +849,7 @@ __gcov_execle (const char *path, const char *arg, ...)
length++;
va_end (ap);
args = alloca (length * sizeof (void *));
args = (char **) alloca (length * sizeof (void *));
args[0] = (char *) arg;
for (i = 1; i < length; i++)
args[i] = va_arg (aq, char *);

View File

@ -374,7 +374,7 @@ create_bb (void *h, void *e, basic_block after)
bb->index = last_basic_block;
bb->flags = BB_NEW;
bb->stmt_list = h ? h : alloc_stmt_list ();
bb->stmt_list = h ? (tree) h : alloc_stmt_list ();
/* Add the new block to the linked list of blocks. */
link_block (bb, after);
@ -640,7 +640,7 @@ edge_to_cases_eq (const void *p1, const void *p2)
static void
edge_to_cases_cleanup (void *p)
{
struct edge_to_cases_elt *elt = p;
struct edge_to_cases_elt *elt = (struct edge_to_cases_elt *) p;
tree t, next;
for (t = elt->case_labels; t; t = next)
@ -691,7 +691,7 @@ record_switch_edge (edge e, tree case_label)
/* Build a hash table element so we can see if E is already
in the table. */
elt = xmalloc (sizeof (struct edge_to_cases_elt));
elt = XNEW (struct edge_to_cases_elt);
elt->e = e;
elt->case_labels = case_label;
@ -942,7 +942,7 @@ void
cleanup_dead_labels (void)
{
basic_block bb;
label_for_bb = xcalloc (last_basic_block, sizeof (tree));
label_for_bb = XCNEWVEC (tree, last_basic_block);
/* Find a suitable label for each block. We use the first user-defined
label if there is one, or otherwise just the first label we see. */
@ -3453,7 +3453,7 @@ verify_node_sharing (tree * tp, int *walk_subtrees, void *data)
slot = htab_find_slot (htab, *tp, INSERT);
if (*slot)
return *slot;
return (tree) *slot;
*slot = *tp;
return NULL;
@ -4343,7 +4343,7 @@ tree_duplicate_sese_region (edge entry, edge exit,
if (!region_copy)
{
region_copy = xmalloc (sizeof (basic_block) * n_region);
region_copy = XNEWVEC (basic_block, n_region);
free_region_copy = true;
}
@ -4351,7 +4351,7 @@ tree_duplicate_sese_region (edge entry, edge exit,
/* Record blocks outside the region that are dominated by something
inside. */
doms = xmalloc (sizeof (basic_block) * n_basic_blocks);
doms = XNEWVEC (basic_block, n_basic_blocks);
initialize_original_copy_tables ();
n_doms = get_dominated_by_region (CDI_DOMINATORS, region, n_region, doms);

View File

@ -157,7 +157,7 @@ create_var_ann (tree t)
gcc_assert (DECL_P (t));
gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);
ann = ggc_alloc (sizeof (*ann));
ann = GGC_NEW (struct var_ann_d);
memset ((void *) ann, 0, sizeof (*ann));
ann->common.type = VAR_ANN;
@ -178,7 +178,7 @@ create_stmt_ann (tree t)
gcc_assert (is_gimple_stmt (t));
gcc_assert (!t->common.ann || t->common.ann->common.type == STMT_ANN);
ann = ggc_alloc (sizeof (*ann));
ann = GGC_NEW (struct stmt_ann_d);
memset ((void *) ann, 0, sizeof (*ann));
ann->common.type = STMT_ANN;
@ -201,7 +201,7 @@ create_tree_ann (tree t)
gcc_assert (t);
gcc_assert (!t->common.ann || t->common.ann->common.type == TREE_ANN_COMMON);
ann = ggc_alloc (sizeof (*ann));
ann = GGC_NEW (union tree_ann_d);
memset ((void *) ann, 0, sizeof (*ann));
ann->common.type = TREE_ANN_COMMON;
@ -580,7 +580,7 @@ referenced_var_lookup_if_exists (unsigned int uid)
{
struct int_tree_map *h, in;
in.uid = uid;
h = htab_find_with_hash (referenced_vars, &in, uid);
h = (struct int_tree_map *) htab_find_with_hash (referenced_vars, &in, uid);
if (h)
return h->to;
return NULL_TREE;
@ -594,7 +594,7 @@ referenced_var_lookup (unsigned int uid)
{
struct int_tree_map *h, in;
in.uid = uid;
h = htab_find_with_hash (referenced_vars, &in, uid);
h = (struct int_tree_map *) htab_find_with_hash (referenced_vars, &in, uid);
gcc_assert (h || uid == 0);
if (h)
return h->to;
@ -609,7 +609,7 @@ referenced_var_insert (unsigned int uid, tree to)
struct int_tree_map *h;
void **loc;
h = ggc_alloc (sizeof (struct int_tree_map));
h = GGC_NEW (struct int_tree_map);
h->uid = uid;
h->to = to;
loc = htab_find_slot_with_hash (referenced_vars, h, uid, INSERT);
@ -625,7 +625,8 @@ default_def (tree var)
struct int_tree_map *h, in;
gcc_assert (SSA_VAR_P (var));
in.uid = DECL_UID (var);
h = htab_find_with_hash (default_defs, &in, DECL_UID (var));
h = (struct int_tree_map *) htab_find_with_hash (default_defs, &in,
DECL_UID (var));
if (h)
return h->to;
return NULL_TREE;
@ -653,14 +654,14 @@ set_default_def (tree var, tree def)
/* Default definition might be changed by tail call optimization. */
if (!*loc)
{
h = ggc_alloc (sizeof (struct int_tree_map));
h = GGC_NEW (struct int_tree_map);
h->uid = DECL_UID (var);
h->to = def;
*(struct int_tree_map **) loc = h;
}
else
{
h = *loc;
h = (struct int_tree_map *) *loc;
h->to = def;
}
}

View File

@ -57,15 +57,15 @@ using_eh_for_cleanups (void)
static int
struct_ptr_eq (const void *a, const void *b)
{
const void * const * x = a;
const void * const * y = b;
const void * const * x = (const void * const *) a;
const void * const * y = (const void * const *) b;
return *x == *y;
}
static hashval_t
struct_ptr_hash (const void *a)
{
const void * const * x = a;
const void * const * x = (const void * const *) a;
return (size_t)*x >> 4;
}
@ -100,7 +100,7 @@ add_stmt_to_eh_region_fn (struct function *ifun, tree t, int num)
gcc_assert (num >= 0);
gcc_assert (TREE_CODE (t) != RESX_EXPR);
n = ggc_alloc (sizeof (*n));
n = GGC_NEW (struct throw_stmt_node);
n->stmt = t;
n->region_nr = num;
@ -168,7 +168,8 @@ lookup_stmt_eh_region_fn (struct function *ifun, tree t)
return -2;
n.stmt = t;
p = htab_find (get_eh_throw_stmt_table (ifun), &n);
p = (struct throw_stmt_node *) htab_find (get_eh_throw_stmt_table (ifun),
&n);
return (p ? p->region_nr : -1);
}
@ -202,7 +203,7 @@ record_in_finally_tree (tree child, tree parent)
struct finally_tree_node *n;
void **slot;
n = xmalloc (sizeof (*n));
n = XNEW (struct finally_tree_node);
n->child = child;
n->parent = parent;
@ -266,7 +267,7 @@ outside_finally_tree (tree start, tree target)
do
{
n.child = start;
p = htab_find (finally_tree, &n);
p = (struct finally_tree_node *) htab_find (finally_tree, &n);
if (!p)
return true;
start = p->parent;
@ -369,7 +370,8 @@ find_goto_replacement (struct leh_tf_state *tf, tree stmt)
{
struct goto_queue_node tmp, *ret;
tmp.stmt = stmt;
ret = bsearch (&tmp, tf->goto_queue, tf->goto_queue_active,
ret = (struct goto_queue_node *)
bsearch (&tmp, tf->goto_queue, tf->goto_queue_active,
sizeof (struct goto_queue_node), goto_queue_cmp);
return (ret ? ret->repl_stmt : NULL);
}
@ -537,7 +539,7 @@ maybe_record_in_goto_queue (struct leh_state *state, tree stmt)
size = (size ? size * 2 : 32);
tf->goto_queue_size = size;
tf->goto_queue
= xrealloc (tf->goto_queue, size * sizeof (struct goto_queue_node));
= XRESIZEVEC (struct goto_queue_node, tf->goto_queue, size);
}
q = &tf->goto_queue[active];
@ -1058,14 +1060,14 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
struct goto_queue_node *q, *qe;
tree return_val = NULL;
int return_index, index;
struct
struct labels_s
{
struct goto_queue_node *q;
tree label;
} *labels;
return_index = VEC_length (tree, tf->dest_array);
labels = xcalloc (sizeof (*labels), return_index + 1);
labels = XCNEWVEC (struct labels_s, return_index + 1);
q = tf->goto_queue;
qe = q + tf->goto_queue_active;
@ -1713,7 +1715,7 @@ make_eh_edge (struct eh_region *region, void *data)
tree stmt, lab;
basic_block src, dst;
stmt = data;
stmt = (tree) data;
lab = get_eh_region_tree_label (region);
src = bb_for_stmt (stmt);
@ -1755,7 +1757,7 @@ mark_eh_edge (struct eh_region *region, void *data)
basic_block src, dst;
edge e;
stmt = data;
stmt = (tree) data;
lab = get_eh_region_tree_label (region);
src = bb_for_stmt (stmt);

View File

@ -246,7 +246,7 @@ get_ssa_name_ann (tree name)
if (!SSA_NAME_AUX (name))
SSA_NAME_AUX (name) = xcalloc (1, sizeof (struct ssa_name_info));
return SSA_NAME_AUX (name);
return (struct ssa_name_info *) SSA_NAME_AUX (name);
}
@ -365,7 +365,7 @@ get_def_blocks_for (tree var)
slot = htab_find_slot (def_blocks, (void *) &db, INSERT);
if (*slot == NULL)
{
db_p = xmalloc (sizeof (*db_p));
db_p = XNEW (struct def_blocks_d);
db_p->var = var;
db_p->def_blocks = BITMAP_ALLOC (NULL);
db_p->phi_blocks = BITMAP_ALLOC (NULL);
@ -532,7 +532,7 @@ add_to_repl_tbl (tree new, tree old)
slot = htab_find_slot (repl_tbl, (void *) &m, INSERT);
if (*slot == NULL)
{
mp = xmalloc (sizeof (*mp));
mp = XNEW (struct repl_map_d);
mp->name = new;
mp->set = BITMAP_ALLOC (NULL);
*slot = (void *) mp;
@ -630,7 +630,8 @@ mark_def_sites (struct dom_walk_data *walk_data,
basic_block bb,
block_stmt_iterator bsi)
{
struct mark_def_sites_global_data *gd = walk_data->global_data;
struct mark_def_sites_global_data *gd =
(struct mark_def_sites_global_data *) walk_data->global_data;
bitmap kills = gd->kills;
tree stmt, def;
use_operand_p use_p;
@ -1203,7 +1204,7 @@ def_blocks_eq (const void *p1, const void *p2)
static void
def_blocks_free (void *p)
{
struct def_blocks_d *entry = p;
struct def_blocks_d *entry = (struct def_blocks_d *) p;
BITMAP_FREE (entry->def_blocks);
BITMAP_FREE (entry->phi_blocks);
BITMAP_FREE (entry->livein_blocks);
@ -1645,7 +1646,8 @@ static void
mark_def_sites_initialize_block (struct dom_walk_data *walk_data,
basic_block bb ATTRIBUTE_UNUSED)
{
struct mark_def_sites_global_data *gd = walk_data->global_data;
struct mark_def_sites_global_data *gd =
(struct mark_def_sites_global_data *) walk_data->global_data;
bitmap kills = gd->kills;
bitmap_clear (kills);
}
@ -2744,7 +2746,7 @@ update_ssa (unsigned update_flags)
/* If the caller requested PHI nodes to be added, compute
dominance frontiers. */
dfs = xmalloc (last_basic_block * sizeof (bitmap));
dfs = XNEWVEC (bitmap, last_basic_block);
FOR_EACH_BB (bb)
dfs[bb->index] = BITMAP_ALLOC (NULL);
compute_dominance_frontiers (dfs);

View File

@ -1340,12 +1340,12 @@ new_temp_expr_table (var_map map)
{
temp_expr_table_p t;
t = (temp_expr_table_p) xmalloc (sizeof (struct temp_expr_table_d));
t = XNEW (struct temp_expr_table_d);
t->map = map;
t->version_info = xcalloc (num_ssa_names + 1, sizeof (void *));
t->partition_dep_list = xcalloc (num_var_partitions (map) + 1,
sizeof (value_expr_p));
t->version_info = XCNEWVEC (void *, num_ssa_names + 1);
t->partition_dep_list = XCNEWVEC (value_expr_p,
num_var_partitions (map) + 1);
t->replaceable = BITMAP_ALLOC (NULL);
t->partition_in_use = BITMAP_ALLOC (NULL);

View File

@ -1867,7 +1867,7 @@ get_instantiated_value (htab_t cache, tree version)
struct scev_info_str *info, pattern;
pattern.var = version;
info = htab_find (cache, &pattern);
info = (struct scev_info_str *) htab_find (cache, &pattern);
if (info)
return info->chrec;

View File

@ -538,7 +538,7 @@ ccp_initialize (void)
{
basic_block bb;
const_val = xmalloc (num_ssa_names * sizeof (*const_val));
const_val = XNEWVEC (prop_value_t, num_ssa_names);
memset (const_val, 0, num_ssa_names * sizeof (*const_val));
/* Initialize simulation flags for PHI nodes and statements. */
@ -935,7 +935,7 @@ ccp_fold (tree stmt)
use_operand_p var_p;
/* Preserve the original values of every operand. */
orig = xmalloc (sizeof (tree) * NUM_SSA_OPERANDS (stmt, SSA_OP_USE));
orig = XNEWVEC (tree, NUM_SSA_OPERANDS (stmt, SSA_OP_USE));
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_USE)
orig[i++] = var;
@ -1937,7 +1937,7 @@ struct fold_stmt_r_data
static tree
fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
{
struct fold_stmt_r_data *fold_stmt_r_data = data;
struct fold_stmt_r_data *fold_stmt_r_data = (struct fold_stmt_r_data *) data;
bool *inside_addr_expr_p = fold_stmt_r_data->inside_addr_expr_p;
bool *changed_p = fold_stmt_r_data->changed_p;
tree expr = *expr_p, t;

View File

@ -634,7 +634,7 @@ verify_ssa (bool check_modified_stmt)
{
size_t i;
basic_block bb;
basic_block *definition_block = xcalloc (num_ssa_names, sizeof (basic_block));
basic_block *definition_block = XCNEWVEC (basic_block, num_ssa_names);
ssa_op_iter iter;
tree op;
enum dom_state orig_dom_state = dom_computed[CDI_DOMINATORS];
@ -781,7 +781,8 @@ err:
int
int_tree_map_eq (const void *va, const void *vb)
{
const struct int_tree_map *a = va, *b = vb;
const struct int_tree_map *a = (const struct int_tree_map *) va;
const struct int_tree_map *b = (const struct int_tree_map *) vb;
return (a->uid == b->uid);
}

View File

@ -201,7 +201,7 @@ vn_add (tree expr, tree val, tree stmt)
void **slot;
val_expr_pair_t new_pair;
new_pair = xmalloc (sizeof (struct val_expr_pair_d));
new_pair = XNEW (struct val_expr_pair_d);
new_pair->e = expr;
new_pair->v = val;
new_pair->stmt = stmt;