本文整理汇总了C++中print_generic_expr函数的典型用法代码示例。如果您正苦于以下问题:C++ print_generic_expr函数的具体用法?C++ print_generic_expr怎么用?C++ print_generic_expr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_generic_expr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: insert_value_copy_on_edge
static void
insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
{
rtx seq, x;
enum machine_mode dest_mode, src_mode;
int unsignedp;
tree var;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file,
"Inserting a value copy on edge BB%d->BB%d : PART.%d = ",
e->src->index,
e->dest->index, dest);
print_generic_expr (dump_file, src, TDF_SLIM);
fprintf (dump_file, "\n");
}
gcc_assert (SA.partition_to_pseudo[dest]);
set_location_for_edge (e);
/* If a locus is provided, override the default. */
if (locus)
set_curr_insn_source_location (locus);
start_sequence ();
var = SSA_NAME_VAR (partition_to_var (SA.map, dest));
src_mode = TYPE_MODE (TREE_TYPE (src));
dest_mode = GET_MODE (SA.partition_to_pseudo[dest]);
gcc_assert (src_mode == TYPE_MODE (TREE_TYPE (var)));
gcc_assert (!REG_P (SA.partition_to_pseudo[dest])
|| dest_mode == promote_decl_mode (var, &unsignedp));
if (src_mode != dest_mode)
{
x = expand_expr (src, NULL, src_mode, EXPAND_NORMAL);
x = convert_modes (dest_mode, src_mode, x, unsignedp);
}
else if (src_mode == BLKmode)
{
x = SA.partition_to_pseudo[dest];
store_expr (src, x, 0, false);
}
else
x = expand_expr (src, SA.partition_to_pseudo[dest],
dest_mode, EXPAND_NORMAL);
if (x != SA.partition_to_pseudo[dest])
emit_move_insn (SA.partition_to_pseudo[dest], x);
seq = get_insns ();
end_sequence ();
insert_insn_on_edge (seq, e);
}
开发者ID:pombredanne,项目名称:NetBSD,代码行数:55,代码来源:tree-outof-ssa.c
示例2: maybe_dump_rtl_for_tree_stmt
static void
maybe_dump_rtl_for_tree_stmt (tree stmt, rtx since)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\n;; ");
print_generic_expr (dump_file, stmt, TDF_SLIM);
fprintf (dump_file, "\n");
print_rtl (dump_file, since ? NEXT_INSN (since) : since);
}
}
开发者ID:seguljac,项目名称:higpu,代码行数:12,代码来源:cfgexpand.c
示例3: chkp_print_addr
/* Dump ADDR into dump_file. */
static void
chkp_print_addr (const address_t &addr)
{
unsigned int n = 0;
for (n = 0; n < addr.pol.length (); n++)
{
if (n > 0)
fprintf (dump_file, " + ");
if (addr.pol[n].var == NULL_TREE)
print_generic_expr (dump_file, addr.pol[n].cst, 0);
else
{
if (TREE_CODE (addr.pol[n].cst) != INTEGER_CST
|| !integer_onep (addr.pol[n].cst))
{
print_generic_expr (dump_file, addr.pol[n].cst, 0);
fprintf (dump_file, " * ");
}
print_generic_expr (dump_file, addr.pol[n].var, 0);
}
}
}
开发者ID:paranoiacblack,项目名称:gcc,代码行数:24,代码来源:tree-chkp-opt.c
示例4: SSA_NAME_VALUE
void
const_and_copies::record_const_or_copy (tree x, tree y, tree prev_x)
{
/* Y may be NULL if we are invalidating entries in the table. */
if (y && TREE_CODE (y) == SSA_NAME)
{
tree tmp = SSA_NAME_VALUE (y);
y = tmp ? tmp : y;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "0>>> COPY ");
print_generic_expr (dump_file, x, 0);
fprintf (dump_file, " = ");
print_generic_expr (dump_file, y, 0);
fprintf (dump_file, "\n");
}
set_ssa_name_value (x, y);
stack.reserve (2);
stack.quick_push (prev_x);
stack.quick_push (x);
}
开发者ID:daniel-k,项目名称:gcc,代码行数:24,代码来源:tree-ssa-scopedtables.c
示例5: forward_propagate_into_cond
static void
forward_propagate_into_cond (tree cond_expr)
{
gcc_assert (TREE_CODE (cond_expr) == COND_EXPR);
while (1)
{
tree test_var = NULL_TREE;
tree cond = COND_EXPR_COND (cond_expr);
tree new_cond = forward_propagate_into_cond_1 (cond, &test_var);
/* Return if unsuccessful. */
if (new_cond == NULL_TREE)
break;
/* Dump details. */
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " Replaced '");
print_generic_expr (dump_file, cond, dump_flags);
fprintf (dump_file, "' with '");
print_generic_expr (dump_file, new_cond, dump_flags);
fprintf (dump_file, "'\n");
}
COND_EXPR_COND (cond_expr) = new_cond;
update_stmt (cond_expr);
if (has_zero_uses (test_var))
{
tree def = SSA_NAME_DEF_STMT (test_var);
block_stmt_iterator bsi = bsi_for_stmt (def);
bsi_remove (&bsi);
}
}
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:36,代码来源:tree-ssa-forwprop.c
示例6: chkp_gather_checks_info
/* Find all checks in current function and store info about them
in check_infos. */
static void
chkp_gather_checks_info (void)
{
basic_block bb;
gimple_stmt_iterator i;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Gathering information about checks...\n");
chkp_init_check_info ();
FOR_EACH_BB_FN (bb, cfun)
{
struct bb_checks *bbc = &check_infos[bb->index];
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Searching checks in BB%d...\n", bb->index);
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
gimple *stmt = gsi_stmt (i);
if (gimple_code (stmt) != GIMPLE_CALL)
continue;
if (gimple_call_fndecl (stmt) == chkp_checkl_fndecl
|| gimple_call_fndecl (stmt) == chkp_checku_fndecl)
{
struct check_info ci;
chkp_fill_check_info (stmt, &ci);
bbc->checks.safe_push (ci);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Adding check information:\n");
fprintf (dump_file, " bounds: ");
print_generic_expr (dump_file, ci.bounds, 0);
fprintf (dump_file, "\n address: ");
chkp_print_addr (ci.addr);
fprintf (dump_file, "\n check: ");
print_gimple_stmt (dump_file, stmt, 0, 0);
}
}
}
}
}
开发者ID:paranoiacblack,项目名称:gcc,代码行数:49,代码来源:tree-chkp-opt.c
示例7: create_canonical_iv
static void
create_canonical_iv (struct loop *loop, edge exit, tree niter)
{
edge in;
tree type, var;
gcond *cond;
gimple_stmt_iterator incr_at;
enum tree_code cmp;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Added canonical iv to loop %d, ", loop->num);
print_generic_expr (dump_file, niter, TDF_SLIM);
fprintf (dump_file, " iterations.\n");
}
cond = as_a <gcond *> (last_stmt (exit->src));
in = EDGE_SUCC (exit->src, 0);
if (in == exit)
in = EDGE_SUCC (exit->src, 1);
/* Note that we do not need to worry about overflows, since
type of niter is always unsigned and all comparisons are
just for equality/nonequality -- i.e. everything works
with a modulo arithmetics. */
type = TREE_TYPE (niter);
niter = fold_build2 (PLUS_EXPR, type,
niter,
build_int_cst (type, 1));
incr_at = gsi_last_bb (in->src);
create_iv (niter,
build_int_cst (type, -1),
NULL_TREE, loop,
&incr_at, false, NULL, &var);
cmp = (exit->flags & EDGE_TRUE_VALUE) ? EQ_EXPR : NE_EXPR;
gimple_cond_set_code (cond, cmp);
gimple_cond_set_lhs (cond, var);
gimple_cond_set_rhs (cond, build_int_cst (type, 0));
update_stmt (cond);
}
开发者ID:0day-ci,项目名称:gcc,代码行数:42,代码来源:tree-ssa-loop-ivcanon.c
示例8: print_ssa_operands
void print_ssa_operands() {
tree var;
ssa_op_iter iter;
gimple_stmt_iterator gsi;
basic_block bb;
fprintf (stdout, "Print all SSA operands\n");
FOR_ALL_BB_FN(bb, cfun) {
for (gsi = gsi_start_bb (bb); !(gsi_end_p (gsi)); gsi_next(&gsi)) {
gimple *stmt = gsi_stmt(gsi);
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_OPERANDS) {
print_gimple_stmt(stdout, stmt,1, 1);
print_generic_expr (stdout, var, TDF_SLIM);
printf("\n");
tree ref = get_inner_ref (var);
if (ref)
printf ("Inner reference: %s\n", get_name(ref));
}
}
}
开发者ID:cristina2689,项目名称:gcc,代码行数:20,代码来源:utils.c
示例9: increase_alignment
static unsigned int
increase_alignment (void)
{
struct varpool_node *vnode;
/* Increase the alignment of all global arrays for vectorization. */
for (vnode = varpool_nodes_queue;
vnode;
vnode = vnode->next_needed)
{
tree vectype, decl = vnode->decl;
tree t;
unsigned int alignment;
t = TREE_TYPE(decl);
if (TREE_CODE (t) != ARRAY_TYPE)
continue;
vectype = get_vectype_for_scalar_type (strip_array_types (t));
if (!vectype)
continue;
alignment = TYPE_ALIGN (vectype);
if (DECL_ALIGN (decl) >= alignment)
continue;
if (vect_can_force_dr_alignment_p (decl, alignment))
{
DECL_ALIGN (decl) = TYPE_ALIGN (vectype);
DECL_USER_ALIGN (decl) = 1;
if (dump_file)
{
fprintf (dump_file, "Increasing alignment of decl: ");
print_generic_expr (dump_file, decl, TDF_SLIM);
fprintf (dump_file, "\n");
}
}
}
return 0;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:38,代码来源:tree-vectorizer.c
示例10: 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;
}
开发者ID:5432935,项目名称:crossbridge,代码行数:36,代码来源:tree-ssa.c
示例11: chrec_apply
tree
chrec_apply (unsigned var,
tree chrec,
tree x)
{
tree type = chrec_type (chrec);
tree res = chrec_dont_know;
if (automatically_generated_chrec_p (chrec)
|| automatically_generated_chrec_p (x)
/* When the symbols are defined in an outer loop, it is possible
to symbolically compute the apply, since the symbols are
constants with respect to the varying loop. */
|| chrec_contains_symbols_defined_in_loop (chrec, var))
return chrec_dont_know;
if (dump_file && (dump_flags & TDF_SCEV))
fprintf (dump_file, "(chrec_apply \n");
if (TREE_CODE (x) == INTEGER_CST && SCALAR_FLOAT_TYPE_P (type))
x = build_real_from_int_cst (type, x);
switch (TREE_CODE (chrec))
{
case POLYNOMIAL_CHREC:
if (evolution_function_is_affine_p (chrec))
{
if (CHREC_VARIABLE (chrec) != var)
return build_polynomial_chrec
(CHREC_VARIABLE (chrec),
chrec_apply (var, CHREC_LEFT (chrec), x),
chrec_apply (var, CHREC_RIGHT (chrec), x));
/* "{a, +, b} (x)" -> "a + b*x". */
x = chrec_convert_rhs (type, x, NULL);
res = chrec_fold_multiply (TREE_TYPE (x), CHREC_RIGHT (chrec), x);
res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
}
else if (TREE_CODE (x) == INTEGER_CST
&& tree_int_cst_sgn (x) == 1)
/* testsuite/.../ssa-chrec-38.c. */
res = chrec_evaluate (var, chrec, x, 0);
else
res = chrec_dont_know;
break;
CASE_CONVERT:
res = chrec_convert (TREE_TYPE (chrec),
chrec_apply (var, TREE_OPERAND (chrec, 0), x),
NULL);
break;
default:
res = chrec;
break;
}
if (dump_file && (dump_flags & TDF_SCEV))
{
fprintf (dump_file, " (varying_loop = %d\n", var);
fprintf (dump_file, ")\n (chrec = ");
print_generic_expr (dump_file, chrec, 0);
fprintf (dump_file, ")\n (x = ");
print_generic_expr (dump_file, x, 0);
fprintf (dump_file, ")\n (res = ");
print_generic_expr (dump_file, res, 0);
fprintf (dump_file, "))\n");
}
return res;
}
开发者ID:hemantjain95,项目名称:gcc,代码行数:72,代码来源:tree-chrec.c
示例12: copy_rename_partition_coalesce
static bool
copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{
int p1, p2, p3;
tree root1, root2;
tree rep1, rep2;
bool ign1, ign2, abnorm;
gcc_assert (TREE_CODE (var1) == SSA_NAME);
gcc_assert (TREE_CODE (var2) == SSA_NAME);
register_ssa_partition (map, var1);
register_ssa_partition (map, var2);
p1 = partition_find (map->var_partition, SSA_NAME_VERSION (var1));
p2 = partition_find (map->var_partition, SSA_NAME_VERSION (var2));
if (debug)
{
fprintf (debug, "Try : ");
print_generic_expr (debug, var1, TDF_SLIM);
fprintf (debug, "(P%d) & ", p1);
print_generic_expr (debug, var2, TDF_SLIM);
fprintf (debug, "(P%d)", p2);
}
gcc_assert (p1 != NO_PARTITION);
gcc_assert (p2 != NO_PARTITION);
if (p1 == p2)
{
if (debug)
fprintf (debug, " : Already coalesced.\n");
return false;
}
rep1 = partition_to_var (map, p1);
rep2 = partition_to_var (map, p2);
root1 = SSA_NAME_VAR (rep1);
root2 = SSA_NAME_VAR (rep2);
if (!root1 && !root2)
return false;
/* Don't coalesce if one of the variables occurs in an abnormal PHI. */
abnorm = (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep1)
|| SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep2));
if (abnorm)
{
if (debug)
fprintf (debug, " : Abnormal PHI barrier. No coalesce.\n");
return false;
}
/* Partitions already have the same root, simply merge them. */
if (root1 == root2)
{
p1 = partition_union (map->var_partition, p1, p2);
if (debug)
fprintf (debug, " : Same root, coalesced --> P%d.\n", p1);
return false;
}
/* Never attempt to coalesce 2 different parameters. */
if ((root1 && TREE_CODE (root1) == PARM_DECL)
&& (root2 && TREE_CODE (root2) == PARM_DECL))
{
if (debug)
fprintf (debug, " : 2 different PARM_DECLS. No coalesce.\n");
return false;
}
if ((root1 && TREE_CODE (root1) == RESULT_DECL)
!= (root2 && TREE_CODE (root2) == RESULT_DECL))
{
if (debug)
fprintf (debug, " : One root a RESULT_DECL. No coalesce.\n");
return false;
}
ign1 = !root1 || (TREE_CODE (root1) == VAR_DECL && DECL_IGNORED_P (root1));
ign2 = !root2 || (TREE_CODE (root2) == VAR_DECL && DECL_IGNORED_P (root2));
/* Refrain from coalescing user variables, if requested. */
if (!ign1 && !ign2)
{
if (flag_ssa_coalesce_vars && DECL_FROM_INLINE (root2))
ign2 = true;
else if (flag_ssa_coalesce_vars && DECL_FROM_INLINE (root1))
ign1 = true;
else if (flag_ssa_coalesce_vars != 2)
{
if (debug)
fprintf (debug, " : 2 different USER vars. No coalesce.\n");
return false;
}
else
ign2 = true;
}
/* If both values have default defs, we can't coalesce. If only one has a
//.........这里部分代码省略.........
开发者ID:Lao16,项目名称:gcc,代码行数:101,代码来源:tree-ssa-copyrename.c
示例13: rename_ssa_copies
//.........这里部分代码省略.........
tree rhs = gimple_assign_rhs1 (stmt);
updated |= copy_rename_partition_coalesce (map, lhs, rhs, debug);
}
}
}
FOR_EACH_BB (bb)
{
/* Treat PHI nodes as copies between the result and each argument. */
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
size_t i;
tree res;
phi = gsi_stmt (gsi);
res = gimple_phi_result (phi);
/* Do not process virtual SSA_NAMES. */
if (virtual_operand_p (res))
continue;
/* Make sure to only use the same partition for an argument
as the result but never the other way around. */
if (SSA_NAME_VAR (res)
&& !DECL_IGNORED_P (SSA_NAME_VAR (res)))
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree arg = PHI_ARG_DEF (phi, i);
if (TREE_CODE (arg) == SSA_NAME)
updated |= copy_rename_partition_coalesce (map, res, arg,
debug);
}
/* Else if all arguments are in the same partition try to merge
it with the result. */
else
{
int all_p_same = -1;
int p = -1;
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree arg = PHI_ARG_DEF (phi, i);
if (TREE_CODE (arg) != SSA_NAME)
{
all_p_same = 0;
break;
}
else if (all_p_same == -1)
{
p = partition_find (map->var_partition,
SSA_NAME_VERSION (arg));
all_p_same = 1;
}
else if (all_p_same == 1
&& p != partition_find (map->var_partition,
SSA_NAME_VERSION (arg)))
{
all_p_same = 0;
break;
}
}
if (all_p_same == 1)
updated |= copy_rename_partition_coalesce (map, res,
PHI_ARG_DEF (phi, 0),
debug);
}
}
}
if (debug)
dump_var_map (debug, map);
/* Now one more pass to make all elements of a partition share the same
root variable. */
for (x = 1; x < num_ssa_names; x++)
{
part_var = partition_to_var (map, x);
if (!part_var)
continue;
var = ssa_name (x);
if (SSA_NAME_VAR (var) == SSA_NAME_VAR (part_var))
continue;
if (debug)
{
fprintf (debug, "Coalesced ");
print_generic_expr (debug, var, TDF_SLIM);
fprintf (debug, " to ");
print_generic_expr (debug, part_var, TDF_SLIM);
fprintf (debug, "\n");
}
stats.coalesced++;
replace_ssa_name_symbol (var, SSA_NAME_VAR (part_var));
}
statistics_counter_event (cfun, "copies coalesced",
stats.coalesced);
delete_var_map (map);
return updated ? TODO_remove_unused_locals : 0;
}
开发者ID:Lao16,项目名称:gcc,代码行数:101,代码来源:tree-ssa-copyrename.c
示例14: tree_nrv
static void
tree_nrv (void)
{
tree result = DECL_RESULT (current_function_decl);
tree result_type = TREE_TYPE (result);
tree found = NULL;
basic_block bb;
block_stmt_iterator bsi;
struct nrv_data data;
/* If this function does not return an aggregate type in memory, then
there is nothing to do. */
if (!aggregate_value_p (result, current_function_decl))
return;
/* Look through each block for assignments to the RESULT_DECL. */
FOR_EACH_BB (bb)
{
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
tree ret_expr;
if (TREE_CODE (stmt) == RETURN_EXPR)
{
/* In a function with an aggregate return value, the
gimplifier has changed all non-empty RETURN_EXPRs to
return the RESULT_DECL. */
ret_expr = TREE_OPERAND (stmt, 0);
if (ret_expr)
gcc_assert (ret_expr == result);
}
else if (TREE_CODE (stmt) == MODIFY_EXPR
&& TREE_OPERAND (stmt, 0) == result)
{
ret_expr = TREE_OPERAND (stmt, 1);
/* Now verify that this return statement uses the same value
as any previously encountered return statement. */
if (found != NULL)
{
/* If we found a return statement using a different variable
than previous return statements, then we can not perform
NRV optimizations. */
if (found != ret_expr)
return;
}
else
found = ret_expr;
/* The returned value must be a local automatic variable of the
same type and alignment as the function's result. */
if (TREE_CODE (found) != VAR_DECL
|| TREE_THIS_VOLATILE (found)
|| DECL_CONTEXT (found) != current_function_decl
|| TREE_STATIC (found)
|| TREE_ADDRESSABLE (found)
|| DECL_ALIGN (found) > DECL_ALIGN (result)
|| !lang_hooks.types_compatible_p (TREE_TYPE (found),
result_type))
return;
}
}
}
if (!found)
return;
/* If dumping details, then note once and only the NRV replacement. */
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "NRV Replaced: ");
print_generic_expr (dump_file, found, dump_flags);
fprintf (dump_file, " with: ");
print_generic_expr (dump_file, result, dump_flags);
fprintf (dump_file, "\n");
}
/* At this point we know that all the return statements return the
same local which has suitable attributes for NRV. Copy debugging
information from FOUND to RESULT. */
DECL_NAME (result) = DECL_NAME (found);
DECL_SOURCE_LOCATION (result) = DECL_SOURCE_LOCATION (found);
DECL_ABSTRACT_ORIGIN (result) = DECL_ABSTRACT_ORIGIN (found);
TREE_ADDRESSABLE (result) = TREE_ADDRESSABLE (found);
/* Now walk through the function changing all references to VAR to be
RESULT. */
data.var = found;
data.result = result;
FOR_EACH_BB (bb)
{
for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
{
tree *tp = bsi_stmt_ptr (bsi);
/* If this is a copy from VAR to RESULT, remove it. */
if (TREE_CODE (*tp) == MODIFY_EXPR
&& TREE_OPERAND (*tp, 0) == result
&& TREE_OPERAND (*tp, 1) == found)
bsi_remove (&bsi);
//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,代码来源:tree-nrv.c
示例15: ifcombine_iforif
static bool
ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
{
gimple inner_cond, outer_cond;
tree name1, name2, bits1, bits2;
inner_cond = last_stmt (inner_cond_bb);
if (!inner_cond
|| gimple_code (inner_cond) != GIMPLE_COND)
return false;
outer_cond = last_stmt (outer_cond_bb);
if (!outer_cond
|| gimple_code (outer_cond) != GIMPLE_COND)
return false;
/* See if we have two bit tests of the same name in both tests.
In that case remove the outer test and change the inner one to
test for name & (bits1 | bits2) != 0. */
if (recognize_bits_test (inner_cond, &name1, &bits1)
&& recognize_bits_test (outer_cond, &name2, &bits2))
{
gimple_stmt_iterator gsi;
tree t;
/* Find the common name which is bit-tested. */
if (name1 == name2)
;
else if (bits1 == bits2)
{
t = name2;
name2 = bits2;
bits2 = t;
t = name1;
name1 = bits1;
bits1 = t;
}
else if (name1 == bits2)
{
t = name2;
name2 = bits2;
bits2 = t;
}
else if (bits1 == name2)
{
t = name1;
name1 = bits1;
bits1 = t;
}
else
return false;
/* As we strip non-widening conversions in finding a common
name that is tested make sure to end up with an integral
type for building the bit operations. */
if (TYPE_PRECISION (TREE_TYPE (bits1))
>= TYPE_PRECISION (TREE_TYPE (bits2)))
{
bits1 = fold_convert (unsigned_type_for (TREE_TYPE (bits1)), bits1);
name1 = fold_convert (TREE_TYPE (bits1), name1);
bits2 = fold_convert (unsigned_type_for (TREE_TYPE (bits2)), bits2);
bits2 = fold_convert (TREE_TYPE (bits1), bits2);
}
else
{
bits2 = fold_convert (unsigned_type_for (TREE_TYPE (bits2)), bits2);
name1 = fold_convert (TREE_TYPE (bits2), name1);
bits1 = fold_convert (unsigned_type_for (TREE_TYPE (bits1)), bits1);
bits1 = fold_convert (TREE_TYPE (bits2), bits1);
}
/* Do it. */
gsi = gsi_for_stmt (inner_cond);
t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), bits1, bits2);
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
true, GSI_SAME_STMT);
t = fold_build2 (BIT_AND_EXPR, TREE_TYPE (name1), name1, t);
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
true, GSI_SAME_STMT);
t = fold_build2 (NE_EXPR, boolean_type_node, t,
build_int_cst (TREE_TYPE (t), 0));
gimple_cond_set_condition_from_tree (inner_cond, t);
update_stmt (inner_cond);
/* Leave CFG optimization to cfg_cleanup. */
gimple_cond_set_condition_from_tree (outer_cond, boolean_false_node);
update_stmt (outer_cond);
if (dump_file)
{
fprintf (dump_file, "optimizing bits or bits test to ");
print_generic_expr (dump_file, name1, 0);
fprintf (dump_file, " & T != 0\nwith temporary T = ");
print_generic_expr (dump_file, bits1, 0);
fprintf (dump_file, " | ");
print_generic_expr (dump_file, bits2, 0);
fprintf (dump_file, "\n");
}
return true;
//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,代码来源:tree-ssa-ifcombine.c
示例16: compute_builtin_object_size
unsigned HOST_WIDE_INT
compute_builtin_object_size (tree ptr, int object_size_type)
{
gcc_assert (object_size_type >= 0 && object_size_type <= 3);
if (! offset_limit)
init_offset_limit ();
if (TREE_CODE (ptr) == ADDR_EXPR)
return addr_object_size (ptr, object_size_type);
else if (TREE_CODE (ptr) == CALL_EXPR)
{
tree arg = pass_through_call (ptr);
if (arg)
return compute_builtin_object_size (arg, object_size_type);
else
return alloc_object_size (ptr, object_size_type);
}
else if (TREE_CODE (ptr) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (ptr))
&& object_sizes[object_size_type] != NULL)
{
if (!bitmap_bit_p (computed[object_size_type], SSA_NAME_VERSION (ptr)))
{
struct object_size_info osi;
bitmap_iterator bi;
unsigned int i;
if (dump_file)
{
fprintf (dump_file, "Computing %s %sobject size for ",
(object_size_type & 2) ? "minimum" : "maximum",
(object_size_type & 1) ? "sub" : "");
print_generic_expr (dump_file, ptr, dump_flags);
fprintf (dump_file, ":\n");
}
osi.visited = BITMAP_ALLOC (NULL);
osi.reexamine = BITMAP_ALLOC (NULL);
osi.object_size_type = object_size_type;
osi.depths = NULL;
osi.stack = NULL;
osi.tos = NULL;
/* First pass: walk UD chains, compute object sizes that
can be computed. osi.reexamine bitmap at the end will
contain what variables were found in dependency cycles
and therefore need to be reexamined. */
osi.pass = 0;
osi.changed = false;
collect_object_sizes_for (&osi, ptr);
/* Second pass: keep recomputing object sizes of variables
that need reexamination, until no object sizes are
increased or all object sizes are computed. */
if (! bitmap_empty_p (osi.reexamine))
{
bitmap reexamine = BITMAP_ALLOC (NULL);
/* If looking for minimum instead of maximum object size,
detect cases where a pointer is increased in a loop.
Although even without this detection pass 2 would eventually
terminate, it could take a long time. If a pointer is
increasing this way, we need to assume 0 object size.
E.g. p = &buf[0]; while (cond) p = p + 4; */
if (object_size_type & 2)
{
osi.depths = xcalloc (num_ssa_names, sizeof (unsigned int));
osi.stack = xmalloc (num_ssa_names * sizeof (unsigned int));
osi.tos = osi.stack;
osi.pass = 1;
/* collect_object_sizes_for is changing
osi.reexamine bitmap, so iterate over a copy. */
bitmap_copy (reexamine, osi.reexamine);
EXECUTE_IF_SET_IN_BITMAP (reexamine, 0, i, bi)
if (bitmap_bit_p (osi.reexamine, i))
check_for_plus_in_loops (&osi, ssa_name (i));
free (osi.depths);
osi.depths = NULL;
free (osi.stack);
osi.stack = NULL;
osi.tos = NULL;
}
do
{
osi.pass = 2;
osi.changed = false;
/* collect_object_sizes_for is changing
osi.reexamine bitmap, so iterate over a copy. */
bitmap_copy (reexamine, osi.reexamine);
EXECUTE_IF_SET_IN_BITMAP (reexamine, 0, i, bi)
if (bitmap_bit_p (osi.reexamine, i))
{
collect_object_sizes_for (&osi, ssa_name (i));
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Reexamining ");
//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,代码来源:tree-object-size.c
示例17: ifcombine_ifandif
static bool
ifcombine_ifandif (basic_block inner_cond_bb, basic_block outer_cond_bb)
{
gimple_stmt_iterator gsi;
gimple inner_cond, outer_cond;
tree name1, name2, bit1, bit2;
inner_cond = last_stmt (inner_cond_bb);
if (!inner_cond
|| gimple_code (inner_cond) != GIMPLE_COND)
return false;
outer_cond = last_stmt (outer_cond_bb);
if (!outer_cond
|| gimple_code (outer_cond) != GIMPLE_COND)
return false;
/* See if we test a single bit of the same name in both tests. In
that case remove the outer test, merging both else edges,
and change the inner one to test for
name & (bit1 | bit2) == (bit1 | bit2). */
if (recognize_single_bit_test (inner_cond, &name1, &bit1)
&& recognize_single_bit_test (outer_cond, &name2, &bit2)
&& name1 == name2)
{
tree t, t2;
/* Do it. */
gsi = gsi_for_stmt (inner_cond);
t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
build_int_cst (TREE_TYPE (name1), 1), bit1);
t2 = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
build_int_cst (TREE_TYPE (name1), 1), bit2);
t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), t, t2);
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
true, GSI_SAME_STMT);
t2 = fold_build2 (BIT_AND_EXPR, TREE_TYPE (name1), name1, t);
t2 = force_gimple_operand_gsi (&gsi, t2, true, NULL_TREE,
true, GSI_SAME_STMT);
t = fold_build2 (EQ_EXPR, boolean_type_node, t2, t);
gimple_cond_set_condition_from_tree (inner_cond, t);
update_stmt (inner_cond);
/* Leave CFG optimization to cfg_cleanup. */
gimple_cond_set_condition_from_tree (outer_cond, boolean_true_node);
update_stmt (outer_cond);
if (dump_file)
{
fprintf (dump_file, "optimizing double bit test to ");
print_generic_expr (dump_file, name1, 0);
fprintf (dump_file, " & T == T\nwith temporary T = (1 << ");
print_generic_expr (dump_file, bit1, 0);
fprintf (dump_file, ") | (1 << ");
print_generic_expr (dump_file, bit2, 0);
fprintf (dump_file, ")\n");
}
return true;
}
return false;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:63,代码来源:tree-ssa-ifcombine.c
示例18: forward_propagate_into_gimple_cond
static int
forward_propagate_into_gimple_cond (gimple stmt)
{
int did_something = 0;
location_t loc = gimple_location (stmt);
do {
tree tmp = NULL_TREE;
tree name, rhs0 = NULL_TREE, rhs1 = NULL_TREE;
gimple def_stmt;
bool single_use0_p = false, single_use1_p = false;
enum tree_code code = gimple_cond_code (stmt);
/* We can do tree combining on SSA_NAME and comparison expressions. */
if (TREE_CODE_CLASS (gimple_cond_code (stmt)) == tcc_comparison
&& TREE_CODE (gimple_cond_lhs (stmt)) == SSA_NAME)
{
/* For comparisons use the first operand, that is likely to
simplify comparisons against constants. */
name = gimple_cond_lhs (stmt);
def_stmt = get_prop_source_stmt (name, false, &single_use0_p);
if (def_stmt && can_propagate_from (def_stmt))
{
tree op1 = gimple_cond_rhs (stmt);
rhs0 = rhs_to_tree (TREE_TYPE (op1), def_stmt);
tmp = combine_cond_expr_cond (loc, code, boolean_type_node, rhs0,
op1, !single_use0_p);
}
/* If that wasn't successful, try the second operand. */
if (tmp == NULL_TREE
&& TREE_CODE (gimple_cond_rhs (stmt)) == SSA_NAME)
{
tree op0 = gimple_cond_lhs (stmt);
name = gimple_cond_rhs (stmt);
def_stmt = get_prop_source_stmt (name, false, &single_use1_p);
if (!def_stmt || !can_propagate_from (def_stmt))
return did_something;
rhs1 = rhs_to_tree (TREE_TYPE (op0), def_stmt);
tmp = combine_cond_expr_cond (loc, code, boolean_type_node, op0,
rhs1, !single_use1_p);
}
/* If that wasn't successful either, try both operands. */
if (tmp == NULL_TREE
&& rhs0 != NULL_TREE
&& rhs1 != NULL_TREE)
tmp = combine_cond_expr_cond (loc, code, boolean_type_node, rhs0,
fold_convert_loc (loc,
TREE_TYPE (rhs0),
rhs1),
!(single_use0_p && single_use1_p));
}
if (tmp)
{
if (dump_file && tmp)
{
tree cond = build2 (gimple_cond_code (stmt),
boolean_type_node,
gimple_cond_lhs (stmt),
gimple_cond_rhs (stmt));
fprintf (dump_file, " Replaced '");
print_generic_expr (dump_file, cond, 0);
fprintf (dump_file, "' with '");
print_generic_expr (dump_file, tmp, 0);
fprintf (dump_file, "'\n");
}
gimple_cond_set_condition_from_tree (stmt, unshare_expr (tmp));
update_stmt (stmt);
/* Remove defining statements. */
remove_prop_source_from_use (name, NULL);
if (is_gimple_min_invariant (tmp))
did_something = 2;
else if (did_something == 0)
did_something = 1;
/* Continue combining. */
continue;
}
break;
} while (1);
return did_something;
}
开发者ID:Scorpiion,项目名称:Renux_cross_gcc,代码行数:88,代码来源:tree-ssa-forwprop.c
示例19: copy_rename_partition_coalesce
static bool
copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{
int p1, p2, p3;
tree root1, root2;
tree rep1, rep2;
bool ign1, ign2, abnorm;
gcc_assert (TREE_CODE (var1) == SSA_NAME);
gcc_assert (TREE_CODE (var2) == SSA_NAME);
register_ssa_partition (map, var1);
register_ssa_partition (map, var2);
p1 = partition_find (map->var_partition, SSA_NAME_VERSION (var1));
p2 = partition_find (map->var_partition, SSA_NAME_VERSION (var2));
if (debug)
{
fprintf (debug, "Try : ");
print_generic_expr (debug, var1, TDF_SLIM);
fprintf (debug, "(P%d) & ", p1);
print_generic_expr (debug, var2, TDF_SLIM);
fprintf (debug, "(P%d)", p2);
}
gcc_assert (p1 != NO_PARTITION);
gcc_assert (p2 != NO_PARTITION);
rep1 = partition_to_var (map, p1);
rep2 = partition_to_var (map, p2);
root1 = SSA_NAME_VAR (rep1);
root2 = SSA_NAME_VAR (rep2);
if (p1 == p2)
{
if (debug)
fprintf (debug, " : Already coalesced.\n");
return false;
}
/* Don't coalesce if one of the variables occurs in an abnormal PHI. */
abnorm = (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep1)
|| SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep2));
if (abnorm)
{
if (debug)
fprintf (debug, " : Abnormal PHI barrier. No coalesce.\n");
return false;
}
/* Partitions already have the same root, simply merge them. */
if (root1 == root2)
{
p1 = partition_union (map->var_partition, p1, p2);
if (debug)
fprintf (debug, " : Same root, coalesced --> P%d.\n", p1);
return false;
}
/* Never attempt to coalesce 2 difference parameters. */
if (TREE_CODE (root1) == PARM_DECL && TREE_CODE (root2) == PARM_DECL)
{
if (debug)
fprintf (debug, " : 2 different PARM_DECLS. No coalesce.\n");
return false;
}
if ((TREE_CODE (root1) == RESULT_DECL) != (TREE_CODE (root2) == RESULT_DECL))
{
if (debug)
fprintf (debug, " : One root a RESULT_DECL. No coalesce.\n");
return false;
}
ign1 = TREE_CODE (root1) == VAR_DECL && DECL_IGNORED_P (root1);
ign2 = TREE_CODE (root2) == VAR_DECL && DECL_IGNORED_P (root2);
/* Never attempt to coalesce 2 user variables unless one is an inline
variable. */
if (!ign1 && !ign2)
{
if (DECL_FROM_INLINE (root2))
ign2 = true;
else if (DECL_FROM_INLINE (root1))
ign1 = true;
else
{
if (debug)
fprintf (debug, " : 2 different USER vars. No coalesce.\n");
return false;
}
}
/* If both values have default defs, we can't coalesce. If only one has a
tag, make sure that variable is the new root partition. */
if (gimple_default_def (cfun, root1))
{
if (gimple_default_def (cfun, root2))
{
//.........这里部分代码省略.........
开发者ID:DIYzzuzpb,项目名称:pic32-gcc,代码行数:101,代码来源:tree-ssa-copyrename.c
示例20: rename_ssa_copies
static unsigned int
rename_ssa_copies (void)
{
var_map map;
basic_block bb;
gimple_stmt_iterator gsi;
tree var, part_var;
gimple stmt, phi;
unsigned x;
FILE *debug;
bool updated = false;
if (dump_file && (dump_flags & TDF_DETAILS))
debug = dump_file;
else
debug = NULL;
map = init_var_map (num_ssa_names);
FOR_EACH_BB (bb)
{
/* Scan for real copies. */
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
stmt = gsi_stmt (gsi);
if (gimple_assign_ssa_name_copy_p (stmt))
{
tree lhs = gimple_assign_lhs (stmt);
tree rh
|
请发表评论