GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "toplev.h"
#include "ctfc.h"
#include "diagnostic-core.h"
Variables | |
ctf_container_ref | tu_ctfc |
ctf_dtdef_ref ctf_add_array | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const ctf_arinfo_t * | arp, | ||
dw_die_ref | die ) |
References ctf_add_generic(), ctf_container::ctfc_num_stypes, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_arr, gcc_assert, and NULL.
Referenced by gen_ctf_subrange_type().
void ctf_add_cuname | ( | ctf_container_ref | ctfc, |
const char * | filename ) |
Add the compilation unit (CU) name string to the CTF string table. The CU name has a prepended pwd string if it is a relative path. Also set the CU name offset in the CTF container.
References CONST_CAST, ctf_add_string(), ctf_container::ctfc_cuname_offset, ctf_container::ctfc_strlen, DIR_SEPARATOR, get_src_pwd(), ggc_alloc_atomic(), ggc_strdup, and NULL.
Referenced by ctf_output().
|
static |
References ceil_log2(), ctf_encoding::cte_bits, ctf_add_generic(), ctf_container::ctfc_num_stypes, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_enc, and ROUND_UP.
Referenced by ctf_add_float(), ctf_add_integer(), and ctf_add_unknown().
ctf_dtdef_ref ctf_add_enum | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const char * | name, | ||
HOST_WIDE_INT | size, | ||
bool | eunsigned, | ||
dw_die_ref | die ) |
References ctf_add_generic(), CTF_ADD_NONROOT, ctf_dtd_lookup(), ctf_container::ctfc_num_stypes, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_enum_unsigned, and gcc_assert.
Referenced by gen_ctf_enumeration_type().
int ctf_add_enumerator | ( | ctf_container_ref | ctfc, |
ctf_dtdef_ref | enum_dtd, | ||
const char * | name, | ||
HOST_WIDE_INT | value, | ||
dw_die_ref | die ) |
References btf_debuginfo_p(), ctf_add_string(), ctf_dmd_list_append(), ctf_dtd_lookup(), ctf_container::ctfc_strlen, ctf_itype::ctti_info, ctf_dmdef::dmd_name, ctf_dmdef::dmd_name_offset, ctf_dmdef::dmd_offset, ctf_dmdef::dmd_type, ctf_dmdef::dmd_value, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_members, gcc_assert, ggc_cleared_alloc(), INT_MAX, INT_MIN, and NULL.
Referenced by gen_ctf_enumeration_type().
ctf_dtdef_ref ctf_add_float | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const char * | name, | ||
const ctf_encoding_t * | ep, | ||
dw_die_ref | die ) |
References ctf_add_encoded().
Referenced by gen_ctf_base_type().
ctf_dtdef_ref ctf_add_forward | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const char * | name, | ||
uint32_t | kind, | ||
dw_die_ref | die ) |
References ctf_add_generic(), ctf_container::ctfc_num_stypes, ctf_itype::ctti_info, and ctf_dtdef::dtd_data.
Referenced by gen_ctf_enumeration_type(), and gen_ctf_sou_type().
ctf_dtdef_ref ctf_add_function | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const char * | name, | ||
const ctf_funcinfo_t * | ctc, | ||
dw_die_ref | die, | ||
bool | from_global_func, | ||
int | linkage ) |
References ctf_funcinfo::ctc_argc, ctf_funcinfo::ctc_return, ctf_add_generic(), ctf_container::ctfc_num_stypes, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_type, ctf_dtdef::from_global_func, gcc_assert, ctf_dtdef::linkage, and ctf_dtdef::ref_type.
Referenced by gen_ctf_function_type().
int ctf_add_function_arg | ( | ctf_container_ref | ctfc, |
dw_die_ref | func, | ||
const char * | name, | ||
ctf_dtdef_ref | arg_dtd ) |
References ctf_add_string(), CTF_AUX_STRTAB, ctf_dtd_lookup(), ctf_farg_list_append(), ctf_container::ctfc_aux_strlen, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_argv, ctf_func_arg::farg_name, ctf_func_arg::farg_name_offset, ctf_func_arg::farg_type, gcc_assert, ggc_cleared_alloc(), and NULL.
Referenced by gen_ctf_function_type().
|
static |
Functions to create CTF types. These functions perform the task of adding CTF types to the CTF container. No de-duplication is done by them; the onus is on the calling function to do so. The caller must first do a lookup via ctf_dtd_lookup or ctf_dvd_lookup, as applicable, to ascertain that the CTF type or the CTF variable respectively does not already exist, and then add it.
References CTF_ADD_NONROOT, CTF_ADD_ROOT, ctf_add_string(), ctf_dtd_insert(), ctf_container::ctfc_nextid, ctf_container::ctfc_strlen, ctf_itype::ctti_name, ctf_dtdef::dtd_data, ctf_dtdef::dtd_key, ctf_dtdef::dtd_name, ctf_dtdef::dtd_type, gcc_assert, ggc_cleared_alloc(), NULL, and type().
Referenced by ctf_add_array(), ctf_add_encoded(), ctf_add_enum(), ctf_add_forward(), ctf_add_function(), ctf_add_reftype(), ctf_add_slice(), ctf_add_sou(), and ctf_add_typedef().
ctf_dtdef_ref ctf_add_integer | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const char * | name, | ||
const ctf_encoding_t * | ep, | ||
dw_die_ref | die ) |
References ctf_add_encoded().
Referenced by gen_ctf_base_type(), and gen_ctf_void_type().
int ctf_add_member_offset | ( | ctf_container_ref | ctfc, |
dw_die_ref | sou, | ||
const char * | name, | ||
ctf_dtdef_ref | type, | ||
uint64_t | bit_offset ) |
References ctf_add_string(), ctf_dmd_list_append(), ctf_dtd_lookup(), ctf_container::ctfc_strlen, ctf_itype::ctti_info, ctf_dmdef::dmd_name, ctf_dmdef::dmd_name_offset, ctf_dmdef::dmd_offset, ctf_dmdef::dmd_type, ctf_dmdef::dmd_value, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_members, gcc_assert, ggc_cleared_alloc(), NULL, and type().
Referenced by gen_ctf_sou_type().
ctf_dtdef_ref ctf_add_pointer | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
ctf_dtdef_ref | ref, | ||
dw_die_ref | die ) |
References ctf_add_reftype().
Referenced by gen_ctf_pointer_type().
ctf_dtdef_ref ctf_add_reftype | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
ctf_dtdef_ref | ref, | ||
uint32_t | kind, | ||
dw_die_ref | die ) |
References ctf_add_generic(), ctf_container::ctfc_num_stypes, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_type, gcc_assert, NULL, and ctf_dtdef::ref_type.
Referenced by btf_add_const_void(), ctf_add_pointer(), and gen_ctf_modifier_type().
ctf_dtdef_ref ctf_add_slice | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
ctf_dtdef_ref | ref, | ||
uint32_t | bit_offset, | ||
uint32_t | bit_size, | ||
dw_die_ref | die ) |
References ceil_log2(), ctf_add_generic(), ctf_container::ctfc_num_stypes, ctf_sliceinfo::cts_bits, ctf_sliceinfo::cts_offset, ctf_sliceinfo::cts_type, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, ctf_dtdef::dtu_slice, gcc_assert, NULL, and ROUND_UP.
Referenced by gen_ctf_sou_type().
ctf_dtdef_ref ctf_add_sou | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const char * | name, | ||
uint32_t | kind, | ||
size_t | size, | ||
dw_die_ref | die ) |
const char * ctf_add_string | ( | ctf_container_ref | ctfc, |
const char * | name, | ||
uint32_t * | name_offset, | ||
int | aux_str = CTF_STRTAB ) |
Add string to the appropriate string table in the CTF container.
References ctfc_get_strtab(), and ctfc_strtable_add_str().
Referenced by btf_add_used_type(), btf_collect_pruned_types(), btf_datasec_push_entry(), ctf_add_cuname(), ctf_add_enumerator(), ctf_add_function_arg(), ctf_add_generic(), ctf_add_member_offset(), and ctf_add_variable().
ctf_dtdef_ref ctf_add_typedef | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const char * | name, | ||
ctf_dtdef_ref | ref, | ||
dw_die_ref | die ) |
References ctf_add_generic(), ctf_container::ctfc_num_stypes, ctf_itype::ctti_info, ctf_dtdef::dtd_data, ctf_dtdef::dtd_type, gcc_assert, NULL, and ctf_dtdef::ref_type.
Referenced by gen_ctf_typedef().
ctf_dtdef_ref ctf_add_unknown | ( | ctf_container_ref | ctfc, |
uint32_t | flag, | ||
const char * | name, | ||
const ctf_encoding_t * | ep, | ||
dw_die_ref | die ) |
References ctf_add_encoded().
Referenced by gen_ctf_unknown_type().
int ctf_add_variable | ( | ctf_container_ref | ctfc, |
const char * | name, | ||
ctf_dtdef_ref | ref, | ||
dw_die_ref | die, | ||
unsigned int | external_vis, | ||
dw_die_ref | die_var_decl ) |
|
static |
Append member definition to the list. Member list is a singly-linked list with list start pointing to the head.
References ctf_dmdef::dmd_next, and NULL.
Referenced by ctf_add_enumerator(), and ctf_add_member_offset().
|
static |
Insert CTF type into the CTF container.
References ctf_container::ctfc_types, hash_table< Descriptor, Lazy, Allocator >::find_slot(), gcc_assert, and NULL.
Referenced by ctf_add_generic().
ctf_dtdef_ref ctf_dtd_lookup | ( | const ctf_container_ref | ctfc, |
const dw_die_ref | type ) |
Lookup CTF type given a DWARF die for the type.
References ctf_container::ctfc_types, ctf_dtdef::dtd_key, hash_table< Descriptor, Lazy, Allocator >::find_slot(), NULL, and type().
Referenced by btf_add_func_datasec_entries(), btf_add_func_records(), ctf_add_enum(), ctf_add_enumerator(), ctf_add_function_arg(), ctf_add_member_offset(), ctf_add_sou(), ctf_lookup_tree_type(), and ctf_type_exists().
enum ctf_dtu_d_union_enum ctf_dtu_d_union_selector | ( | ctf_dtdef_ref | ctftype | ) |
Return which member of the union is used in CTFTYPE. Used for garbage collection.
References CTF_DTU_D_ARGUMENTS, CTF_DTU_D_ARRAY, CTF_DTU_D_ENCODING, CTF_DTU_D_MEMBERS, CTF_DTU_D_SLICE, ctf_itype::ctti_info, and ctf_dtdef::dtd_data.
|
static |
Insert a dummy CTF variable into the list of variables to be ignored.
References ctf_container::ctfc_ignore_vars, hash_table< Descriptor, Lazy, Allocator >::find_slot(), gcc_assert, and NULL.
Referenced by ctf_add_variable().
bool ctf_dvd_ignore_lookup | ( | const ctf_container_ref | ctfc, |
dw_die_ref | die ) |
Lookup the dummy CTF variable given the DWARF die for the non-defining decl to be ignored.
References ctf_container::ctfc_ignore_vars, ctf_dvdef::dvd_key, and hash_table< Descriptor, Lazy, Allocator >::find_slot().
Referenced by btf_emit_variable_p(), ctf_dvd_preprocess_cb(), and gen_ctf_variable().
|
static |
Insert CTF variable into the CTF container.
References ctf_container::ctfc_vars, hash_table< Descriptor, Lazy, Allocator >::find_slot(), gcc_assert, and NULL.
Referenced by ctf_add_variable().
ctf_dvdef_ref ctf_dvd_lookup | ( | const ctf_container_ref | ctfc, |
dw_die_ref | die ) |
Lookup CTF variable given a DWARF die for the decl.
References ctf_container::ctfc_vars, ctf_dvdef::dvd_key, hash_table< Descriptor, Lazy, Allocator >::find_slot(), and NULL.
Referenced by btf_add_const_void(), btf_emit_variable_p(), and gen_ctf_variable().
|
static |
Append function argument to the list. Member list is a singly-linked list with list start pointing to the head.
References ctf_func_arg::farg_next, and NULL.
Referenced by ctf_add_function_arg().
ctf_container_ref ctf_get_tu_ctfc | ( | void | ) |
References tu_ctfc.
Referenced by btf_early_finish(), btf_finalize(), btf_finish(), btf_mark_type_used(), ctf_do_die(), ctf_finalize(), and ctf_output().
void ctf_init | ( | void | ) |
CTF routines interfacing to the compiler.
References init_ctf_container().
Referenced by ctf_debug_init().
ctf_dtdef_ref ctf_lookup_tree_type | ( | ctf_container_ref | ctfc, |
const tree | type ) |
Given a TREE_TYPE node, return the CTF type object for that type.
References ctf_dtd_lookup(), lookup_type_die(), and NULL.
Referenced by btf_mark_type_used().
bool ctf_type_exists | ( | ctf_container_ref | ctfc, |
dw_die_ref | type, | ||
ctf_dtdef_ref * | dtd ) |
Check if CTF for TYPE has already been generated. Mainstay for de-duplication. If CTF type already exists, returns TRUE and updates the CTF type object DTD for the caller.
References ctf_dtd_lookup().
Referenced by gen_ctf_array_type(), gen_ctf_function(), gen_ctf_function_type(), gen_ctf_modifier_type(), gen_ctf_pointer_type(), gen_ctf_sou_type(), gen_ctf_subrange_type(), gen_ctf_type(), gen_ctf_typedef(), and gen_ctf_unknown_type().
void ctfc_delete_container | ( | ctf_container_ref | ctfc | ) |
Delete the CTF container's resources.
References ctf_container::ctfc_aux_strtable, ctfc_delete_strtab(), ctf_container::ctfc_gfuncs_list, ctf_container::ctfc_gobjts_list, ctf_container::ctfc_ignore_vars, ctf_container::ctfc_strtable, ctf_container::ctfc_types, ctf_container::ctfc_types_list, ctf_container::ctfc_vars, ctf_container::ctfc_vars_list, hash_table< Descriptor, Lazy, Allocator >::empty(), ggc_free(), and NULL.
Referenced by btf_finalize(), and ctf_finalize().
void ctfc_delete_strtab | ( | ctf_strtable_t * | strtab | ) |
References ctf_string::cts_next, ctf_strtable::ctstab_estr, ctf_strtable::ctstab_head, ctf_strtable::ctstab_tail, ggc_free(), and NULL.
Referenced by btf_early_finish(), and ctfc_delete_container().
int ctfc_get_dtd_srcloc | ( | ctf_dtdef_ref | dtd, |
ctf_srcloc_ref | loc ) |
Location information for CTF Types and CTF Variables. CTF section does not emit location information; at this time, location information is needed for BTF CO-RE use-cases.
References ctf_get_die_loc_col(), ctf_get_die_loc_file(), ctf_get_die_loc_line(), ctf_srcloc::ctsloc_col, ctf_srcloc::ctsloc_file, ctf_srcloc::ctsloc_line, ctf_dtdef::dtd_key, and NULL.
int ctfc_get_dvd_srcloc | ( | ctf_dvdef_ref | dvd, |
ctf_srcloc_ref | loc ) |
unsigned int ctfc_get_num_ctf_types | ( | ctf_container_ref | ctfc | ) |
Get the total number of CTF types in the container.
References ctf_container::ctfc_types, and hash_table< Descriptor, Lazy, Allocator >::elements().
Referenced by output_ctf_header().
unsigned int ctfc_get_num_ctf_vars | ( | ctf_container_ref | ctfc | ) |
Get the total number of CTF variables in the container.
References ctf_container::ctfc_vars, and hash_table< Descriptor, Lazy, Allocator >::elements().
Referenced by ctf_preprocess().
size_t ctfc_get_num_vlen_bytes | ( | ctf_container_ref | ctfc | ) |
Get the number of bytes to represent the variable length portion of all CTF types in the CTF container.
References ctf_container::ctfc_num_vlen_bytes.
Referenced by output_ctf_header().
ctf_strtable_t * ctfc_get_strtab | ( | ctf_container_ref | ctfc, |
int | aux ) |
Get reference to the CTF string table or the CTF auxilliary string table.
References ctf_container::ctfc_strtable.
Referenced by ctf_add_string(), and ctfc_get_strtab_len().
size_t ctfc_get_strtab_len | ( | ctf_container_ref | ctfc, |
int | aux ) |
Get the length of the specified string table of the CTF container.
References ctfc_get_strtab(), and ctf_strtable::ctstab_len.
Referenced by btf_assign_datasec_ids(), ctf_output(), and output_asm_btf_func_args_list().
bool ctfc_is_empty_container | ( | ctf_container_ref | ctfc | ) |
If the next ctf type id is still set to the init value, no ctf records to report.
References CTF_INIT_TYPEID.
Referenced by output_btf_header(), and output_ctf_header().
|
static |
Wrapper function to add str to the CTF string table. No de-duplication of CTF strings is done by the compiler.
References CONST_CAST, ctfc_strtable_append_str(), ctf_strtable::ctstab_estr, ctf_strtable::ctstab_len, ctf_strtable::ctstab_num, gcc_assert, ggc_strdup, and NULL.
Referenced by ctf_add_string(), and init_ctf_strtable().
|
static |
Append str to the CTF string table.
References ctf_string::cts_next, ctf_string::cts_str, ctf_strtable::ctstab_head, ctf_strtable::ctstab_tail, ggc_cleared_alloc(), and NULL.
Referenced by ctfc_strtable_add_str().
|
static |
Initialize a CTF container per translation unit.
References CTF_INIT_TYPEID, ctf_container::ctfc_flags, ctf_container::ctfc_magic, ctf_container::ctfc_nextid, ctf_container::ctfc_version, init_ctf_string_table(), new_ctf_container(), and tu_ctfc.
Referenced by ctf_init().
|
static |
Initialize the string tables in the CTF container.
References ctf_container::ctfc_aux_strlen, ctf_container::ctfc_aux_strtable, ctf_container::ctfc_strlen, ctf_container::ctfc_strtable, and init_ctf_strtable().
Referenced by init_ctf_container().
void init_ctf_strtable | ( | ctf_strtable_t * | strtab | ) |
CTF container setup and teardown routines.
Initialize the CTF string table. The first entry in the CTF string table (empty string) is added.
References ctfc_strtable_add_str(), ctf_strtable::ctstab_estr, ctf_strtable::ctstab_head, ctf_strtable::ctstab_len, ctf_strtable::ctstab_num, ctf_strtable::ctstab_tail, and NULL.
Referenced by btf_early_finish(), and init_ctf_string_table().
|
inlinestatic |
Allocate a new CTF container with the desired flags.
References hash_table< Descriptor, Lazy, Allocator >::create_ggc(), ctf_container::ctfc_ignore_vars, ctf_container::ctfc_types, ctf_container::ctfc_vars, ggc_cleared_alloc(), and tu_ctfc.
Referenced by init_ctf_container().
ctf_container_ref tu_ctfc |
Generate CTF. 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/>.
A CTF container object - one per translation unit.
Referenced by btf_early_finish(), btf_finalize(), btf_finish(), ctf_do_die(), ctf_finalize(), ctf_get_tu_ctfc(), ctf_output(), init_ctf_container(), and new_ctf_container().