本文整理汇总了C++中builtin_decl_implicit函数 的典型用法代码示例。如果您正苦于以下问题:C++ builtin_decl_implicit函数的具体用法?C++ builtin_decl_implicit怎么用?C++ builtin_decl_implicit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了builtin_decl_implicit函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: maybe_push_res_to_seq
tree
maybe_push_res_to_seq (code_helper rcode, tree type, tree *ops,
gimple_seq *seq, tree res)
{
if (rcode.is_tree_code ())
{
if (!res
&& (TREE_CODE_LENGTH ((tree_code) rcode) == 0
|| ((tree_code) rcode) == ADDR_EXPR)
&& is_gimple_val (ops[0]))
return ops[0];
if (!seq)
return NULL_TREE;
/* Play safe and do not allow abnormals to be mentioned in
newly created statements. */
if ((TREE_CODE (ops[0]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[0]))
|| (ops[1]
&& TREE_CODE (ops[1]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[1]))
|| (ops[2]
&& TREE_CODE (ops[2]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2])))
return NULL_TREE;
if (!res)
res = make_ssa_name (type, NULL);
maybe_build_generic_op (rcode, type, &ops[0], ops[1], ops[2]);
gimple new_stmt = gimple_build_assign_with_ops (rcode, res,
ops[0], ops[1], ops[2]);
gimple_seq_add_stmt_without_update (seq, new_stmt);
return res;
}
else
{
if (!seq)
return NULL_TREE;
tree decl = builtin_decl_implicit (rcode);
if (!decl)
return NULL_TREE;
unsigned nargs = type_num_arguments (TREE_TYPE (decl));
gcc_assert (nargs <= 3);
/* Play safe and do not allow abnormals to be mentioned in
newly created statements. */
if ((TREE_CODE (ops[0]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[0]))
|| (nargs >= 2
&& TREE_CODE (ops[1]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[1]))
|| (nargs == 3
&& TREE_CODE (ops[2]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2])))
return NULL_TREE;
if (!res)
res = make_ssa_name (type, NULL);
gimple new_stmt = gimple_build_call (decl, nargs, ops[0], ops[1], ops[2]);
gimple_call_set_lhs (new_stmt, res);
gimple_seq_add_stmt_without_update (seq, new_stmt);
return res;
}
}
开发者ID:angrysnail, 项目名称:gcc, 代码行数:60, 代码来源:gimple-match-head.c
示例2: cilk_call_setjmp
tree
cilk_call_setjmp (tree frame)
{
tree c = cilk_dot (frame, CILK_TI_FRAME_CONTEXT, false);
c = build1 (ADDR_EXPR, build_pointer_type (ptr_type_node), c);
return build_call_expr (builtin_decl_implicit (BUILT_IN_SETJMP), 1, c);
}
开发者ID:krichter722, 项目名称:gcc, 代码行数:7, 代码来源:cilk-common.c
示例3: gimple_simplify
tree
gimple_simplify (enum built_in_function fn, tree type,
tree arg0, tree arg1, tree arg2,
gimple_seq *seq, tree (*valueize)(tree))
{
if (constant_for_folding (arg0)
&& constant_for_folding (arg1)
&& constant_for_folding (arg2))
{
tree decl = builtin_decl_implicit (fn);
if (decl)
{
tree args[3];
args[0] = arg0;
args[1] = arg1;
args[2] = arg2;
tree res = fold_builtin_n (UNKNOWN_LOCATION, decl, args, 3, false);
if (res)
{
/* fold_builtin_n wraps the result inside a NOP_EXPR. */
STRIP_NOPS (res);
res = fold_convert (type, res);
if (CONSTANT_CLASS_P (res))
return res;
}
}
}
code_helper rcode;
tree ops[3] = {};
if (!gimple_simplify (&rcode, ops, seq, valueize,
fn, type, arg0, arg1, arg2))
return NULL_TREE;
return maybe_push_res_to_seq (rcode, type, ops, seq);
}
开发者ID:angrysnail, 项目名称:gcc, 代码行数:35, 代码来源:gimple-match-head.c
示例4: chkp_get_nochk_fndecl
/* Return no-check version of string function FNCODE. */
static tree
chkp_get_nochk_fndecl (enum built_in_function fncode)
{
/* Check if we are allowed to use fast string functions. */
if (!flag_chkp_use_nochk_string_functions)
return NULL_TREE;
tree fndecl = NULL_TREE;
switch (fncode)
{
case BUILT_IN_MEMCPY_CHKP:
fndecl = builtin_decl_implicit (BUILT_IN_CHKP_MEMCPY_NOCHK);
break;
case BUILT_IN_MEMPCPY_CHKP:
fndecl = builtin_decl_implicit (BUILT_IN_CHKP_MEMPCPY_NOCHK);
break;
case BUILT_IN_MEMMOVE_CHKP:
fndecl = builtin_decl_implicit (BUILT_IN_CHKP_MEMMOVE_NOCHK);
break;
case BUILT_IN_MEMSET_CHKP:
fndecl = builtin_decl_implicit (BUILT_IN_CHKP_MEMSET_NOCHK);
break;
case BUILT_IN_CHKP_MEMCPY_NOBND_CHKP:
fndecl = builtin_decl_implicit (BUILT_IN_CHKP_MEMCPY_NOBND_NOCHK);
break;
case BUILT_IN_CHKP_MEMPCPY_NOBND_CHKP:
fndecl = builtin_decl_implicit (BUILT_IN_CHKP_MEMPCPY_NOBND_NOCHK);
break;
case BUILT_IN_CHKP_MEMMOVE_NOBND_CHKP:
fndecl = builtin_decl_implicit (BUILT_IN_CHKP_MEMMOVE_NOBND_NOCHK);
break;
case BUILT_IN_CHKP_MEMSET_NOBND_CHKP:
fndecl = builtin_decl_implicit (BUILT_IN_CHKP_MEMSET_NOBND_NOCHK);
break;
default:
break;
}
if (fndecl)
fndecl = chkp_maybe_clone_builtin_fndecl (fndecl);
return fndecl;
}
开发者ID:paranoiacblack, 项目名称:gcc, 代码行数:53, 代码来源:tree-chkp-opt.c
示例5: set_cilk_except_data
static tree
set_cilk_except_data (tree frame)
{
tree except_data = cilk_dot (frame, CILK_TI_FRAME_EXCEPTION, 0);
tree uresume_fn = builtin_decl_implicit (BUILT_IN_EH_POINTER);
tree ret_expr;
uresume_fn = build_call_expr (uresume_fn, 1,
build_int_cst (integer_type_node, 0));
ret_expr = build2 (MODIFY_EXPR, void_type_node, except_data, uresume_fn);
return ret_expr;
}
开发者ID:CookieChen, 项目名称:gcc, 代码行数:11, 代码来源:cp-cilkplus.c
示例6: remove_exits_and_undefined_stmts
static bool
remove_exits_and_undefined_stmts (struct loop *loop, unsigned int npeeled)
{
struct nb_iter_bound *elt;
bool changed = false;
for (elt = loop->bounds; elt; elt = elt->next)
{
/* If statement is known to be undefined after peeling, turn it
into unreachable (or trap when debugging experience is supposed
to be good). */
if (!elt->is_exit
&& wi::ltu_p (elt->bound, npeeled))
{
gimple_stmt_iterator gsi = gsi_for_stmt (elt->stmt);
gcall *stmt = gimple_build_call
(builtin_decl_implicit (BUILT_IN_UNREACHABLE), 0);
gimple_set_location (stmt, gimple_location (elt->stmt));
gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
split_block (gimple_bb (stmt), stmt);
changed = true;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Forced statement unreachable: ");
print_gimple_stmt (dump_file, elt->stmt, 0, 0);
}
}
/* If we know the exit will be taken after peeling, update. */
else if (elt->is_exit
&& wi::leu_p (elt->bound, npeeled))
{
basic_block bb = gimple_bb (elt->stmt);
edge exit_edge = EDGE_SUCC (bb, 0);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Forced exit to be taken: ");
print_gimple_stmt (dump_file, elt->stmt, 0, 0);
}
if (!loop_exit_edge_p (loop, exit_edge))
exit_edge = EDGE_SUCC (bb, 1);
gcc_checking_assert (loop_exit_edge_p (loop, exit_edge));
gcond *cond_stmt = as_a <gcond *> (elt->stmt);
if (exit_edge->flags & EDGE_TRUE_VALUE)
gimple_cond_make_true (cond_stmt);
else
gimple_cond_make_false (cond_stmt);
update_stmt (cond_stmt);
changed = true;
}
}
return changed;
}
开发者ID:0day-ci, 项目名称:gcc, 代码行数:53, 代码来源:tree-ssa-loop-ivcanon.c
示例7: gimple_resimplify1
static bool
gimple_resimplify1 (gimple_seq *seq,
code_helper *res_code, tree type, tree *res_ops,
tree (*valueize)(tree))
{
if (constant_for_folding (res_ops[0]))
{
tree tem = NULL_TREE;
if (res_code->is_tree_code ())
tem = const_unop (*res_code, type, res_ops[0]);
else
{
tree decl = builtin_decl_implicit (*res_code);
if (decl)
{
tem = fold_builtin_n (UNKNOWN_LOCATION, decl, res_ops, 1, false);
if (tem)
{
/* fold_builtin_n wraps the result inside a NOP_EXPR. */
STRIP_NOPS (tem);
tem = fold_convert (type, tem);
}
}
}
if (tem != NULL_TREE
&& CONSTANT_CLASS_P (tem))
{
res_ops[0] = tem;
res_ops[1] = NULL_TREE;
res_ops[2] = NULL_TREE;
*res_code = TREE_CODE (res_ops[0]);
return true;
}
}
code_helper res_code2;
tree res_ops2[3] = {};
if (gimple_simplify (&res_code2, res_ops2, seq, valueize,
*res_code, type, res_ops[0]))
{
*res_code = res_code2;
res_ops[0] = res_ops2[0];
res_ops[1] = res_ops2[1];
res_ops[2] = res_ops2[2];
return true;
}
return false;
}
开发者ID:angrysnail, 项目名称:gcc, 代码行数:49, 代码来源:gimple-match-head.c
示例8: unloop_loops
static void
unloop_loops (bitmap loop_closed_ssa_invalidated,
bool *irred_invalidated)
{
while (loops_to_unloop.length ())
{
struct loop *loop = loops_to_unloop.pop ();
int n_unroll = loops_to_unloop_nunroll.pop ();
basic_block latch = loop->latch;
edge latch_edge = loop_latch_edge (loop);
int flags = latch_edge->flags;
location_t locus = latch_edge->goto_locus;
gcall *stmt;
gimple_stmt_iterator gsi;
remove_exits_and_undefined_stmts (loop, n_unroll);
/* Unloop destroys the latch edge. */
unloop (loop, irred_invalidated, loop_closed_ssa_invalidated);
/* Create new basic block for the latch edge destination and wire
it in. */
stmt = gimple_build_call (builtin_decl_implicit (BUILT_IN_UNREACHABLE), 0);
latch_edge = make_edge (latch, create_basic_block (NULL, NULL, latch), flags);
latch_edge->probability = 0;
latch_edge->count = 0;
latch_edge->flags |= flags;
latch_edge->goto_locus = locus;
latch_edge->dest->loop_father = current_loops->tree_root;
latch_edge->dest->count = 0;
latch_edge->dest->frequency = 0;
set_immediate_dominator (CDI_DOMINATORS, latch_edge->dest, latch_edge->src);
gsi = gsi_start_bb (latch_edge->dest);
gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
}
loops_to_unloop.release ();
loops_to_unloop_nunroll.release ();
/* Remove edges in peeled copies. */
unsigned i;
edge e;
FOR_EACH_VEC_ELT (edges_to_remove, i, e)
{
bool ok = remove_path (e);
gcc_assert (ok);
}
开发者ID:RajibTheKing, 项目名称:gcc, 代码行数:48, 代码来源:tree-ssa-loop-ivcanon.c
示例9: generate_memset_zero
static void
generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
gimple_stmt_iterator bsi)
{
tree addr_base, nb_bytes;
bool res = false;
gimple_seq stmt_list = NULL, stmts;
gimple fn_call;
tree mem, fn;
struct data_reference *dr = XCNEW (struct data_reference);
location_t loc = gimple_location (stmt);
DR_STMT (dr) = stmt;
DR_REF (dr) = op0;
res = dr_analyze_innermost (dr, loop_containing_stmt (stmt));
gcc_assert (res && stride_of_unit_type_p (DR_STEP (dr), TREE_TYPE (op0)));
nb_bytes = build_size_arg_loc (loc, nb_iter, op0, &stmt_list);
addr_base = size_binop_loc (loc, PLUS_EXPR, DR_OFFSET (dr), DR_INIT (dr));
addr_base = fold_convert_loc (loc, sizetype, addr_base);
/* Test for a negative stride, iterating over every element. */
if (tree_int_cst_sgn (DR_STEP (dr)) == -1)
{
addr_base = size_binop_loc (loc, MINUS_EXPR, addr_base,
fold_convert_loc (loc, sizetype, nb_bytes));
addr_base = size_binop_loc (loc, PLUS_EXPR, addr_base,
TYPE_SIZE_UNIT (TREE_TYPE (op0)));
}
addr_base = fold_build_pointer_plus_loc (loc,
DR_BASE_ADDRESS (dr), addr_base);
mem = force_gimple_operand (addr_base, &stmts, true, NULL);
gimple_seq_add_seq (&stmt_list, stmts);
fn = build_fold_addr_expr (builtin_decl_implicit (BUILT_IN_MEMSET));
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call);
gsi_insert_seq_after (&bsi, stmt_list, GSI_CONTINUE_LINKING);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "generated memset zero\n");
free_data_ref (dr);
}
开发者ID:Gwenio, 项目名称:DragonFlyBSD, 代码行数:45, 代码来源:tree-loop-distribution.c
示例10: lower_builtin_posix_memalign
static void
lower_builtin_posix_memalign (gimple_stmt_iterator *gsi)
{
gimple stmt, call = gsi_stmt (*gsi);
tree pptr = gimple_call_arg (call, 0);
tree align = gimple_call_arg (call, 1);
tree res = gimple_call_lhs (call);
tree ptr = create_tmp_reg (ptr_type_node, NULL);
if (TREE_CODE (pptr) == ADDR_EXPR)
{
tree tem = create_tmp_var (ptr_type_node, NULL);
TREE_ADDRESSABLE (tem) = 1;
gimple_call_set_arg (call, 0, build_fold_addr_expr (tem));
stmt = gimple_build_assign (ptr, tem);
}
else
stmt = gimple_build_assign (ptr,
fold_build2 (MEM_REF, ptr_type_node, pptr,
build_int_cst (ptr_type_node, 0)));
if (res == NULL_TREE)
{
res = create_tmp_reg (integer_type_node, NULL);
gimple_call_set_lhs (call, res);
}
tree align_label = create_artificial_label (UNKNOWN_LOCATION);
tree noalign_label = create_artificial_label (UNKNOWN_LOCATION);
gimple cond = gimple_build_cond (EQ_EXPR, res, integer_zero_node,
align_label, noalign_label);
gsi_insert_after (gsi, cond, GSI_NEW_STMT);
gsi_insert_after (gsi, gimple_build_label (align_label), GSI_NEW_STMT);
gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
stmt = gimple_build_call (builtin_decl_implicit (BUILT_IN_ASSUME_ALIGNED),
2, ptr, align);
gimple_call_set_lhs (stmt, ptr);
gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
stmt = gimple_build_assign (fold_build2 (MEM_REF, ptr_type_node, pptr,
build_int_cst (ptr_type_node, 0)),
ptr);
gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
gsi_insert_after (gsi, gimple_build_label (noalign_label), GSI_NEW_STMT);
}
开发者ID:ChillyWillyGuru, 项目名称:gcc-4.9.0-PS3, 代码行数:41, 代码来源:gimple-low.c
示例11: aarch64_atomic_assign_expand_fenv
void
aarch64_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
{
const unsigned AARCH64_FE_INVALID = 1;
const unsigned AARCH64_FE_DIVBYZERO = 2;
const unsigned AARCH64_FE_OVERFLOW = 4;
const unsigned AARCH64_FE_UNDERFLOW = 8;
const unsigned AARCH64_FE_INEXACT = 16;
const unsigned HOST_WIDE_INT AARCH64_FE_ALL_EXCEPT = (AARCH64_FE_INVALID
| AARCH64_FE_DIVBYZERO
| AARCH64_FE_OVERFLOW
| AARCH64_FE_UNDERFLOW
| AARCH64_FE_INEXACT);
const unsigned HOST_WIDE_INT AARCH64_FE_EXCEPT_SHIFT = 8;
tree fenv_cr, fenv_sr, get_fpcr, set_fpcr, mask_cr, mask_sr;
tree ld_fenv_cr, ld_fenv_sr, masked_fenv_cr, masked_fenv_sr, hold_fnclex_cr;
tree hold_fnclex_sr, new_fenv_var, reload_fenv, restore_fnenv, get_fpsr, set_fpsr;
tree update_call, atomic_feraiseexcept, hold_fnclex, masked_fenv, ld_fenv;
/* Generate the equivalence of :
unsigned int fenv_cr;
fenv_cr = __builtin_aarch64_get_fpcr ();
unsigned int fenv_sr;
fenv_sr = __builtin_aarch64_get_fpsr ();
Now set all exceptions to non-stop
unsigned int mask_cr
= ~(AARCH64_FE_ALL_EXCEPT << AARCH64_FE_EXCEPT_SHIFT);
unsigned int masked_cr;
masked_cr = fenv_cr & mask_cr;
And clear all exception flags
unsigned int maske_sr = ~AARCH64_FE_ALL_EXCEPT;
unsigned int masked_cr;
masked_sr = fenv_sr & mask_sr;
__builtin_aarch64_set_cr (masked_cr);
__builtin_aarch64_set_sr (masked_sr); */
fenv_cr = create_tmp_var (unsigned_type_node, NULL);
fenv_sr = create_tmp_var (unsigned_type_node, NULL);
get_fpcr = aarch64_builtin_decls[AARCH64_BUILTIN_GET_FPCR];
set_fpcr = aarch64_builtin_decls[AARCH64_BUILTIN_SET_FPCR];
get_fpsr = aarch64_builtin_decls[AARCH64_BUILTIN_GET_FPSR];
set_fpsr = aarch64_builtin_decls[AARCH64_BUILTIN_SET_FPSR];
mask_cr = build_int_cst (unsigned_type_node,
~(AARCH64_FE_ALL_EXCEPT << AARCH64_FE_EXCEPT_SHIFT));
mask_sr = build_int_cst (unsigned_type_node,
~(AARCH64_FE_ALL_EXCEPT));
ld_fenv_cr = build2 (MODIFY_EXPR, unsigned_type_node,
fenv_cr, build_call_expr (get_fpcr, 0));
ld_fenv_sr = build2 (MODIFY_EXPR, unsigned_type_node,
fenv_sr, build_call_expr (get_fpsr, 0));
masked_fenv_cr = build2 (BIT_AND_EXPR, unsigned_type_node, fenv_cr, mask_cr);
masked_fenv_sr = build2 (BIT_AND_EXPR, unsigned_type_node, fenv_sr, mask_sr);
hold_fnclex_cr = build_call_expr (set_fpcr, 1, masked_fenv_cr);
hold_fnclex_sr = build_call_expr (set_fpsr, 1, masked_fenv_sr);
hold_fnclex = build2 (COMPOUND_EXPR, void_type_node, hold_fnclex_cr,
hold_fnclex_sr);
masked_fenv = build2 (COMPOUND_EXPR, void_type_node, masked_fenv_cr,
masked_fenv_sr);
ld_fenv = build2 (COMPOUND_EXPR, void_type_node, ld_fenv_cr, ld_fenv_sr);
*hold = build2 (COMPOUND_EXPR, void_type_node,
build2 (COMPOUND_EXPR, void_type_node, masked_fenv, ld_fenv),
hold_fnclex);
/* Store the value of masked_fenv to clear the exceptions:
__builtin_aarch64_set_fpsr (masked_fenv_sr); */
*clear = build_call_expr (set_fpsr, 1, masked_fenv_sr);
/* Generate the equivalent of :
unsigned int new_fenv_var;
new_fenv_var = __builtin_aarch64_get_fpsr ();
__builtin_aarch64_set_fpsr (fenv_sr);
__atomic_feraiseexcept (new_fenv_var); */
new_fenv_var = create_tmp_var (unsigned_type_node, NULL);
reload_fenv = build2 (MODIFY_EXPR, unsigned_type_node,
new_fenv_var, build_call_expr (get_fpsr, 0));
restore_fnenv = build_call_expr (set_fpsr, 1, fenv_sr);
atomic_feraiseexcept = builtin_decl_implicit (BUILT_IN_ATOMIC_FERAISEEXCEPT);
update_call = build_call_expr (atomic_feraiseexcept, 1,
fold_convert (integer_type_node, new_fenv_var));
*update = build2 (COMPOUND_EXPR, void_type_node,
build2 (COMPOUND_EXPR, void_type_node,
reload_fenv, restore_fnenv), update_call);
}
开发者ID:rockflying, 项目名称:gcc, 代码行数:98, 代码来源:aarch64-builtins.c
示例12: maybe_push_res_to_seq
tree
maybe_push_res_to_seq (code_helper rcode, tree type, tree *ops,
gimple_seq *seq, tree res)
{
if (rcode.is_tree_code ())
{
if (!res
&& gimple_simplified_result_is_gimple_val (rcode, ops))
return ops[0];
if (mprts_hook)
{
tree tem = mprts_hook (rcode, type, ops);
if (tem)
return tem;
}
if (!seq)
return NULL_TREE;
/* Play safe and do not allow abnormals to be mentioned in
newly created statements. */
if ((TREE_CODE (ops[0]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[0]))
|| (ops[1]
&& TREE_CODE (ops[1]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[1]))
|| (ops[2]
&& TREE_CODE (ops[2]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2]))
|| (COMPARISON_CLASS_P (ops[0])
&& ((TREE_CODE (TREE_OPERAND (ops[0], 0)) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0],
0)))
|| (TREE_CODE (TREE_OPERAND (ops[0], 1)) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0],
1))))))
return NULL_TREE;
if (!res)
{
if (gimple_in_ssa_p (cfun))
res = make_ssa_name (type);
else
res = create_tmp_reg (type);
}
maybe_build_generic_op (rcode, type, ops);
gimple *new_stmt = gimple_build_assign (res, rcode,
ops[0], ops[1], ops[2]);
gimple_seq_add_stmt_without_update (seq, new_stmt);
return res;
}
else
{
if (!seq)
return NULL_TREE;
combined_fn fn = rcode;
/* Play safe and do not allow abnormals to be mentioned in
newly created statements. */
unsigned nargs;
for (nargs = 0; nargs < 3; ++nargs)
{
if (!ops[nargs])
break;
if (TREE_CODE (ops[nargs]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[nargs]))
return NULL_TREE;
}
gcc_assert (nargs != 0);
gcall *new_stmt = NULL;
if (internal_fn_p (fn))
{
/* Generate the given function if we can. */
internal_fn ifn = as_internal_fn (fn);
new_stmt = build_call_internal (ifn, type, nargs, ops);
if (!new_stmt)
return NULL_TREE;
}
else
{
/* Find the function we want to call. */
tree decl = builtin_decl_implicit (as_builtin_fn (fn));
if (!decl)
return NULL;
/* We can't and should not emit calls to non-const functions. */
if (!(flags_from_decl_or_type (decl) & ECF_CONST))
return NULL;
new_stmt = gimple_build_call (decl, nargs, ops[0], ops[1], ops[2]);
}
if (!res)
{
if (gimple_in_ssa_p (cfun))
res = make_ssa_name (type);
else
res = create_tmp_reg (type);
}
gimple_call_set_lhs (new_stmt, res);
gimple_seq_add_stmt_without_update (seq, new_stmt);
return res;
}
}
开发者ID:MaxKellermann, 项目名称:gcc, 代码行数:99, 代码来源:gimple-match-head.c
示例13: gimple_resimplify3
static bool
gimple_resimplify3 (gimple_seq *seq,
code_helper *res_code, tree type, tree *res_ops,
tree (*valueize)(tree))
{
if (constant_for_folding (res_ops[0]) && constant_for_folding (res_ops[1])
&& constant_for_folding (res_ops[2]))
{
tree tem = NULL_TREE;
if (res_code->is_tree_code ())
tem = fold_ternary/*_to_constant*/ (*res_code, type, res_ops[0],
res_ops[1], res_ops[2]);
else
{
tree decl = builtin_decl_implicit (*res_code);
if (decl)
{
tem = fold_builtin_n (UNKNOWN_LOCATION, decl, res_ops, 3, false);
if (tem)
{
/* fold_builtin_n wraps the result inside a NOP_EXPR. */
STRIP_NOPS (tem);
tem = fold_convert (type, tem);
}
}
}
if (tem != NULL_TREE
&& CONSTANT_CLASS_P (tem))
{
res_ops[0] = tem;
res_ops[1] = NULL_TREE;
res_ops[2] = NULL_TREE;
*res_code = TREE_CODE (res_ops[0]);
return true;
}
}
/* Canonicalize operand order. */
bool canonicalized = false;
if (res_code->is_tree_code ()
&& commutative_ternary_tree_code (*res_code)
&& tree_swap_operands_p (res_ops[0], res_ops[1], false))
{
tree tem = res_ops[0];
res_ops[0] = res_ops[1];
res_ops[1] = tem;
canonicalized = true;
}
code_helper res_code2;
tree res_ops2[3] = {};
if (gimple_simplify (&res_code2, res_ops2, seq, valueize,
*res_code, type,
res_ops[0], res_ops[1], res_ops[2]))
{
*res_code = res_code2;
res_ops[0] = res_ops2[0];
res_ops[1] = res_ops2[1];
res_ops[2] = res_ops2[2];
return true;
}
return canonicalized;
}
开发者ID:angrysnail, 项目名称:gcc, 代码行数:64, 代码来源:gimple-match-head.c
示例14: maybe_push_res_to_seq
tree
maybe_push_res_to_seq (code_helper rcode, tree type, tree *ops,
gimple_seq *seq, tree res)
{
if (rcode.is_tree_code ())
{
if (!res
&& gimple_simplified_result_is_gimple_val (rcode, ops))
return ops[0];
if (mprts_hook)
{
tree tem = mprts_hook (rcode, type, ops);
if (tem)
return tem;
}
if (!seq)
return NULL_TREE;
/* Play safe and do not allow abnormals to be mentioned in
newly created statements. */
if ((TREE_CODE (ops[0]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[0]))
|| (ops[1]
&& TREE_CODE (ops[1]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[1]))
|| (ops[2]
&& TREE_CODE (ops[2]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2])))
return NULL_TREE;
if (!res)
res = make_ssa_name (type);
maybe_build_generic_op (rcode, type, &ops[0], ops[1], ops[2]);
gimple *new_stmt = gimple_build_assign (res, rcode,
ops[0], ops[1], ops[2]);
gimple_seq_add_stmt_without_update (seq, new_stmt);
return res;
}
else
{
if (!seq)
return NULL_TREE;
tree decl = builtin_decl_implicit (rcode);
if (!decl)
return NULL_TREE;
/* We can't and should not emit calls to non-const functions. */
if (!(flags_from_decl_or_type (decl) & ECF_CONST))
return NULL_TREE;
/* Play safe and do not allow abnormals to be mentioned in
newly created statements. */
unsigned nargs;
for (nargs = 0; nargs < 3; ++nargs)
{
if (!ops[nargs])
break;
if (TREE_CODE (ops[nargs]) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[nargs]))
return NULL_TREE;
}
gcc_assert (nargs != 0);
if (!res)
res = make_ssa_name (type);
gimple *new_stmt = gimple_build_call (decl, nargs, ops[0], ops[1], ops[2]);
gimple_call_set_lhs (new_stmt, res);
gimple_seq_add_stmt_without_update (seq, new_stmt);
return res;
}
}
开发者ID:jtramm, 项目名称:gcc, 代码行数:66, 代码来源:gimple-match-head.c
示例15: ortho_init
static bool
ortho_init (void)
{
tree n;
input_location = BUILTINS_LOCATION;
/* Create a global binding. Don't use push_binding, as neither a BLOCK nor
a BIND_EXPR are needed. */
push_binding (GLOBAL_BINDING);
build_common_tree_nodes (0, 0);
n = build_decl (input_location,
TYPE_DECL, get_identifier ("int"), integer_type_node);
pushdecl (n);
n = build_decl (input_location,
TYPE_DECL, get_identifier ("char"), char_type_node);
pushdecl (n);
/* Create alloca builtin. */
{
tree args_type = tree_cons (NULL_TREE, size_type_node, void_list_node);
tree func_type = build_function_type (ptr_type_node, args_type);
define_builtin ("__builtin_alloca", func_type,
BUILT_IN_ALLOCA, NULL, 0);
stack_alloc_function_ptr = build1
(ADDR_EXPR,
build_pointer_type (func_type),
builtin_decl_implicit (BUILT_IN_ALLOCA));
}
{
tree ptr_ftype = build_function_type (ptr_type_node, NULL_TREE);
define_builtin ("__builtin_stack_save", ptr_ftype,
BUILT_IN_STACK_SAVE, NULL, 0);
}
{
tree ftype_ptr = build_function_type_list (void_type_node,
ptr_type_node, NULL_TREE);
define_builtin ("__builtin_stack_restore", ftype_ptr,
BUILT_IN_STACK_RESTORE, NULL, 0);
}
{
tree ftype_ptr = build_function_type_list (void_type_node, NULL_TREE);
define_builtin ("__builtin_trap", ftype_ptr,
BUILT_IN_TRAP, NULL, ECF_NOTHROW | ECF_LEAF);
TREE_THIS_VOLATILE (builtin_decl_explicit (BUILT_IN_TRAP)) = 1;
}
{
REAL_VALUE_TYPE v;
REAL_VALUE_FROM_INT (v, 1, 0, DFmode);
real_ldexp (&fp_const_p5, &v, -1);
REAL_VALUE_FROM_INT (v, -1, -1, DFmode);
real_ldexp (&fp_const_m_p5, &v, -1);
REAL_VALUE_FROM_INT (fp_const_zero, 0, 0, DFmode);
}
build_common_builtin_nodes ();
// FIXME: this MAY remove the need for creating the builtins above...
// Evaluate tree.c / build_common_builtin_nodes (); for each in turn.
return true;
}
开发者ID:Jonsba, 项目名称:ghdl, 代码行数:75, 代码来源:ortho-lang.c
示例16: lower_builtin_setjmp
static void
lower_builtin_setjmp (gimple_stmt_iterator *gsi)
{
gimple *stmt = gsi_stmt (*gsi);
location_t loc = gimple_location (stmt);
tree cont_label = create_artificial_label (loc);
tree next_label = create_artificial_label (loc);
tree dest, t, arg;
gimple *g;
/* __builtin_setjmp_{setup,receiver} aren't ECF_RETURNS_TWICE and for RTL
these builtins are modelled as non-local label jumps to the label
that is passed to these two builtins, so pretend we have a non-local
label during GIMPLE passes too. See PR60003. */
cfun->has_nonlocal_label = 1;
/* NEXT_LABEL is the label __builtin_longjmp will jump to. Its address is
passed to both __builtin_setjmp_setup and __builtin_setjmp_receiver. */
FORCED_LABEL (next_label) = 1;
tree orig_dest = dest = gimple_call_lhs (stmt);
if (orig_dest && TREE_CODE (orig_dest) == SSA_NAME)
dest = create_tmp_reg (TREE_TYPE (orig_dest));
/* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */
arg = build_addr (next_label);
t = builtin_decl_implicit (BUILT_IN_SETJMP_SETUP);
g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg);
gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'DEST = 0' and insert. */
if (dest)
{
g = gimple_build_assign (dest, build_zero_cst (TREE_TYPE (dest)));
gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
}
/* Build 'goto CONT_LABEL' and insert. */
g = gimple_build_goto (cont_label);
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'NEXT_LABEL:' and insert. */
g = gimple_build_label (next_label);
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */
arg = build_addr (next_label);
t = builtin_decl_implicit (BUILT_IN_SETJMP_RECEIVER);
g = gimple_build_call (t, 1, arg);
gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'DEST = 1' and insert. */
if (dest)
{
g = gimple_build_assign (dest, fold_convert_loc (loc, TREE_TYPE (dest),
integer_one_node));
gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
}
/* Build 'CONT_LABEL:' and insert. */
g = gimple_build_label (cont_label);
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build orig_dest = dest if necessary. */
if (dest != orig_dest)
{
g = gimple_build_assign (orig_dest, dest);
gsi_insert_before (gsi, g, GSI_SAME_STMT);
}
/* Remove the call to __builtin_setjmp. */
gsi_remove (gsi, false);
}
开发者ID:KangDroid, 项目名称:gcc, 代码行数:81, 代码来源:gimple-low.c
示例17: lower_builtin_setjmp
static void
lower_builtin_setjmp (gimple_stmt_iterator *gsi)
{
gimple stmt = gsi_stmt (*gsi);
location_t loc = gimple_location (stmt);
tree cont_label = create_artificial_label (loc);
tree next_label = create_artificial_label (loc);
tree dest, t, arg;
gimple g;
/* NEXT_LABEL is the label __builtin_longjmp will jump to. Its address is
passed to both __builtin_setjmp_setup and __builtin_setjmp_receiver. */
FORCED_LABEL (next_label) = 1;
dest = gimple_call_lhs (stmt);
/* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */
arg = build_addr (next_label, current_function_decl);
t = builtin_decl_implicit (BUILT_IN_SETJMP_SETUP);
g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg);
gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'DEST = 0' and insert. */
if (dest)
{
g = gimple_build_assign (dest, build_zero_cst (TREE_TYPE (dest)));
gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
}
/* Build 'goto CONT_LABEL' and insert. */
g = gimple_build_goto (cont_label);
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'NEXT_LABEL:' and insert. */
g = gimple_build_label (next_label);
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */
arg = build_addr (next_label, current_function_decl);
t = builtin_decl_implicit (BUILT_IN_SETJMP_RECEIVER);
g = gimple_build_call (t, 1, arg);
gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'DEST = 1' and insert. */
if (dest)
{
g = gimple_build_assign (dest, fold_convert_loc (loc, TREE_TYPE (dest),
integer_one_node));
gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
}
/* Build 'CONT_LABEL:' and insert. */
g = gimple_build_label (cont_label);
gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Remove the call to __builtin_setjmp. */
gsi_remove (gsi, false);
}
开发者ID:hnaik, 项目名称:gcc, 代码行数:66, 代码来源:gimple-low.c
示例18: lower_function_body
static unsigned int
lower_function_body (void)
{
struct lower_data data;
gimple_seq body = gimple_body (current_function_decl);
gimple_seq lowered_body;
gimple_stmt_iterator i;
gimple bind;
tree t;
gimple x;
/* The gimplifier should've left a body of exactly one statement,
namely a GIMPLE_BIND. */
gcc_assert (gimple_seq_first (body) == gimple_seq_last (body)
&& gimple_code (gimple_seq_first_stmt (body)) == GIMPLE_BIND);
memset (&data, 0, sizeof (data));
data.block = DECL_INITIAL (current_function_decl);
BLOCK_SUBBLOCKS (data.block) = NULL_TREE;
BLOCK_CHAIN (data.block) = NULL_TREE;
TREE_ASM_WRITTEN (data.block) = 1;
data.return_statements.create (8);
bind = gimple_seq_first_stmt (body);
lowered_body = NULL;
gimple_seq_add_stmt (&lowered_body, bind);
i = gsi_start (lowered_body);
lower_gimple_bind (&i, &data);
i = gsi_last (lowered_body);
/* If the function falls off the end, we need a null return statement.
If we've already got one in the return_statements vector, we don't
need to do anything special. Otherwise build one by hand. */
if (gimple_seq_may_fallthru (lowered_body)
&& (data.return_statements.is_empty ()
|| gimple_return_retval (data.return_statements.last().stmt) != NULL))
{
x = gimple_build_return (NULL);
gimple_set_location (x, cfun->function_end_locus);
gimple_set_block (x, DECL_INITIAL (current_function_decl));
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
}
/* If we lowered any return statements, emit the representative
at the end of the function. */
while (!data.return_statements.is_empty ())
{
return_statements_t t = data.return_statements.pop ();
x = gimple_build_label (t.label);
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING);
}
/* If the function calls __builtin_setjmp, we need to emit the computed
goto that will serve as the unique dispatcher for all the receivers. */
if (data.calls_builtin_setjmp)
{
tree disp_label, disp_var, arg;
/* Build 'DISP_LABEL:' and insert. */
disp_label = create_artificial_label (cfun->function_end_locus);
/* This mark will create forward edges from every call site. */
DECL_NONLOCAL (disp_label) = 1;
cfun->has_nonlocal_label = 1;
x = gimple_build_label (disp_label);
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
/* Build 'DISP_VAR = __builtin_setjmp_dispatcher (DISP_LABEL);'
and insert. */
disp_var = create_tmp_var (ptr_type_node, "setjmpvar");
arg = build_addr (disp_label, current_function_decl);
t = builtin_decl_implicit (BUILT_IN_SETJMP_DISPATCHER);
x = gimple_build_call (t, 1, arg);
gimple_call_set_lhs (x, disp_var);
/* Build 'goto DISP_VAR;' and insert. */
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
x = gimple_build_goto (disp_var);
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
}
/* Once the old body has been lowered, replace it with the new
lowered sequence. */
gimple_set_body (current_function_decl, lowered_body);
gcc_assert (data.block == DECL_INITIAL (current_function_decl));
BLOCK_SUBBLOCKS (data.block)
= blocks_nreverse (BLOCK_SUBBLOCKS (data.block));
clear_block_marks (data.block);
data.return_statements.release ();
return 0;
}
开发者ID:hnaik, 项目名称:gcc, 代码行数:94, 代码来源:gimple-low.c
示例19: execute_fixup_cfg
unsigned int
execute_fixup_cfg (void)
{
basic_block bb;
gimple_stmt_iterator gsi;
int todo = gimple_in_ssa_p (cfun) ? TODO_verify_ssa : 0;
gcov_type count_scale;
edge e;
edge_iterator ei;
count_scale
= GCOV_COMPUTE_SCALE (cgraph_get_node (current_function_decl)->count,
ENTRY_BLOCK_PTR->count);
ENTRY_BLOCK_PTR->count = cgraph_get_node (current_function_decl)->count;
EXIT_BLOCK_PTR->count = apply_scale (EXIT_BLOCK_PTR->count,
count_scale);
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs)
e->count = apply_scale (e->count, count_scale);
FOR_EACH_BB (bb)
{
bb->count = apply_scale (bb->count, count_scale);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
tree decl = is_gimple_call (stmt)
? gimple_call_fndecl (stmt)
: NULL;
if (decl)
{
int flags = gimple_call_flags (stmt);
if (flags & (ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE))
{
if (gimple_purge_dead_abnormal_call_edges (bb))
todo |= TODO_cleanup_cfg;
if (gimple_in_ssa_p (cfun))
{
todo |= TODO_update_ssa | TODO_cleanup_cfg;
update_stmt (stmt);
}
}
if (flags & ECF_NORETURN
&& fixup_noreturn_call (stmt))
todo |= TODO_cleanup_cfg;
}
if (maybe_clean_eh_stmt (stmt)
&& gimple_purge_dead_eh_edges (bb))
todo |= TODO_cleanup_cfg;
}
FOR_EACH_EDGE (e, ei, bb->succs)
e->count = apply_scale (e->count, count_scale);
/* If we have a basic block with no successors that does not
end with a control statement or a noreturn call end it with
a call to __builtin_unreachable. This situation can occur
when inlining a noreturn call that does in fact return. */
if (EDGE_COUNT (bb->succs) == 0)
{
gimple stmt = last_stmt (bb);
if (!stmt
|| (!is_ctrl_stmt (stmt)
&& (!is_gimple_call (stmt)
|| (gimple_call_flags (stmt) & ECF_NORETURN) == 0)))
{
stmt = gimple_build_call
(builtin_decl_implicit (BUILT_IN_UNREACHABLE), 0);
gimple_stmt_iterator gsi = gsi_last_bb (bb);
gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
}
}
}
if (count_scale != REG_BR_PROB_BASE)
compute_function_frequency ();
/* We just processed all calls. */
if (cfun->gimple_df)
vec_free (MODIFIED_NORETURN_CALLS (cfun));
/* Dump a textual representation of the flowgraph. */
if (dump_file)
gimple_dump_cfg (dump_file, dump_flags);
if (current_loops
&& (todo & TODO_cleanup_cfg))
loops_state_set (LOOPS_NEED_FIXUP);
return todo;
}
开发者ID:wanggong, 项目名称:gcc, 代码行数:94, 代码来源:tree-optimize.c
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18148| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9634| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8161| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8538| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8440| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9360| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8410| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7848| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8395| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7387| 2022-11-06
请发表评论