本文整理汇总了C++中SSA_NAME_VAR函数的典型用法代码示例。如果您正苦于以下问题:C++ SSA_NAME_VAR函数的具体用法?C++ SSA_NAME_VAR怎么用?C++ SSA_NAME_VAR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SSA_NAME_VAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: may_propagate_copy
bool
may_propagate_copy (tree dest, tree orig)
{
tree type_d = TREE_TYPE (dest);
tree type_o = TREE_TYPE (orig);
/* If ORIG flows in from an abnormal edge, it cannot be propagated. */
if (TREE_CODE (orig) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig)
/* If it is the default definition and an automatic variable then
we can though and it is important that we do to avoid
uninitialized regular copies. */
&& !(SSA_NAME_IS_DEFAULT_DEF (orig)
&& (SSA_NAME_VAR (orig) == NULL_TREE
|| TREE_CODE (SSA_NAME_VAR (orig)) == VAR_DECL)))
return false;
/* If DEST is an SSA_NAME that flows from an abnormal edge, then it
cannot be replaced. */
if (TREE_CODE (dest) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest))
return false;
/* Do not copy between types for which we *do* need a conversion. */
if (!useless_type_conversion_p (type_d, type_o))
return false;
/* Generally propagating virtual operands is not ok as that may
create overlapping life-ranges. */
if (TREE_CODE (dest) == SSA_NAME && virtual_operand_p (dest))
return false;
/* Anything else is OK. */
return true;
}
示例2: gimple_can_coalesce_p
bool
gimple_can_coalesce_p (tree name1, tree name2)
{
/* First check the SSA_NAME's associated DECL. We only want to
coalesce if they have the same DECL or both have no associated DECL. */
tree var1 = SSA_NAME_VAR (name1);
tree var2 = SSA_NAME_VAR (name2);
var1 = (var1 && (!VAR_P (var1) || !DECL_IGNORED_P (var1))) ? var1 : NULL_TREE;
var2 = (var2 && (!VAR_P (var2) || !DECL_IGNORED_P (var2))) ? var2 : NULL_TREE;
if (var1 != var2)
return false;
/* Now check the types. If the types are the same, then we should
try to coalesce V1 and V2. */
tree t1 = TREE_TYPE (name1);
tree t2 = TREE_TYPE (name2);
if (t1 == t2)
return true;
/* If the types are not the same, check for a canonical type match. This
(for example) allows coalescing when the types are fundamentally the
same, but just have different names.
Note pointer types with different address spaces may have the same
canonical type. Those are rejected for coalescing by the
types_compatible_p check. */
if (TYPE_CANONICAL (t1)
&& TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2)
&& types_compatible_p (t1, t2))
return true;
return false;
}
示例3: 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)));
}
示例4: perturb_latent_entropy
static void perturb_latent_entropy(basic_block bb, tree rhs)
{
gimple_stmt_iterator gsi;
gimple assign;
tree addxorrol, temp;
// 1. create temporary copy of latent_entropy
temp = create_tmp_var(unsigned_intDI_type_node, "temp_latent_entropy");
add_referenced_var(temp);
// 2. read...
temp = make_ssa_name(temp, NULL);
assign = gimple_build_assign(temp, latent_entropy_decl);
SSA_NAME_DEF_STMT(temp) = assign;
add_referenced_var(latent_entropy_decl);
gsi = gsi_after_labels(bb);
gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
update_stmt(assign);
// 3. ...modify...
addxorrol = fold_build2_loc(UNKNOWN_LOCATION, get_op(NULL), unsigned_intDI_type_node, temp, rhs);
temp = make_ssa_name(SSA_NAME_VAR(temp), NULL);
assign = gimple_build_assign(temp, addxorrol);
SSA_NAME_DEF_STMT(temp) = assign;
gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
update_stmt(assign);
// 4. ...write latent_entropy
assign = gimple_build_assign(latent_entropy_decl, temp);
gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
update_stmt(assign);
}
示例5: target_for_debug_bind
tree
target_for_debug_bind (tree var)
{
if (!MAY_HAVE_DEBUG_STMTS)
return NULL_TREE;
if (TREE_CODE (var) == SSA_NAME)
{
var = SSA_NAME_VAR (var);
if (var == NULL_TREE)
return NULL_TREE;
}
if ((TREE_CODE (var) != VAR_DECL
|| VAR_DECL_IS_VIRTUAL_OPERAND (var))
&& TREE_CODE (var) != PARM_DECL)
return NULL_TREE;
if (DECL_HAS_VALUE_EXPR_P (var))
return target_for_debug_bind (DECL_VALUE_EXPR (var));
if (DECL_IGNORED_P (var))
return NULL_TREE;
/* var-tracking only tracks registers. */
if (!is_gimple_reg_type (TREE_TYPE (var)))
return NULL_TREE;
return var;
}
示例6: add_stmt_operand
static void
add_stmt_operand (tree *var_p, gimple stmt, int flags)
{
tree var, sym;
gcc_assert (SSA_VAR_P (*var_p));
var = *var_p;
sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
/* Mark statements with volatile operands. */
if (TREE_THIS_VOLATILE (sym))
gimple_set_has_volatile_ops (stmt, true);
if (is_gimple_reg (sym))
{
/* The variable is a GIMPLE register. Add it to real operands. */
if (flags & opf_def)
append_def (var_p);
else
append_use (var_p);
}
else
add_virtual_operand (stmt, flags);
}
示例7: finalize_ssa_defs
static inline void
finalize_ssa_defs (struct function *fn, gimple *stmt)
{
/* Pre-pend the vdef we may have built. */
if (build_vdef != NULL_TREE)
{
tree oldvdef = gimple_vdef (stmt);
if (oldvdef
&& TREE_CODE (oldvdef) == SSA_NAME)
oldvdef = SSA_NAME_VAR (oldvdef);
if (oldvdef != build_vdef)
gimple_set_vdef (stmt, build_vdef);
}
/* Clear and unlink a no longer necessary VDEF. */
if (build_vdef == NULL_TREE
&& gimple_vdef (stmt) != NULL_TREE)
{
if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
{
unlink_stmt_vdef (stmt);
release_ssa_name_fn (fn, gimple_vdef (stmt));
}
gimple_set_vdef (stmt, NULL_TREE);
}
/* If we have a non-SSA_NAME VDEF, mark it for renaming. */
if (gimple_vdef (stmt)
&& TREE_CODE (gimple_vdef (stmt)) != SSA_NAME)
{
fn->gimple_df->rename_vops = 1;
fn->gimple_df->ssa_renaming_needed = 1;
}
}
示例8: finalize_ssa_uses
static inline void
finalize_ssa_uses (struct function *fn, gimple *stmt)
{
unsigned new_i;
struct use_optype_d new_list;
use_optype_p old_ops, ptr, last;
/* Pre-pend the VUSE we may have built. */
if (build_vuse != NULL_TREE)
{
tree oldvuse = gimple_vuse (stmt);
if (oldvuse
&& TREE_CODE (oldvuse) == SSA_NAME)
oldvuse = SSA_NAME_VAR (oldvuse);
if (oldvuse != (build_vuse != NULL_TREE
? build_vuse : build_vdef))
gimple_set_vuse (stmt, NULL_TREE);
build_uses.safe_insert (0, gimple_vuse_ptr (stmt));
}
new_list.next = NULL;
last = &new_list;
old_ops = gimple_use_ops (stmt);
/* Clear a no longer necessary VUSE. */
if (build_vuse == NULL_TREE
&& gimple_vuse (stmt) != NULL_TREE)
gimple_set_vuse (stmt, NULL_TREE);
/* If there is anything in the old list, free it. */
if (old_ops)
{
for (ptr = old_ops; ptr->next; ptr = ptr->next)
delink_imm_use (USE_OP_PTR (ptr));
delink_imm_use (USE_OP_PTR (ptr));
ptr->next = gimple_ssa_operands (fn)->free_uses;
gimple_ssa_operands (fn)->free_uses = old_ops;
}
/* If we added a VUSE, make sure to set the operand if it is not already
present and mark it for renaming. */
if (build_vuse != NULL_TREE
&& gimple_vuse (stmt) == NULL_TREE)
{
gimple_set_vuse (stmt, gimple_vop (fn));
fn->gimple_df->rename_vops = 1;
fn->gimple_df->ssa_renaming_needed = 1;
}
/* Now create nodes for all the new nodes. */
for (new_i = 0; new_i < build_uses.length (); new_i++)
{
tree *op = build_uses[new_i];
last = add_use_op (fn, stmt, op, last);
}
/* Now set the stmt's operands. */
gimple_set_use_ops (stmt, new_list.next);
}
示例9: execute_kernexec_fptr
/*
* find all C level function pointer dereferences and forcibly set the highest bit of the pointer
*/
static unsigned int execute_kernexec_fptr(void)
{
basic_block bb;
// 1. loop through BBs and GIMPLE statements
FOR_EACH_BB(bb) {
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
// gimple match: h_1 = get_fptr (); D.2709_3 = h_1 (x_2(D));
tree fn;
gimple call_stmt;
// is it a call ...
call_stmt = gsi_stmt(gsi);
if (!is_gimple_call(call_stmt))
continue;
fn = gimple_call_fn(call_stmt);
if (TREE_CODE(fn) == ADDR_EXPR)
continue;
if (TREE_CODE(fn) != SSA_NAME)
gcc_unreachable();
// ... through a function pointer
if (SSA_NAME_VAR(fn) != NULL_TREE) {
fn = SSA_NAME_VAR(fn);
if (TREE_CODE(fn) != VAR_DECL && TREE_CODE(fn) != PARM_DECL) {
debug_tree(fn);
gcc_unreachable();
}
}
fn = TREE_TYPE(fn);
if (TREE_CODE(fn) != POINTER_TYPE)
continue;
fn = TREE_TYPE(fn);
if (TREE_CODE(fn) != FUNCTION_TYPE)
continue;
kernexec_instrument_fptr(&gsi);
//debug_tree(gimple_call_fn(call_stmt));
//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
}
}
return 0;
}
示例10: is_gimple_non_addressable
bool
is_gimple_non_addressable (tree t)
{
if (TREE_CODE (t) == SSA_NAME)
t = SSA_NAME_VAR (t);
return (is_gimple_variable (t) && ! needs_to_live_in_memory (t));
}
示例11: get_name_decl
static inline unsigned
get_name_decl (const_tree t)
{
if (TREE_CODE (t) != SSA_NAME)
return DECL_UID (t);
else
return DECL_UID (SSA_NAME_VAR (t));
}
示例12: TREE_CODE
static t_myproof_variable *read_operand( tree t, t_myproof_function *function )
{
t_myproof_variable *variable = NULL;
enum tree_code tc;
tc = TREE_CODE( t );
switch ( tc )
{
case VAR_DECL:
case PARM_DECL:
case CONST_DECL:
variable = read_data( t, function );
break;
case ARRAY_REF:
printf("variable pass array_ref\n");
read_operand( TREE_OPERAND(t,0), function ); /* array base */
variable = read_operand( TREE_OPERAND(t,1), function ); /* array index */
/* if ( store == true ) */
/* { */
/* function->nstore++; */
/* } */
/* else */
/* { */
/* function->nload++; */
/* } */
break;
case ADDR_EXPR:
case INDIRECT_REF:
/* pointer & dereferencing */
break;
case INTEGER_CST:
case REAL_CST:
case STRING_CST:
/* integer/real/string constant */
break;
case SSA_NAME:
variable = read_data( SSA_NAME_VAR(t), function );
break;
case COND_EXPR:
case TARGET_MEM_REF:
break;
default:
fprintf( stderr, "myproof: read_operand(): unhandled \'%s\'\n", tree_code_name[tc] );
gcc_unreachable( );
}
return variable;
}
示例13: finalize_ssa_uses
static inline void
finalize_ssa_uses (gimple stmt)
{
unsigned new_i;
struct use_optype_d new_list;
use_optype_p old_ops, ptr, last;
/* Pre-pend the VUSE we may have built. */
if (build_vuse != NULL_TREE)
{
tree oldvuse = gimple_vuse (stmt);
if (oldvuse
&& TREE_CODE (oldvuse) == SSA_NAME)
oldvuse = SSA_NAME_VAR (oldvuse);
if (oldvuse != (build_vuse != NULL_TREE
? build_vuse : build_vdef))
gimple_set_vuse (stmt, NULL_TREE);
VEC_safe_insert (tree, heap, build_uses, 0, (tree)gimple_vuse_ptr (stmt));
}
new_list.next = NULL;
last = &new_list;
old_ops = gimple_use_ops (stmt);
/* Clear a no longer necessary VUSE. */
if (build_vuse == NULL_TREE
&& gimple_vuse (stmt) != NULL_TREE)
gimple_set_vuse (stmt, NULL_TREE);
/* If there is anything in the old list, free it. */
if (old_ops)
{
for (ptr = old_ops; ptr; ptr = ptr->next)
delink_imm_use (USE_OP_PTR (ptr));
old_ops->next = gimple_ssa_operands (cfun)->free_uses;
gimple_ssa_operands (cfun)->free_uses = old_ops;
}
/* If we added a VUSE, make sure to set the operand if it is not already
present and mark it for renaming. */
if (build_vuse != NULL_TREE
&& gimple_vuse (stmt) == NULL_TREE)
{
gimple_set_vuse (stmt, gimple_vop (cfun));
mark_sym_for_renaming (gimple_vop (cfun));
}
/* Now create nodes for all the new nodes. */
for (new_i = 0; new_i < VEC_length (tree, build_uses); new_i++)
last = add_use_op (stmt,
(tree *) VEC_index (tree, build_uses, new_i),
last);
/* Now set the stmt's operands. */
gimple_set_use_ops (stmt, new_list.next);
}
示例14: adjust_simduid_builtins
static void
adjust_simduid_builtins (hash_table<simduid_to_vf> *htab)
{
basic_block bb;
FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
unsigned int vf = 1;
enum internal_fn ifn;
gimple stmt = gsi_stmt (i);
tree t;
if (!is_gimple_call (stmt)
|| !gimple_call_internal_p (stmt))
continue;
ifn = gimple_call_internal_fn (stmt);
switch (ifn)
{
case IFN_GOMP_SIMD_LANE:
case IFN_GOMP_SIMD_VF:
case IFN_GOMP_SIMD_LAST_LANE:
break;
default:
continue;
}
tree arg = gimple_call_arg (stmt, 0);
gcc_assert (arg != NULL_TREE);
gcc_assert (TREE_CODE (arg) == SSA_NAME);
simduid_to_vf *p = NULL, data;
data.simduid = DECL_UID (SSA_NAME_VAR (arg));
if (htab)
{
p = htab->find (&data);
if (p)
vf = p->vf;
}
switch (ifn)
{
case IFN_GOMP_SIMD_VF:
t = build_int_cst (unsigned_type_node, vf);
break;
case IFN_GOMP_SIMD_LANE:
t = build_int_cst (unsigned_type_node, 0);
break;
case IFN_GOMP_SIMD_LAST_LANE:
t = gimple_call_arg (stmt, 1);
break;
default:
gcc_unreachable ();
}
update_call_from_tree (&i, t);
}
}
示例15: read_operand
static void read_operand( tree t )
{
enum tree_code tc;
tc = TREE_CODE( t );
/* tree tree_new = TREE_TYPE( t ); */
/* enum tree_code tc_new = TREE_CODE ( t ); */
/* if ( tc_new == REAL_TYPE ) */
/* { */
/* printf("this is a real variable\n"); */
/* } */
/* else if ( tc_new == INTEGER_TYPE ) */
/* { */
/* printf("this is an integer variable\n"); */
/* } */
switch ( tc )
{
case VAR_DECL:
case PARM_DECL:
case CONST_DECL:
read_data( t );
break;
case ARRAY_REF:
read_operand( TREE_OPERAND(t,0) ); /* array base */
read_operand( TREE_OPERAND(t,1) ); /* array index */
break;
case ADDR_EXPR:
case INDIRECT_REF:
/* pointer & dereferencing */
break;
case INTEGER_CST:
case REAL_CST:
case STRING_CST:
/* integer/real/string constant */
break;
case SSA_NAME:
read_data( SSA_NAME_VAR(t) );
break;
case COND_EXPR:
case TARGET_MEM_REF:
break;
default:
fprintf( stderr, "myproof: read_operand(): unhandled \'%s\'\n", tree_code_name[tc] );
gcc_unreachable( );
}
}