这篇教程C++ DECL_STRUCT_FUNCTION函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DECL_STRUCT_FUNCTION函数的典型用法代码示例。如果您正苦于以下问题:C++ DECL_STRUCT_FUNCTION函数的具体用法?C++ DECL_STRUCT_FUNCTION怎么用?C++ DECL_STRUCT_FUNCTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DECL_STRUCT_FUNCTION函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: getSizeint getSize(char *name) { struct cgraph_node *node; basic_block bb; gimple statement; enum gimple_code code; gimple_stmt_iterator gsi; int size = 0; for (node = cgraph_nodes; node; node = node->next) { /* Nodes without a body, and clone nodes are not interesting. */ if (!gimple_has_body_p(node->decl) || node->clone_of) continue; if (strcmp(cgraph_node_name(node), name) == 0) { set_cfun(DECL_STRUCT_FUNCTION(node->decl)); //fprintf(stderr, "%s --> ", cgraph_node_name(node)); FOR_ALL_BB(bb) { for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) { statement = gsi_stmt(gsi); code = gimple_code(statement); //debug_gimple_stmt(statement); if (code != GIMPLE_CALL) { size++; } } } return size; } }
开发者ID:sm88,项目名称:programs,代码行数:30,
示例2: test_conversion_to_ssastatic voidtest_conversion_to_ssa (){ /* As above, construct a trivial function, gimplify it, and build a CFG: */ tree fndecl = build_trivial_high_gimple_function (); function *fun = DECL_STRUCT_FUNCTION (fndecl); ASSERT_TRUE (fun != NULL); build_cfg (fndecl); convert_to_ssa (fndecl); verify_three_block_gimple_cfg (fun); /* For out trivial test function we should now have something like this: test_fn () { <bb 2>: _1 = 42; return _1; } */ basic_block bb2 = get_real_block (fun); gimple *stmt_a = gimple_seq_first_stmt (bb_seq (bb2)); ASSERT_EQ (GIMPLE_ASSIGN, gimple_code (stmt_a)); gimple *stmt_b = stmt_a->next; ASSERT_EQ (GIMPLE_RETURN, gimple_code (stmt_b)); ASSERT_EQ (NULL, stmt_b->next); greturn *return_stmt = as_a <greturn *> (stmt_b); ASSERT_EQ (SSA_NAME, TREE_CODE (gimple_return_retval (return_stmt)));}
开发者ID:duarten,项目名称:gcc,代码行数:33,
示例3: record_vars_intovoidrecord_vars_into (tree vars, tree fn){ bool change_cfun = fn != current_function_decl; if (change_cfun) push_cfun (DECL_STRUCT_FUNCTION (fn)); for (; vars; vars = DECL_CHAIN (vars)) { tree var = vars; /* BIND_EXPRs contains also function/type/constant declarations we don't need to care about. */ if (TREE_CODE (var) != VAR_DECL) continue; /* Nothing to do in this case. */ if (DECL_EXTERNAL (var)) continue; /* Record the variable. */ add_local_decl (cfun, var); } if (change_cfun) pop_cfun ();}
开发者ID:hnaik,项目名称:gcc,代码行数:28,
示例4: call_graph_add_fnstatic voidcall_graph_add_fn (tree fndecl){ const tree outer = current_function_decl; struct function *f = DECL_STRUCT_FUNCTION (fndecl); gcc_assert (TREE_CODE (fndecl) == FUNCTION_DECL); f->is_cilk_function = 1; f->curr_properties = cfun->curr_properties; gcc_assert (cfun == DECL_STRUCT_FUNCTION (outer)); gcc_assert (cfun->decl == outer); push_cfun (f); cgraph_node::create (fndecl); pop_cfun_to (outer);}
开发者ID:kito-cheng,项目名称:gcc,代码行数:16,
示例5: set_callers_may_not_allocate_framestatic voidset_callers_may_not_allocate_frame (function *fn){ basic_block bb; gimple_stmt_iterator gsi; gimple *stmt; tree called_fn_tree; function *called_fn; if (fn->cfg == NULL) return; FOR_EACH_BB_FN (bb, fn) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { stmt = gsi_stmt (gsi); if (is_gimple_call (stmt)) { called_fn_tree = gimple_call_fndecl (stmt); if (called_fn_tree != NULL) { called_fn = DECL_STRUCT_FUNCTION (called_fn_tree); if (called_fn != NULL) called_fn->machine->callers_may_not_allocate_frame = true; } } } } return;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:31,
示例6: pop_cfun_tostatic voidpop_cfun_to (tree outer){ pop_cfun (); current_function_decl = outer; gcc_assert (cfun == DECL_STRUCT_FUNCTION (current_function_decl)); gcc_assert (cfun->decl == current_function_decl);}
开发者ID:kito-cheng,项目名称:gcc,代码行数:8,
示例7: build_functionstatic voidbuild_function (tree fndecl, tree stmts, tree block){ DECL_INITIAL(fndecl) = block; DECL_SAVED_TREE (fndecl) = stmts ; tree resdecl = build_decl(input_location,RESULT_DECL, NULL_TREE, integer_type_node); DECL_CONTEXT (resdecl) = fndecl; DECL_RESULT(fndecl) = resdecl; current_function_decl = fndecl; if (DECL_STRUCT_FUNCTION(fndecl) == NULL) push_struct_function(fndecl); else push_cfun(DECL_STRUCT_FUNCTION(fndecl)); cfun->function_end_locus = BUILTINS_LOCATION;}
开发者ID:pradeep-subrahmanion,项目名称:SLANG-GCC,代码行数:19,
示例8: 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,
示例9: afdo_indirect_callstatic voidafdo_indirect_call (gimple_stmt_iterator *gsi, const icall_target_map &map, bool transform){ gimple gs = gsi_stmt (*gsi); tree callee; if (map.size () == 0) return; gcall *stmt = dyn_cast <gcall *> (gs); if ((!stmt) || gimple_call_fndecl (stmt) != NULL_TREE) return; callee = gimple_call_fn (stmt); histogram_value hist = gimple_alloc_histogram_value ( cfun, HIST_TYPE_INDIR_CALL, stmt, callee); hist->n_counters = 3; hist->hvalue.counters = XNEWVEC (gcov_type, hist->n_counters); gimple_add_histogram_value (cfun, stmt, hist); gcov_type total = 0; icall_target_map::const_iterator max_iter = map.end (); for (icall_target_map::const_iterator iter = map.begin (); iter != map.end (); ++iter) { total += iter->second; if (max_iter == map.end () || max_iter->second < iter->second) max_iter = iter; } hist->hvalue.counters[0] = (unsigned long long)afdo_string_table->get_name (max_iter->first); hist->hvalue.counters[1] = max_iter->second; hist->hvalue.counters[2] = total; if (!transform) return; struct cgraph_edge *indirect_edge = cgraph_node::get (current_function_decl)->get_edge (stmt); struct cgraph_node *direct_call = cgraph_node::get_for_asmname ( get_identifier ((const char *) hist->hvalue.counters[0])); if (direct_call == NULL || !check_ic_target (stmt, direct_call)) return; if (DECL_STRUCT_FUNCTION (direct_call->decl) == NULL) return; struct cgraph_edge *new_edge = indirect_edge->make_speculative (direct_call, 0, 0); new_edge->redirect_call_stmt_to_callee (); gimple_remove_histogram_value (cfun, stmt, hist); inline_call (new_edge, true, NULL, NULL, false);}
开发者ID:chainalgit,项目名称:gcc,代码行数:55,
示例10: convert_to_ssastatic voidconvert_to_ssa (tree fndecl){ function *fun = DECL_STRUCT_FUNCTION (fndecl); ASSERT_TRUE (fun != NULL); ASSERT_EQ (fndecl, fun->decl); gimple_opt_pass *build_ssa_pass = make_pass_build_ssa (g); push_cfun (fun); build_ssa_pass->execute (fun); pop_cfun ();}
开发者ID:duarten,项目名称:gcc,代码行数:12,
示例11: symtab_nonoverwritable_aliassymtab_node *symtab_nonoverwritable_alias (symtab_node *node){ tree new_decl; symtab_node *new_node = NULL; /* First try to look up existing alias or base object (if that is already non-overwritable). */ node = symtab_alias_ultimate_target (node, NULL); gcc_assert (!node->alias && !node->weakref); symtab_for_node_and_aliases (node, symtab_nonoverwritable_alias_1, (void *)&new_node, true); if (new_node) return new_node;#ifndef ASM_OUTPUT_DEF /* If aliases aren't supported by the assembler, fail. */ return NULL;#endif /* Otherwise create a new one. */ new_decl = copy_node (node->decl); DECL_DLLIMPORT_P (new_decl) = 0; DECL_NAME (new_decl) = clone_function_name (node->decl, "localalias"); if (TREE_CODE (new_decl) == FUNCTION_DECL) DECL_STRUCT_FUNCTION (new_decl) = NULL; DECL_INITIAL (new_decl) = NULL; SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); SET_DECL_RTL (new_decl, NULL); /* Update the properties. */ DECL_EXTERNAL (new_decl) = 0; if (DECL_ONE_ONLY (node->decl)) DECL_SECTION_NAME (new_decl) = NULL; DECL_COMDAT_GROUP (new_decl) = 0; TREE_PUBLIC (new_decl) = 0; DECL_COMDAT (new_decl) = 0; DECL_WEAK (new_decl) = 0; DECL_VIRTUAL_P (new_decl) = 0; if (TREE_CODE (new_decl) == FUNCTION_DECL) { DECL_STATIC_CONSTRUCTOR (new_decl) = 0; DECL_STATIC_DESTRUCTOR (new_decl) = 0; new_node = cgraph_create_function_alias (new_decl, node->decl); } else new_node = varpool_create_variable_alias (new_decl, node->decl); symtab_resolve_alias (new_node, node); gcc_assert (decl_binds_to_current_def_p (new_decl)); return new_node;}
开发者ID:alisw,项目名称:gcc-toolchain,代码行数:52,
示例12: check_bb_profile/* Check the consistency of profile information. We can't do that in verify_flow_info, as the counts may get invalid for incompletely solved graphs, later eliminating of conditionals or roundoff errors. It is still practical to have them reported for debugging of simple testcases. */static voidcheck_bb_profile (basic_block bb, FILE * file, int indent, int flags){ edge e; int sum = 0; gcov_type lsum; edge_iterator ei; struct function *fun = DECL_STRUCT_FUNCTION (current_function_decl); char *s_indent = (char *) alloca ((size_t) indent + 1); memset ((void *) s_indent, ' ', (size_t) indent); s_indent[indent] = '/0'; if (profile_status_for_function (fun) == PROFILE_ABSENT) return; if (bb != EXIT_BLOCK_PTR_FOR_FUNCTION (fun)) { FOR_EACH_EDGE (e, ei, bb->succs) sum += e->probability; if (EDGE_COUNT (bb->succs) && abs (sum - REG_BR_PROB_BASE) > 100) fprintf (file, "%s%sInvalid sum of outgoing probabilities %.1f%%/n", (flags & TDF_COMMENT) ? ";; " : "", s_indent, sum * 100.0 / REG_BR_PROB_BASE); lsum = 0; FOR_EACH_EDGE (e, ei, bb->succs) lsum += e->count; if (EDGE_COUNT (bb->succs) && (lsum - bb->count > 100 || lsum - bb->count < -100)) fprintf (file, "%s%sInvalid sum of outgoing counts %i, should be %i/n", (flags & TDF_COMMENT) ? ";; " : "", s_indent, (int) lsum, (int) bb->count); } if (bb != ENTRY_BLOCK_PTR_FOR_FUNCTION (fun)) { sum = 0; FOR_EACH_EDGE (e, ei, bb->preds) sum += EDGE_FREQUENCY (e); if (abs (sum - bb->frequency) > 100) fprintf (file, "%s%sInvalid sum of incoming frequencies %i, should be %i/n", (flags & TDF_COMMENT) ? ";; " : "", s_indent, sum, bb->frequency); lsum = 0; FOR_EACH_EDGE (e, ei, bb->preds) lsum += e->count; if (lsum - bb->count > 100 || lsum - bb->count < -100) fprintf (file, "%s%sInvalid sum of incoming counts %i, should be %i/n", (flags & TDF_COMMENT) ? ";; " : "", s_indent, (int) lsum, (int) bb->count); }}
开发者ID:BoxianLai,项目名称:moxiedev,代码行数:56,
示例13: xml_local_declsvoid xml_local_decls(int indent, FILE *out){ tree var; fprintf(out, "%s<locals>/n", spc(indent)); indent += INDENT; for (var = DECL_STRUCT_FUNCTION(current_function_decl)->local_decls; var; var = TREE_CHAIN(var)) xml_local_decl(TREE_VALUE(var), indent, out); indent -= INDENT; fprintf(out, "%s</locals>/n", spc(indent));}
开发者ID:ctz,项目名称:lighthouse,代码行数:14,
示例14: gimple_set_bodyvoidgimple_set_body (tree fndecl, gimple_seq seq){ struct function *fn = DECL_STRUCT_FUNCTION (fndecl); if (fn == NULL) { /* If FNDECL still does not have a function structure associated with it, then it does not make sense for it to receive a GIMPLE body. */ gcc_assert (seq == NULL); } else fn->gimple_body = seq;}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:14,
示例15: analyze_functionstatic funct_stateanalyze_function (struct cgraph_node *fn, bool ipa){ tree decl = fn->decl; funct_state l; basic_block this_block; l = XCNEW (struct funct_state_d); l->pure_const_state = IPA_CONST; l->state_previously_known = IPA_NEITHER; l->looping_previously_known = true; l->looping = false; l->can_throw = false; state_from_flags (&l->state_previously_known, &l->looping_previously_known, flags_from_decl_or_type (fn->decl), fn->cannot_return_p ()); if (fn->thunk.thunk_p || fn->alias) { /* Thunk gets propagated through, so nothing interesting happens. */ gcc_assert (ipa); return l; } if (dump_file) { fprintf (dump_file, "/n/n local analysis of %s/n ", fn->name ()); } push_cfun (DECL_STRUCT_FUNCTION (decl)); FOR_EACH_BB_FN (this_block, cfun) { gimple_stmt_iterator gsi; struct walk_stmt_info wi; memset (&wi, 0, sizeof (wi)); for (gsi = gsi_start_bb (this_block); !gsi_end_p (gsi); gsi_next (&gsi)) { check_stmt (&gsi, l, ipa); if (l->pure_const_state == IPA_NEITHER && l->looping && l->can_throw) goto end; } }
开发者ID:Xilinx,项目名称:gcc,代码行数:47,
示例16: test_building_cfgstatic voidtest_building_cfg (){ /* Construct a trivial function, and gimplify it: */ tree fndecl = build_trivial_high_gimple_function (); function *fun = DECL_STRUCT_FUNCTION (fndecl); ASSERT_TRUE (fun != NULL); /* Build a CFG. */ build_cfg (fndecl); /* The CFG-building code constructs a 4-block cfg (with ENTRY and EXIT): test_fn () { <bb 2>: D.65 = 42; <bb 3>: return D.65; } and then ought to merge blocks 2 and 3 in cleanup_tree_cfg. Hence we should end up with a simple 3-block cfg, the two "fake" ones, and a "real" one: [ENTRY] -> [block2] -> [EXIT] with code like this: test_fn () { <bb 2>: D.56 = 42; return D.56; } */ verify_three_block_gimple_cfg (fun); /* Verify the statements within the "real" block. */ basic_block bb2 = get_real_block (fun); gimple *stmt_a = gimple_seq_first_stmt (bb_seq (bb2)); ASSERT_EQ (GIMPLE_ASSIGN, gimple_code (stmt_a)); gimple *stmt_b = stmt_a->next; ASSERT_EQ (GIMPLE_RETURN, gimple_code (stmt_b)); ASSERT_EQ (NULL, stmt_b->next);}
开发者ID:duarten,项目名称:gcc,代码行数:44,
示例17: tree_lowering_passesvoidtree_lowering_passes (tree fn){ tree saved_current_function_decl = current_function_decl; current_function_decl = fn; push_cfun (DECL_STRUCT_FUNCTION (fn)); gimple_register_cfg_hooks (); bitmap_obstack_initialize (NULL); execute_pass_list (all_lowering_passes); if (optimize && cgraph_global_info_ready) execute_pass_list (pass_early_local_passes.pass.sub); free_dominance_info (CDI_POST_DOMINATORS); free_dominance_info (CDI_DOMINATORS); compact_blocks (); current_function_decl = saved_current_function_decl; bitmap_obstack_release (NULL); pop_cfun ();}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:19,
示例18: record_vars_intovoidrecord_vars_into (tree vars, tree fn){ for (; vars; vars = DECL_CHAIN (vars)) { tree var = vars; /* BIND_EXPRs contains also function/type/constant declarations we don't need to care about. */ if (TREE_CODE (var) != VAR_DECL) continue; /* Nothing to do in this case. */ if (DECL_EXTERNAL (var)) continue; /* Record the variable. */ add_local_decl (DECL_STRUCT_FUNCTION (fn), var); }}
开发者ID:ChillyWillyGuru,项目名称:gcc-4.9.0-PS3,代码行数:20,
示例19: test_gimplificationstatic voidtest_gimplification (){ tree fndecl = build_trivial_generic_function (); /* Convert to gimple: */ gimplify_function_tree (fndecl); /* Verify that we got gimple out of it. */ /* The function is now in GIMPLE form but the CFG has not been built yet. */ /* We should have a struct function for the decl. */ function *fun = DECL_STRUCT_FUNCTION (fndecl); ASSERT_TRUE (fun != NULL); ASSERT_EQ (fndecl, fun->decl); /* We expect a GIMPLE_BIND, with two gimple statements within it: tmp = 42; return tmp; */ gimple_seq seq_fn_body = gimple_body (fndecl); ASSERT_TRUE (seq_fn_body != NULL); gimple *bind_stmt = gimple_seq_first_stmt (seq_fn_body); ASSERT_EQ (GIMPLE_BIND, gimple_code (bind_stmt)); ASSERT_EQ (NULL, bind_stmt->next); gimple_seq seq_bind_body = gimple_bind_body (as_a <gbind *> (bind_stmt)); /* Verify that we have the 2 statements we expect. */ ASSERT_TRUE (seq_bind_body != NULL); gimple *stmt1 = gimple_seq_first_stmt (seq_bind_body); ASSERT_TRUE (stmt1 != NULL); ASSERT_EQ (GIMPLE_ASSIGN, gimple_code (stmt1)); gimple *stmt2 = stmt1->next; ASSERT_TRUE (stmt2 != NULL); ASSERT_EQ (stmt1, stmt2->prev); ASSERT_EQ (GIMPLE_RETURN, gimple_code (stmt2));}
开发者ID:duarten,项目名称:gcc,代码行数:40,
示例20: symtab_nonoverwritable_aliassymtab_nodesymtab_nonoverwritable_alias (symtab_node node){ tree new_decl; symtab_node new_node = NULL; symtab_for_node_and_aliases (node, symtab_nonoverwritable_alias_1, (void *)&new_node, true); if (new_node) return new_node; new_decl = copy_node (node->symbol.decl); DECL_NAME (new_decl) = clone_function_name (node->symbol.decl, "localalias"); if (TREE_CODE (new_decl) == FUNCTION_DECL) DECL_STRUCT_FUNCTION (new_decl) = NULL; DECL_INITIAL (new_decl) = NULL; SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); SET_DECL_RTL (new_decl, NULL); /* Update the properties. */ DECL_EXTERNAL (new_decl) = 0; if (DECL_ONE_ONLY (node->symbol.decl)) DECL_SECTION_NAME (new_decl) = NULL; DECL_COMDAT_GROUP (new_decl) = 0; TREE_PUBLIC (new_decl) = 0; DECL_COMDAT (new_decl) = 0; DECL_WEAK (new_decl) = 0; DECL_VIRTUAL_P (new_decl) = 0; if (TREE_CODE (new_decl) == FUNCTION_DECL) { DECL_STATIC_CONSTRUCTOR (new_decl) = 0; DECL_STATIC_DESTRUCTOR (new_decl) = 0; new_node = (symtab_node) cgraph_create_function_alias (new_decl, node->symbol.decl); } else new_node = (symtab_node) varpool_create_variable_alias (new_decl, node->symbol.decl); symtab_resolve_alias (new_node, node); return new_node;}
开发者ID:Roffi,项目名称:gcc,代码行数:38,
示例21: callees_functions_use_frame_headerstatic boolcallees_functions_use_frame_header (function *fn){ basic_block bb; gimple_stmt_iterator gsi; gimple *stmt; tree called_fn_tree; function *called_fn; if (fn->cfg == NULL) return true; FOR_EACH_BB_FN (bb, fn) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { stmt = gsi_stmt (gsi); if (is_gimple_call (stmt)) { called_fn_tree = gimple_call_fndecl (stmt); if (called_fn_tree != NULL) { called_fn = DECL_STRUCT_FUNCTION (called_fn_tree); if (called_fn == NULL || DECL_WEAK (called_fn_tree) || has_inlined_assembly (called_fn) || !is_leaf_function (called_fn) || !called_fn->machine->does_not_use_frame_header) return true; } else return true; } } } return false;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:37,
示例22: cgraph_finalize_functionvoidcgraph_finalize_function (tree decl, bool nested){ struct cgraph_node *node = cgraph_node (decl); if (node->local.finalized) cgraph_reset_node (node); node->pid = cgraph_max_pid ++; notice_global_symbol (decl); node->local.finalized = true; node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL; record_cdtor_fn (node->decl); if (node->nested) lower_nested_functions (decl); gcc_assert (!node->nested); if (decide_is_function_needed (node, decl)) cgraph_mark_needed_node (node); /* Since we reclaim unreachable nodes at the end of every language level unit, we need to be conservative about possible entry points there. */ if ((TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))) cgraph_mark_reachable_node (node); /* If we've not yet emitted decl, tell the debug info about it. */ if (!TREE_ASM_WRITTEN (decl)) (*debug_hooks->deferred_inline_function) (decl); /* Possibly warn about unused parameters. */ if (warn_unused_parameter) do_warn_unused_parameter (decl); if (!nested) ggc_collect ();}
开发者ID:BGmot,项目名称:playbook-dev-tools,代码行数:37,
示例23: build_cfgstatic voidbuild_cfg (tree fndecl){ function *fun = DECL_STRUCT_FUNCTION (fndecl); ASSERT_TRUE (fun != NULL); ASSERT_EQ (fndecl, fun->decl); /* We first have to lower control flow; for our trivial test function this gives us: test_fn () { D.56 = 42; goto <D.57>; <D.57>: return D.56; } */ gimple_opt_pass *lower_cf_pass = make_pass_lower_cf (g); push_cfun (fun); lower_cf_pass->execute (fun); pop_cfun (); /* We can now convert to CFG form; for our trivial test function this gives us: test_fn () { <bb 2>: D.56 = 42; return D.56; } */ gimple_opt_pass *build_cfg_pass = make_pass_build_cfg (g); push_cfun (fun); build_cfg_pass->execute (fun); pop_cfun ();}
开发者ID:duarten,项目名称:gcc,代码行数:36,
示例24: gimple_has_body_p/* Return true when FNDECL has Gimple body either in unlowered or CFG form. */boolgimple_has_body_p (tree fndecl){ struct function *fn = DECL_STRUCT_FUNCTION (fndecl); return (gimple_body (fndecl) || (fn && fn->cfg));}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:8,
示例25: gimple_bodygimple_seqgimple_body (tree fndecl){ struct function *fn = DECL_STRUCT_FUNCTION (fndecl); return fn ? fn->gimple_body : NULL;}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:6,
示例26: print_node//.........这里部分代码省略......... print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4); } if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)) { print_node_brief (file, "abstract_origin", DECL_ABSTRACT_ORIGIN (node), indent + 4); } if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) { print_node (file, "result", DECL_RESULT_FLD (node), indent + 4); } lang_hooks.print_decl (file, node, indent); if (DECL_RTL_SET_P (node)) { indent_to (file, indent + 4); print_rtl (file, DECL_RTL (node)); } if (code == PARM_DECL) { print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4); if (DECL_INCOMING_RTL (node) != 0) { indent_to (file, indent + 4); fprintf (file, "incoming-rtl "); print_rtl (file, DECL_INCOMING_RTL (node)); } } else if (code == FUNCTION_DECL && DECL_STRUCT_FUNCTION (node) != 0) { print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4); indent_to (file, indent + 4); dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node)); } if ((code == VAR_DECL || code == PARM_DECL) && DECL_HAS_VALUE_EXPR_P (node)) print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4); /* Print the decl chain only if decl is at second level. */ if (indent == 4) print_node (file, "chain", TREE_CHAIN (node), indent + 4); else print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); break; case tcc_type: if (TYPE_UNSIGNED (node)) fputs (" unsigned", file); if (TYPE_NO_FORCE_BLK (node)) fputs (" no-force-blk", file); if (TYPE_STRING_FLAG (node)) fputs (" string-flag", file); if (TYPE_NEEDS_CONSTRUCTING (node)) fputs (" needs-constructing", file); if ((code == RECORD_TYPE || code == UNION_TYPE
开发者ID:RajibTheKing,项目名称:gcc,代码行数:67,
示例27: tree_profilingstatic unsigned inttree_profiling (void){ struct cgraph_node *node; /* This is a small-ipa pass that gets called only once, from cgraphunit.c:ipa_passes(). */ gcc_assert (symtab->state == IPA_SSA); init_node_map (true); FOR_EACH_DEFINED_FUNCTION (node) { if (!gimple_has_body_p (node->decl)) continue; /* Don't profile functions produced for builtin stuff. */ if (DECL_SOURCE_LOCATION (node->decl) == BUILTINS_LOCATION) continue; /* Do not instrument extern inline functions when testing coverage. While this is not perfectly consistent (early inlined extern inlines will get acocunted), testsuite expects that. */ if (DECL_EXTERNAL (node->decl) && flag_test_coverage) continue; push_cfun (DECL_STRUCT_FUNCTION (node->decl)); /* Local pure-const may imply need to fixup the cfg. */ if (execute_fixup_cfg () & TODO_cleanup_cfg) cleanup_tree_cfg (); branch_prob (); if (! flag_branch_probabilities && flag_profile_values) gimple_gen_ic_func_profiler (); if (flag_branch_probabilities && flag_profile_values && flag_value_profile_transformations) gimple_value_profile_transformations (); /* The above could hose dominator info. Currently there is none coming in, this is a safety valve. It should be easy to adjust it, if and when there is some. */ free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); pop_cfun (); } /* Drop pure/const flags from instrumented functions. */ FOR_EACH_DEFINED_FUNCTION (node) { if (!gimple_has_body_p (node->decl) || !(!node->clone_of || node->decl != node->clone_of->decl)) continue; /* Don't profile functions produced for builtin stuff. */ if (DECL_SOURCE_LOCATION (node->decl) == BUILTINS_LOCATION) continue; node->set_const_flag (false, false); node->set_pure_flag (false, false); } /* Update call statements and rebuild the cgraph. */ FOR_EACH_DEFINED_FUNCTION (node) { basic_block bb; if (!gimple_has_body_p (node->decl) || !(!node->clone_of || node->decl != node->clone_of->decl)) continue; /* Don't profile functions produced for builtin stuff. */ if (DECL_SOURCE_LOCATION (node->decl) == BUILTINS_LOCATION) continue; push_cfun (DECL_STRUCT_FUNCTION (node->decl)); 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 = gsi_stmt (gsi); if (is_gimple_call (stmt)) update_stmt (stmt); } } /* re-merge split blocks. */ cleanup_tree_cfg (); update_ssa (TODO_update_ssa); cgraph_edge::rebuild_edges ();//.........这里部分代码省略.........
开发者ID:3F,项目名称:gcc,代码行数:101,
示例28: tree_rest_of_compilationvoidtree_rest_of_compilation (tree fndecl){ location_t saved_loc; timevar_push (TV_EXPAND); gcc_assert (cgraph_global_info_ready); /* Initialize the default bitmap obstack. */ bitmap_obstack_initialize (NULL); /* Initialize the RTL code for the function. */ current_function_decl = fndecl; saved_loc = input_location; input_location = DECL_SOURCE_LOCATION (fndecl); init_function_start (fndecl); /* Even though we're inside a function body, we still don't want to call expand_expr to calculate the size of a variable-sized array. We haven't necessarily assigned RTL to all variables yet, so it's not safe to try to expand expressions involving them. */ cfun->dont_save_pending_sizes_p = 1; gimple_register_cfg_hooks (); bitmap_obstack_initialize (®_obstack); /* FIXME, only at RTL generation*/ execute_all_ipa_transforms (); /* Perform all tree transforms and optimizations. */ /* Signal the start of passes. */ invoke_plugin_callbacks (PLUGIN_ALL_PASSES_START, NULL); execute_pass_list (all_passes); /* Signal the end of passes. */ invoke_plugin_callbacks (PLUGIN_ALL_PASSES_END, NULL); bitmap_obstack_release (®_obstack); /* Release the default bitmap obstack. */ bitmap_obstack_release (NULL); set_cfun (NULL); /* If requested, warn about function definitions where the function will return a value (usually of some struct or union type) which itself will take up a lot of stack space. */ if (warn_larger_than && !DECL_EXTERNAL (fndecl) && TREE_TYPE (fndecl)) { tree ret_type = TREE_TYPE (TREE_TYPE (fndecl)); if (ret_type && TYPE_SIZE_UNIT (ret_type) && TREE_CODE (TYPE_SIZE_UNIT (ret_type)) == INTEGER_CST && 0 < compare_tree_int (TYPE_SIZE_UNIT (ret_type), larger_than_size)) { unsigned int size_as_int = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type)); if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0) warning (OPT_Wlarger_than_eq, "size of return value of %q+D is %u bytes", fndecl, size_as_int); else warning (OPT_Wlarger_than_eq, "size of return value of %q+D is larger than %wd bytes", fndecl, larger_than_size); } } gimple_set_body (fndecl, NULL); if (DECL_STRUCT_FUNCTION (fndecl) == 0 && !cgraph_node (fndecl)->origin) { /* Stop pointing to the local nodes about to be freed. But DECL_INITIAL must remain nonzero so we know this was an actual function definition. For a nested function, this is done in c_pop_function_context. If rest_of_compilation set this to 0, leave it 0. */ if (DECL_INITIAL (fndecl) != 0) DECL_INITIAL (fndecl) = error_mark_node; } input_location = saved_loc; ggc_collect (); timevar_pop (TV_EXPAND);}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:89,
注:本文中的DECL_STRUCT_FUNCTION函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DECREASE_PENDING_REQ_COUNT函数代码示例 C++ DECL_SOURCE_LOCATION函数代码示例 |