GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "memmodel.h"
#include "tm_p.h"
#include "output.h"
#include "dwarf2asm.h"
#include "debug.h"
#include "ctfc.h"
#include "diagnostic-core.h"
#include "gt-ctfout.h"
Data Structures | |
struct | ctf_dtd_preprocess_arg |
struct | ctf_dvd_preprocess_arg |
Macros | |
#define | CTF_INFO_SECTION_NAME ".ctf" |
#define | CTF_INFO_SECTION_FLAGS (SECTION_DEBUG) |
#define | MAX_CTF_LABEL_BYTES 40 |
#define | CTF_INFO_SECTION_LABEL "Lctf" |
Typedefs | |
typedef struct ctf_dtd_preprocess_arg | ctf_dtd_preprocess_arg_t |
typedef struct ctf_dvd_preprocess_arg | ctf_dvd_preprocess_arg_t |
Variables | |
static int | ctf_label_num |
static section * | ctf_info_section |
static char | ctf_info_section_label [MAX_CTF_LABEL_BYTES] |
#define CTF_INFO_SECTION_FLAGS (SECTION_DEBUG) |
Section flags for the CTF debug info section.
Referenced by init_ctf_sections().
#define CTF_INFO_SECTION_LABEL "Lctf" |
Referenced by init_ctf_sections().
#define CTF_INFO_SECTION_NAME ".ctf" |
Section names used to hold CTF debugging information.
CTF debug info section.
Referenced by init_ctf_sections().
#define MAX_CTF_LABEL_BYTES 40 |
Maximum size (in bytes) of an artificially generated CTF label.
typedef struct ctf_dtd_preprocess_arg ctf_dtd_preprocess_arg_t |
CTF preprocess callback arguments.
typedef struct ctf_dvd_preprocess_arg ctf_dvd_preprocess_arg_t |
|
static |
Asm'out a CTF type of kind CTF_K_ARRAY.
References ctf_type_id, ctf_arinfo::ctr_contents, ctf_arinfo::ctr_index, ctf_arinfo::ctr_nelems, ctf_dtdef::dtd_u, ctf_dtdef::dtu_arr, and dw2_asm_output_data().
Referenced by output_asm_ctf_vlen_bytes().
|
static |
Asm'out an enumerator constant.
References ctf_dmdef::dmd_name_offset, ctf_dmdef::dmd_value, and dw2_asm_output_data().
Referenced by output_asm_ctf_enum_list().
|
static |
Asm'out a function argument.
References ctf_type_id, dw2_asm_output_data(), and ctf_func_arg::farg_type.
Referenced by output_asm_func_args_list().
|
static |
CTF asm helper routines.
Asm'out the CTF preamble.
References ctf_container::ctfc_flags, ctf_container::ctfc_magic, ctf_container::ctfc_version, and dw2_asm_output_data().
Referenced by output_ctf_header().
|
static |
Asm'out a CTF type of kind CTF_K_SLICE.
References ctf_type_id, and dw2_asm_output_data().
Referenced by output_asm_ctf_vlen_bytes().
|
static |
Asm'out a member of CTF struct or union, represented by ctf_lmember_t.
References ctf_type_id, ctf_dmdef::dmd_name_offset, ctf_dmdef::dmd_offset, ctf_dmdef::dmd_type, and dw2_asm_output_data().
Referenced by output_asm_ctf_sou_fields().
|
static |
Asm'out a member of a CTF sruct or union, represented by ctf_member_t.
References ctf_type_id, ctf_dmdef::dmd_name_offset, ctf_dmdef::dmd_offset, ctf_dmdef::dmd_type, and dw2_asm_output_data().
Referenced by output_asm_ctf_sou_fields().
|
static |
Asm'out a CTF type which is represented by ctf_stype_t.
References dw2_asm_output_data().
Referenced by output_asm_ctf_type().
|
static |
Asm'out a CTF type which is represented by ctf_type_t.
References dw2_asm_output_data().
Referenced by output_asm_ctf_type().
|
static |
Asm'out a CTF variable.
References ctf_type_id, ctf_dvdef::dvd_name_offset, ctf_dvdef::dvd_type, and dw2_asm_output_data().
Referenced by output_ctf_vars().
|
static |
A CTF type record may be followed by variable-length of bytes to encode the CTF type completely. This routine calculates the number of bytes, in the final binary CTF format, which are used to encode information about the type completely. This function must always be in sync with the CTF header.
References ctf_dmd_list_next, ctf_farg_list_next, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_argv, ctf_dtdef::dtu_members, gcc_assert, and NULL.
Referenced by ctf_dtd_preprocess_cb().
int ctf_dtd_preprocess_cb | ( | ctf_dtdef_ref * | slot, |
void * | arg ) |
CTF preprocess callback routine for CTF types.
References ctf_calc_num_vbytes(), ctf_container::ctfc_gfuncs_list, ctf_container::ctfc_num_vlen_bytes, ctf_container::ctfc_types_list, ctf_itype::ctti_info, ctf_dtd_preprocess_arg::dtd_arg_ctfc, ctf_dtdef::dtd_data, ctf_dtd_preprocess_arg::dtd_global_func_idx, ctf_dtdef::dtd_type, ctf_dtdef::from_global_func, and gcc_assert.
Referenced by ctf_preprocess().
int ctf_dvd_preprocess_cb | ( | ctf_dvdef_ref * | slot, |
void * | arg ) |
CTF preprocess callback routine for CTF variables.
References ctf_dvd_ignore_lookup(), ctf_preprocess_var(), ctf_container::ctfc_gobjts_list, ctf_dvd_preprocess_arg::dvd_arg_ctfc, ctf_dvd_preprocess_arg::dvd_global_obj_idx, and ctf_dvdef::dvd_key.
Referenced by ctf_preprocess().
void ctf_finalize | ( | void | ) |
Reset all state for CTF generation so that we can rerun the compiler within the same process.
References ctf_get_tu_ctfc(), ctf_info_section, ctfc_delete_container(), NULL, and tu_ctfc.
Referenced by ctf_debug_early_finish().
|
static |
Add a CTF variable to the end of the list.
References ctf_container::ctfc_vars_list, and ctf_container::ctfc_vars_list_count.
Referenced by ctf_preprocess_var().
void ctf_output | ( | const char * | filename | ) |
CTF routines interfacing to the compiler.
Prepare and output the CTF section.
References ctf_add_cuname(), ctf_get_tu_ctfc(), ctf_preprocess(), CTF_STRTAB, ctfc_get_strtab_len(), ctf_container::ctfc_strlen, CTFINFO_LEVEL_NONE, gcc_assert, init_ctf_sections(), output_ctf_func_info(), output_ctf_funcidx(), output_ctf_header(), output_ctf_obj_info(), output_ctf_objtidx(), output_ctf_strs(), output_ctf_types(), output_ctf_vars(), and tu_ctfc.
Referenced by ctf_debug_early_finish().
|
static |
CTF preprocessing. After the CTF types for the compilation unit have been generated fully, the compiler writes out the asm for the CTF types. CTF writeout in the compiler requires two passes over the CTF types. In the first pass, the CTF preprocess pass: 1. CTF types are sorted in the order of their type IDs. 2. The variable number of bytes after each CTF type record are calculated. This is used to calculate the offsets in the ctf_header_t. 3. If the CTF type is of CTF_K_FUNCTION, the number of bytes in the funcinfo sub-section are calculated. This is used to calculate the offsets in the ctf_header_t. 4. Keep the list of CTF variables in ASCIIbetical order of their names. In the second pass, the CTF writeout pass, asm tags are written out using the compiler's afore-generated internal pre-processed CTF types.
References ctf_dtd_preprocess_cb(), ctf_dvd_preprocess_cb(), ctf_varent_compare(), ctfc_get_num_ctf_vars(), ctf_container::ctfc_gfuncs_list, ctf_container::ctfc_gobjts_list, ctf_container::ctfc_num_global_funcs, ctf_container::ctfc_num_global_objts, ctf_container::ctfc_types, ctf_container::ctfc_types_list, ctf_container::ctfc_vars, ctf_container::ctfc_vars_list, ctf_container::ctfc_vars_list_count, ctf_dtd_preprocess_arg::dtd_arg_ctfc, ctf_dtd_preprocess_arg::dtd_global_func_idx, ctf_dvd_preprocess_arg::dvd_arg_ctfc, ctf_dvd_preprocess_arg::dvd_global_obj_idx, hash_table< Descriptor, Lazy, Allocator >::elements(), gcc_assert, ggc_vec_alloc(), qsort, and hash_table< Descriptor, Lazy, Allocator >::traverse().
Referenced by ctf_output().
|
static |
Routines for CTF pre-processing.
References ctf_list_add_ctf_vars().
Referenced by ctf_dvd_preprocess_cb().
|
static |
Compare two CTF variable definition entries. Currently used for sorting by name.
References ctf_dvdef::dvd_name.
Referenced by ctf_preprocess().
void init_ctf_sections | ( | void | ) |
Initialize the various sections and labels for CTF output.
References ctf_info_section, CTF_INFO_SECTION_FLAGS, CTF_INFO_SECTION_LABEL, ctf_info_section_label, CTF_INFO_SECTION_NAME, ctf_label_num, get_section(), and NULL.
Referenced by ctf_output().
|
static |
Output the list of enumerator constants of the CTF enum type.
References ctf_asm_enum_const(), ctf_dmd_list_next, ctf_dtdef::dtd_u, ctf_dtdef::dtu_members, and NULL.
Referenced by output_asm_ctf_vlen_bytes().
|
static |
Output the members of the CTF struct or union.
References ctf_asm_sou_lmember(), ctf_asm_sou_member(), ctf_dmd_list_next, CTF_NULL_TYPEID, ctf_dmdef::dmd_type, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_members, gcc_assert, and NULL.
Referenced by output_asm_ctf_vlen_bytes().
|
static |
Output a CTF Type.
References ctf_asm_stype(), ctf_asm_type(), CTF_NULL_TYPEID, gcc_assert, and output_asm_ctf_vlen_bytes().
Referenced by output_ctf_types().
|
static |
Output the variable length portion of the CTF type record.
References ctf_encoding::cte_bits, ctf_encoding::cte_format, ctf_encoding::cte_offset, ctf_asm_array(), ctf_asm_slice(), CTF_NULL_TYPEID, ctf_sliceinfo::cts_type, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_enc, ctf_dtdef::dtu_slice, dw2_asm_output_data(), gcc_assert, output_asm_ctf_enum_list(), output_asm_ctf_sou_fields(), and output_asm_func_args_list().
Referenced by output_asm_ctf_type().
|
static |
Output the list of function arguments of the CTF function type.
References ctf_asm_func_arg(), ctf_farg_list_next, ctf_dtdef::dtd_u, ctf_dtdef::dtu_argv, and NULL.
Referenced by output_asm_ctf_vlen_bytes().
|
static |
Output the CTF function info section.
References ctf_container::ctfc_gfuncs_list, ctf_container::ctfc_num_global_funcs, ctf_dtdef::dtd_type, dw2_asm_output_data(), and i.
Referenced by ctf_output().
|
static |
Output the CTF function index section.
References ctf_container::ctfc_gfuncs_list, ctf_container::ctfc_num_global_funcs, ctf_itype::ctti_name, ctf_dtdef::dtd_data, dw2_asm_output_data(), and i.
Referenced by ctf_output().
|
static |
CTF writeout to asm file.
References asm_out_file, ASM_OUTPUT_LABEL, ctf_asm_preamble(), ctf_info_section, ctf_info_section_label, ctf_container::ctfc_cuname_offset, ctfc_get_num_ctf_types(), ctfc_get_num_vlen_bytes(), ctfc_is_empty_container(), ctf_container::ctfc_num_global_funcs, ctf_container::ctfc_num_global_objts, ctf_container::ctfc_num_stypes, ctf_container::ctfc_num_types, ctf_container::ctfc_strlen, ctf_container::ctfc_vars_list_count, dw2_asm_output_data(), gcc_assert, and switch_to_section().
Referenced by ctf_output().
|
static |
Output the CTF object info section.
References ctf_type_id, ctf_container::ctfc_gobjts_list, ctf_container::ctfc_num_global_objts, ctf_dvdef::dvd_type, dw2_asm_output_data(), and i.
Referenced by ctf_output().
|
static |
Output the CTF object index section.
References ctf_container::ctfc_gobjts_list, ctf_container::ctfc_num_global_objts, ctf_dvdef::dvd_name_offset, dw2_asm_output_data(), and i.
Referenced by ctf_output().
|
static |
Output the CTF string records.
References ctf_container::ctfc_strtable, ctf_string::cts_next, ctf_string::cts_str, ctf_strtable::ctstab_head, and dw2_asm_output_nstring().
Referenced by ctf_output().
|
static |
Output all CTF type records.
References ctf_container::ctfc_types, ctf_container::ctfc_types_list, hash_table< Descriptor, Lazy, Allocator >::elements(), i, and output_asm_ctf_type().
Referenced by ctf_output().
|
static |
Output the CTF variables. Variables appear in the sorted ASCIIbetical order of their names. This permits binary searching in the CTF reader.
References ctf_asm_varent(), CTF_NULL_TYPEID, ctf_container::ctfc_vars_list, ctf_container::ctfc_vars_list_count, ctf_dvdef::dvd_type, gcc_assert, and i.
Referenced by ctf_output().
|
static |
Pointers to various CTF sections.
Referenced by ctf_finalize(), init_ctf_sections(), and output_ctf_header().
|
static |
Referenced by init_ctf_sections(), and output_ctf_header().
|
static |
Output CTF format from GCC. Copyright (C) 2019-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/>.
Referenced by init_ctf_sections().