本文整理汇总了C++中SSA_NAME_VERSION函数的典型用法代码示例。如果您正苦于以下问题:C++ SSA_NAME_VERSION函数的具体用法?C++ SSA_NAME_VERSION怎么用?C++ SSA_NAME_VERSION使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SSA_NAME_VERSION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_replaceable
static void
process_replaceable (temp_expr_table_p tab, gimple stmt)
{
tree var, def, basevar;
int version;
ssa_op_iter iter;
bitmap def_vars, use_vars;
#ifdef ENABLE_CHECKING
gcc_assert (is_replaceable_p (stmt));
#endif
def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
version = SSA_NAME_VERSION (def);
basevar = SSA_NAME_VAR (def);
def_vars = BITMAP_ALLOC (NULL);
bitmap_set_bit (def_vars, DECL_UID (basevar));
/* Add this expression to the dependency list for each use partition. */
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_USE)
{
int var_version = SSA_NAME_VERSION (var);
use_vars = tab->expr_decl_uids[var_version];
add_dependence (tab, version, var);
if (use_vars)
{
bitmap_ior_into (def_vars, use_vars);
BITMAP_FREE (tab->expr_decl_uids[var_version]);
}
else
bitmap_set_bit (def_vars, DECL_UID (SSA_NAME_VAR (var)));
}
示例2: set_ssa_name_value
void
set_ssa_name_value (tree name, tree value)
{
if (SSA_NAME_VERSION (name) >= ssa_name_values.length ())
ssa_name_values.safe_grow_cleared (SSA_NAME_VERSION (name) + 1);
ssa_name_values[SSA_NAME_VERSION (name)] = value;
}
示例3: set_ssa_name_value
void
set_ssa_name_value (tree name, tree value)
{
if (SSA_NAME_VERSION (name) >= VEC_length (tree, ssa_name_values))
VEC_safe_grow_cleared (tree, heap, ssa_name_values,
SSA_NAME_VERSION (name) + 1);
VEC_replace (tree, ssa_name_values, SSA_NAME_VERSION (name), value);
}
示例4: set_ssa_name_value
void
set_ssa_name_value (tree name, tree value)
{
if (SSA_NAME_VERSION (name) >= ssa_name_values.length ())
ssa_name_values.safe_grow_cleared (SSA_NAME_VERSION (name) + 1);
if (value && TREE_OVERFLOW_P (value))
value = drop_tree_overflow (value);
ssa_name_values[SSA_NAME_VERSION (name)] = value;
}
示例5: get_value
static tree
get_value (tree name)
{
tree val;
if (SSA_NAME_VERSION (name) >= n_copy_of)
return NULL_TREE;
val = copy_of[SSA_NAME_VERSION (name)].value;
if (val && val != name)
return val;
return NULL_TREE;
}
示例6: make_ssa_name
tree
make_ssa_name (tree var, tree stmt)
{
tree t;
use_operand_p imm;
gcc_assert (DECL_P (var)
|| TREE_CODE (var) == INDIRECT_REF);
gcc_assert (!stmt
|| EXPR_P (stmt) || GIMPLE_STMT_P (stmt)
|| TREE_CODE (stmt) == PHI_NODE);
/* If our free list has an element, then use it. */
if (FREE_SSANAMES (cfun))
{
t = FREE_SSANAMES (cfun);
FREE_SSANAMES (cfun) = TREE_CHAIN (FREE_SSANAMES (cfun));
#ifdef GATHER_STATISTICS
ssa_name_nodes_reused++;
#endif
/* The node was cleared out when we put it on the free list, so
there is no need to do so again here. */
gcc_assert (ssa_name (SSA_NAME_VERSION (t)) == NULL);
VEC_replace (tree, SSANAMES (cfun), SSA_NAME_VERSION (t), t);
}
else
{
t = make_node (SSA_NAME);
SSA_NAME_VERSION (t) = num_ssa_names;
VEC_safe_push (tree, gc, SSANAMES (cfun), t);
#ifdef GATHER_STATISTICS
ssa_name_nodes_created++;
#endif
}
TREE_TYPE (t) = TREE_TYPE (var);
SSA_NAME_VAR (t) = var;
SSA_NAME_DEF_STMT (t) = stmt;
SSA_NAME_PTR_INFO (t) = NULL;
SSA_NAME_IN_FREE_LIST (t) = 0;
SSA_NAME_IS_DEFAULT_DEF (t) = 0;
imm = &(SSA_NAME_IMM_USE_NODE (t));
imm->use = NULL;
imm->prev = imm;
imm->next = imm;
imm->stmt = t;
return t;
}
示例7: sese_bad_liveouts_use
static bool
sese_bad_liveouts_use (sese region, bitmap liveouts, basic_block bb,
tree use)
{
unsigned ver;
basic_block def_bb;
if (TREE_CODE (use) != SSA_NAME)
return false;
ver = SSA_NAME_VERSION (use);
/* If it's in liveouts, the variable will get a new PHI node, and
the debug use will be properly adjusted. */
if (bitmap_bit_p (liveouts, ver))
return false;
def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
if (!def_bb
|| !bb_in_sese_p (def_bb, region)
|| bb_in_sese_p (bb, region))
return false;
return true;
}
示例8: get_stmt_uid
static unsigned
get_stmt_uid (tree stmt)
{
if (TREE_CODE (stmt) == PHI_NODE)
return SSA_NAME_VERSION (PHI_RESULT (stmt)) + max_stmt_uid;
return stmt_ann (stmt)->uid;
}
示例9: init_parameter_lattice_values
static void
init_parameter_lattice_values (void)
{
tree parm, ssa_name;
for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = DECL_CHAIN (parm))
if (is_complex_reg (parm)
&& (ssa_name = ssa_default_def (cfun, parm)) != NULL_TREE)
complex_lattice_values[SSA_NAME_VERSION (ssa_name)] = VARYING;
}
示例10: verify_ssaname_freelists
DEBUG_FUNCTION void
verify_ssaname_freelists (struct function *fun)
{
if (!gimple_in_ssa_p (fun))
return;
bitmap names_in_il = BITMAP_ALLOC (NULL);
/* Walk the entire IL noting every SSA_NAME we see. */
basic_block bb;
FOR_EACH_BB_FN (bb, fun)
{
tree t;
/* First note the result and arguments of PHI nodes. */
for (gphi_iterator gsi = gsi_start_phis (bb);
!gsi_end_p (gsi);
gsi_next (&gsi))
{
gphi *phi = gsi.phi ();
t = gimple_phi_result (phi);
bitmap_set_bit (names_in_il, SSA_NAME_VERSION (t));
for (unsigned int i = 0; i < gimple_phi_num_args (phi); i++)
{
t = gimple_phi_arg_def (phi, i);
if (TREE_CODE (t) == SSA_NAME)
bitmap_set_bit (names_in_il, SSA_NAME_VERSION (t));
}
}
/* Then note the operands of each statement. */
for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
!gsi_end_p (gsi);
gsi_next (&gsi))
{
ssa_op_iter iter;
gimple *stmt = gsi_stmt (gsi);
FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, SSA_OP_ALL_OPERANDS)
bitmap_set_bit (names_in_il, SSA_NAME_VERSION (t));
}
}
示例11: init_parameter_lattice_values
static void
init_parameter_lattice_values (void)
{
tree parm, ssa_name;
for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = TREE_CHAIN (parm))
if (is_complex_reg (parm)
&& var_ann (parm) != NULL
&& (ssa_name = gimple_default_def (cfun, parm)) != NULL_TREE)
VEC_replace (complex_lattice_t, complex_lattice_values,
SSA_NAME_VERSION (ssa_name), VARYING);
}
示例12: verify_def
static bool
verify_def (basic_block bb, basic_block *definition_block, tree ssa_name,
tree stmt, bool is_virtual)
{
if (verify_ssa_name (ssa_name, is_virtual))
goto err;
if (definition_block[SSA_NAME_VERSION (ssa_name)])
{
error ("SSA_NAME created in two different blocks %i and %i",
definition_block[SSA_NAME_VERSION (ssa_name)]->index, bb->index);
goto err;
}
definition_block[SSA_NAME_VERSION (ssa_name)] = bb;
if (SSA_NAME_DEF_STMT (ssa_name) != stmt)
{
error ("SSA_NAME_DEF_STMT is wrong");
fprintf (stderr, "Expected definition statement:\n");
print_generic_stmt (stderr, SSA_NAME_DEF_STMT (ssa_name), TDF_VOPS);
fprintf (stderr, "\nActual definition statement:\n");
print_generic_stmt (stderr, stmt, TDF_VOPS);
goto err;
}
return false;
err:
fprintf (stderr, "while verifying SSA_NAME ");
print_generic_expr (stderr, ssa_name, 0);
fprintf (stderr, " in statement\n");
print_generic_stmt (stderr, stmt, TDF_VOPS);
return true;
}
示例13: add_dependence
static void
add_dependence (temp_expr_table_p tab, int version, tree var)
{
int i;
bitmap_iterator bi;
unsigned x;
i = SSA_NAME_VERSION (var);
if (version_to_be_replaced_p (tab, i))
{
if (!bitmap_empty_p (tab->new_replaceable_dependencies))
{
/* Version will now be killed by a write to any partition the
substituted expression would have been killed by. */
EXECUTE_IF_SET_IN_BITMAP (tab->new_replaceable_dependencies, 0, x, bi)
add_to_partition_kill_list (tab, x, version);
/* Rather than set partition_dependencies and in_use lists bit by
bit, simply OR in the new_replaceable_dependencies bits. */
if (!tab->partition_dependencies[version])
tab->partition_dependencies[version] = BITMAP_ALLOC (NULL);
bitmap_ior_into (tab->partition_dependencies[version],
tab->new_replaceable_dependencies);
bitmap_ior_into (tab->partition_in_use,
tab->new_replaceable_dependencies);
/* It is only necessary to add these once. */
bitmap_clear (tab->new_replaceable_dependencies);
}
}
else
{
i = var_to_partition (tab->map, var);
#ifdef ENABLE_CHECKING
gcc_assert (i != NO_PARTITION);
gcc_assert (tab->num_in_part[i] != 0);
#endif
/* Only dependencies on ssa_names which are coalesced with something need
to be tracked. Partitions with containing only a single SSA_NAME
*cannot* have their value changed. */
if (tab->num_in_part[i] > 1)
{
add_to_partition_kill_list (tab, i, version);
make_dependent_on_partition (tab, version, i);
}
}
}
示例14: sese_build_liveouts_use
static void
sese_build_liveouts_use (sese region, bitmap liveouts, basic_block bb,
tree use)
{
unsigned ver;
basic_block def_bb;
if (TREE_CODE (use) != SSA_NAME)
return;
ver = SSA_NAME_VERSION (use);
def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
if (!def_bb
|| !bb_in_sese_p (def_bb, region)
|| bb_in_sese_p (bb, region))
return;
bitmap_set_bit (liveouts, ver);
}
示例15: release_dead_ssa_names
/* Return SSA names that are unused to GGC memory and compact the SSA
version namespace. This is used to keep footprint of compiler during
interprocedural optimization. */
static unsigned int
release_dead_ssa_names (void)
{
tree t;
unsigned i, j;
int n = VEC_length (tree, FREE_SSANAMES (cfun));
referenced_var_iterator rvi;
/* Current defs point to various dead SSA names that in turn point to
eventually dead variables so a bunch of memory is held live. */
FOR_EACH_REFERENCED_VAR (cfun, t, rvi)
set_current_def (t, NULL);
/* Now release the freelist. */
VEC_free (tree, gc, FREE_SSANAMES (cfun));
FREE_SSANAMES (cfun) = NULL;
/* And compact the SSA number space. We make sure to not change the
relative order of SSA versions. */
for (i = 1, j = 1; i < VEC_length (tree, cfun->gimple_df->ssa_names); ++i)
{
tree name = ssa_name (i);
if (name)
{
if (i != j)
{
SSA_NAME_VERSION (name) = j;
VEC_replace (tree, cfun->gimple_df->ssa_names, j, name);
}
j++;
}
}
VEC_truncate (tree, cfun->gimple_df->ssa_names, j);
statistics_counter_event (cfun, "SSA names released", n);
statistics_counter_event (cfun, "SSA name holes removed", i - j);
if (dump_file)
fprintf (dump_file, "Released %i names, %.2f%%, removed %i holes\n",
n, n * 100.0 / num_ssa_names, i - j);
return 0;
}