这篇教程C++ ENTRY_BLOCK_PTR_FOR_FN函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ENTRY_BLOCK_PTR_FOR_FN函数的典型用法代码示例。如果您正苦于以下问题:C++ ENTRY_BLOCK_PTR_FOR_FN函数的具体用法?C++ ENTRY_BLOCK_PTR_FOR_FN怎么用?C++ ENTRY_BLOCK_PTR_FOR_FN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ENTRY_BLOCK_PTR_FOR_FN函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cgraph_rebuild_referencesvoidcgraph_rebuild_references (void){ basic_block bb; struct cgraph_node *node = cgraph_get_node (current_function_decl); gimple_stmt_iterator gsi; struct ipa_ref *ref; int i; /* Keep speculative references for further cgraph edge expansion. */ for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref);) if (!ref->speculative) ipa_remove_reference (ref); else i++; node->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count; FOR_EACH_BB_FN (bb, cfun) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) ipa_record_stmt_references (node, gsi_stmt (gsi)); for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) ipa_record_stmt_references (node, gsi_stmt (gsi)); } record_eh_tables (node, cfun);}
开发者ID:ArtemL,项目名称:GCC,代码行数:27,
示例2: compute_fartheststatic voidcompute_farthest (struct edge_list *edge_list, int n_exprs, sbitmap *st_avout, sbitmap *st_avin, sbitmap *st_antin, sbitmap *kill, sbitmap *farthest){ int x, num_edges; basic_block pred, succ; num_edges = NUM_EDGES (edge_list); auto_sbitmap difference (n_exprs), temp_bitmap (n_exprs); for (x = 0; x < num_edges; x++) { pred = INDEX_EDGE_PRED_BB (edge_list, x); succ = INDEX_EDGE_SUCC_BB (edge_list, x); if (succ == EXIT_BLOCK_PTR_FOR_FN (cfun)) bitmap_copy (farthest[x], st_avout[pred->index]); else { if (pred == ENTRY_BLOCK_PTR_FOR_FN (cfun)) bitmap_clear (farthest[x]); else { bitmap_and_compl (difference, st_avout[pred->index], st_antin[succ->index]); bitmap_not (temp_bitmap, st_avin[succ->index]); bitmap_and_or (farthest[x], difference, kill[succ->index], temp_bitmap); } } }}
开发者ID:Droufte,项目名称:gcc,代码行数:32,
示例3: tree_optimize_tail_calls_1static unsigned inttree_optimize_tail_calls_1 (bool opt_tailcalls){ edge e; bool phis_constructed = false; struct tailcall *tailcalls = NULL, *act, *next; bool changed = false; basic_block first = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)); tree param; gimple stmt; edge_iterator ei; if (!suitable_for_tail_opt_p ()) return 0; if (opt_tailcalls) opt_tailcalls = suitable_for_tail_call_opt_p (); FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) { /* Only traverse the normal exits, i.e. those that end with return statement. */ stmt = last_stmt (e->src); if (stmt && gimple_code (stmt) == GIMPLE_RETURN) find_tail_calls (e->src, &tailcalls); }
开发者ID:CookieChen,项目名称:gcc,代码行数:27,
示例4: execute_stackleak_tree_instrumentstatic unsigned int execute_stackleak_tree_instrument(void){ basic_block bb, entry_bb; bool prologue_instrumented = false, is_leaf = true; entry_bb = ENTRY_BLOCK_PTR_FOR_FN(cfun)->next_bb; // 1. loop through BBs and GIMPLE statements FOR_EACH_BB_FN(bb, cfun) { gimple_stmt_iterator gsi; for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) { gimple stmt; stmt = gsi_stmt(gsi); if (is_gimple_call(stmt)) is_leaf = false; // gimple match: align 8 built-in BUILT_IN_NORMAL:BUILT_IN_ALLOCA attributes <tree_list 0xb7576450> if (!is_alloca(stmt)) continue; // 2. insert stack overflow check before each __builtin_alloca call stackleak_check_alloca(&gsi); // 3. insert track call after each __builtin_alloca call stackleak_add_instrumentation(&gsi); if (bb == entry_bb) prologue_instrumented = true; } }
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:32,
示例5: ENTRY_BLOCK_PTR_FOR_FNvoidcgraph_edge::rebuild_references (void){ basic_block bb; cgraph_node *node = cgraph_node::get (current_function_decl); gimple_stmt_iterator gsi; ipa_ref *ref = NULL; int i; /* Keep speculative references for further cgraph edge expansion. */ for (i = 0; node->iterate_reference (i, ref);) if (!ref->speculative) ref->remove_reference (); else i++; node->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count; FOR_EACH_BB_FN (bb, cfun) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) node->record_stmt_references (gsi_stmt (gsi)); for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) node->record_stmt_references (gsi_stmt (gsi)); } record_eh_tables (node, cfun); if (node->instrumented_version && !node->instrumentation_clone) node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL);}
开发者ID:AHelper,项目名称:gcc,代码行数:31,
示例6: reachable_at_most_oncestatic boolreachable_at_most_once (basic_block va_arg_bb, basic_block va_start_bb){ vec<edge> stack = vNULL; edge e; edge_iterator ei; sbitmap visited; bool ret; if (va_arg_bb == va_start_bb) return true; if (! dominated_by_p (CDI_DOMINATORS, va_arg_bb, va_start_bb)) return false; visited = sbitmap_alloc (last_basic_block_for_fn (cfun)); bitmap_clear (visited); ret = true; FOR_EACH_EDGE (e, ei, va_arg_bb->preds) stack.safe_push (e); while (! stack.is_empty ()) { basic_block src; e = stack.pop (); src = e->src; if (e->flags & EDGE_COMPLEX) { ret = false; break; } if (src == va_start_bb) continue; /* va_arg_bb can be executed more times than va_start_bb. */ if (src == va_arg_bb) { ret = false; break; } gcc_assert (src != ENTRY_BLOCK_PTR_FOR_FN (cfun)); if (! bitmap_bit_p (visited, src->index)) { bitmap_set_bit (visited, src->index); FOR_EACH_EDGE (e, ei, src->preds) stack.safe_push (e); } } stack.release (); sbitmap_free (visited); return ret;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:59,
示例7: init_flowvoidinit_flow (struct function *the_fun){ if (!the_fun->cfg) the_fun->cfg = ggc_cleared_alloc<control_flow_graph> (); n_edges_for_fn (the_fun) = 0; ENTRY_BLOCK_PTR_FOR_FN (the_fun) = ggc_cleared_alloc<basic_block_def> (); ENTRY_BLOCK_PTR_FOR_FN (the_fun)->index = ENTRY_BLOCK; EXIT_BLOCK_PTR_FOR_FN (the_fun) = ggc_cleared_alloc<basic_block_def> (); EXIT_BLOCK_PTR_FOR_FN (the_fun)->index = EXIT_BLOCK; ENTRY_BLOCK_PTR_FOR_FN (the_fun)->next_bb = EXIT_BLOCK_PTR_FOR_FN (the_fun); EXIT_BLOCK_PTR_FOR_FN (the_fun)->prev_bb = ENTRY_BLOCK_PTR_FOR_FN (the_fun);}
开发者ID:AHelper,项目名称:gcc,代码行数:17,
示例8: gimple_gen_ic_func_profilervoidgimple_gen_ic_func_profiler (void){ struct cgraph_node * c_node = cgraph_node::get (current_function_decl); gimple_stmt_iterator gsi; gcall *stmt1; gassign *stmt2; tree tree_uid, cur_func, void0; if (c_node->only_called_directly_p ()) return; gimple_init_edge_profiler (); /* Insert code: stmt1: __gcov_indirect_call_profiler_v2 (profile_id, ¤t_function_decl) */ gsi = gsi_after_labels (split_edge (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun)))); cur_func = force_gimple_operand_gsi (&gsi, build_addr (current_function_decl, current_function_decl), true, NULL_TREE, true, GSI_SAME_STMT); tree_uid = build_int_cst (gcov_type_node, cgraph_node::get (current_function_decl)->profile_id); /* Workaround for binutils bug 14342. Once it is fixed, remove lto path. */ if (flag_lto) { tree counter_ptr, ptr_var; counter_ptr = force_gimple_operand_gsi (&gsi, ic_gcov_type_ptr_var, true, NULL_TREE, true, GSI_SAME_STMT); ptr_var = force_gimple_operand_gsi (&gsi, ic_void_ptr_var, true, NULL_TREE, true, GSI_SAME_STMT); stmt1 = gimple_build_call (tree_indirect_call_profiler_fn, 4, counter_ptr, tree_uid, cur_func, ptr_var); } else { stmt1 = gimple_build_call (tree_indirect_call_profiler_fn, 2, tree_uid, cur_func); } gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT); /* Set __gcov_indirect_call_callee to 0, so that calls from other modules won't get misattributed to the last caller of the current callee. */ void0 = build_int_cst (build_pointer_type (void_type_node), 0); stmt2 = gimple_build_assign (ic_void_ptr_var, void0); gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);}
开发者ID:AlexMioMio,项目名称:gcc,代码行数:56,
示例9: init_flowvoidinit_flow (struct function *the_fun){ if (!the_fun->cfg) the_fun->cfg = ggc_cleared_alloc<control_flow_graph> (); n_edges_for_fn (the_fun) = 0; the_fun->cfg->count_max = profile_count::uninitialized (); ENTRY_BLOCK_PTR_FOR_FN (the_fun) = alloc_block (); ENTRY_BLOCK_PTR_FOR_FN (the_fun)->index = ENTRY_BLOCK; EXIT_BLOCK_PTR_FOR_FN (the_fun) = alloc_block (); EXIT_BLOCK_PTR_FOR_FN (the_fun)->index = EXIT_BLOCK; ENTRY_BLOCK_PTR_FOR_FN (the_fun)->next_bb = EXIT_BLOCK_PTR_FOR_FN (the_fun); EXIT_BLOCK_PTR_FOR_FN (the_fun)->prev_bb = ENTRY_BLOCK_PTR_FOR_FN (the_fun); the_fun->cfg->edge_flags_allocated = EDGE_ALL_FLAGS; the_fun->cfg->bb_flags_allocated = BB_ALL_FLAGS;}
开发者ID:Lucretia,项目名称:gcc,代码行数:20,
示例10: gsi_commit_edge_insertsvoidgsi_commit_edge_inserts (void){ basic_block bb; edge e; edge_iterator ei; gsi_commit_one_edge_insert (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun)), NULL); FOR_EACH_BB_FN (bb, cfun) FOR_EACH_EDGE (e, ei, bb->succs) gsi_commit_one_edge_insert (e, NULL);}
开发者ID:hemantjain95,项目名称:gcc,代码行数:14,
示例11: cfg_blocks_addstatic voidcfg_blocks_add (basic_block bb){ bool head = false; gcc_assert (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) && bb != EXIT_BLOCK_PTR_FOR_FN (cfun)); gcc_assert (!bitmap_bit_p (bb_in_list, bb->index)); if (cfg_blocks_empty_p ()) { cfg_blocks_tail = cfg_blocks_head = 0; cfg_blocks_num = 1; } else { cfg_blocks_num++; if (cfg_blocks_num > cfg_blocks.length ()) { /* We have to grow the array now. Adjust to queue to occupy the full space of the original array. We do not need to initialize the newly allocated portion of the array because we keep track of CFG_BLOCKS_HEAD and CFG_BLOCKS_HEAD. */ cfg_blocks_tail = cfg_blocks.length (); cfg_blocks_head = 0; cfg_blocks.safe_grow (2 * cfg_blocks_tail); } /* Minor optimization: we prefer to see blocks with more predecessors later, because there is more of a chance that the incoming edges will be executable. */ else if (EDGE_COUNT (bb->preds) >= EDGE_COUNT (cfg_blocks[cfg_blocks_head]->preds)) cfg_blocks_tail = ((cfg_blocks_tail + 1) % cfg_blocks.length ()); else { if (cfg_blocks_head == 0) cfg_blocks_head = cfg_blocks.length (); --cfg_blocks_head; head = true; } } cfg_blocks[head ? cfg_blocks_head : cfg_blocks_tail] = bb; bitmap_set_bit (bb_in_list, bb->index);}
开发者ID:AlexMioMio,项目名称:gcc,代码行数:46,
示例12: rebuild_cgraph_edgesunsigned intrebuild_cgraph_edges (void){ basic_block bb; struct cgraph_node *node = cgraph_get_node (current_function_decl); gimple_stmt_iterator gsi; cgraph_node_remove_callees (node); ipa_remove_all_references (&node->ref_list); node->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count; FOR_EACH_BB_FN (bb, cfun) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple stmt = gsi_stmt (gsi); tree decl; if (is_gimple_call (stmt)) { int freq = compute_call_stmt_bb_frequency (current_function_decl, bb); decl = gimple_call_fndecl (stmt); if (decl) cgraph_create_edge (node, cgraph_get_create_node (decl), stmt, bb->count, freq); else if (gimple_call_internal_p (stmt)) ; else cgraph_create_indirect_edge (node, stmt, gimple_call_flags (stmt), bb->count, freq); } ipa_record_stmt_references (node, stmt); } for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) ipa_record_stmt_references (node, gsi_stmt (gsi)); } record_eh_tables (node, cfun); gcc_assert (!node->global.inlined_to); return 0;}
开发者ID:ArtemL,项目名称:GCC,代码行数:44,
示例13: compute_call_stmt_bb_frequency/* Computes the frequency of the call statement so that it can be stored in cgraph_edge. BB is the basic block of the call statement. */intcompute_call_stmt_bb_frequency (tree decl, basic_block bb){ int entry_freq = ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->frequency; int freq = bb->frequency; if (profile_status_for_fn (DECL_STRUCT_FUNCTION (decl)) == PROFILE_ABSENT) return CGRAPH_FREQ_BASE; if (!entry_freq) entry_freq = 1, freq++; freq = freq * CGRAPH_FREQ_BASE / entry_freq; if (freq > CGRAPH_FREQ_MAX) freq = CGRAPH_FREQ_MAX; return freq;}
开发者ID:ArtemL,项目名称:GCC,代码行数:21,
示例14: verify_three_block_cfgstatic voidverify_three_block_cfg (function *fun){ ASSERT_TRUE (fun->cfg != NULL); ASSERT_EQ (3, n_basic_blocks_for_fn (fun)); ASSERT_EQ (2, n_edges_for_fn (fun)); /* The "fake" basic blocks. */ basic_block entry = ENTRY_BLOCK_PTR_FOR_FN (fun); ASSERT_TRUE (entry != NULL); ASSERT_EQ (ENTRY_BLOCK, entry->index); basic_block exit = EXIT_BLOCK_PTR_FOR_FN (fun); ASSERT_TRUE (exit != NULL); ASSERT_EQ (EXIT_BLOCK, exit->index); /* The "real" basic block. */ basic_block bb2 = get_real_block (fun); ASSERT_TRUE (bb2 != NULL); ASSERT_EQ (2, bb2->index); /* Verify connectivity. */ ASSERT_EQ (NULL, entry->preds); ASSERT_EQ (1, entry->succs->length ()); edge from_entry_to_bb2 = (*entry->succs)[0]; ASSERT_EQ (entry, from_entry_to_bb2->src); ASSERT_EQ (bb2, from_entry_to_bb2->dest); ASSERT_EQ (1, bb2->preds->length ()); ASSERT_EQ (from_entry_to_bb2, (*bb2->preds)[0]); ASSERT_EQ (1, bb2->succs->length ()); edge from_bb2_to_exit = (*bb2->succs)[0]; ASSERT_EQ (bb2, from_bb2_to_exit->src); ASSERT_EQ (exit, from_bb2_to_exit->dest); ASSERT_EQ (1, exit->preds->length ()); ASSERT_EQ (from_bb2_to_exit, (*exit->preds)[0]); ASSERT_EQ (NULL, exit->succs);}
开发者ID:duarten,项目名称:gcc,代码行数:41,
示例15: nearest_common_dominator_of_usesstatic basic_blocknearest_common_dominator_of_uses (def_operand_p def_p, bool *debug_stmts){ tree var = DEF_FROM_PTR (def_p); bitmap blocks = BITMAP_ALLOC (NULL); basic_block commondom; unsigned int j; bitmap_iterator bi; imm_use_iterator imm_iter; use_operand_p use_p; FOR_EACH_IMM_USE_FAST (use_p, imm_iter, var) { gimple *usestmt = USE_STMT (use_p); basic_block useblock; if (gphi *phi = dyn_cast <gphi *> (usestmt)) { int idx = PHI_ARG_INDEX_FROM_USE (use_p); useblock = gimple_phi_arg_edge (phi, idx)->src; } else if (is_gimple_debug (usestmt)) { *debug_stmts = true; continue; } else { useblock = gimple_bb (usestmt); } /* Short circuit. Nothing dominates the entry block. */ if (useblock == ENTRY_BLOCK_PTR_FOR_FN (cfun)) { BITMAP_FREE (blocks); return NULL; } bitmap_set_bit (blocks, useblock->index); }
开发者ID:0day-ci,项目名称:gcc,代码行数:40,
示例16: compute_earlieststatic voidcompute_earliest (struct edge_list *edge_list, int n_exprs, sbitmap *antin, sbitmap *antout, sbitmap *avout, sbitmap *kill, sbitmap *earliest){ sbitmap difference, temp_bitmap; int x, num_edges; basic_block pred, succ; num_edges = NUM_EDGES (edge_list); difference = sbitmap_alloc (n_exprs); temp_bitmap = sbitmap_alloc (n_exprs); for (x = 0; x < num_edges; x++) { pred = INDEX_EDGE_PRED_BB (edge_list, x); succ = INDEX_EDGE_SUCC_BB (edge_list, x); if (pred == ENTRY_BLOCK_PTR_FOR_FN (cfun)) bitmap_copy (earliest[x], antin[succ->index]); else { if (succ == EXIT_BLOCK_PTR_FOR_FN (cfun)) bitmap_clear (earliest[x]); else { bitmap_and_compl (difference, antin[succ->index], avout[pred->index]); bitmap_not (temp_bitmap, antout[pred->index]); bitmap_and_or (earliest[x], difference, kill[pred->index], temp_bitmap); } } } sbitmap_free (temp_bitmap); sbitmap_free (difference);}
开发者ID:krnowak,项目名称:gcc,代码行数:38,
示例17: verify_three_block_rtl_cfgstatic voidverify_three_block_rtl_cfg (function *fun){ verify_three_block_cfg (fun); /* The "fake" basic blocks should be flagged as RTL, but with no insns. */ basic_block entry = ENTRY_BLOCK_PTR_FOR_FN (fun); ASSERT_TRUE (entry != NULL); ASSERT_EQ (BB_RTL, entry->flags & BB_RTL); ASSERT_EQ (NULL, BB_HEAD (entry)); basic_block exit = EXIT_BLOCK_PTR_FOR_FN (fun); ASSERT_TRUE (exit != NULL); ASSERT_EQ (BB_RTL, entry->flags & BB_RTL); ASSERT_EQ (NULL, BB_HEAD (exit)); /* The "real" basic block should be flagged as RTL, and have one or more insns. */ basic_block bb2 = get_real_block (fun); ASSERT_TRUE (bb2 != NULL); ASSERT_EQ (BB_RTL, entry->flags & BB_RTL); ASSERT_TRUE (BB_HEAD (bb2) != NULL);}
开发者ID:duarten,项目名称:gcc,代码行数:24,
示例18: verify_three_block_gimple_cfgstatic voidverify_three_block_gimple_cfg (function *fun){ verify_three_block_cfg (fun); /* The "fake" basic blocks should be flagged as gimple, but with have no statements. */ basic_block entry = ENTRY_BLOCK_PTR_FOR_FN (fun); ASSERT_TRUE (entry != NULL); ASSERT_EQ (0, entry->flags & BB_RTL); ASSERT_EQ (NULL, bb_seq (entry)); basic_block exit = EXIT_BLOCK_PTR_FOR_FN (fun); ASSERT_TRUE (exit != NULL); ASSERT_EQ (0, entry->flags & BB_RTL); ASSERT_EQ (NULL, bb_seq (exit)); /* The "real" basic block should be flagged as gimple, and have one or more statements. */ basic_block bb2 = get_real_block (fun); ASSERT_TRUE (bb2 != NULL); ASSERT_EQ (0, entry->flags & BB_RTL); ASSERT_TRUE (bb_seq (bb2) != NULL);}
开发者ID:duarten,项目名称:gcc,代码行数:24,
示例19: optimize_mode_switchingstatic intoptimize_mode_switching (void){ int e; basic_block bb; bool need_commit = false; static const int num_modes[] = NUM_MODES_FOR_MODE_SWITCHING;#define N_ENTITIES ARRAY_SIZE (num_modes) int entity_map[N_ENTITIES]; struct bb_info *bb_info[N_ENTITIES]; int i, j; int n_entities = 0; int max_num_modes = 0; bool emitted ATTRIBUTE_UNUSED = false; basic_block post_entry = 0; basic_block pre_exit = 0; struct edge_list *edge_list = 0; /* These bitmaps are used for the LCM algorithm. */ sbitmap *kill, *del, *insert, *antic, *transp, *comp; sbitmap *avin, *avout; for (e = N_ENTITIES - 1; e >= 0; e--) if (OPTIMIZE_MODE_SWITCHING (e)) { int entry_exit_extra = 0; /* Create the list of segments within each basic block. If NORMAL_MODE is defined, allow for two extra blocks split from the entry and exit block. */ if (targetm.mode_switching.entry && targetm.mode_switching.exit) entry_exit_extra = 3; bb_info[n_entities] = XCNEWVEC (struct bb_info, last_basic_block_for_fn (cfun) + entry_exit_extra); entity_map[n_entities++] = e; if (num_modes[e] > max_num_modes) max_num_modes = num_modes[e]; } if (! n_entities) return 0; /* Make sure if MODE_ENTRY is defined MODE_EXIT is defined. */ gcc_assert ((targetm.mode_switching.entry && targetm.mode_switching.exit) || (!targetm.mode_switching.entry && !targetm.mode_switching.exit)); if (targetm.mode_switching.entry && targetm.mode_switching.exit) { /* Split the edge from the entry block, so that we can note that there NORMAL_MODE is supplied. */ post_entry = split_edge (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun))); pre_exit = create_pre_exit (n_entities, entity_map, num_modes); } df_analyze (); /* Create the bitmap vectors. */ antic = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities * max_num_modes); transp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities * max_num_modes); comp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities * max_num_modes); avin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities * max_num_modes); avout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities * max_num_modes); kill = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities * max_num_modes); bitmap_vector_ones (transp, last_basic_block_for_fn (cfun)); bitmap_vector_clear (antic, last_basic_block_for_fn (cfun)); bitmap_vector_clear (comp, last_basic_block_for_fn (cfun)); for (j = n_entities - 1; j >= 0; j--) { int e = entity_map[j]; int no_mode = num_modes[e]; struct bb_info *info = bb_info[j]; rtx_insn *insn; /* Determine what the first use (if any) need for a mode of entity E is. This will be the mode that is anticipatable for this block. Also compute the initial transparency settings. */ FOR_EACH_BB_FN (bb, cfun) { struct seginfo *ptr; int last_mode = no_mode; bool any_set_required = false; HARD_REG_SET live_now; info[bb->index].mode_out = info[bb->index].mode_in = no_mode; REG_SET_TO_HARD_REG_SET (live_now, df_get_live_in (bb)); /* Pretend the mode is clobbered across abnormal edges. */ {//.........这里部分代码省略.........
开发者ID:groessler,项目名称:gcc-6502,代码行数:101,
示例20: eliminate_tail_callstatic voideliminate_tail_call (struct tailcall *t){ tree param, rslt; gimple stmt, call; tree arg; size_t idx; basic_block bb, first; edge e; gimple phi; gimple_stmt_iterator gsi; gimple orig_stmt; stmt = orig_stmt = gsi_stmt (t->call_gsi); bb = gsi_bb (t->call_gsi); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Eliminated tail recursion in bb %d : ", bb->index); print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); fprintf (dump_file, "/n"); } gcc_assert (is_gimple_call (stmt)); first = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)); /* Remove the code after call_gsi that will become unreachable. The possibly unreachable code in other blocks is removed later in cfg cleanup. */ gsi = t->call_gsi; gsi_next (&gsi); while (!gsi_end_p (gsi)) { gimple t = gsi_stmt (gsi); /* Do not remove the return statement, so that redirect_edge_and_branch sees how the block ends. */ if (gimple_code (t) == GIMPLE_RETURN) break; gsi_remove (&gsi, true); release_defs (t); } /* Number of executions of function has reduced by the tailcall. */ e = single_succ_edge (gsi_bb (t->call_gsi)); decrease_profile (EXIT_BLOCK_PTR_FOR_FN (cfun), e->count, EDGE_FREQUENCY (e)); decrease_profile (ENTRY_BLOCK_PTR_FOR_FN (cfun), e->count, EDGE_FREQUENCY (e)); if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)) decrease_profile (e->dest, e->count, EDGE_FREQUENCY (e)); /* Replace the call by a jump to the start of function. */ e = redirect_edge_and_branch (single_succ_edge (gsi_bb (t->call_gsi)), first); gcc_assert (e); PENDING_STMT (e) = NULL; /* Add phi node entries for arguments. The ordering of the phi nodes should be the same as the ordering of the arguments. */ for (param = DECL_ARGUMENTS (current_function_decl), idx = 0, gsi = gsi_start_phis (first); param; param = DECL_CHAIN (param), idx++) { if (!arg_needs_copy_p (param)) continue; arg = gimple_call_arg (stmt, idx); phi = gsi_stmt (gsi); gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi))); add_phi_arg (phi, arg, e, gimple_location (stmt)); gsi_next (&gsi); } /* Update the values of accumulators. */ adjust_accumulator_values (t->call_gsi, t->mult, t->add, e); call = gsi_stmt (t->call_gsi); rslt = gimple_call_lhs (call); if (rslt != NULL_TREE) { /* Result of the call will no longer be defined. So adjust the SSA_NAME_DEF_STMT accordingly. */ SSA_NAME_DEF_STMT (rslt) = gimple_build_nop (); } gsi_remove (&t->call_gsi, true); release_defs (call);}
开发者ID:CookieChen,项目名称:gcc,代码行数:92,
示例21: create_tmp_var } if (!latent_entropy_decl) {// debug_tree(current_function_decl); return 0; } }//fprintf(stderr, "latent_entropy: %s/n", IDENTIFIER_POINTER(DECL_NAME(current_function_decl))); // 1. create local entropy variable local_entropy = create_tmp_var(unsigned_intDI_type_node, "local_entropy"); add_referenced_var(local_entropy); mark_sym_for_renaming(local_entropy); // 2. initialize local entropy variable bb = split_block_after_labels(ENTRY_BLOCK_PTR_FOR_FN(cfun))->dest; if (dom_info_available_p(CDI_DOMINATORS)) set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR_FOR_FN(cfun)); gsi = gsi_start_bb(bb); assign = gimple_build_assign(local_entropy, build_int_cstu(unsigned_intDI_type_node, get_random_const()));// gimple_set_location(assign, loc); gsi_insert_after(&gsi, assign, GSI_NEW_STMT); update_stmt(assign);//debug_bb(bb); gcc_assert(single_succ_p(bb)); bb = single_succ(bb); // 3. instrument each BB with an operation on the local entropy variable while (bb != EXIT_BLOCK_PTR_FOR_FN(cfun)) { perturb_local_entropy(bb, local_entropy);
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:31,
示例22: FOR_EACH_BB_FN basic_block bb; edge e; edge_iterator ei; FOR_EACH_BB_FN (bb, fn) { FOR_EACH_EDGE (e, ei, bb->succs) free_edge (fn, e); vec_safe_truncate (bb->succs, 0); vec_safe_truncate (bb->preds, 0); } FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (fn)->succs) free_edge (fn, e); vec_safe_truncate (EXIT_BLOCK_PTR_FOR_FN (fn)->preds, 0); vec_safe_truncate (ENTRY_BLOCK_PTR_FOR_FN (fn)->succs, 0); gcc_assert (!n_edges_for_fn (fn));}/* Allocate memory for basic_block. */basic_blockalloc_block (void){ basic_block bb; bb = ggc_cleared_alloc<basic_block_def> (); bb->count = profile_count::uninitialized (); return bb;}
开发者ID:Lucretia,项目名称:gcc,代码行数:30,
示例23: gimple_find_edge_insert_locstatic boolgimple_find_edge_insert_loc (edge e, gimple_stmt_iterator *gsi, basic_block *new_bb){ basic_block dest, src; gimple *tmp; dest = e->dest; /* If the destination has one predecessor which has no PHI nodes, insert there. Except for the exit block. The requirement for no PHI nodes could be relaxed. Basically we would have to examine the PHIs to prove that none of them used the value set by the statement we want to insert on E. That hardly seems worth the effort. */ restart: if (single_pred_p (dest) && gimple_seq_empty_p (phi_nodes (dest)) && dest != EXIT_BLOCK_PTR_FOR_FN (cfun)) { *gsi = gsi_start_bb (dest); if (gsi_end_p (*gsi)) return true; /* Make sure we insert after any leading labels. */ tmp = gsi_stmt (*gsi); while (gimple_code (tmp) == GIMPLE_LABEL) { gsi_next (gsi); if (gsi_end_p (*gsi)) break; tmp = gsi_stmt (*gsi); } if (gsi_end_p (*gsi)) { *gsi = gsi_last_bb (dest); return true; } else return false; } /* If the source has one successor, the edge is not abnormal and the last statement does not end a basic block, insert there. Except for the entry block. */ src = e->src; if ((e->flags & EDGE_ABNORMAL) == 0 && single_succ_p (src) && src != ENTRY_BLOCK_PTR_FOR_FN (cfun)) { *gsi = gsi_last_bb (src); if (gsi_end_p (*gsi)) return true; tmp = gsi_stmt (*gsi); if (!stmt_ends_bb_p (tmp)) return true; switch (gimple_code (tmp)) { case GIMPLE_RETURN: case GIMPLE_RESX: return false; default: break; } } /* Otherwise, create a new basic block, and split this edge. */ dest = split_edge (e); if (new_bb) *new_bb = dest; e = single_pred_edge (dest); goto restart;}
开发者ID:hemantjain95,项目名称:gcc,代码行数:77,
示例24: compute_laterinstatic voidcompute_laterin (struct edge_list *edge_list, sbitmap *earliest, sbitmap *antloc, sbitmap *later, sbitmap *laterin){ int num_edges, i; edge e; basic_block *worklist, *qin, *qout, *qend, bb; unsigned int qlen; edge_iterator ei; num_edges = NUM_EDGES (edge_list); /* Allocate a worklist array/queue. Entries are only added to the list if they were not already on the list. So the size is bounded by the number of basic blocks. */ qin = qout = worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun)); /* Initialize a mapping from each edge to its index. */ for (i = 0; i < num_edges; i++) INDEX_EDGE (edge_list, i)->aux = (void *) (size_t) i; /* We want a maximal solution, so initially consider LATER true for all edges. This allows propagation through a loop since the incoming loop edge will have LATER set, so if all the other incoming edges to the loop are set, then LATERIN will be set for the head of the loop. If the optimistic setting of LATER on that edge was incorrect (for example the expression is ANTLOC in a block within the loop) then this algorithm will detect it when we process the block at the head of the optimistic edge. That will requeue the affected blocks. */ bitmap_vector_ones (later, num_edges); /* Note that even though we want an optimistic setting of LATER, we do not want to be overly optimistic. Consider an outgoing edge from the entry block. That edge should always have a LATER value the same as EARLIEST for that edge. */ FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs) bitmap_copy (later[(size_t) e->aux], earliest[(size_t) e->aux]); /* Add all the blocks to the worklist. This prevents an early exit from the loop given our optimistic initialization of LATER above. */ int *postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun)); int postorder_num = inverted_post_order_compute (postorder); for (int i = 0; i < postorder_num; ++i) { bb = BASIC_BLOCK_FOR_FN (cfun, postorder[i]); if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)) continue; *qin++ = bb; bb->aux = bb; } free (postorder); /* Note that we do not use the last allocated element for our queue, as EXIT_BLOCK is never inserted into it. */ qin = worklist; qend = &worklist[n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS]; qlen = n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS; /* Iterate until the worklist is empty. */ while (qlen) { /* Take the first entry off the worklist. */ bb = *qout++; bb->aux = NULL; qlen--; if (qout >= qend) qout = worklist; /* Compute the intersection of LATERIN for each incoming edge to B. */ bitmap_ones (laterin[bb->index]); FOR_EACH_EDGE (e, ei, bb->preds) bitmap_and (laterin[bb->index], laterin[bb->index], later[(size_t)e->aux]); /* Calculate LATER for all outgoing edges. */ FOR_EACH_EDGE (e, ei, bb->succs) if (bitmap_ior_and_compl (later[(size_t) e->aux], earliest[(size_t) e->aux], laterin[bb->index], antloc[bb->index]) /* If LATER for an outgoing edge was changed, then we need to add the target of the outgoing edge to the worklist. */ && e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun) && e->dest->aux == 0) { *qin++ = e->dest; e->dest->aux = e; qlen++; if (qin >= qend) qin = worklist; } } /* Computation of insertion and deletion points requires computing LATERIN for the EXIT block. We allocated an extra entry in the LATERIN array for just this purpose. */ bitmap_ones (laterin[last_basic_block_for_fn (cfun)]);//.........这里部分代码省略.........
开发者ID:krnowak,项目名称:gcc,代码行数:101,
示例25: compute_availablevoidcompute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout, sbitmap *avin){ edge e; basic_block *worklist, *qin, *qout, *qend, bb; unsigned int qlen; edge_iterator ei; /* Allocate a worklist array/queue. Entries are only added to the list if they were not already on the list. So the size is bounded by the number of basic blocks. */ qin = qout = worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS); /* We want a maximal solution. */ bitmap_vector_ones (avout, last_basic_block_for_fn (cfun)); /* Put every block on the worklist; this is necessary because of the optimistic initialization of AVOUT above. Use inverted postorder to make the dataflow problem require less iterations. */ int *postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun)); int postorder_num = inverted_post_order_compute (postorder); for (int i = 0; i < postorder_num; ++i) { bb = BASIC_BLOCK_FOR_FN (cfun, postorder[i]); if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)) continue; *qin++ = bb; bb->aux = bb; } free (postorder); qin = worklist; qend = &worklist[n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS]; qlen = n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS; /* Mark blocks which are successors of the entry block so that we can easily identify them below. */ FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs) e->dest->aux = ENTRY_BLOCK_PTR_FOR_FN (cfun); /* Iterate until the worklist is empty. */ while (qlen) { /* Take the first entry off the worklist. */ bb = *qout++; qlen--; if (qout >= qend) qout = worklist; /* If one of the predecessor blocks is the ENTRY block, then the intersection of avouts is the null set. We can identify such blocks by the special value in the AUX field in the block structure. */ if (bb->aux == ENTRY_BLOCK_PTR_FOR_FN (cfun)) /* Do not clear the aux field for blocks which are successors of the ENTRY block. That way we never add then to the worklist again. */ bitmap_clear (avin[bb->index]); else { /* Clear the aux field of this block so that it can be added to the worklist again if necessary. */ bb->aux = NULL; bitmap_intersection_of_preds (avin[bb->index], avout, bb); } if (bitmap_ior_and_compl (avout[bb->index], avloc[bb->index], avin[bb->index], kill[bb->index])) /* If the out state of this block changed, then we need to add the successors of this block to the worklist if they are not already on the worklist. */ FOR_EACH_EDGE (e, ei, bb->succs) if (!e->dest->aux && e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)) { *qin++ = e->dest; e->dest->aux = e; qlen++; if (qin >= qend) qin = worklist; } } clear_aux_for_edges (); clear_aux_for_blocks (); free (worklist);}
开发者ID:krnowak,项目名称:gcc,代码行数:89,
示例26: compute_antinout_edgestatic voidcompute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin, sbitmap *antout){ basic_block bb; edge e; basic_block *worklist, *qin, *qout, *qend; unsigned int qlen; edge_iterator ei; /* Allocate a worklist array/queue. Entries are only added to the list if they were not already on the list. So the size is bounded by the number of basic blocks. */ qin = qout = worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun)); /* We want a maximal solution, so make an optimistic initialization of ANTIN. */ bitmap_vector_ones (antin, last_basic_block_for_fn (cfun)); /* Put every block on the worklist; this is necessary because of the optimistic initialization of ANTIN above. */ int *postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun)); int postorder_num = post_order_compute (postorder, false, false); for (int i = 0; i < postorder_num; ++i) { bb = BASIC_BLOCK_FOR_FN (cfun, postorder[i]); *qin++ = bb; bb->aux = bb; } free (postorder); qin = worklist; qend = &worklist[n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS]; qlen = n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS; /* Mark blocks which are predecessors of the exit block so that we can easily identify them below. */ FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) e->src->aux = EXIT_BLOCK_PTR_FOR_FN (cfun); /* Iterate until the worklist is empty. */ while (qlen) { /* Take the first entry off the worklist. */ bb = *qout++; qlen--; if (qout >= qend) qout = worklist; if (bb->aux == EXIT_BLOCK_PTR_FOR_FN (cfun)) /* Do not clear the aux field for blocks which are predecessors of the EXIT block. That way we never add then to the worklist again. */ bitmap_clear (antout[bb->index]); else { /* Clear the aux field of this block so that it can be added to the worklist again if necessary. */ bb->aux = NULL; bitmap_intersection_of_succs (antout[bb->index], antin, bb); } if (bitmap_or_and (antin[bb->index], antloc[bb->index], transp[bb->index], antout[bb->index])) /* If the in state of this block changed, then we need to add the predecessors of this block to the worklist if they are not already on the worklist. */ FOR_EACH_EDGE (e, ei, bb->preds) if (!e->src->aux && e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun)) { *qin++ = e->src; e->src->aux = e; qlen++; if (qin >= qend) qin = worklist; } } clear_aux_for_edges (); clear_aux_for_blocks (); free (worklist);}
开发者ID:krnowak,项目名称:gcc,代码行数:83,
注:本文中的ENTRY_BLOCK_PTR_FOR_FN函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ENUM_TO_STRING函数代码示例 C++ ENTRY函数代码示例 |