GCC Middle and Back End API Reference
gentarget-def.cc File Reference
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
#include "hash-table.h"
#include "target-insns.def"
Include dependency graph for gentarget-def.cc:

Data Structures

struct  insn_hasher
 

Macros

#define DEF_TARGET_INSN(INSN, ARGS)
 

Functions

static bool parse_argument (const char *p, const char **end_out, unsigned int *opno_out=0, bool *required_out=0)
 
static void def_target_insn (const char *name, const char *prototype)
 
static void add_insn (md_rtx_info *info)
 
int main (int argc, const char **argv)
 

Variables

static hash_table< insn_hasher > * insns
 
static hash_table< nofree_string_hash > * stubs
 
static hash_map< nofree_string_hash, const char * > * have_funcs
 

Macro Definition Documentation

◆ DEF_TARGET_INSN

#define DEF_TARGET_INSN ( INSN,
ARGS )
Value:
def_target_insn (#INSN, #ARGS);
static void def_target_insn(const char *name, const char *prototype)
Definition gentarget-def.cc:104

Function Documentation

◆ add_insn()

static void add_insn ( md_rtx_info * info)
static
Record the DEFINE_INSN or DEFINE_EXPAND described by INFO.   

References md_rtx_info::def, error_at(), insns, md_rtx_info::loc, and XSTR.

Referenced by main().

◆ def_target_insn()

static void def_target_insn ( const char * name,
const char * prototype )
static
Output hook definitions for pattern NAME, which has target-insns.def
prototype PROTOTYPE.   

References end(), error(), error_at(), FATAL_EXIT_CODE, fputc(), gcc_assert, get_file_location(), get_pattern_stats(), have_funcs, i, insns, maybe_eval_c_test(), parse_argument(), md_reader::print_c_condition(), rtx_reader_ptr, stats, stubs, XSTR, and XVEC.

◆ main()

int main ( int argc,
const char ** argv )
Target instruction definitions.
Copyright (C) 2015-2024 Free Software Foundation, Inc.

This program 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.

This program 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 this program; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
This file has one entry for each public pattern name that the target
can provide.  It is only used if no distinction between operand modes
is necessary.  If separate patterns are needed for different modes
(so as to distinguish addition of QImode values from addition of
HImode values, for example) then an optab should be used instead.

Each entry has the form:

  DEF_TARGET_INSN (name, prototype)

where NAME is the name of the pattern and PROTOTYPE is its C prototype.
The prototype should use parameter names of the form "x0", "x1", etc.
for the operands that the .md pattern is required to have, followed by
parameter names of the form "optN" for operands that the .md pattern
may choose to ignore.  Patterns that never take operands should have
a prototype "(void)".

Pattern names should be documented in md.texi rather than here.   

References add_insn(), md_rtx_info::def, FATAL_EXIT_CODE, GET_CODE, have_error, have_funcs, init_rtx_reader_args(), insns, progname, read_md_rtx(), stubs, and SUCCESS_EXIT_CODE.

◆ parse_argument()

static bool parse_argument ( const char * p,
const char ** end_out,
unsigned int * opno_out = 0,
bool * required_out = 0 )
static
Return true if the part of the prototype at P is for an argument
name.  If so, point *END_OUT to the first character after the name.
If OPNO_OUT is nonnull, set *OPNO_OUT to the number of the associated
operand.  If REQUIRED_OUT is nonnull, set *REQUIRED_OUT to whether the
.md pattern is required to match the operand.   

Referenced by def_target_insn().

Variable Documentation

◆ have_funcs

hash_map<nofree_string_hash, const char *>* have_funcs
static
Records which C conditions have been wrapped in functions, as a mapping
from the C condition to the function name.   

Referenced by def_target_insn(), and main().

◆ insns

hash_table<insn_hasher>* insns
static
All define_insns and define_expands, hashed by name.   

Referenced by add_equal_note(), add_insn(), add_next_usage_insn(), add_to_inherit(), asan_clear_shadow(), asan_emit_allocas_unpoison(), asan_emit_stack_protection(), assign_parm_setup_reg(), change_sp_offset(), commit_one_edge_insertion(), compute_max_insns(), convert_mode_scalar(), cse_cc_succs(), def_target_insn(), delete_trivially_dead_insns(), emit_libcall_block(), emit_libcall_block_1(), emit_moves(), expand_absneg_bit(), expand_binop(), expand_builtin_int_roundingfn(), expand_builtin_int_roundingfn_2(), expand_builtin_mathfn_3(), expand_builtin_mathfn_ternary(), expand_call(), expand_copysign_bit(), expand_DIVMOD(), expand_fix(), expand_fixed_convert(), expand_float(), expand_phi_nodes(), expand_twoval_binop_libfunc(), expand_unop(), expmed_mult_highpart_optab(), pair_fusion::find_trailing_add(), finish_eh_generation(), fixup_debug_uses(), pair_fusion_bb_info::fuse_pair(), pair_fusion::get_viable_bases(), hwasan_emit_untag_frame(), inherit_in_ebb(), init_insn_rhs_dead_pseudo_p(), init_loop_unswitch_info(), inline_string_cmp(), ira(), ira_update_equiv_info_by_shuffle_insn(), main(), mark_target_live_regs(), match_asm_constraints_1(), prepare_float_lib_cmp(), process_address_1(), record_insns(), reorder_blocks_1(), replace_read(), resolve_shift_zext(), resolve_simple_move(), reverse_equiv_p(), should_duplicate_loop_header_p(), split_edge_and_insert(), split_if_necessary(), pair_fusion_bb_info::try_fuse_pair(), pair_fusion::try_promote_writeback(), and vect_slp_bbs().

◆ stubs

Records the prototype suffix X for each invalid_X stub that has been
generated.   

Referenced by def_target_insn(), and main().