GCC Middle and Back End API Reference
gensupport.h File Reference
#include "hash-set.h"
#include "read-md.h"
#include "optabs.def"
Include dependency graph for gensupport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  md_rtx_info
 
struct  optab_def
 
struct  optab_pattern
 
struct  c_test
 
struct  pred_data
 
struct  pattern_stats
 

Macros

#define OPTAB_CL(name, pat, c, b, l)
 
#define OPTAB_CX(name, pat)
 
#define OPTAB_CD(name, pat)
 
#define OPTAB_NL(name, pat, c, b, s, l)
 
#define OPTAB_NC(name, pat, c)
 
#define OPTAB_NX(name, pat)
 
#define OPTAB_VL(name, pat, c, b, s, l)
 
#define OPTAB_VC(name, pat, c)
 
#define OPTAB_VX(name, pat)
 
#define OPTAB_DC(name, pat, c)
 
#define OPTAB_D(name, pat)
 
#define FOR_ALL_PREDICATES(p)
 

Typedefs

typedef enum optab_tag optab
 

Enumerations

enum  optab_tag { unknown_optab , NUM_OPTABS }
 

Functions

unsigned int get_register_filter_id (const char *)
 
rtx add_implicit_parallel (rtvec)
 
rtx_readerinit_rtx_reader_args_cb (int, const char **, bool(*)(const char *))
 
rtx_readerinit_rtx_reader_args (int, const char **)
 
int count_patterns ()
 
bool read_md_rtx (md_rtx_info *)
 
unsigned int get_num_insn_codes ()
 
const char * get_c_test (rtx)
 
int maybe_eval_c_test (const char *)
 
void add_c_test (const char *, int)
 
struct pred_datalookup_predicate (const char *)
 
void add_predicate_code (struct pred_data *, enum rtx_code)
 
void add_predicate (struct pred_data *)
 
void get_pattern_stats (struct pattern_stats *ranges, rtvec vec)
 
void compute_test_codes (rtx, file_location, char *)
 
file_location get_file_location (rtx)
 
const char * get_emit_function (rtx)
 
bool needs_barrier_p (rtx)
 
bool find_optab (optab_pattern *, const char *)
 
FILE * choose_output (const vec< FILE * > &, unsigned &)
 

Variables

struct obstackrtl_obstack
 
optab_def optabs []
 
unsigned int num_optabs
 
vec< const char * > register_filters
 
int insn_elision
 
struct pred_datafirst_predicate
 
hash_set< rtxcompact_syntax
 

Macro Definition Documentation

◆ FOR_ALL_PREDICATES

#define FOR_ALL_PREDICATES ( p)
Value:
for (p = first_predicate; p; p = p->next)
struct pred_data * first_predicate
Definition gensupport.cc:3451
struct pred_data * next
Definition gensupport.h:176

Referenced by write_insn_preds_c(), and write_tm_preds_h().

◆ OPTAB_CD

#define OPTAB_CD ( name,
pat )
Value:
name,

◆ OPTAB_CL

#define OPTAB_CL ( name,
pat,
c,
b,
l )
Value:
name,

◆ OPTAB_CX

#define OPTAB_CX ( name,
pat )

◆ OPTAB_D

#define OPTAB_D ( name,
pat )
Value:
name,

◆ OPTAB_DC

#define OPTAB_DC ( name,
pat,
c )
Value:
name,

◆ OPTAB_NC

#define OPTAB_NC ( name,
pat,
c )
Value:
name,

◆ OPTAB_NL

#define OPTAB_NL ( name,
pat,
c,
b,
s,
l )
Value:
name,

◆ OPTAB_NX

#define OPTAB_NX ( name,
pat )

◆ OPTAB_VC

#define OPTAB_VC ( name,
pat,
c )
Value:
name,

◆ OPTAB_VL

#define OPTAB_VL ( name,
pat,
c,
b,
s,
l )
Value:
name,

◆ OPTAB_VX

#define OPTAB_VX ( name,
pat )

Typedef Documentation

◆ optab

typedef enum optab_tag optab
Enumerates all optabs.   

Enumeration Type Documentation

◆ optab_tag

enum optab_tag
Enumerates all optabs.   
Enumerator
unknown_optab 
NUM_OPTABS 
Definitions for operation tables, or "optabs".
   Copyright (C) 1987-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 entries in optabs.def are categorized:
  C: A "conversion" optab, which uses two modes; has libcall data.
  N: A "normal" optab, which uses one mode; has libcall data.
  D: A "direct" optab, which uses one mode; does not have libcall data.
  V: An "oVerflow" optab.  Like N, but does not record its code in
     code_to_optab.

  CX, NX, VX: An extra pattern entry for a conversion or normal optab.

These patterns may be present in the MD file with names that contain
the mode(s) used and the name of the operation.  This array contains
a list of optabs that need to be initialized.  Within each name,
$a and $b are used to match a short mode name (the part of the mode
name not including `mode' and converted to lower-case).

$I means that only full integer modes should be considered for the
next mode, and $F means that only float modes should be considered.
$P means that both full and partial integer modes should be considered.
$Q means that only fixed-point modes should be considered.

The pattern may be NULL if the optab exists only for the libcalls
that we plan to attach to it, and there are no named patterns in
the md files.
WARNING: do not have a pattern name have a `c` right before a possible scalar mode,
csi, cdi are valid modes (complex si/di) and the match is based on which pattern is done
first. For an example `andc$a3` and `and$a3` with `andcsi3` will match which one comes first
here.   
The extension libcalls are used for float extension.   
Conversions for fixed-point modes and other modes.   
Misc optabs that use two modes; model them as "conversions".   
Comparison libcalls for integers MUST come in pairs, signed/unsigned.   
EQ etc are floating point comparisons.   
These are all initialized individually, on a per-host basis.   
C99 implementations of fmax/fmin.   
Vector reduction to a scalar.   

Function Documentation

◆ add_c_test()

void add_c_test ( const char * expr,
int value )
extern
Add an entry to the table of conditions.  Used by genconditions and
by read-rtl.cc.   
Record the C test expression EXPR in the condition_table, with
value VAL.  Duplicates clobber previous entries.   

References condition_table, c_test::expr, expr, and c_test::value.

Referenced by main().

◆ add_implicit_parallel()

rtx add_implicit_parallel ( rtvec vec)
extern
Return the rtx pattern specified by the list of rtxes in a
define_insn or define_split.   

References GET_NUM_ELEM, RTVEC_ELT, rtx_alloc(), and XVEC.

Referenced by gen_insn(), gen_rewrite_sequence(), main(), and process_one_cond_exec().

◆ add_predicate()

void add_predicate ( struct pred_data * pred)
extern

◆ add_predicate_code()

void add_predicate_code ( struct pred_data * pred,
enum rtx_code code )
extern

◆ choose_output()

FILE * choose_output ( const vec< FILE * > & parts,
unsigned & idx )
extern

References gcc_unreachable, i, and NULL.

◆ compute_test_codes()

void compute_test_codes ( rtx exp,
file_location loc,
char * codes )
extern
Recursively calculate the set of rtx codes accepted by the
predicate expression EXP, writing the result to CODES.  LOC is
the .md file location of the directive containing EXP.   

References pred_data::codes, compute_test_codes(), did_you_mean_codes, error_at(), exp(), GET_CODE, GET_RTX_NAME, I, i, queue_elem::loc, lookup_predicate(), message_at(), N, NUM_RTX_CODE, scan_comma_elt(), TRISTATE_AND, TRISTATE_NOT, TRISTATE_OR, XEXP, XSTR, and Y.

Referenced by add_constraint(), compute_test_codes(), and process_define_predicate().

◆ count_patterns()

int count_patterns ( )
extern
Count the number of patterns in all queues and return the count.   

References count, queue_elem::data, define_attr_queue, define_insn_queue, define_pred_queue, get_c_test(), insn_elision, maybe_eval_c_test(), queue_elem::next, and other_queue.

◆ find_optab()

bool find_optab ( optab_pattern * p,
const char * name )
extern
Return true if NAME is the name of an optab, describing it in P if so.   

References optab_pattern::m1, optab_pattern::m2, match_pattern(), optab_pattern::name, pred_data::name, optab_def::op, optab_pattern::op, optabs, and optab_pattern::sort_num.

Referenced by gen_expand(), and gen_insn().

◆ get_c_test()

const char * get_c_test ( rtx x)
extern
Return the C test that says whether a definition rtx can be used,
or "" if it can be used unconditionally.   
Return the C test that says whether definition rtx DEF can be used,
or "" if it can be used unconditionally.   

References GET_CODE, and XSTR.

Referenced by count_patterns(), main(), match_pattern_1(), read_md_rtx(), and validate_pattern().

◆ get_emit_function()

const char * get_emit_function ( rtx x)
extern
Return the emit_* function that should be used for pattern X, or NULL
if we can't pick a particular type at compile time and should instead
fall back to "emit".   

References classify_insn(), gcc_unreachable, and NULL.

Referenced by gen_emit_seq().

◆ get_file_location()

file_location get_file_location ( rtx x)
extern
Return the file location of DEFINE_* rtx X, which was previously
returned by read_md_rtx.   

References gcc_assert, and rtx_locs.

Referenced by def_target_insn().

◆ get_num_insn_codes()

unsigned int get_num_insn_codes ( )
extern
Return the number of possible INSN_CODEs.  Only meaningful once the
whole file has been processed.   

References insn_sequence_num.

Referenced by main().

◆ get_pattern_stats()

void get_pattern_stats ( struct pattern_stats * stats,
rtvec pattern )
extern
Make STATS describe the operands that appear in instruction pattern
PATTERN.   

References GET_NUM_ELEM, get_pattern_stats_1(), i, MAX, and RTVEC_ELT.

Referenced by def_target_insn(), gen_expand(), gen_expand(), gen_insn(), gen_insn(), gen_peephole(), gen_split(), handle_overloaded_gen(), and handle_overloaded_gen().

◆ get_register_filter_id()

unsigned int get_register_filter_id ( const char * filter)
extern
Return the unique identifier for filter condition FILTER.  Identifiers
are assigned automatically when the define_register_constraint is
parsed.   

References gcc_assert, and register_filter_map.

Referenced by preprocess_constraints(), write_get_register_filter(), and write_get_register_filter_id().

◆ init_rtx_reader_args()

rtx_reader * init_rtx_reader_args ( int argc,
const char ** argv )
extern
Programs that don't have their own options can use this entry point
instead.   

References init_rtx_reader_args_cb().

Referenced by main(), and main().

◆ init_rtx_reader_args_cb()

◆ lookup_predicate()

◆ maybe_eval_c_test()

int maybe_eval_c_test ( const char * expr)
extern
If the C test passed as the argument can be evaluated at compile
time, return its truth value; else return -1.  The test must have
appeared somewhere in the machine description when genconditions
was run.   
Given a string representing a C test expression, look it up in the
condition_table and report whether or not its value is known
at compile time.  Returns a tristate: 1 for known true, 0 for
known false, -1 for unknown.   

References condition_table, c_test::expr, expr, and c_test::value.

Referenced by count_patterns(), def_target_insn(), gen_insn(), gen_insn(), gen_proto(), match_pattern_1(), and read_md_rtx().

◆ needs_barrier_p()

bool needs_barrier_p ( rtx x)
extern
Return true if we must emit a barrier after pattern X.   

References GET_CODE, SET, SET_DEST, and SET_SRC.

Referenced by gen_emit_seq().

◆ read_md_rtx()

Variable Documentation

◆ compact_syntax

hash_set<rtx> compact_syntax
extern
List of entries which are part of the new syntax.   

Referenced by convert_syntax(), and gen_insn().

◆ first_predicate

struct pred_data* first_predicate
extern

◆ insn_elision

int insn_elision
extern
Set this to 0 to disable automatic elision of insn patterns which
can never be used in this configuration.  See genconditions.cc.
Must be set before calling init_md_reader.   

Referenced by count_patterns(), main(), and read_md_rtx().

◆ num_optabs

unsigned int num_optabs
extern
The number of entries in optabs[].   

Referenced by main().

◆ optabs

optab_def optabs[]
extern
An array of all optabs.  Note that the same optab can appear more
than once, with a different pattern.   

Referenced by find_optab(), and main().

◆ register_filters

vec<const char *> register_filters
extern

◆ rtl_obstack