GCC Middle and Back End API Reference
varasm.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

tree tree_output_constant_def (tree)
 
void make_decl_rtl (tree)
 
rtx make_decl_rtl_for_debug (tree)
 
void make_decl_one_only (tree, tree)
 
bool supports_one_only (void)
 
void resolve_unique_section (tree, int, int)
 
void mark_referenced (tree)
 
void mark_decl_referenced (tree)
 
void notice_global_symbol (tree)
 
void set_user_assembler_name (tree, const char *)
 
void process_pending_assemble_externals (void)
 
bool decl_replaceable_p (tree, bool)
 
bool decl_binds_to_current_def_p (const_tree)
 
enum tls_model decl_default_tls_model (const_tree)
 
void declare_weak (tree)
 
void merge_weak (tree, tree)
 
void assemble_alias (tree, tree)
 
tree initializer_constant_valid_p (tree, tree, bool=false)
 
bool initializer_constant_valid_for_bitfield_p (const_tree)
 
bool constructor_static_from_elts_p (const_tree)
 
void init_varasm_status (void)
 
rtx assemble_static_space (unsigned HOST_WIDE_INT)
 
rtx assemble_trampoline_template (void)
 
void switch_to_comdat_section (section *, tree)
 

Variables

tree cold_function_name
 

Function Documentation

◆ assemble_alias()

◆ assemble_static_space()

rtx assemble_static_space ( unsigned HOST_WIDE_INT size)
extern
Allocate SIZE bytes writable static space with a gensym name
and return an RTX to refer to its address.   

References asm_out_file, const_labelno, ggc_strdup, symtab_node::name(), NULL_TREE, SYMBOL_FLAG_LOCAL, and SYMBOL_REF_FLAGS.

Referenced by expand_function_start().

◆ assemble_trampoline_template()

◆ constructor_static_from_elts_p()

bool constructor_static_from_elts_p ( const_tree ctor)
extern
Whether a constructor CTOR is a valid static constant initializer if all
its elements are.  This used to be internal to initializer_constant_valid_p
and has been exposed to let other functions like categorize_ctor_elements
evaluate the property while walking a constructor for other purposes.   

References TREE_CODE, TREE_CONSTANT, and TREE_TYPE.

Referenced by categorize_ctor_elements_1(), and initializer_constant_valid_p_1().

◆ decl_binds_to_current_def_p()

bool decl_binds_to_current_def_p ( const_tree decl)
extern
Return true when references to DECL must bind to current definition in
final executable.

The condition is usually equivalent to whether the function binds to the
current module (shared library or executable), that is to binds_local_p.
We use this fact to avoid need for another target hook and implement
the logic using binds_local_p and just special cases where
decl_binds_to_current_def_p is stronger than binds_local_p.  In particular
the weak definitions (that can be overwritten at linktime by other
definition from different object file) and when resolution info is available
we simply use the knowledge passed to us by linker plugin.   

References DECL_COMDAT_GROUP, DECL_COMMON, DECL_EXTERNAL, DECL_INITIAL, DECL_P, DECL_WEAK, error_mark_node, gcc_assert, symtab_node::get(), NULL, resolution_to_local_definition_p(), targetm, and TREE_PUBLIC.

Referenced by align_variable(), base_object_writable(), symtab_node::binds_to_current_def_p(), symtab_node::can_increase_alignment_p(), can_replace_by_local_alias(), compare_base_symbol_refs(), decl_replaceable_p(), default_use_anchors_for_symbol_p(), symtab_node::equal_address_to(), fndecl_abi(), get_range_strlen_tree(), get_variable_align(), maybe_instrument_pointer_overflow(), maybe_optimize_ubsan_ptr_ifn(), ipa_icf::sem_function::merge(), ipa_icf::sem_variable::merge(), symtab_node::noninterposable_alias(), symtab_node::noninterposable_alias(), optimize_weakref(), ptrs_compare_unequal(), rest_of_clean_state(), self_recursive_call_p(), and set_uids_in_ptset().

◆ decl_default_tls_model()

◆ decl_replaceable_p()

bool decl_replaceable_p ( tree decl,
bool semantic_interposition_p )
extern
A replaceable function or variable is one which may be replaced
at link-time with an entirely different definition, provided that the
replacement has the same type.  For example, functions declared
with __attribute__((weak)) on most systems are replaceable.
If SEMANTIC_INTERPOSITION_P is false allow interposition only on
symbols explicitly declared weak.

COMDAT functions are not replaceable, since all definitions of the
function must be equivalent.  It is important that COMDAT functions
not be treated as replaceable so that use of C++ template
instantiations is not penalized.   

References decl_binds_to_current_def_p(), DECL_COMDAT, DECL_P, DECL_WEAK, gcc_assert, and TREE_PUBLIC.

Referenced by varpool_node::ctor_useable_for_folding_p(), cgraph_node::get_availability(), and varpool_node::get_availability().

◆ declare_weak()

void declare_weak ( tree decl)
extern

◆ init_varasm_status()

void init_varasm_status ( void )
extern
Initialize constant pool hashing for a new function.   

References create_constant_pool(), and crtl.

Referenced by prepare_function_start(), read_rtl_function_body(), and read_rtl_function_body_from_file_range().

◆ initializer_constant_valid_for_bitfield_p()

bool initializer_constant_valid_for_bitfield_p ( const_tree value)
extern
Return true if VALUE is a valid constant-valued expression
for use in initializing a static bit-field; one that can be
an element of a "constant" initializer.   

References CONSTRUCTOR_ELTS, FOR_EACH_CONSTRUCTOR_VALUE, initializer_constant_valid_for_bitfield_p(), TREE_CODE, and TREE_OPERAND.

Referenced by immediate_const_ctor_p(), and initializer_constant_valid_for_bitfield_p().

◆ initializer_constant_valid_p()

tree initializer_constant_valid_p ( tree value,
tree endtype,
bool reverse )
extern
Return nonzero if VALUE is a valid constant-valued expression
for use in initializing a static variable; one that can be an
element of a "constant" initializer.

Return null_pointer_node if the value is absolute;
if it is relocatable, return the variable that determines the relocation.
We assume that VALUE has been folded as much as possible;
therefore, we do not need to check for such things as
arithmetic-combinations of integers.   

References AGGREGATE_TYPE_P, initializer_constant_valid_p_1(), NULL, null_pointer_node, NULL_TREE, and VECTOR_TYPE_P.

Referenced by categorize_ctor_elements_1(), tree_switch_conversion::switch_conversion::check_final_bb(), gimplify_init_constructor(), rtl_for_decl_init(), and tree_add_const_value_attribute().

◆ make_decl_one_only()

void make_decl_one_only ( tree decl,
tree comdat_group )
extern

◆ make_decl_rtl()

void make_decl_rtl ( tree decl)
extern
Create the DECL_RTL for a VAR_DECL or FUNCTION_DECL.  DECL should
have static storage duration.  In other words, it should not be an
automatic variable, including PARM_DECLs.

There is, however, one exception: this function handles variables
explicitly placed in a particular register by the user.

This is never called for PARM_DECL nodes.   

References accessible_reg_set, adjust_address_nv, asm_out_file, change_symbol_block(), create_block_symbol(), DECL_ASSEMBLER_NAME, DECL_COMMON, DECL_EXTERNAL, DECL_HARD_REGISTER, DECL_IN_CONSTANT_POOL, DECL_INITIAL, DECL_MODE, DECL_NAME, DECL_REGISTER, DECL_RTL, DECL_RTL_SET_P, DECL_SECTION_NAME, DECL_WEAK, decode_reg_name(), eliminable_regno_p(), error(), error_mark_node, gcc_assert, gen_raw_REG(), gen_rtx_MEM(), get_block_for_decl(), GET_CODE, GET_MODE, globalize_reg(), HARD_FRAME_POINTER_REGNUM, hard_regno_nregs(), IDENTIFIER_POINTER, in_hard_reg_set_p(), MEM_P, symtab_node::name(), NULL, NULL_TREE, operand_reg_set, ORIGINAL_REGNO, output_constant_def(), REG_USERVAR_P, SET_DECL_ASSEMBLER_NAME, SET_DECL_RTL, set_mem_attributes(), SET_SYMBOL_REF_DECL, SYMBOL_REF_HAS_BLOCK_INFO_P, SYMBOL_REF_WEAK, targetm, TREE_CODE, TREE_PUBLIC, TREE_STATIC, TREE_THIS_VOLATILE, TREE_TYPE, TYPE_ADDR_SPACE, use_blocks_for_decl_p(), use_object_blocks_p(), VAR_P, warning(), and XEXP.

Referenced by rt_bb_visited::check(), symtab_node::copy_visibility_from(), create_odr_indicator(), do_assemble_alias(), symtab_node::make_decl_local(), and rest_of_decl_compilation().

◆ make_decl_rtl_for_debug()

rtx make_decl_rtl_for_debug ( tree decl)
extern
Like make_decl_rtl, but inhibit creation of new alias sets when
calling make_decl_rtl.  Also, reset DECL_RTL before returning the
rtl.   

References DECL_RTL, DECL_RTL_SET_P, NULL, and SET_DECL_RTL.

Referenced by expand_debug_expr(), and rtl_for_decl_location().

◆ mark_decl_referenced()

void mark_decl_referenced ( tree decl)
extern

◆ mark_referenced()

void mark_referenced ( tree id)
extern
Set the symbol_referenced flag for ID.   

References TREE_SYMBOL_REFERENCED.

Referenced by assemble_name_resolve().

◆ merge_weak()

void merge_weak ( tree newdecl,
tree olddecl )
extern

◆ notice_global_symbol()

void notice_global_symbol ( tree decl)
extern
DECL is an object (either VAR_DECL or FUNCTION_DECL) which is going
to be output to assembler.
Set first_global_object_name and weak_global_object_name as appropriate.   

References DECL_ASSEMBLER_NAME, DECL_COMMON, DECL_EXTERNAL, DECL_HARD_REGISTER, DECL_INITIAL, DECL_NAME, DECL_ONE_ONLY, DECL_WEAK, error_mark_node, first_global_object_name, ggc_strdup, IDENTIFIER_POINTER, targetm, TREE_CODE, TREE_PUBLIC, ultimate_transparent_alias_target(), VAR_P, and weak_global_object_name.

Referenced by assemble_start_function(), assemble_variable(), varpool_node::finalize_decl(), and cgraph_node::finalize_function().

◆ process_pending_assemble_externals()

void process_pending_assemble_externals ( void )
extern

◆ resolve_unique_section()

void resolve_unique_section ( tree decl,
int reloc,
int flag_function_or_data_sections )
extern

◆ set_user_assembler_name()

void set_user_assembler_name ( tree decl,
const char * name )
extern
The user has asked for a DECL to have a particular name.  Set (or
change) it in such a way that we don't prefix an underscore to
it.   

References alloca, symbol_table::change_decl_assembler_name(), get_identifier(), symtab_node::name(), NULL_RTX, SET_DECL_RTL, and symtab.

Referenced by set_builtin_user_assembler_name(), and set_user_assembler_libfunc().

◆ supports_one_only()

bool supports_one_only ( void )
extern
Returns true if the target configuration supports defining public symbols
so that one of them will be chosen at link time instead of generating a
multiply-defined symbol error, whether through the use of weak symbols or
a target-specific mechanism for having duplicates discarded.   

References SUPPORTS_ONE_ONLY, and TARGET_SUPPORTS_WEAK.

◆ switch_to_comdat_section()

void switch_to_comdat_section ( section * sect,
tree decl )
extern
Switch to a COMDAT section with COMDAT name of decl.

FIXME:  resolve_unique_section needs to deal better with
decls with both DECL_SECTION_NAME and DECL_ONE_ONLY.  Once
that is fixed, this if-else statement can be replaced with
a single call to "switch_to_section (sect)".   

References named_section::common, DECL_COMDAT_GROUP, section_common::flags, IDENTIFIER_POINTER, in_section, named_section::name, section::named, NULL, SECTION_LINKONCE, switch_to_section(), TARGET_PECOFF, targetm, and TREE_CODE.

Referenced by default_print_patchable_function_entry(), and handle_vtv_comdat_section().

◆ tree_output_constant_def()

tree tree_output_constant_def ( tree exp)
extern
Return a tree representing a reference to constant data in memory
for the constant expression EXP.

This is the counterpart of output_constant_def at the Tree level.   

References add_constant_to_table(), exp(), varpool_node::finalize_decl(), constant_descriptor_tree::rtl, SYMBOL_REF_DECL, and XEXP.

Referenced by expand_expr_real_1(), gimple_lower_bitint(), and gimplify_init_constructor().

Variable Documentation

◆ cold_function_name

tree cold_function_name
extern
Declarations for varasm.h.
   Copyright (C) 2013-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/>.   
The following global holds the "function name" for the code in the
cold section of a function, if hot/cold function splitting is enabled
and there was actually code that went into the cold section.  A
pseudo function name is needed for the cold section of code for some
debugging tools that perform symbolization.  
The following global holds the "function name" for the code in the
cold section of a function, if hot/cold function splitting is enabled
and there was actually code that went into the cold section.  A
pseudo function name is needed for the cold section of code for some
debugging tools that perform symbolization.  

Referenced by assemble_end_function(), assemble_start_function(), and final_scan_insn_1().