GCC Middle and Back End API Reference
|
#include "bconfig.h"
#include "system.h"
#include "errors.h"
#include "getopt.h"
#include "version.h"
#include "xregex.h"
#include "obstack.h"
#include "gengtype.h"
#include "filenames.h"
Functions | |
static outf_p | create_file (const char *, const char *) |
static const char * | get_file_basename (const input_file *) |
static const char * | get_file_realbasename (const input_file *) |
static int | get_prefix_langdir_index (const char *) |
static const char * | get_file_langdir (const input_file *) |
static void | dump_pair (int indent, pair_p p) |
static void | dump_type (int indent, type_p p) |
static void | dump_type_list (int indent, type_p p) |
static void | gen_rtx_next (void) |
static void | write_rtx_next (void) |
static void | open_base_files (void) |
static void | close_output_files (void) |
void | error_at_line (const struct fileloc *pos, const char *msg,...) |
static const_type_p | get_ultimate_base_class (const_type_p s) |
void | dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t) |
static size_t | measure_input_list (FILE *list) |
static bool | read_input_line (FILE *list, char **herep, char **linep, struct fileloc *pos) |
static void | read_input_list (const char *listname) |
static type_p | adjust_field_rtx_def (type_p t, options_p opt) |
void | do_typedef (const char *s, type_p t, struct fileloc *pos) |
void | do_scalar_typedef (const char *s, struct fileloc *pos) |
static char * | strtoken (char *str, const char *delim, char **next) |
type_p | create_user_defined_type (const char *type_name, struct fileloc *pos) |
free (str) | |
static type_p | type_for_name (const char *s) |
static type_p | create_undefined_type (const char *s, struct fileloc *pos) |
type_p | resolve_typedef (const char *s, struct fileloc *pos) |
Variables | |
outf_p | output_files |
outf_p | header_file |
static char * | inputlist |
static input_file ** | plugin_files |
static size_t | nb_plugin_files |
static outf_p | plugin_output |
static char * | plugin_output_filename |
const char * | srcdir |
size_t | srcdir_len |
const char * | read_state_filename |
const char * | write_state_filename |
int | do_dump |
int | do_debug |
int | verbosity_level |
static int | type_count |
static const char * | backup_dir |
bool | hit_error = false |
const input_file ** | gt_files |
size_t | num_gt_files |
const char ** | build_headers |
size_t | num_build_headers |
input_file * | this_file |
input_file * | system_h_file |
const char ** | lang_dir_names |
size_t | num_lang_dirs |
static outf_p * | base_files |
struct type | string_type |
struct type | scalar_nonchar |
struct type | scalar_char |
struct type | callback_type |
pair_p | typedefs = NULL |
type_p | structures = NULL |
pair_p | variables = NULL |
else | arg_type = resolve_typedef (field_name, pos) |
fields = create_field_at (fields, arg_type, field_name, 0, pos) | |
type_id = strtoken (0, ",>", &next) | |
return | ty |
|
static |
|
static |
Create an undefined type with name S and location POS. Return the newly created type.
Define TYPE_NAME to be a user defined type at location POS.
References do_typedef(), fileloc::file, find_structure(), get_lang_bitmap(), ty, and TYPE_USER_STRUCT.
Referenced by type().
void dbgprint_count_type_at | ( | const char * | fil, |
int | lin, | ||
const char * | msg, | ||
type_p | t ) |
Utility debugging function, printing the various type counts within a list of types. Called through the DBGPRINT_COUNT_TYPE macro.
References gcc_unreachable, type::kind, msg, type::next, NULL, TYPE_ARRAY, TYPE_CALLBACK, TYPE_LANG_STRUCT, TYPE_NONE, TYPE_POINTER, TYPE_SCALAR, TYPE_STRING, TYPE_STRUCT, TYPE_UNDEFINED, TYPE_UNION, and TYPE_USER_STRUCT.
void do_scalar_typedef | ( | const char * | s, |
struct fileloc * | pos ) |
Define S as a typename of a scalar. Cannot be used to define typedefs of 'char'. Note: is also used for pointer-to-function typedefs (which are therefore not treated as pointers).
References do_typedef(), type::s, and scalar_nonchar.
Define S as a typedef to T at POS.
References error_at_line(), fileloc::file, type::line, type::next, NULL, type::opt, type::p, type::s, this_file, and typedefs.
Referenced by create_user_defined_type(), do_scalar_typedef(), and typedef_decl().
|
static |
|
static |
|
static |
void error_at_line | ( | const struct fileloc * | pos, |
const char * | msg, | ||
... ) |
Report an error at POS, printing MSG.
References ap, fileloc::file, fputc(), gcc_assert, get_input_file_name(), hit_error, fileloc::line, msg, NULL, and vfprintf().
Referenced by do_typedef(), read_input_line(), and read_input_list().
free | ( | str | ) |
Referenced by add_constant(), add_desc_attribute(), add_loop(), add_prefix_map(), add_scope_conflicts(), add_standard_paths(), add_sysrooted_hdrs_prefix(), add_sysrooted_prefix(), add_to_list(), alias_get_name(), alloc_page(), analyze_candidates_and_replace(), analyze_function_body(), analyze_insns_in_loop(), analyze_memory_references(), assign_by_spills(), assign_spill_hard_regs(), associate_equivalences_with_edges(), average_num_loop_insns(), loop_distribution::bb_top_order_destroy(), loop_distribution::bb_top_order_init(), loop_distribution::break_alias_scc_partitions(), bt_callback(), bt_callback(), build_insn_chain(), option_proposer::build_option_suggestions(), diagnostic_text_output_format::build_prefix(), build_store_vectors(), calculate_elim_costs_all_insns(), calculate_live_ranges(), can_duplicate_loop_p(), cancel_loop(), canon_relative_path_prefix(), ccp_finalize(), cleanup_dead_labels(), clear_bb_predictions(), clear_iv_info(), collect_execute(), combine_blocks(), combine_instructions(), common_handle_option(), comp_dir_string(), compare_debug_dump_opt_spec_function(), fnfilter::compile(), compile_images_for_offload_targets(), complain_wrong_lang(), compute_antic(), compute_antinout_edge(), compute_avail(), compute_available(), compute_builtin_object_size(), compute_hash_table_work(), compute_laterin(), compute_live_vars(), compute_nearerout(), compute_store_table(), compute_value_histograms(), copy_function_or_variable(), copyprop_hardreg_forward_bb_without_debug_insn(), coverage_checksum_string(), coverage_compute_profile_id(), create_cand(), create_cands(), create_file_names(), create_fixup_graph(), create_function_info_for(), create_log_links(), create_variable_info_for_1(), cse_extended_basic_block(), cse_main(), cselib_finish(), cselib_init(), dbr_schedule(), decode_cmdline_option(), delete_coalesce_list(), delete_fixup_graph(), delete_points_to_sets(), delete_tree_live_info(), delete_trivially_dead_insns(), delete_var_map(), destroy_loop(), destroy_output_block(), determine_bb_domination_status(), determine_dominators_for_sons(), determine_loop_nest_reuse(), pcom_worker::determine_roots_comp(), df_analyze(), df_analyze_loop(), df_chain_free(), df_chain_fully_remove_problem(), df_compact_blocks(), df_live_free(), df_live_verify_solution_end(), df_lr_free(), df_lr_verify_solution_end(), df_maybe_reorganize_def_refs(), df_maybe_reorganize_use_refs(), df_md_free(), df_md_local_compute(), df_mir_free(), df_mir_verify_solution_end(), df_note_free(), df_rd_free(), df_scan_free(), df_scan_free_internal(), df_word_lr_free(), df_worklist_dataflow(), dfs_enumerate_from(), do_per_function_toporder(), do_reassoc(), do_report_bug(), do_self_spec(), do_spec_1(), driver::do_spec_on_infiles(), doloop_valid_p(), draw_cfg_nodes_for_loop(), draw_cfg_nodes_no_loops(), driver_handle_option(), dse_step7(), bitmap_usage::dump(), ggc_usage::dump(), mem_usage::dump(), pool_usage::dump(), gcc::dump_manager::dump_begin(), ipa_icf::sem_item_optimizer::dump_cong_classes(), gcc::dump_manager::dump_enable_all(), dump_hash_table(), dump_hash_table(), dump_node(), dump_probability(), dump_profile(), gcc::dump_manager::dump_start(), gcc::dump_manager::dump_switch_p_1(), dump_targets(), dumps_spec_func(), duplicate_loop_body_to_header_edge(), back_jt_path_registry::duplicate_thread_path(), eliminate_unnecessary_stmts(), emit_documentation(), emit_library_call_value_1(), enable_disable_pass(), enable_warning_as_error(), escaped_string::escape(), estimate_loops_at_level(), estimate_numbers_of_iterations(), execute(), execute_over_cond_phis(), expand_all_functions(), expand_call(), files_equal_p(), filter_predictions(), pcom_worker::filter_suitable_components(), final_1(), driver::finalize(), find_a_file(), find_and_merge_options(), find_data_references_in_loop(), find_invariants(), find_loop_guard(), find_minimum_cost_flow(), find_moveable_pseudos(), find_seed_stmts_for_distribution(), find_simple_exit(), find_unreachable_blocks(), fini_copy_prop(), fini_reassoc(), fini_separate_shrink_wrap(), finish_insn_code_data_once(), finish_insn_recog_data(), finish_live_range_start_chains(), finish_live_reload_and_inheritance_pseudos(), finish_live_solver(), finish_lives(), gcc::pass_manager::finish_optimization_passes(), finish_out_of_ssa(), finish_record_layout(), finish_reg_equiv(), finish_reg_info(), finish_regno_assign_info(), finish_remat_bb_data(), finish_saved_hard_regs(), finish_states(), fix_bb_placements(), fix_loop_bb_probability(), flow_loop_dump(), flow_loops_find(), for_each_path(), free_after_compilation(), free_array_of_ptrs(), free_augmenting_path(), free_bb_predicate(), free_cand(), free_conflict_function(), free_csa_reflist(), free_data_ref(), free_dependence_relation(), free_edge_list(), free_gimplify_stack(), free_graph(), free_hash_table(), free_hash_table(), free_hist(), free_insn_recog_data(), free_inv_motion_data(), target_ira_int::free_ira_costs(), free_ldst_entry(), free_lim_aux_data(), free_loop_data(), free_loop_data(), free_mem(), free_modify_mem_tables(), free_name_expansion(), free_nesting_tree(), free_oacc_loop(), free_omp_region_1(), free_opt_info(), free_path(), free_rdg(), free_reg_equiv(), free_reg_info(), target_ira_int::free_register_move_costs(), free_resource_info(), free_st_expr_entry(), vec_info::free_stmt_vec_info(), free_subscripts(), free_temp_expr_table(), free_toporder_info(), free_tree_niter_desc(), free_use_list(), free_var_substitution_info(), wi::from_mpz(), gather_memory_references(), gcc_qsort(), gcc_sort_r(), gcov_output_files(), gcov_write_filename(), gen_mnemonic_attr(), gen_producer_string(), gen_split(), generate_loops_for_partition(), get_attr_order(), get_frame_type(), ipa_icf::sem_item_optimizer::get_group_by_hash(), autofdo::string_table::get_index_by_decl(), get_key_value(), get_loop_body_in_if_conv_order(), get_loop_exit_edges(), get_options_from_collect_gcc_options(), ggc_free(), ggc_pch_finish(), gimple_duplicate_seme_region(), gimple_duplicate_sese_tail(), gimple_fold_builtin_printf(), gimple_init_gcov_profiler(), gimple_remove_histogram_value(), gimplify_asm_expr(), global_decl_processing(), graphds_dfs(), graphds_domtree(), graphds_scc(), function_reader::handle_any_trailing_information(), handle_braces(), handle_foffload_option(), md_reader::handle_include(), handle_spec_function(), has_nonexceptional_receiver(), has_nonexceptional_receiver(), hoist_code(), hoist_guard(), identify_predicable_attribute(), ifcvt_split_critical_edges(), init_alias_analysis(), init_asm_output(), init_cse_reg_info(), init_insn_lengths(), init_loop_unswitch_info(), init_num_threads(), init_predicate_table(), init_reassoc(), init_var_map(), inline_small_functions(), input_function(), funct_state_summary_t::insert(), insert(), ipa_free_postorder_info(), ipa_inline(), ipa_odr_read_section(), ipa_profile(), ipa_reduced_postorder(), ipa_reverse_postorder(), ipa_sra_summarize_function(), ipa_write_summaries(), ira(), ira_free(), ira_restore_scratches(), iterate_fix_dominators(), iv_analysis_done(), iv_ca_delta_free(), iv_ca_free(), load_specs(), fwd_jt_path_registry::lookup_redirection_data(), loop_has_blocks_with_irreducible_flag(), loop_has_phi_with_address_arg(), loop_has_vector_phi_nodes(), loop_invariant_motion_in_fun(), loop_inverted_rev_post_order_compute(), loop_nest_has_data_refs(), loop_rev_post_order_compute(), loop_version(), lower_try_finally(), lower_try_finally_copy(), lra_assign(), lra_coalesce(), lra_create_live_ranges_1(), lra_inheritance(), lra_remat(), lra_spill(), lto_compression_zlib(), lto_delete_out_decl_state(), lto_destroy_compression_stream(), lto_destroy_simple_output_block(), lto_free_section_data(), lto_get_section_name(), lto_output_toplevel_asms(), lto_symtab_encoder_delete(), lto_uncompression_zlib(), lto_write_mode_table(), lto_write_options(), lto_write_stream(), lto_zfree(), main(), sarif_builder::make_artifact_location_object_for_pwd(), make_complex_modes(), sarif_builder::make_driver_tool_component_object(), sarif_builder::make_reporting_descriptor_object_for_cwe_id(), sarif_builder::make_reporting_descriptor_object_for_warning(), sarif_builder::make_result_object(), mark_dfs_back_edges(), sarif_builder::maybe_make_artifact_content_object(), driver::maybe_putenv_OFFLOAD_TARGETS(), driver::maybe_run_linker(), maybe_run_lto_and_relink(), merge_loop_tree(), move_loop_invariants(), move_ptes_to_front(), move_sese_region_to_fn(), new_delete_mismatch_p(), new_delete_mismatch_p(), new_var_info(), next_state_tokens(), num_loop_branches(), num_loop_insns(), number_blocks(), number_of_iterations_exit_assumptions(), oacc_entry_exit_ok(), json_output_format::on_report_diagnostic(), one_cprop_pass(), open_auxiliary_file(), optimize_attrs(), optimize_mask_stores(), optimize_va_list_gpr_fpr_size(), output_get_cpu_unit_code_func(), output_operand_lossage(), parse_and_check_align_values(), parse_and_check_patch_area(), parser::parse_operation(), partition_free(), partition_view_init(), pass_through_libs_spec_func(), path_prefix_reset(), pre_expr_reaches_here_p(), pre_gcse(), predict_loops(), prefix_from_string(), prepare_block_for_update(), diagnostic_text_output_format::print_any_cwe(), diagnostic_text_output_format::print_any_rules(), print_help_one_plugin(), diagnostic_text_output_format::print_option_information(), print_rtl_with_bb(), process_brace_body(), process_command(), process_options(), process_state_for_insn_equiv_partition(), produce_asm(), produce_asm_for_decls(), produce_lto_section(), produce_symtab(), produce_symtab_extension(), propagate(), propagate_malloc(), propagate_nothrow(), propagate_pure_const(), prune_insertions_deletions(), prune_options(), prune_unused_phi_nodes(), pure_const_generate_summary(), quote_spec_arg(), quote_string(), read_md_rtx(), function_reader::read_rtx_operand_r(), read_specs(), read_state_fileloc(), read_state_files_list(), read_thunk_profile(), recog_init(), record_edge_info(), record_temp_file(), referenced_in_one_insn_in_loop_p(), gcc::pass_manager::register_one_dump_file(), regrename_analyze(), regstat_free_calls_crossed(), regstat_free_n_sets_and_refs(), regstat_free_ri(), va_heap::release(), pcom_worker::release_chain(), release_dump_file_name(), release_mem_refs(), release_pages(), release_structures(), reload(), reload_as_needed(), reload_combine(), remap_filename(), counts_entry::remove(), log_entry_hasher::remove(), polymorphic_call_target_hasher::remove(), stats_counter_hasher::remove(), typed_const_free_remove< Type >::remove(), typed_free_remove< Type >::remove(), symbol_table::remove_cgraph_duplication_hook(), symbol_table::remove_cgraph_insertion_hook(), symbol_table::remove_cgraph_removal_hook(), remove_dead_stmt(), symbol_table::remove_edge_duplication_hook(), symbol_table::remove_edge_removal_hook(), remove_path(), remove_preds_and_fake_succs(), remove_reachable_equiv_notes(), remove_some_program_points_and_update_live_ranges(), symbol_table::remove_varpool_insertion_hook(), symbol_table::remove_varpool_removal_hook(), renaming_slot_free(), reset_debug_uses_in_loop(), reset_indirect_string(), resolve_asm_operand_names(), rest_of_handle_df_finish(), env_manager::restore(), rewrite_all_phi_nodes_with_iv(), rewrite_into_loop_closed_ssa_1(), rtl_verify_bb_insn_chain(), run_gcc(), run_rtl_passes(), sbitmap_free(), sbitmap_vector_free(), scale_loop_frequencies(), self_reuse_distance(), owned_nullable_string::set(), set_multilib_dir(), pretty_printer::set_prefix(), set_sanitized_sections(), set_spec(), set_static_spec(), set_uid_loop_bbs(), setup_save_areas(), shorten_branches(), simplify_cond(), simplify_loop_version(), slpeel_can_duplicate_loop_p(), slpeel_tree_duplicate_loop_to_edge_cfg(), solve_constraints(), sort_sibling_loops(), split_loop(), ssa_conflicts_delete(), ssa_prop_fini(), ssa_redirect_edges(), starts_infinite_loop_p(), loop_distribution::stmts_from_loop(), streamer_tree_cache_delete(), switch_to_exception_section(), tail_duplicate(), tm_mangle(), tm_memopt_compute_antic(), tm_memopt_compute_available(), transform_to_exit_first_loop(), translate_name(), tree_estimate_loop_size(), tree_if_conversion(), tree_lower_complex(), tree_num_loop_insns(), tree_optimize_tail_calls_1(), tree_ssa_iv_optimize_finalize(), tree_ssa_iv_optimize_loop(), tree_ssa_lim_finalize(), tree_unswitch_single_loop(), pcom_worker::try_combine_chains(), try_forward_edges(), try_generate_repro(), try_head_merge_bb(), undistribute_ops_list(), units_to_automata_heuristic_distr(), unloop(), unroll_jam_possible_p(), unroll_loop_runtime_iterations(), back_jt_path_registry::update_cfg(), fwd_jt_path_registry::update_cfg(), gcc::dump_manager::update_dfi_for_opt_info(), update_dominators_in_loop(), update_epilogue_loop_vinfo(), update_path(), update_ssa(), var_map_base_fini(), vect_analyze_loop_form(), vect_create_destination_var(), vect_do_peeling(), vect_free_slp_instance(), vect_get_new_ssa_name(), vect_get_new_vect_var(), vect_slp_function(), verify_flow_info(), verify_loop_closed_ssa(), verify_loop_structure(), verify_ssa(), vt_find_locations(), vt_stack_adjustments(), dom_walker::walk(), warn_types_mismatch(), optrecord_json_writer::write(), write_c_file_stat(), write_global_references(), _loop_vec_info::~_loop_vec_info(), _slp_tree::~_slp_tree(), added_line::~added_line(), auto_cpp_string_vec::~auto_cpp_string_vec(), auto_string_vec::~auto_string_vec(), ana::debug_event::~debug_event(), diagnostic_manager::~diagnostic_manager(), dom_walker::~dom_walker(), gcc::dump_manager::~dump_manager(), edited_line::~edited_line(), json::error::~error(), escaped_string::~escaped_string(), expr_hash_elt::~expr_hash_elt(), fixup_expr::~fixup_expr(), function_info::~function_info(), function_reader::~function_reader(), impl_range_label::~impl_range_label(), ana::bar_chart::item::~item(), json_file_output_format::~json_file_output_format(), loop_cand::~loop_cand(), md_reader::~md_reader(), json::object::~object(), optinfo_item::~optinfo_item(), owned_nullable_string::~owned_nullable_string(), ana::precanned_custom_event::~precanned_custom_event(), pretty_printer::~pretty_printer(), scc_info::~scc_info(), ipa_icf::sem_item_optimizer::~sem_item_optimizer(), simple_diagnostic_event::~simple_diagnostic_event(), split_info::~split_info(), json::string::~string(), autofdo::string_table::~string_table(), timer::~timer(), vec_rtx_properties_base::~vec_rtx_properties_base(), and virtual_operand_live::~virtual_operand_live().
|
static |
|
static |
Referenced by read_input_list().
|
static |
|
static |
|
static |
|
static |
Locate the ultimate base class of struct S.
References type::base_class, type::s, and type::u.
|
static |
Scan the input file, LIST, and determine how much space we need to store strings in. Also, count the number of language directories and files. The numbers returned are overestimates as they does not consider repeated files.
References nb_plugin_files, num_gt_files, num_lang_dirs, and plugin_files.
Referenced by read_input_list().
|
static |
|
static |
Read one input line from LIST to HEREP (which is updated). A pointer to the string is returned via LINEP. If it was a language subdirectory in square brackets, strip off the square brackets and return true. Otherwise, leave space before the string for a lang_bitmap, and return false. At EOF, returns false, does not touch *HEREP, and sets *LINEP to NULL. POS is used for diagnostics.
References error_at_line().
Referenced by read_input_list().
|
static |
Read the list of input files from LIST and compute all of the relevant tables. There is one file per line of the list. At first, all the files on the list are language-generic, but eventually a line will appear which is the name of a language subdirectory in square brackets, like this: [cp]. All subsequent files are specific to that language, until another language subdirectory tag appears. Files can appear more than once, if they apply to more than one language.
References errno, error(), error_at_line(), fatal(), fileloc::file, fopen, gcc_assert, get_file_basename(), get_lang_bitmap(), gt_files, i, input_file_by_name(), lang_dir_names, fileloc::line, measure_input_list(), nb_plugin_files, num_gt_files, num_lang_dirs, plugin_files, read_input_line(), and set_lang_bitmap().
Return the type previously defined for S. Use POS to report errors.
Return a scalar type with name NAME.
Return a pointer to T.
Return an array of length LEN.
Return a string options structure with name NAME and info INFO. NEXT is the next option in the chain.
Create a type options structure with name NAME and info INFO. NEXT is the next option in the chain.
Create a nested pointer options structure with name NAME and info INFO. NEXT is the next option in the chain.
Return an options structure for a "nested_ptr" option.
Add a variable named S of type T with options O defined at POS, to `variables'.
Most-general structure field creator.
Create a field that came from the source code we are scanning, i.e. we have a 'struct fileloc', and possibly options; also, adjust_field_type should be called.
Create a fake field with the given type and name. NEXT is the next field in the chain.
Like create_field, but the field is only valid when condition COND is true.
Reverse a linked list of 'struct pair's in place.
We don't care how long a CONST_DOUBLE is.
We don't want to see codes that are only for generator files.
We also need codes and names for insn notes (not register notes). Note that we do *not* bias the note values here.
We must allocate one more entry here, as we use NOTE_INSN_MAX as the default field for line number notes.
Generate the contents of the rtx_next array. This really doesn't belong in gengtype at all, but it's needed for adjust_field_rtx_def.
Write out the contents of the rtx_next array.
Handle `special("rtx_def")'. This is a special case for field `fld' of struct rtx_def, which is an array of unions whose values are based in a complex way on the type of RTL.
Perform any special processing on a type T, about to become the type of a field. Return the appropriate type for the field. At present: - Converts pointer-to-char, with no length parameter, to TYPE_STRING; - Similarly for arrays of pointer-to-char; - Handles "special" options.
Handle OPT for set_gc_used_type.
Set the gc_used field of T to LEVEL, and handle the types it references. If ALLOWED_UNDEFINED_TYPES is true, types of kind TYPE_UNDEFINED are set to GC_UNUSED. Otherwise, an error is emitted for TYPE_UNDEFINED types. This is used to support user-defined template types with non-type arguments. For instance, when we parse a template type with enum arguments (e.g. MyType<AnotherType, EnumValue>), the parser created two artificial fields for 'MyType', one for 'AnotherType', the other one for 'EnumValue'. At the time that we parse this type we don't know that 'EnumValue' is really an enum value, so the parser creates a TYPE_UNDEFINED type for it. Since 'EnumValue' is never resolved to a known structure, it will stay with TYPE_UNDEFINED. Since 'MyType' is a TYPE_USER_STRUCT, we can simply ignore 'EnumValue'. Generating marking code for it would cause compilation failures since the marking routines assumes that 'EnumValue' is a type.
Set the gc_used fields of all the types pointed to by VARIABLES.
File mapping routines. For each input file, there is one output .cc file (but some output files have many input files), and there is one .h file for the whole build.
Output file handling.
Create and return an outf_p for a new file for NAME, to be called ONAME.
Print, like fprintf, to O. N.B. You might think this could be implemented more efficiently with vsnprintf(). Unfortunately, there are C libraries that provide that function but without the C99 semantics for its return value, making it impossible to know how much space is required.
Open the global header file and the language-specific header files.
For INPF an input file, return the real basename of INPF, with all the directory components skipped.
For INPF a filename, return the relative path to INPF from $(srcdir) if the latter is a prefix in INPF, NULL otherwise.
For INPF an input_file, return the relative path to INPF from $(srcdir) if the latter is a prefix in INPF, or the real basename of INPF otherwise.
For F a filename, return the lang_dir_names relative index of the language directory that is a prefix in F, if any, -1 otherwise.
For INPF an input file, return the name of language directory where F is located, if any, NULL otherwise.
The gt- output file name for INPF.
Each input_file has its associated output file outf_p. The association is computed by the function get_output_file_with_visibility. The associated file is cached inside input_file in its inpoutf field, so is really computed only once. Associated output file paths (i.e. output_name-s) are computed by a rule based regexp machinery, using the files_rules array of struct file_rule_st. A for_name is also computed, giving the source file name for which the output_file is generated; it is often the last component of the input_file path.
Signature of actions in file rules.
File rule action handling *.h files.
File rule action handling *.cc files.
The prefix in our regexp-s matching the directory.
The array of our rules governing file name generation. Rules order matters, so change with extreme care!
Special file rules action for handling *.h header files. It gives "gtype-desc.cc" for common headers and corresponding output files for language-specific header files.
Special file rules action for handling *.cc source files using * get_file_gtfilename to compute their output_name and * get_file_basename to compute their for_name. The output_name is * gt-<LANG>-<BASE>.h for language specific source files, and * gt-<BASE>.h for common source files.
Utility function for get_output_file_with_visibility which returns * a malloc-ed substituted string using TRS on matching of the FILNAM * file name, using the PMATCH array.
An output file, suitable for definitions, that can see declarations made in INPF and is linked into every language that uses INPF. Since the result is cached inside INPF, that argument cannot be declared constant, but is "almost" constant.
The name of an output file, suitable for definitions, that can see declarations made in INPF and is linked into every language that uses INPF.
Check if existing file is equal to the in memory buffer.
Copy the output to its final destination, but don't unnecessarily change modification times.
For scalars and strings, given the item in 'val'. For structures, given a pointer to the item in 'val'. For misc. pointers, given the item in 'val'.
Parameters for write_types.
Parameters for walk_type.
Given a string TYPE_NAME, representing a C++ typename, return a valid pre-processor identifier to use in a #define directive. This replaces special characters used in C++ identifiers like '>', '<' and ':' with '_'. If no C++ special characters are found in TYPE_NAME, return TYPE_NAME. Otherwise, return a copy of TYPE_NAME with the special characters replaced with '_'. In this case, the caller is responsible for freeing the allocated string.
Print a mangled name representing T to OF.
Print PARAM to D->OF processing escapes. D->VAL references the current object, D->PREV_VAL the object containing the current object, ONAME is the name of the option and D->LINE is used to print error messages.
Machinery for avoiding duplicate tags within switch statements.
Call D->PROCESS_FIELD for every field (or subfield) of D->VAL, which is of type T. Write code to D->OF to constrain execution (at the point that D->PROCESS_FIELD is called) to the appropriate cases. Call D->PROCESS_FIELD on subobjects before calling it on pointers to those objects. D->PREV_VAL lists the objects containing the current object, D->OPT is a list of options to apply, D->INDENT is the current indentation level, D->LINE is used to print error messages, D->BITMAP indicates which languages to print the structure for.
process_field routine for marking routines.
Return an output file that is suitable for definitions which can reference struct S
Returns the specifier keyword for a string or union type S, empty string otherwise.
Emits a declaration for type TY (assumed to be a union or a structure) on stream OUT.
Write on OF the name of the marker function for structure S. PREFIX is the prefix to use (to distinguish ggc from pch markers).
Write on OF a user-callable routine to act as an entry point for the marking routine for S, generated by write_func_for_structure. WTD distinguishes between ggc and pch markers.
Write a function to mark all the fields of type S on OF. PREFIX and D are as in write_user_marking_functions.
Emit the user-callable functions needed to mark all the types used by the user structure S. PREFIX is the prefix to use to distinguish ggc and pch markers. D contains data needed to pass to walk_type when traversing the fields of a type. For every type T referenced by S, two routines are generated: one that takes 'T *', marks the pointer and calls the second routine, which just marks the fields of T.
For S, a structure that's part of ORIG_S write out a routine that: - Takes a parameter, a void * but actually of type *S - If SEEN_ROUTINE returns nonzero, calls write_types_process_field on each field of S or its substructures and (in some cases) things that are pointed to by S.
Write out marker routines for STRUCTURES.
Write out the local pointer-walking routines.
process_field routine for local pointer-walking for user-callable routines. The difference between this and write_types_local_process_field is that, in this case, we do not need to check whether the given pointer matches the address of the parent structure. This check was already generated by the call to gt_pch_nx in the main gt_pch_p_*() function that is calling this code.
Write a function to PCH walk all the fields of type S on OF. D contains data needed by walk_type to recurse into the fields of S.
Emit the user-callable functions needed to mark all the types used by the user structure S. PREFIX is the prefix to use to distinguish ggc and pch markers. CHAIN_NEXT is set if S has the chain_next option defined. D contains data needed to pass to walk_type when traversing the fields of a type. For every type T referenced by S, two routines are generated: one that takes 'T *', marks the pointer and calls the second routine, which just marks the fields of T.
process_field routine for local pointer-walking.
For S, a structure that's part of ORIG_S, and using parameters PARAM, write out a routine that: - Is of type gt_note_pointers - Calls PROCESS_FIELD on each field of S or its substructures.
Write out local marker routines for STRUCTURES.
Nonzero if S is a type for which typed GC allocators should be output.
Might T contain any non-pointer elements?
Mangle INPF and print it to F.
Finish off the currently-created root tables in FLP. PFX, TNAME, LASTNAME, and NAME are all strings to insert in various places in the resulting code.
Finish off the created gt_clear_caches_file_c functions.
Write the first three fields (pointer, count and stride) for root NAME to F. V and LINE are as for write_root. Return true if the entry could be written; return false on error.
A subroutine of write_root for writing the roots for field FIELD_NAME, which has type FIELD_TYPE. Parameters F to EMIT_PCH are the parameters of the caller.
Write out to F the table entry and any marker routines needed to mark NAME as TYPE. V can be one of three values: - null, if NAME is too complex to represent using a single count and stride. In this case, it is an error for NAME to contain any gc-ed data. - the outermost array that contains NAME, if NAME is part of an array. - the C variable that contains NAME, if NAME is not part of an array. LINE is the line of the C source that declares the root variable. HAS_LENGTH is nonzero iff V was a variable-length array.
References type::next, NULL, type::p, type::s, startswith(), and typedefs.
Referenced by type().
|
static |
|
static |
Given a typedef name S, return its associated type. Return NULL if S is not a registered type name.
References type::next, strtoken(), and type_id.
|
static |
else arg_type = resolve_typedef (field_name, pos) |
|
static |
The backup directory should be in the same file system as the generated files, otherwise the rename(2) system call would fail. If NULL, no backup is made when overwriting a generated file.
|
static |
An array of output files suitable for definitions. There is one BASE_FILES entry for each language.
const char** build_headers |
Table of headers to be included in gtype-desc.cc that are generated during the build. These are identified as "./<filename>.h".
Referenced by read_state_files_list().
struct type callback_type |
The one and only TYPE_CALLBACK.
Referenced by read_state_callback_type(), and state_writer::write_state_callback_type().
int do_debug |
Trace the execution by many DBGPRINTF (with the position inside gengtype source code). Only useful to debug gengtype itself.
int do_dump |
Variables to help debugging.
ty u s fields = create_field_at (fields, arg_type, field_name, 0, pos) |
Referenced by asan_global_struct(), build_fn_info(), build_fn_info_type(), build_info_type(), build_receiver_ref(), build_sender_ref(), contains_pointers_p(), dump_gimple_asm(), encode_lfs(), finish_builtin_struct(), install_var_field(), lhd_simulate_record_decl(), oacc_do_neutering(), read_state_fields(), type(), ubsan_create_data(), ubsan_get_source_location_type(), ubsan_get_type_descriptor_type(), worker_single_copy(), and state_writer::write_state_fields().
const input_file** gt_files |
Input file handling.
Table of all input files.
Referenced by read_input_list(), read_state_files_list(), and state_writer::write_state_files_list().
outf_p header_file |
The output header file that is included into pretty much every source file.
Nonzero iff an error has occurred.
Referenced by error_at_line(), and parse_error().
|
static |
The name of the file containing the list of input files.
const char** lang_dir_names |
Vector of per-language directories.
Referenced by read_input_list(), read_state_languages(), and state_writer::write_state_languages().
|
static |
Referenced by measure_input_list(), and read_input_list().
size_t num_build_headers |
Referenced by read_state_files_list(), and state_writer::write_state_files_list().
size_t num_gt_files |
Referenced by measure_input_list(), read_input_list(), read_state_files_list(), and state_writer::write_state_files_list().
size_t num_lang_dirs |
Referenced by measure_input_list(), read_input_list(), read_state_languages(), and state_writer::write_state_languages().
outf_p output_files |
Process source files and output type information. Copyright (C) 2002-2024 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Data types, macros, etc. used only in this file.
The list of output files.
|
static |
The plugin input files and their number; in that case only a single file is produced.
Referenced by measure_input_list(), and read_input_list().
|
static |
The generated plugin output file and name.
|
static |
const char* read_state_filename |
Variables used for reading and writing the state.
struct type scalar_char |
Referenced by read_state_scalar_char_type(), and state_writer::write_state_scalar_type().
struct type scalar_nonchar |
The two and only TYPE_SCALARs. Their u.scalar_is_char flags are set early in main.
Referenced by do_scalar_typedef(), read_state_scalar_nonchar_type(), and state_writer::write_state_scalar_type().
const char* srcdir |
Our source directory and its length.
Referenced by read_state_fileloc(), read_state_files_list(), read_state_srcdir(), and state_writer::write_state_srcdir().
size_t srcdir_len |
Length of srcdir name.
Referenced by read_state_srcdir().
struct type string_type |
The one and only TYPE_STRING.
Referenced by read_state_string_type(), and state_writer::write_state_string_type().
Referenced by read_state(), read_state_structures(), and state_writer::write_state_structures().
input_file* system_h_file |
The "system.h" file is likewise specially useful.
input_file* this_file |
A number of places use the name of this "gengtype.cc" file for a location for things that we can't rely on the source to define. Make sure we can still use pointer comparison on filenames.
Referenced by do_typedef(), trim_filename(), and trim_filename().
return ty |
Referenced by absdecl(), array_and_function_declarators_opt(), bitmask_inv_cst_vector_p(), create_user_defined_type(), declarator(), direct_declarator(), extern_or_static(), hash_type_number(), inner_declarator(), nestedptr_optvalue(), struct_field_seq(), type_lineloc(), type_optvalue(), and typedef_decl().
|
static |
We have a type count and use it to set the state_number of newly allocated types to some unique negative number.
type_id = strtoken (0, ",>", &next) |
Referenced by type_for_name().
Lists of various things.
Referenced by do_typedef(), read_state(), read_state_typedefs(), resolve_typedef(), and state_writer::write_state_typedefs().
Referenced by asan_poison_variables(), read_state(), read_state_variables(), and state_writer::write_state_variables().
int verbosity_level |
Level for verbose messages.
Referenced by read_state(), read_state_structures(), read_state_typedefs(), read_state_variables(), state_writer::write_state_structures(), state_writer::write_state_typedefs(), and state_writer::write_state_variables().
const char* write_state_filename |