GCC Middle and Back End API Reference
dwarf2asm.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "memmodel.h"
#include "tm_p.h"
#include "stringpool.h"
#include "varasm.h"
#include "output.h"
#include "dwarf2asm.h"
#include "dwarf2.h"
#include "function.h"
#include "emit-rtl.h"
#include "fold-const.h"
#include "gt-dwarf2asm.h"
Include dependency graph for dwarf2asm.cc:

Macros

#define XCOFF_DEBUGGING_INFO   0
 
#define S(p, v)
 
#define USE_LINKONCE_INDIRECT   0
 

Functions

void dw2_assemble_integer (int size, rtx x)
 
void dw2_asm_output_data_raw (int size, unsigned HOST_WIDE_INT value)
 
void dw2_asm_output_data (int size, unsigned HOST_WIDE_INT value, const char *comment,...)
 
void dw2_asm_output_delta (int size, const char *lab1, const char *lab2, const char *comment,...)
 
void dw2_asm_output_offset (int size, const char *label, section *base, const char *comment,...)
 
void dw2_asm_output_offset (int size, const char *label, HOST_WIDE_INT offset, section *base, const char *comment,...)
 
void dw2_asm_output_addr (int size, const char *label, const char *comment,...)
 
void dw2_asm_output_addr_rtx (int size, rtx addr, const char *comment,...)
 
void dw2_asm_output_nstring (const char *str, size_t orig_len, const char *comment,...)
 
int size_of_uleb128 (unsigned HOST_WIDE_INT value)
 
int size_of_sleb128 (HOST_WIDE_INT value)
 
int size_of_encoded_value (int encoding)
 
const char * eh_data_format_name (int format)
 
void dw2_asm_output_data_uleb128_raw (unsigned HOST_WIDE_INT value)
 
void dw2_asm_output_data_uleb128 (unsigned HOST_WIDE_INT value, const char *comment,...)
 
void dw2_asm_output_data_sleb128_raw (HOST_WIDE_INT value)
 
void dw2_asm_output_data_sleb128 (HOST_WIDE_INT value, const char *comment,...)
 
void dw2_asm_output_symname_uleb128 (const char *lab1, const char *comment,...)
 
void dw2_asm_output_delta_uleb128 (const char *lab1, const char *lab2, const char *comment,...)
 
static int compare_strings (const void *a, const void *b)
 
rtx dw2_force_const_mem (rtx x, bool is_public)
 
static int dw2_output_indirect_constant_1 (const char *sym, tree id)
 
void dw2_output_indirect_constants (void)
 
void dw2_asm_output_encoded_addr_rtx (int encoding, rtx addr, bool is_public, const char *comment,...)
 

Variables

static hash_map< const char *, tree > * indirect_pool
 
static int dw2_const_labelno
 

Macro Definition Documentation

◆ S

◆ USE_LINKONCE_INDIRECT

#define USE_LINKONCE_INDIRECT   0

◆ XCOFF_DEBUGGING_INFO

#define XCOFF_DEBUGGING_INFO   0
Dwarf2 assembler output helper routines.
   Copyright (C) 2001-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 dw2_asm_output_nstring().

Function Documentation

◆ compare_strings()

static int compare_strings ( const void * a,
const void * b )
static
Compare two std::pair<const char *, tree> by their first element.
Returns <0, 0, or
>0 to indicate whether K1 is less than, equal to, or greater than
K2, respectively.   

References a, b, and gcc_assert.

Referenced by dw2_output_indirect_constants().

◆ dw2_asm_output_addr()

void dw2_asm_output_addr ( int size,
const char * label,
const char * comment,
... )

◆ dw2_asm_output_addr_rtx()

void dw2_asm_output_addr_rtx ( int size,
rtx addr,
const char * comment,
... )
Similar, but use an RTX expression instead of a text label.   

References ap, ASM_COMMENT_START, asm_out_file, dw2_assemble_integer(), fputc(), and vfprintf().

Referenced by output_addr_table(), output_attr_index_or_value(), and output_loc_operands().

◆ dw2_asm_output_data()

void dw2_asm_output_data ( int size,
unsigned HOST_WIDE_INT value,
const char * comment,
... )
Output an immediate constant in a given SIZE in bytes.   

References ap, ASM_COMMENT_START, asm_out_file, assemble_integer(), fprint_whex(), GEN_INT, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_M1U, integer_asm_op(), and vfprintf().

Referenced by btf_asm_array(), btf_asm_datasec_entry(), btf_asm_datasec_type(), btf_asm_enum_const(), btf_asm_func_arg(), btf_asm_func_type(), btf_asm_sou_member(), btf_asm_type(), btf_asm_type_ref(), btf_asm_varent(), count_index_strings(), ctf_asm_array(), ctf_asm_enum_const(), ctf_asm_func_arg(), ctf_asm_preamble(), ctf_asm_slice(), ctf_asm_sou_lmember(), ctf_asm_sou_member(), ctf_asm_stype(), ctf_asm_type(), ctf_asm_varent(), dw2_output_call_site_table(), dwarf2out_maybe_output_loclist_view_pair(), output_abbrev_section(), output_aranges(), output_asm_btf_vlen_bytes(), output_asm_ctf_vlen_bytes(), output_btf_header(), output_call_frame_info(), output_cfa_loc(), output_cfi(), output_comdat_type_unit(), output_comp_unit(), output_compilation_unit_header(), output_ctf_func_info(), output_ctf_funcidx(), output_ctf_header(), output_ctf_obj_info(), output_ctf_objtidx(), output_die(), output_die_abbrevs(), output_dwarf_version(), output_fde(), output_file_names(), output_line_info(), output_loc_list(), output_loc_operands(), output_loc_sequence(), output_one_function_exception_table(), output_one_line_info_table(), output_pubname(), output_pubnames(), output_range_list_offset(), output_ranges(), output_rnglists(), output_signature(), output_skeleton_debug_sections(), and prune_unmark_dies().

◆ dw2_asm_output_data_raw()

void dw2_asm_output_data_raw ( int size,
unsigned HOST_WIDE_INT value )
Output a value of a given size in target byte order.   

References asm_out_file, and i.

Referenced by output_loc_operands_raw().

◆ dw2_asm_output_data_sleb128()

void dw2_asm_output_data_sleb128 ( HOST_WIDE_INT value,
const char * comment,
... )

◆ dw2_asm_output_data_sleb128_raw()

void dw2_asm_output_data_sleb128_raw ( HOST_WIDE_INT value)
Output an signed LEB128 quantity, but only the byte values.   

References asm_out_file, and fputc().

Referenced by output_loc_operands_raw().

◆ dw2_asm_output_data_uleb128()

◆ dw2_asm_output_data_uleb128_raw()

void dw2_asm_output_data_uleb128_raw ( unsigned HOST_WIDE_INT value)
Output an unsigned LEB128 quantity, but only the byte values.   

References asm_out_file, and fputc().

Referenced by output_cfa_loc_raw(), output_cfi_directive(), and output_loc_operands_raw().

◆ dw2_asm_output_delta()

void dw2_asm_output_delta ( int size,
const char * lab1,
const char * lab2,
const char * comment,
... )
Output the difference between two symbols in a given size.   
??? There appear to be assemblers that do not like such
subtraction, but do support ASM_SET_OP.  It's unfortunately
impossible to do here, since the ASM_SET_OP for the difference
symbol must appear after both symbols are defined.   

References ap, ASM_COMMENT_START, asm_out_file, dw2_assemble_integer(), fputc(), and vfprintf().

Referenced by dw2_output_call_site_table(), output_aranges(), output_call_frame_info(), output_cfi(), output_die(), output_fde(), output_line_info(), output_loc_list(), output_loc_list_offset(), output_loclists_offsets(), output_one_line_info_table(), output_ranges(), output_rnglists(), and output_view_list_offset().

◆ dw2_asm_output_delta_uleb128()

void dw2_asm_output_delta_uleb128 ( const char * lab1,
const char * lab2,
const char * comment,
... )

◆ dw2_asm_output_encoded_addr_rtx()

void dw2_asm_output_encoded_addr_rtx ( int encoding,
rtx addr,
bool is_public,
const char * comment,
... )
Like dw2_asm_output_addr_rtx, but encode the pointer as directed.
If PUBLIC is set and the encoding is DW_EH_PE_indirect, the indirect
reference is shared across the entire application (or DSO).   

References ap, ASM_COMMENT_START, asm_out_file, assemble_align(), assemble_integer(), const0_rtx, const1_rtx, dw2_assemble_integer(), dw2_force_const_mem(), fputc(), gcc_assert, gcc_unreachable, GET_CODE, pc_rtx, POINTER_SIZE, size_of_encoded_value(), vfprintf(), and XSTR.

Referenced by output_call_frame_info(), output_cfi(), output_fde(), and output_ttype().

◆ dw2_asm_output_nstring()

void dw2_asm_output_nstring ( const char * str,
size_t orig_len,
const char * comment,
... )
Output the first ORIG_LEN characters of STR as a string.
If ORIG_LEN is equal to -1, ignore this parameter and output
the entire STR instead.
If COMMENT is not NULL and comments in the debug information
have been requested by the user, append the given COMMENT
to the generated output.   

References ap, ASM_COMMENT_START, asm_out_file, ASM_OUTPUT_ASCII, assemble_integer(), const0_rtx, fputc(), i, vfprintf(), and XCOFF_DEBUGGING_INFO.

Referenced by output_btf_strs(), output_call_frame_info(), output_ctf_strs(), output_die(), output_file_names(), output_line_string(), and output_pubname().

◆ dw2_asm_output_offset() [1/2]

void dw2_asm_output_offset ( int size,
const char * label,
HOST_WIDE_INT offset,
section * base,
const char * comment,
... )

◆ dw2_asm_output_offset() [2/2]

void dw2_asm_output_offset ( int size,
const char * label,
section * base,
const char * comment,
... )
Output a section-relative reference to a LABEL, which was placed in
BASE.  In general this can only be done for debugging symbols.
E.g. on most targets with the GNU linker, this is accomplished with
a direct reference and the knowledge that the debugging section
will be placed at VMA 0.  Some targets have special relocations for
this that we must use.   

References ap, ASM_COMMENT_START, asm_out_file, dw2_assemble_integer(), fputc(), and vfprintf().

Referenced by btf_asm_datasec_entry(), output_aranges(), output_compilation_unit_header(), output_die(), output_fde(), output_line_string(), output_loc_list_offset(), output_loc_operands(), output_pubnames(), output_range_list_offset(), output_skeleton_debug_sections(), and output_view_list_offset().

◆ dw2_asm_output_symname_uleb128()

void dw2_asm_output_symname_uleb128 ( const char * lab1,
const char * comment,
... )
Output symbol LAB1 as an unsigned LEB128 quantity.  LAB1 should be
an assembler-computed constant, e.g. a view number, because we
can't have relocations in LEB128 quantities.   

References ap, ASM_COMMENT_START, asm_out_file, assemble_name(), fputc(), gcc_unreachable, and vfprintf().

Referenced by dwarf2out_maybe_output_loclist_view_pair(), and output_loc_list().

◆ dw2_assemble_integer()

void dw2_assemble_integer ( int size,
rtx x )
Output an unaligned integer with the given value and size.  Prefer not
to print a newline, since the caller may want to add a comment.   

References asm_out_file, assemble_integer(), const0_rtx, CONST_INT_P, CONST_SCALAR_INT_P, DWARF2_ADDR_SIZE, fprint_whex(), integer_asm_op(), INTVAL, and output_addr_const().

Referenced by dw2_asm_output_addr(), dw2_asm_output_addr_rtx(), dw2_asm_output_delta(), dw2_asm_output_encoded_addr_rtx(), dw2_asm_output_offset(), and dw2_asm_output_offset().

◆ dw2_force_const_mem()

rtx dw2_force_const_mem ( rtx x,
bool is_public )
Put X, a SYMBOL_REF, in memory.  Return a SYMBOL_REF to the allocated
memory.  Differs from force_const_mem in that a single pool is used for
the entire unit of translation, and the memory is not guaranteed to be
"near" the function in any interesting sense.  IS_PUBLIC controls whether
the symbol can be shared across the entire application (or DSO).   

References hash_map< KeyId, Value, Traits >::create_ggc(), dw2_const_labelno, gcc_assert, GET_CODE, get_identifier(), IDENTIFIER_POINTER, indirect_pool, maybe_get_identifier(), targetm, TREE_PUBLIC, TREE_SYMBOL_REFERENCED, USE_LINKONCE_INDIRECT, and XSTR.

Referenced by dw2_asm_output_encoded_addr_rtx(), and dwarf2out_do_cfi_startproc().

◆ dw2_output_indirect_constant_1()

◆ dw2_output_indirect_constants()

void dw2_output_indirect_constants ( void )
Emit the constants queued through dw2_force_const_mem.   

References compare_strings(), dw2_output_indirect_constant_1(), i, and indirect_pool.

Referenced by compile_file().

◆ eh_data_format_name()

const char * eh_data_format_name ( int format)
Yield a name for a given pointer encoding.   

References gcc_assert, gcc_unreachable, names, and S.

Referenced by output_call_frame_info(), and output_one_function_exception_table().

◆ size_of_encoded_value()

int size_of_encoded_value ( int encoding)
Given an encoding, return the number of bytes the format occupies.
This is only defined for fixed-size encodings, and so does not
include leb128.   

References gcc_unreachable, and POINTER_SIZE_UNITS.

Referenced by dw2_asm_output_encoded_addr_rtx(), output_call_frame_info(), output_fde(), and output_one_function_exception_table().

◆ size_of_sleb128()

int size_of_sleb128 ( HOST_WIDE_INT value)

◆ size_of_uleb128()

Variable Documentation

◆ dw2_const_labelno

int dw2_const_labelno
static

Referenced by dw2_force_const_mem().

◆ indirect_pool

hash_map<const char *, tree>* indirect_pool
static