这篇教程C++ vec_safe_push函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vec_safe_push函数的典型用法代码示例。如果您正苦于以下问题:C++ vec_safe_push函数的具体用法?C++ vec_safe_push怎么用?C++ vec_safe_push使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vec_safe_push函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: create_array_refsstatic vec<tree, va_gc> *create_array_refs (location_t loc, vec<vec<an_parts> > an_info, vec<an_loop_parts> an_loop_info, size_t size, size_t rank){ tree ind_mult, ind_incr; vec<tree, va_gc> *array_operand = NULL; for (size_t ii = 0; ii < size; ii++) if (an_info[ii][0].is_vector) { tree array_opr = an_info[ii][rank - 1].value; for (int s_jj = rank -1; s_jj >= 0; s_jj--) { tree start = cp_fold_convert (ptrdiff_type_node, an_info[ii][s_jj].start); tree stride = cp_fold_convert (ptrdiff_type_node, an_info[ii][s_jj].stride); tree var = cp_fold_convert (ptrdiff_type_node, an_loop_info[s_jj].var); ind_mult = build2 (MULT_EXPR, TREE_TYPE (var), var, stride); ind_incr = build2 (PLUS_EXPR, TREE_TYPE (var), start, ind_mult); /* Array [ start_index + (induction_var * stride)] */ array_opr = grok_array_decl (loc, array_opr, ind_incr, false); } vec_safe_push (array_operand, array_opr); } else vec_safe_push (array_operand, integer_one_node); return array_operand;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:31,
示例2: create_array_refsstatic vec<tree, va_gc> *create_array_refs (location_t loc, vec<vec<an_parts> > an_info, vec<an_loop_parts> an_loop_info, size_t size, size_t rank){ tree ind_mult, ind_incr; vec<tree, va_gc> *array_operand = NULL; for (size_t ii = 0; ii < size; ii++) if (an_info[ii][0].is_vector) { tree array_opr = an_info[ii][rank - 1].value; for (int s_jj = rank - 1; s_jj >= 0; s_jj--) { tree var = an_loop_info[s_jj].var; tree stride = an_info[ii][s_jj].stride; tree start = an_info[ii][s_jj].start; ind_mult = build2 (MULT_EXPR, TREE_TYPE (var), var, stride); ind_incr = build2 (PLUS_EXPR, TREE_TYPE (var), start, ind_mult); array_opr = build_array_ref (loc, array_opr, ind_incr); } vec_safe_push (array_operand, array_opr); } else /* This is just a dummy node to make sure both the list sizes for both array list and array operand list are the same. */ vec_safe_push (array_operand, integer_one_node); return array_operand;}
开发者ID:AHelper,项目名称:gcc,代码行数:27,
示例3: fsm_find_thread_pathstatic boolfsm_find_thread_path (basic_block start_bb, basic_block end_bb, vec<basic_block, va_gc> *&path, hash_set<basic_block> *visited_bbs, loop_p loop){ if (loop != start_bb->loop_father) return false; if (start_bb == end_bb) { vec_safe_push (path, start_bb); return true; } if (!visited_bbs->add (start_bb)) { edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, start_bb->succs) if (fsm_find_thread_path (e->dest, end_bb, path, visited_bbs, loop)) { vec_safe_push (path, start_bb); return true; } }
开发者ID:Droufte,项目名称:gcc,代码行数:25,
示例4: free_stmt_listvoidfree_stmt_list (tree t){ gcc_assert (!STATEMENT_LIST_HEAD (t)); gcc_assert (!STATEMENT_LIST_TAIL (t)); vec_safe_push (stmt_list_cache, t);}
开发者ID:crizeridsdf,项目名称:gcc,代码行数:7,
示例5: build_capture_proxytreebuild_capture_proxy (tree member){ tree var, object, fn, closure, name, lam, type; if (PACK_EXPANSION_P (member)) member = PACK_EXPANSION_PATTERN (member); closure = DECL_CONTEXT (member); fn = lambda_function (closure); lam = CLASSTYPE_LAMBDA_EXPR (closure); /* The proxy variable forwards to the capture field. */ object = build_fold_indirect_ref (DECL_ARGUMENTS (fn)); object = finish_non_static_data_member (member, object, NULL_TREE); if (REFERENCE_REF_P (object)) object = TREE_OPERAND (object, 0); /* Remove the __ inserted by add_capture. */ if (DECL_NORMAL_CAPTURE_P (member)) name = get_identifier (IDENTIFIER_POINTER (DECL_NAME (member)) + 2); else name = DECL_NAME (member); type = lambda_proxy_type (object); if (DECL_VLA_CAPTURE_P (member)) { /* Rebuild the VLA type from the pointer and maxindex. */ tree field = next_initializable_field (TYPE_FIELDS (type)); tree ptr = build_simple_component_ref (object, field); field = next_initializable_field (DECL_CHAIN (field)); tree max = build_simple_component_ref (object, field); type = build_cplus_array_type (TREE_TYPE (TREE_TYPE (ptr)), build_index_type (max)); type = build_reference_type (type); REFERENCE_VLA_OK (type) = true; object = convert (type, ptr); } var = build_decl (input_location, VAR_DECL, name, type); SET_DECL_VALUE_EXPR (var, object); DECL_HAS_VALUE_EXPR_P (var) = 1; DECL_ARTIFICIAL (var) = 1; TREE_USED (var) = 1; DECL_CONTEXT (var) = fn; if (name == this_identifier) { gcc_assert (LAMBDA_EXPR_THIS_CAPTURE (lam) == member); LAMBDA_EXPR_THIS_CAPTURE (lam) = var; } if (fn == current_function_decl) insert_capture_proxy (var); else vec_safe_push (LAMBDA_EXPR_PENDING_PROXIES (lam), var); return var;}
开发者ID:alisw,项目名称:gcc-toolchain,代码行数:60,
示例6: replace_invariant_exprstreereplace_invariant_exprs (tree *node){ size_t ix = 0; tree node_list = NULL_TREE; tree t = NULL_TREE, new_var = NULL_TREE, new_node; struct inv_list data; data.list_values = NULL; data.replacement = NULL; data.additional_tcodes = NULL; walk_tree (node, find_inv_trees, (void *)&data, NULL); if (vec_safe_length (data.list_values)) { node_list = push_stmt_list (); for (ix = 0; vec_safe_iterate (data.list_values, ix, &t); ix++) { new_var = build_decl (EXPR_LOCATION (t), VAR_DECL, NULL_TREE, TREE_TYPE (t)); gcc_assert (new_var != NULL_TREE && new_var != error_mark_node); new_node = build2 (MODIFY_EXPR, TREE_TYPE (t), new_var, t); add_stmt (new_node); vec_safe_push (data.replacement, new_var); } walk_tree (node, replace_inv_trees, (void *)&data, NULL); node_list = pop_stmt_list (node_list); } return node_list;}
开发者ID:AHelper,项目名称:gcc,代码行数:30,
示例7: unpack_ts_translation_unit_decl_value_fieldsstatic voidunpack_ts_translation_unit_decl_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr){ TRANSLATION_UNIT_LANGUAGE (expr) = xstrdup (bp_unpack_string (data_in, bp)); vec_safe_push (all_translation_units, expr);}
开发者ID:pdziepak,项目名称:gcc,代码行数:7,
示例8: push_stmt_listtreepush_stmt_list (void){ tree t; t = alloc_stmt_list (); vec_safe_push (stmt_list_stack, t); return t;}
开发者ID:Dasoccerguy,项目名称:gcc,代码行数:8,
示例9: kernexec_instrument_fptr_orstatic void kernexec_instrument_fptr_or(gimple_stmt_iterator *gsi){ gimple asm_or_stmt, call_stmt; tree old_fptr, new_fptr, input, output;#if BUILDING_GCC_VERSION <= 4007 VEC(tree, gc) *inputs = NULL; VEC(tree, gc) *outputs = NULL;#else vec<tree, va_gc> *inputs = NULL; vec<tree, va_gc> *outputs = NULL;#endif call_stmt = gsi_stmt(*gsi); old_fptr = gimple_call_fn(call_stmt); // create temporary fptr variable new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_or");#if BUILDING_GCC_VERSION <= 4007 add_referenced_var(new_fptr);#endif new_fptr = make_ssa_name(new_fptr, NULL); // build asm volatile("orq %%r10, %0/n/t" : "=r"(new_fptr) : "0"(old_fptr)); input = build_tree_list(NULL_TREE, build_string(2, "0")); input = chainon(NULL_TREE, build_tree_list(input, old_fptr)); output = build_tree_list(NULL_TREE, build_string(3, "=r")); output = chainon(NULL_TREE, build_tree_list(output, new_fptr));#if BUILDING_GCC_VERSION <= 4007 VEC_safe_push(tree, gc, inputs, input); VEC_safe_push(tree, gc, outputs, output);#else vec_safe_push(inputs, input); vec_safe_push(outputs, output);#endif asm_or_stmt = gimple_build_asm_vec("orq %%r10, %0/n/t", inputs, outputs, NULL, NULL); SSA_NAME_DEF_STMT(new_fptr) = asm_or_stmt; gimple_asm_set_volatile(asm_or_stmt, true); gsi_insert_before(gsi, asm_or_stmt, GSI_SAME_STMT); update_stmt(asm_or_stmt); // replace call stmt fn with the new fptr gimple_call_set_fn(call_stmt, new_fptr); update_stmt(call_stmt);}
开发者ID:garyvan,项目名称:openwrt-1.6,代码行数:44,
示例10: add_ssa_edgestatic voidadd_ssa_edge (tree var, bool is_varying){ imm_use_iterator iter; use_operand_p use_p; FOR_EACH_IMM_USE_FAST (use_p, iter, var) { gimple use_stmt = USE_STMT (use_p); if (prop_simulate_again_p (use_stmt) && !gimple_plf (use_stmt, STMT_IN_SSA_EDGE_WORKLIST)) { gimple_set_plf (use_stmt, STMT_IN_SSA_EDGE_WORKLIST, true); if (is_varying) vec_safe_push (varying_ssa_edges, use_stmt); else vec_safe_push (interesting_ssa_edges, use_stmt); } }
开发者ID:Roffi,项目名称:gcc,代码行数:20,
示例11: get_odr_typeodr_typeget_odr_type (tree type, bool insert){ odr_type_d **slot; odr_type val; hashval_t hash; type = TYPE_MAIN_VARIANT (type); gcc_checking_assert (TYPE_MAIN_VARIANT (type) == type); hash = hash_type_name (type); slot = odr_hash.find_slot_with_hash (type, hash, insert ? INSERT : NO_INSERT); if (!slot) return NULL; /* See if we already have entry for type. */ if (*slot) { val = *slot; /* With LTO we need to support multiple tree representation of the same ODR type. */ if (val->type != type) add_type_duplicate (val, type); } else { tree binfo = TYPE_BINFO (type); unsigned int i; val = ggc_alloc_cleared_odr_type_d (); val->type = type; val->bases = vNULL; val->derived_types = vNULL; val->anonymous_namespace = type_in_anonymous_namespace_p (type); *slot = val; for (i = 0; i < BINFO_N_BASE_BINFOS (binfo); i++) /* For now record only polymorphic types. other are pointless for devirtualization and we can not precisely determine ODR equivalency of these during LTO. */ if (polymorphic_type_binfo_p (BINFO_BASE_BINFO (binfo, i))) { odr_type base = get_odr_type (BINFO_TYPE (BINFO_BASE_BINFO (binfo, i)), true); base->derived_types.safe_push (val); val->bases.safe_push (base); } /* First record bases, then add into array so ids are increasing. */ if (odr_types_ptr) val->id = odr_types.length (); vec_safe_push (odr_types_ptr, val); } return val;}
开发者ID:Nodplus,项目名称:gcc,代码行数:54,
示例12: release_phi_nodevoidrelease_phi_node (gimple phi){ size_t bucket; size_t len = gimple_phi_capacity (phi); size_t x; for (x = 0; x < gimple_phi_num_args (phi); x++) { use_operand_p imm; imm = gimple_phi_arg_imm_use_ptr (phi, x); delink_imm_use (imm); } bucket = len > NUM_BUCKETS - 1 ? NUM_BUCKETS - 1 : len; bucket -= 2; vec_safe_push (free_phinodes[bucket], phi); free_phinode_count++;}
开发者ID:andikleen,项目名称:gcc,代码行数:19,
示例13: redirect_edge_var_map_addvoidredirect_edge_var_map_add (edge e, tree result, tree def, source_location locus){ void **slot; edge_var_map_vector *head; edge_var_map new_node; if (edge_var_maps == NULL) edge_var_maps = pointer_map_create (); slot = pointer_map_insert (edge_var_maps, e); head = (edge_var_map_vector *) *slot; if (!head) vec_safe_reserve (head, 5); new_node.def = def; new_node.result = result; new_node.locus = locus; vec_safe_push (head, new_node); *slot = head;}
开发者ID:acoxepochlabs,项目名称:gcc,代码行数:21,
示例14: replace_invariant_exprsstatic treereplace_invariant_exprs (tree *node){ size_t ix = 0; tree node_list = NULL_TREE; tree t = NULL_TREE, new_var = NULL_TREE; struct inv_list data; data.list_values = NULL; data.replacement = NULL; data.additional_tcodes = NULL; cp_walk_tree (node, find_inv_trees, (void *) &data, NULL); if (vec_safe_length (data.list_values)) { node_list = push_stmt_list (); for (ix = 0; vec_safe_iterate (data.list_values, ix, &t); ix++) { /* Sometimes, when comma_expr has a function call in it, it will typecast it to void. Find_inv_trees finds those nodes and so if it void type, then don't bother creating a new var to hold the return value. */ if (VOID_TYPE_P (TREE_TYPE (t))) { finish_expr_stmt (t); new_var = void_node; } else new_var = get_temp_regvar (TREE_TYPE (t), t); vec_safe_push (data.replacement, new_var); } cp_walk_tree (node, replace_inv_trees, (void *) &data, NULL); node_list = pop_stmt_list (node_list); } return node_list;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:36,
示例15: expand_sec_reduce_builtin//.........这里部分代码省略......... switch (an_type) { case BUILT_IN_CILKPLUS_SEC_REDUCE_ADD: case BUILT_IN_CILKPLUS_SEC_REDUCE_MUL: new_expr = build_x_modify_expr (location, *new_var, code, func_parm, tf_warning_or_error); break; case BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_ZERO: case BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_NONZERO: case BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_ZERO: case BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_NONZERO: /* In all these cases, assume the false case is true and as soon as we find a true case, set the true flag on and latch it in. */ new_yes_expr = build_x_modify_expr (location, *new_var, NOP_EXPR, cond_init, tf_warning_or_error); new_no_expr = build_x_modify_expr (location, *new_var, NOP_EXPR, *new_var, tf_warning_or_error); new_cond_expr = build_x_binary_op (location, code, func_parm, TREE_CODE (func_parm), comp_node, TREE_CODE (comp_node), NULL, tf_warning_or_error); new_expr = build_x_conditional_expr (location, new_cond_expr, new_yes_expr, new_no_expr, tf_warning_or_error); break; case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX: case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN: new_cond_expr = build_x_binary_op (location, code, *new_var, TREE_CODE (*new_var), func_parm, TREE_CODE (func_parm), NULL, tf_warning_or_error); new_expr = build_x_modify_expr (location, *new_var, NOP_EXPR, func_parm, tf_warning_or_error); break; case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND: case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND: new_yes_expr = build_x_modify_expr (location, array_ind_value, NOP_EXPR, func_parm, tf_warning_or_error); new_no_expr = build_x_modify_expr (location, array_ind_value, NOP_EXPR, array_ind_value, tf_warning_or_error); if (list_size > 1) new_yes_ind = build_x_modify_expr (location, *new_var, NOP_EXPR, an_loop_info[0].var, tf_warning_or_error); else new_yes_ind = build_x_modify_expr (location, *new_var, NOP_EXPR, TREE_OPERAND (array_op0, 1), tf_warning_or_error); new_no_ind = build_x_modify_expr (location, *new_var, NOP_EXPR, *new_var, tf_warning_or_error); new_yes_list = alloc_stmt_list (); append_to_statement_list (new_yes_ind, &new_yes_list); append_to_statement_list (new_yes_expr, &new_yes_list); new_no_list = alloc_stmt_list (); append_to_statement_list (new_no_ind, &new_no_list); append_to_statement_list (new_no_expr, &new_no_list); new_cond_expr = build_x_binary_op (location, code, array_ind_value, TREE_CODE (array_ind_value), func_parm, TREE_CODE (func_parm), NULL, tf_warning_or_error); new_expr = build_x_conditional_expr (location, new_cond_expr, new_yes_list, new_no_list, tf_warning_or_error); break; case BUILT_IN_CILKPLUS_SEC_REDUCE: case BUILT_IN_CILKPLUS_SEC_REDUCE_MUTATING: func_args = make_tree_vector (); if (an_type == BUILT_IN_CILKPLUS_SEC_REDUCE) vec_safe_push (func_args, *new_var); else vec_safe_push (func_args, identity_value); vec_safe_push (func_args, func_parm); new_expr = finish_call_expr (call_fn, &func_args, false, true, tf_warning_or_error); if (an_type == BUILT_IN_CILKPLUS_SEC_REDUCE) new_expr = build_x_modify_expr (location, *new_var, NOP_EXPR, new_expr, tf_warning_or_error); release_tree_vector (func_args); break; default: gcc_unreachable (); } an_init = pop_stmt_list (an_init); append_to_statement_list (an_init, &loop_with_init); body = new_expr; for (ii = 0; ii < rank; ii++) { tree new_loop = push_stmt_list (); create_an_loop (an_loop_info[ii].ind_init, an_loop_info[ii].cmp, an_loop_info[ii].incr, body); body = pop_stmt_list (new_loop); } append_to_statement_list (body, &loop_with_init); release_vec_vec (an_info); return loop_with_init;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:101,
示例16: expand_unary_array_notation_exprsstatic treeexpand_unary_array_notation_exprs (tree orig_stmt){ vec<tree, va_gc> *array_list = NULL, *array_operand = NULL; size_t list_size = 0, rank = 0, ii = 0; tree body; tree builtin_loop, stmt = NULL_TREE, new_var = NULL_TREE; location_t location = EXPR_LOCATION (orig_stmt); tree an_init, loop_with_init = alloc_stmt_list (); vec<vec<an_parts> > an_info = vNULL; auto_vec<an_loop_parts> an_loop_info; if (!find_rank (location, orig_stmt, orig_stmt, true, &rank)) return error_mark_node; if (rank == 0) return orig_stmt; extract_array_notation_exprs (orig_stmt, false, &array_list); list_size = vec_safe_length (array_list); location = EXPR_LOCATION (orig_stmt); stmt = NULL_TREE; for (ii = 0; ii < list_size; ii++) if (TREE_CODE ((*array_list)[ii]) == CALL_EXPR || TREE_CODE ((*array_list)[ii]) == AGGR_INIT_EXPR) { tree list_node = (*array_list)[ii]; builtin_loop = expand_sec_reduce_builtin (list_node, &new_var); if (builtin_loop == error_mark_node) return error_mark_node; else if (builtin_loop) { vec<tree, va_gc> *sub_list = NULL, *new_var_list = NULL; stmt = alloc_stmt_list (); append_to_statement_list (builtin_loop, &stmt); vec_safe_push (sub_list, list_node); vec_safe_push (new_var_list, new_var); replace_array_notations (&orig_stmt, false, sub_list, new_var_list); } } if (stmt != NULL_TREE) append_to_statement_list (finish_expr_stmt (orig_stmt), &stmt); else stmt = orig_stmt; rank = 0; list_size = 0; array_list = NULL; extract_array_notation_exprs (stmt, true, &array_list); list_size = vec_safe_length (array_list); if (!find_rank (EXPR_LOCATION (stmt), stmt, stmt, true, &rank)) return error_mark_node; if (rank == 0 || list_size == 0) return stmt; an_loop_info.safe_grow_cleared (rank); an_init = push_stmt_list (); /* Assign the array notation components to variable so that they can satisfy the exec-once rule. */ for (ii = 0; ii < list_size; ii++) { tree array_node = (*array_list)[ii]; make_triplet_val_inv (&ARRAY_NOTATION_START (array_node)); make_triplet_val_inv (&ARRAY_NOTATION_LENGTH (array_node)); make_triplet_val_inv (&ARRAY_NOTATION_STRIDE (array_node)); } cilkplus_extract_an_triplets (array_list, list_size, rank, &an_info); for (ii = 0; ii < rank; ii++) { tree typ = ptrdiff_type_node; an_loop_info[ii].var = create_temporary_var (typ); add_decl_expr (an_loop_info[ii].var); an_loop_info[ii].ind_init = build_x_modify_expr (location, an_loop_info[ii].var, INIT_EXPR, build_zero_cst (typ), tf_warning_or_error); } array_operand = create_array_refs (location, an_info, an_loop_info, list_size, rank); replace_array_notations (&stmt, true, array_list, array_operand); create_cmp_incr (location, &an_loop_info, rank, an_info, tf_warning_or_error); an_init = pop_stmt_list (an_init); append_to_statement_list (an_init, &loop_with_init); body = stmt; for (ii = 0; ii < rank; ii++) { tree new_loop = push_stmt_list (); create_an_loop (an_loop_info[ii].ind_init, an_loop_info[ii].cmp, an_loop_info[ii].incr, body); body = pop_stmt_list (new_loop); } append_to_statement_list (body, &loop_with_init); release_vec_vec (an_info); return loop_with_init;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:97,
示例17: maybe_add_lambda_conv_op//.........这里部分代码省略......... { tree new_node = copy_node (src); if (!fn_args) fn_args = tgt = new_node; else { TREE_CHAIN (tgt) = new_node; tgt = new_node; } mark_exp_read (tgt); if (generic_lambda_p) { if (DECL_PACK_P (tgt)) { tree a = make_pack_expansion (tgt); if (decltype_call) CALL_EXPR_ARG (decltype_call, ix) = copy_node (a); PACK_EXPANSION_LOCAL_P (a) = true; CALL_EXPR_ARG (call, ix) = a; } else { tree a = convert_from_reference (tgt); CALL_EXPR_ARG (call, ix) = a; if (decltype_call) CALL_EXPR_ARG (decltype_call, ix) = copy_node (a); } ++ix; } else vec_safe_push (direct_argvec, tgt); src = TREE_CHAIN (src); } } if (generic_lambda_p) { if (decltype_call) { ++processing_template_decl; fn_result = finish_decltype_type (decltype_call, /*id_expression_or_member_access_p=*/false, tf_warning_or_error); --processing_template_decl; } } else call = build_call_a (callop, direct_argvec->length (), direct_argvec->address ()); CALL_FROM_THUNK_P (call) = 1; tree stattype = build_function_type (fn_result, FUNCTION_ARG_CHAIN (callop)); /* First build up the conversion op. */ tree rettype = build_pointer_type (stattype); tree name = mangle_conv_op_name_for_type (rettype); tree thistype = cp_build_qualified_type (type, TYPE_QUAL_CONST); tree fntype = build_method_type_directly (thistype, rettype, void_list_node);
开发者ID:nguyentu1602,项目名称:gcc,代码行数:67,
示例18: fix_conditional_array_notations_1static treefix_conditional_array_notations_1 (tree stmt){ vec<tree, va_gc> *array_list = NULL, *array_operand = NULL; size_t list_size = 0; tree cond = NULL_TREE, builtin_loop = NULL_TREE, new_var = NULL_TREE; size_t rank = 0, ii = 0; tree loop_init; location_t location = EXPR_LOCATION (stmt); tree body = NULL_TREE, loop_with_init = alloc_stmt_list (); vec<vec<an_parts> > an_info = vNULL; vec<an_loop_parts> an_loop_info = vNULL; if (TREE_CODE (stmt) == COND_EXPR) cond = COND_EXPR_COND (stmt); else if (TREE_CODE (stmt) == SWITCH_EXPR) cond = SWITCH_COND (stmt); else if (truth_value_p (TREE_CODE (stmt))) cond = TREE_OPERAND (stmt, 0); else /* Otherwise dont even touch the statement. */ return stmt; if (!find_rank (location, cond, cond, false, &rank)) return error_mark_node; extract_array_notation_exprs (stmt, false, &array_list); loop_init = push_stmt_list (); for (ii = 0; ii < vec_safe_length (array_list); ii++) { tree array_node = (*array_list)[ii]; if (TREE_CODE (array_node) == CALL_EXPR) { builtin_loop = fix_builtin_array_notation_fn (array_node, &new_var); if (builtin_loop == error_mark_node) { add_stmt (error_mark_node); pop_stmt_list (loop_init); return loop_init; } else if (builtin_loop) { vec <tree, va_gc>* sub_list = NULL, *new_var_list = NULL; vec_safe_push (sub_list, array_node); vec_safe_push (new_var_list, new_var); add_stmt (builtin_loop); replace_array_notations (&stmt, false, sub_list, new_var_list); } } } if (!find_rank (location, stmt, stmt, true, &rank)) { pop_stmt_list (loop_init); return error_mark_node; } if (rank == 0) { add_stmt (stmt); pop_stmt_list (loop_init); return loop_init; } extract_array_notation_exprs (stmt, true, &array_list); if (vec_safe_length (array_list) == 0) return stmt; list_size = vec_safe_length (array_list); an_loop_info.safe_grow_cleared (rank); for (ii = 0; ii < list_size; ii++) if ((*array_list)[ii] && TREE_CODE ((*array_list)[ii]) == ARRAY_NOTATION_REF) { tree array_node = (*array_list)[ii]; make_triplet_val_inv (location, &ARRAY_NOTATION_START (array_node)); make_triplet_val_inv (location, &ARRAY_NOTATION_LENGTH (array_node)); make_triplet_val_inv (location, &ARRAY_NOTATION_STRIDE (array_node)); } cilkplus_extract_an_triplets (array_list, list_size, rank, &an_info); for (ii = 0; ii < rank; ii++) { an_loop_info[ii].var = create_tmp_var (integer_type_node); an_loop_info[ii].ind_init = build_modify_expr (location, an_loop_info[ii].var, TREE_TYPE (an_loop_info[ii].var), NOP_EXPR, location, build_int_cst (TREE_TYPE (an_loop_info[ii].var), 0), TREE_TYPE (an_loop_info[ii].var)); } array_operand = create_array_refs (location, an_info, an_loop_info, list_size, rank); replace_array_notations (&stmt, true, array_list, array_operand); create_cmp_incr (location, &an_loop_info, rank, an_info); loop_init = pop_stmt_list (loop_init); body = stmt; append_to_statement_list_force (loop_init, &loop_with_init); for (ii = 0; ii < rank; ii++) {//.........这里部分代码省略.........
开发者ID:AHelper,项目名称:gcc,代码行数:101,
示例19: build_array_notation_exprtreebuild_array_notation_expr (location_t location, tree lhs, tree lhs_origtype, enum tree_code modifycode, location_t rhs_loc, tree rhs, tree rhs_origtype){ bool found_builtin_fn = false; tree array_expr_lhs = NULL_TREE, array_expr_rhs = NULL_TREE; tree array_expr = NULL_TREE; tree an_init = NULL_TREE; vec<tree> cond_expr = vNULL; tree body, loop_with_init = alloc_stmt_list(); tree scalar_mods = NULL_TREE; vec<tree, va_gc> *rhs_array_operand = NULL, *lhs_array_operand = NULL; size_t lhs_rank = 0, rhs_rank = 0; size_t ii = 0; vec<tree, va_gc> *lhs_list = NULL, *rhs_list = NULL; tree new_modify_expr, new_var = NULL_TREE, builtin_loop = NULL_TREE; size_t rhs_list_size = 0, lhs_list_size = 0; vec<vec<an_parts> > lhs_an_info = vNULL, rhs_an_info = vNULL; vec<an_loop_parts> lhs_an_loop_info = vNULL, rhs_an_loop_info = vNULL; /* If either of this is true, an error message must have been send out already. Not necessary to send out multiple error messages. */ if (lhs == error_mark_node || rhs == error_mark_node) return error_mark_node; if (!find_rank (location, rhs, rhs, false, &rhs_rank)) return error_mark_node; extract_array_notation_exprs (rhs, false, &rhs_list); rhs_list_size = vec_safe_length (rhs_list); an_init = push_stmt_list (); if (rhs_rank) { scalar_mods = replace_invariant_exprs (&rhs); if (scalar_mods) add_stmt (scalar_mods); } for (ii = 0; ii < rhs_list_size; ii++) { tree rhs_node = (*rhs_list)[ii]; if (TREE_CODE (rhs_node) == CALL_EXPR) { builtin_loop = fix_builtin_array_notation_fn (rhs_node, &new_var); if (builtin_loop == error_mark_node) { pop_stmt_list (an_init); return error_mark_node; } else if (builtin_loop) { add_stmt (builtin_loop); found_builtin_fn = true; if (new_var) { vec<tree, va_gc> *rhs_sub_list = NULL, *new_var_list = NULL; vec_safe_push (rhs_sub_list, rhs_node); vec_safe_push (new_var_list, new_var); replace_array_notations (&rhs, false, rhs_sub_list, new_var_list); } } } } lhs_rank = 0; rhs_rank = 0; if (!find_rank (location, lhs, lhs, true, &lhs_rank)) { pop_stmt_list (an_init); return error_mark_node; } if (!find_rank (location, rhs, rhs, true, &rhs_rank)) { pop_stmt_list (an_init); return error_mark_node; } if (lhs_rank == 0 && rhs_rank == 0) { if (found_builtin_fn) { new_modify_expr = build_modify_expr (location, lhs, lhs_origtype, modifycode, rhs_loc, rhs, rhs_origtype); add_stmt (new_modify_expr); pop_stmt_list (an_init); return an_init; } else { pop_stmt_list (an_init); return NULL_TREE; } } rhs_list_size = 0; rhs_list = NULL; extract_array_notation_exprs (rhs, true, &rhs_list); extract_array_notation_exprs (lhs, true, &lhs_list);//.........这里部分代码省略.........
开发者ID:AHelper,项目名称:gcc,代码行数:101,
示例20: ubsan_create_datatreeubsan_create_data (const char *name, const location_t *ploc, const struct ubsan_mismatch_data *mismatch, ...){ va_list args; tree ret, t; tree fields[5]; vec<tree, va_gc> *saved_args = NULL; size_t i = 0; location_t loc = UNKNOWN_LOCATION; /* Firstly, create a pointer to type descriptor type. */ tree td_type = ubsan_type_descriptor_type (); TYPE_READONLY (td_type) = 1; td_type = build_pointer_type (td_type); /* Create the structure type. */ ret = make_node (RECORD_TYPE); if (ploc != NULL) { loc = LOCATION_LOCUS (*ploc); fields[i] = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE, ubsan_source_location_type ()); DECL_CONTEXT (fields[i]) = ret; i++; } va_start (args, mismatch); for (t = va_arg (args, tree); t != NULL_TREE; i++, t = va_arg (args, tree)) { gcc_checking_assert (i < 3); /* Save the tree arguments for later use. */ vec_safe_push (saved_args, t); fields[i] = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE, td_type); DECL_CONTEXT (fields[i]) = ret; if (i) DECL_CHAIN (fields[i - 1]) = fields[i]; } va_end (args); if (mismatch != NULL) { /* We have to add two more decls. */ fields[i] = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE, pointer_sized_int_node); DECL_CONTEXT (fields[i]) = ret; DECL_CHAIN (fields[i - 1]) = fields[i]; i++; fields[i] = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE, unsigned_char_type_node); DECL_CONTEXT (fields[i]) = ret; DECL_CHAIN (fields[i - 1]) = fields[i]; i++; } TYPE_FIELDS (ret) = fields[0]; TYPE_NAME (ret) = get_identifier (name); layout_type (ret); /* Now, fill in the type. */ char tmp_name[32]; static unsigned int ubsan_var_id_num; ASM_GENERATE_INTERNAL_LABEL (tmp_name, "Lubsan_data", ubsan_var_id_num++); tree var = build_decl (UNKNOWN_LOCATION, VAR_DECL, get_identifier (tmp_name), ret); TREE_STATIC (var) = 1; TREE_PUBLIC (var) = 0; DECL_ARTIFICIAL (var) = 1; DECL_IGNORED_P (var) = 1; DECL_EXTERNAL (var) = 0; vec<constructor_elt, va_gc> *v; vec_alloc (v, i); tree ctor = build_constructor (ret, v); /* If desirable, set the __ubsan_source_location element. */ if (ploc != NULL) CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, ubsan_source_location (loc)); size_t nelts = vec_safe_length (saved_args); for (i = 0; i < nelts; i++) { t = (*saved_args)[i]; CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, t); } if (mismatch != NULL) { /* Append the pointer data. */ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, mismatch->align); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, mismatch->ckind); } TREE_CONSTANT (ctor) = 1; TREE_STATIC (ctor) = 1; DECL_INITIAL (var) = ctor; varpool_finalize_decl (var);//.........这里部分代码省略.........
开发者ID:acoxepochlabs,项目名称:gcc,代码行数:101,
示例21: expand_an_in_modify_exprstatic treeexpand_an_in_modify_expr (location_t location, tree lhs, enum tree_code modifycode, tree rhs, tsubst_flags_t complain){ tree array_expr_lhs = NULL_TREE, array_expr_rhs = NULL_TREE; tree array_expr = NULL_TREE; tree body = NULL_TREE; auto_vec<tree> cond_expr; vec<tree, va_gc> *lhs_array_operand = NULL, *rhs_array_operand = NULL; size_t lhs_rank = 0, rhs_rank = 0, ii = 0; vec<tree, va_gc> *rhs_list = NULL, *lhs_list = NULL; size_t rhs_list_size = 0, lhs_list_size = 0; tree new_modify_expr, new_var = NULL_TREE, builtin_loop, scalar_mods; bool found_builtin_fn = false; tree an_init, loop_with_init = alloc_stmt_list (); vec<vec<an_parts> > lhs_an_info = vNULL, rhs_an_info = vNULL; auto_vec<an_loop_parts> lhs_an_loop_info, rhs_an_loop_info; tree lhs_len, rhs_len; if (!find_rank (location, rhs, rhs, false, &rhs_rank)) return error_mark_node; extract_array_notation_exprs (rhs, false, &rhs_list); rhs_list_size = vec_safe_length (rhs_list); an_init = push_stmt_list (); if (rhs_rank) { scalar_mods = replace_invariant_exprs (&rhs); if (scalar_mods) finish_expr_stmt (scalar_mods); } for (ii = 0; ii < rhs_list_size; ii++) { tree rhs_node = (*rhs_list)[ii]; if (TREE_CODE (rhs_node) == CALL_EXPR) { builtin_loop = expand_sec_reduce_builtin (rhs_node, &new_var); if (builtin_loop == error_mark_node) return error_mark_node; else if (builtin_loop) { finish_expr_stmt (builtin_loop); found_builtin_fn = true; if (new_var) { vec <tree, va_gc> *rhs_sub_list = NULL, *new_var_list = NULL; vec_safe_push (rhs_sub_list, rhs_node); vec_safe_push (new_var_list, new_var); replace_array_notations (&rhs, false, rhs_sub_list, new_var_list); } } } } lhs_rank = 0; rhs_rank = 0; if (!find_rank (location, lhs, lhs, true, &lhs_rank) || !find_rank (location, rhs, rhs, true, &rhs_rank)) { pop_stmt_list (an_init); return error_mark_node; } /* If both are scalar, then the only reason why we will get this far is if there is some array notations inside it and was using a builtin array notation functions. If so, we have already broken those guys up and now a simple build_x_modify_expr would do. */ if (lhs_rank == 0 && rhs_rank == 0) { if (found_builtin_fn) { new_modify_expr = build_x_modify_expr (location, lhs, modifycode, rhs, complain); finish_expr_stmt (new_modify_expr); pop_stmt_list (an_init); return an_init; } else gcc_unreachable (); } /* If for some reason location is not set, then find if LHS or RHS has location info. If so, then use that so we atleast have an idea. */ if (location == UNKNOWN_LOCATION) { if (EXPR_LOCATION (lhs) != UNKNOWN_LOCATION) location = EXPR_LOCATION (lhs); else if (EXPR_LOCATION (rhs) != UNKNOWN_LOCATION) location = EXPR_LOCATION (rhs); } /* We need this when we have a scatter issue. */ extract_array_notation_exprs (lhs, true, &lhs_list); rhs_list = NULL; extract_array_notation_exprs (rhs, true, &rhs_list); rhs_list_size = vec_safe_length (rhs_list); lhs_list_size = vec_safe_length (lhs_list); if (lhs_rank == 0 && rhs_rank != 0) {//.........这里部分代码省略.........
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:101,
示例22: cp_expand_cond_array_notations//.........这里部分代码省略......... { size_t left_rank = 0, right_rank = 0; tree left_expr = TREE_OPERAND (orig_stmt, 0); tree right_expr = TREE_OPERAND (orig_stmt, 1); if (!find_rank (EXPR_LOCATION (left_expr), left_expr, left_expr, true, &left_rank) || !find_rank (EXPR_LOCATION (right_expr), right_expr, right_expr, true, &right_rank)) return error_mark_node; if (right_rank == 0 && left_rank == 0) return orig_stmt; } if (!find_rank (EXPR_LOCATION (orig_stmt), orig_stmt, orig_stmt, true, &rank)) return error_mark_node; if (rank == 0) return orig_stmt; extract_array_notation_exprs (orig_stmt, false, &array_list); stmt = alloc_stmt_list (); for (ii = 0; ii < vec_safe_length (array_list); ii++) { tree array_node = (*array_list)[ii]; if (TREE_CODE (array_node) == CALL_EXPR || TREE_CODE (array_node) == AGGR_INIT_EXPR) { builtin_loop = expand_sec_reduce_builtin (array_node, &new_var); if (builtin_loop == error_mark_node) finish_expr_stmt (error_mark_node); else if (new_var) { vec<tree, va_gc> *sub_list = NULL, *new_var_list = NULL; vec_safe_push (sub_list, array_node); vec_safe_push (new_var_list, new_var); replace_array_notations (&orig_stmt, false, sub_list, new_var_list); append_to_statement_list (builtin_loop, &stmt); } } } append_to_statement_list (orig_stmt, &stmt); rank = 0; array_list = NULL; if (!find_rank (EXPR_LOCATION (stmt), stmt, stmt, true, &rank)) return error_mark_node; if (rank == 0) return stmt; extract_array_notation_exprs (stmt, true, &array_list); list_size = vec_safe_length (array_list); if (list_size == 0) return stmt; location = EXPR_LOCATION (orig_stmt); list_size = vec_safe_length (array_list); an_loop_info.safe_grow_cleared (rank); an_init = push_stmt_list (); /* Assign the array notation components to variable so that they can satisfy the exec-once rule. */ for (ii = 0; ii < list_size; ii++) { tree anode = (*array_list)[ii]; make_triplet_val_inv (&ARRAY_NOTATION_START (anode));
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:67,
示例23: add_type_duplicatestatic voidadd_type_duplicate (odr_type val, tree type){ if (!val->types_set) val->types_set = pointer_set_create (); /* See if this duplicate is new. */ if (!pointer_set_insert (val->types_set, type)) { bool merge = true; bool base_mismatch = false; gcc_assert (in_lto_p); vec_safe_push (val->types, type); unsigned int i,j; /* First we compare memory layout. */ if (!types_compatible_p (val->type, type)) { merge = false; if (BINFO_VTABLE (TYPE_BINFO (val->type)) && warning_at (DECL_SOURCE_LOCATION (TYPE_NAME (type)), 0, "type %qD violates one definition rule ", type)) inform (DECL_SOURCE_LOCATION (TYPE_NAME (val->type)), "a type with the same name but different layout is " "defined in another translation unit"); if (cgraph_dump_file) { fprintf (cgraph_dump_file, "ODR violation or merging or ODR type bug?/n"); print_node (cgraph_dump_file, "", val->type, 0); putc ('/n',cgraph_dump_file); print_node (cgraph_dump_file, "", type, 0); putc ('/n',cgraph_dump_file); } } /* Next sanity check that bases are the same. If not, we will end up producing wrong answers. */ for (j = 0, i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (type)); i++) if (polymorphic_type_binfo_p (BINFO_BASE_BINFO (TYPE_BINFO (type), i))) { odr_type base = get_odr_type (BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type), i)), true); if (val->bases.length () <= j || val->bases[j] != base) base_mismatch = true; j++; } if (base_mismatch) { merge = false; if (warning_at (DECL_SOURCE_LOCATION (TYPE_NAME (type)), 0, "type %qD violates one definition rule ", type)) inform (DECL_SOURCE_LOCATION (TYPE_NAME (val->type)), "a type with the same name but different bases is " "defined in another translation unit"); if (cgraph_dump_file) { fprintf (cgraph_dump_file, "ODR bse violation or merging bug?/n"); print_node (cgraph_dump_file, "", val->type, 0); putc ('/n',cgraph_dump_file); print_node (cgraph_dump_file, "", type, 0); putc ('/n',cgraph_dump_file); } } /* Regularize things a little. During LTO same types may come with different BINFOs. Either because their virtual table was not merged by tree merging and only later at decl merging or because one type comes with external vtable, while other with internal. We want to merge equivalent binfos to conserve memory and streaming overhead. The external vtables are more harmful: they contain references to external declarations of methods that may be defined in the merged LTO unit. For this reason we absolutely need to remove them and replace by internal variants. Not doing so will lead to incomplete answers from possible_polymorphic_call_targets. */ if (!flag_ltrans && merge) { tree master_binfo = TYPE_BINFO (val->type); tree v1 = BINFO_VTABLE (master_binfo); tree v2 = BINFO_VTABLE (TYPE_BINFO (type)); if (TREE_CODE (v1) == POINTER_PLUS_EXPR) { gcc_assert (TREE_CODE (v2) == POINTER_PLUS_EXPR && operand_equal_p (TREE_OPERAND (v1, 1), TREE_OPERAND (v2, 1), 0)); v1 = TREE_OPERAND (TREE_OPERAND (v1, 0), 0); v2 = TREE_OPERAND (TREE_OPERAND (v2, 0), 0); } gcc_assert (DECL_ASSEMBLER_NAME (v1) == DECL_ASSEMBLER_NAME (v2));//.........这里部分代码省略.........
开发者ID:Nodplus,项目名称:gcc,代码行数:101,
注:本文中的vec_safe_push函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vec_scale函数代码示例 C++ vec_perm函数代码示例 |