GCC Middle and Back End API Reference
genattrtab.cc File Reference
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "obstack.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
#include "fnmatch.h"
Include dependency graph for genattrtab.cc:

Data Structures

class  insn_def
 
struct  insn_ent
 
struct  attr_value
 
class  attr_desc
 
class  delay_desc
 
struct  attr_value_list
 
struct  attr_hash
 
struct  insn_reserv
 
struct  bypass_list
 

Macros

#define ATTR_IND_SIMPLIFIED_P(RTX)
 
#define ATTR_CURR_SIMPLIFIED_P(RTX)
 
#define ATTR_PERMANENT_P(RTX)
 
#define strcmp_check(S1, S2)
 
#define DEBUG   0
 
#define ATTR_NONE   0
 
#define ATTR_SPECIAL   (1 << 0)
 
#define MAX_DIGITS   (HOST_BITS_PER_INT * 3 / 10 + 3)
 
#define MAX_ATTRS_INDEX   256
 
#define SIMPLIFY_TEST_EXP(EXP, INSN_CODE, INSN_INDEX)
 
#define DEF_ATTR_STRING(S)
 
#define oballoc(T)
 
#define oballocvec(T, N)
 
#define RTL_HASH_SIZE   4093
 
#define RTL_HASH(RTL)
 
#define FLG_BITWISE   1
 
#define FLG_AFTER   2
 
#define FLG_INSIDE   4
 
#define FLG_OUTSIDE_AND   8
 

Typedefs

typedef uint64_t alternative_mask
 

Functions

static char * attr_string (const char *, int)
 
static char * attr_printf (unsigned int, const char *,...) ATTRIBUTE_PRINTF_2
 
static rtx make_numeric_value (int)
 
static class attr_descfind_attr (const char **, int)
 
static rtx mk_attr_alt (alternative_mask)
 
static char * next_comma_elt (const char **)
 
static rtx insert_right_side (enum rtx_code, rtx, rtx, int, int)
 
static rtx copy_boolean (rtx)
 
static int compares_alternatives_p (rtx)
 
static void make_internal_attr (const char *, rtx, int)
 
static void insert_insn_ent (struct attr_value *, struct insn_ent *)
 
static void walk_attr_value (rtx)
 
static int max_attr_value (rtx)
 
static int min_attr_value (rtx)
 
static unsigned int attr_value_alignment (rtx)
 
static rtx simplify_test_exp (rtx, int, int)
 
static rtx simplify_test_exp_in_temp (rtx, int, int)
 
static rtx copy_rtx_unchanging (rtx)
 
static bool attr_alt_subset_p (rtx, rtx)
 
static bool attr_alt_subset_of_compl_p (rtx, rtx)
 
static void clear_struct_flag (rtx)
 
static void write_attr_valueq (FILE *, class attr_desc *, const char *)
 
static struct attr_valuefind_most_used (class attr_desc *)
 
static void write_attr_set (FILE *, class attr_desc *, int, rtx, const char *, const char *, rtx, int, int, unsigned int)
 
static void write_attr_case (FILE *, class attr_desc *, struct attr_value *, int, const char *, const char *, int, rtx)
 
static void write_attr_value (FILE *, class attr_desc *, rtx)
 
static void write_upcase (FILE *, const char *)
 
static void write_indent (FILE *, int)
 
static rtx identity_fn (rtx)
 
static rtx zero_fn (rtx)
 
static rtx one_fn (rtx)
 
static rtx max_fn (rtx)
 
static rtx min_fn (rtx)
 
static void attr_hash_add_rtx (unsigned int hashcode, rtx rtl)
 
static void attr_hash_add_string (unsigned int hashcode, char *str)
 
static rtx attr_rtx_1 (enum rtx_code code, va_list p)
 
static rtx attr_rtx (enum rtx_code code,...)
 
static rtx attr_eq (const char *name, const char *value)
 
static const char * attr_numeral (int n)
 
static int attr_equal_p (rtx x, rtx y)
 
static rtx check_attr_test (file_location loc, rtx exp, attr_desc *attr)
 
static rtx check_attr_value (file_location loc, rtx exp, class attr_desc *attr)
 
static rtx convert_set_attr_alternative (rtx exp, class insn_def *id)
 
static rtx convert_set_attr (rtx exp, class insn_def *id)
 
static void check_defs (void)
 
static rtx make_canonical (file_location loc, class attr_desc *attr, rtx exp)
 
static struct attr_valueget_attr_value (file_location loc, rtx value, class attr_desc *attr, int insn_code)
 
static void expand_delays (void)
 
static void fill_attr (class attr_desc *attr)
 
static rtx substitute_address (rtx exp, rtx(*no_address_fn)(rtx), rtx(*address_fn)(rtx))
 
static void make_length_attrs (void)
 
static void write_length_unit_log (FILE *outf)
 
static int attr_rtx_cost (rtx x)
 
static rtx simplify_cond (rtx exp, int insn_code, int insn_index)
 
static void remove_insn_ent (struct attr_value *av, struct insn_ent *ie)
 
static alternative_mask compute_alternative_mask (rtx exp, enum rtx_code code)
 
static rtx make_alternative_compare (alternative_mask mask)
 
static rtx evaluate_eq_attr (rtx exp, class attr_desc *attr, rtx value, int insn_code, int insn_index)
 
static rtx simplify_and_tree (rtx exp, rtx *pterm, int insn_code, int insn_index)
 
static rtx simplify_or_tree (rtx exp, rtx *pterm, int insn_code, int insn_index)
 
static rtx attr_alt_intersection (rtx s1, rtx s2)
 
static rtx attr_alt_union (rtx s1, rtx s2)
 
static rtx attr_alt_complement (rtx s)
 
static int tests_attr_p (rtx p, class attr_desc *attr)
 
static int get_attr_order (class attr_desc ***ret)
 
static void optimize_attrs (int num_insn_codes)
 
static void add_attr_value (class attr_desc *attr, const char *name)
 
static void gen_attr (md_rtx_info *info)
 
static int count_alternatives (rtx exp)
 
static void gen_insn (md_rtx_info *info)
 
static void gen_delay (md_rtx_info *info)
 
static void find_attrs_to_cache (rtx exp, bool create)
 
static unsigned int write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags, bool emit_parens=true)
 
static void write_attr_get (FILE *outf, class attr_desc *attr)
 
static rtx eliminate_known_true (rtx known_true, rtx exp, int insn_code, int insn_index)
 
static void write_insn_cases (FILE *outf, struct insn_ent *ie, int indent)
 
static void write_dummy_eligible_delay (FILE *outf, const char *kind)
 
static void write_eligible_delay (FILE *outf, const char *kind)
 
static void write_const_num_delay_slots (FILE *outf)
 
static void gen_insn_reserv (md_rtx_info *info)
 
static void gen_bypass_1 (const char *s, size_t len)
 
static void gen_bypass (md_rtx_info *info)
 
static void process_bypasses (void)
 
static bool check_tune_attr (const char *name, rtx exp)
 
static class attr_descfind_tune_attr (rtx exp)
 
static void make_automaton_attrs (void)
 
static void write_header (FILE *outf)
 
static FILE * open_outfile (const char *file_name)
 
static bool handle_arg (const char *arg)
 
int main (int argc, const char **argv)
 

Variables

static struct obstack obstack1 obstack2
 
static struct obstackhash_obstack = &obstack1
 
static struct obstacktemp_obstack = &obstack2
 
static class attr_descattrs [MAX_ATTRS_INDEX]
 
static class insn_defdefs
 
static class delay_descdelays
 
struct attr_value_list ** insn_code_values
 
static int insn_index_number
 
static int got_define_asm_attributes
 
static int must_extract
 
static int must_constrain
 
static int address_used
 
static int length_used
 
static int num_delays
 
static int have_annul_true
 
static int have_annul_false
 
static int num_insn_ents
 
static int * insn_n_alternatives
 
static alternative_maskinsn_alternatives
 
static rtx true_rtx
 
static rtx false_rtx
 
static const char * alternative_name
 
static const char * length_str
 
static const char * delay_type_str
 
static const char * delay_1_0_str
 
static const char * num_delay_slots_str
 
static const char * attr_file_name = NULL
 
static const char * dfa_file_name = NULL
 
static const char * latency_file_name = NULL
 
static FILE * attr_file
 
static FILE * dfa_file
 
static FILE * latency_file
 
static struct attr_hashattr_hash_table [RTL_HASH_SIZE]
 
static const char * cached_attrs [32]
 
static int cached_attr_count
 
static unsigned int attrs_seen_once
 
static unsigned int attrs_seen_more_than_once
 
static unsigned int attrs_to_cache
 
static unsigned int attrs_cached_inside
 
static unsigned int attrs_cached_after
 
static struct insn_reservall_insn_reservs = 0
 
static struct insn_reserv ** last_insn_reserv_p = &all_insn_reservs
 
static size_t n_insn_reservs
 
static struct bypass_listall_bypasses
 
static size_t n_bypasses
 
static size_t n_bypassed
 

Macro Definition Documentation

◆ ATTR_CURR_SIMPLIFIED_P

#define ATTR_CURR_SIMPLIFIED_P ( RTX)
Value:
(RTX_FLAG ((RTX), in_struct))
#define RTX_FLAG(RTX, FLAG)
Definition rtl.h:1258

Referenced by attr_rtx_1(), clear_struct_flag(), copy_rtx_unchanging(), and simplify_test_exp().

◆ ATTR_IND_SIMPLIFIED_P

#define ATTR_IND_SIMPLIFIED_P ( RTX)
Value:
(RTX_FLAG ((RTX), unchanging))
Generate code from machine description to compute values of attributes.
   Copyright (C) 1991-2024 Free Software Foundation, Inc.
   Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)

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/>.   
This program handles insn attributes and the DEFINE_DELAY and
DEFINE_INSN_RESERVATION definitions.

It produces a series of functions named `get_attr_...', one for each insn
attribute.  Each of these is given the rtx for an insn and returns a member
of the enum for the attribute.

These subroutines have the form of a `switch' on the INSN_CODE (via
`recog_memoized').  Each case either returns a constant attribute value
or a value that depends on tests on other attributes, the form of
operands, or some random C expression (encoded with a SYMBOL_REF
expression).

If the attribute `alternative', or a random C expression is present,
`constrain_operands' is called.  If either of these cases of a reference to
an operand is found, `extract_insn' is called.

The special attribute `length' is also recognized.  For this operand,
expressions involving the address of an operand or the current insn,
(address (pc)), are valid.  In this case, an initial pass is made to
set all lengths that do not depend on address.  Those that do are set to
the maximum length.  Then each insn that depends on an address is checked
and possibly has its length changed.  The process repeats until no further
changed are made.  The resulting lengths are saved for use by
`get_attr_length'.

A special form of DEFINE_ATTR, where the expression for default value is a
CONST expression, indicates an attribute that is constant for a given run
of the compiler.  The subroutine generated for these attributes has no
parameters as it does not depend on any particular insn.  Constant
attributes are typically used to specify which variety of processor is
used.

Internal attributes are defined to handle DEFINE_DELAY and
DEFINE_INSN_RESERVATION.  Special routines are output for these cases.

This program works by keeping a list of possible values for each attribute.
These include the basic attribute choices, default values for attribute, and
all derived quantities.

As the description file is read, the definition for each insn is saved in a
`struct insn_def'.   When the file reading is complete, a `struct insn_ent'
is created for each insn and chained to the corresponding attribute value,
either that specified, or the default.

An optimization phase is then run.  This simplifies expressions for each
insn.  EQ_ATTR tests are resolved, whenever possible, to a test that
indicates when the attribute has the specified value for the insn.  This
avoids recursive calls during compilation.

The strategy used when processing DEFINE_DELAY definitions is to create
arbitrarily complex expressions and have the optimization simplify them.

Once optimization is complete, any required routines and definitions
will be written.

An optimization that is not yet implemented is to hoist the constant
expressions entirely out of the routines and definitions that are written.
A way to do this is to iterate over all possible combinations of values
for constant attributes and generate a set of functions for that given
combination.  An initialization function would be written that evaluates
the attributes and installs the corresponding set of routines and
definitions (each would be accessed through a pointer).

We use the flags in an RTX as follows:
`unchanging' (ATTR_IND_SIMPLIFIED_P): This rtx is fully simplified
   independent of the insn code.
`in_struct' (ATTR_CURR_SIMPLIFIED_P): This rtx is fully simplified
   for the insn code currently being processed (see optimize_attrs).
`return_val' (ATTR_PERMANENT_P): This rtx is permanent and unique
   (see attr_rtx).   

Referenced by check_attr_test(), clear_struct_flag(), copy_rtx_unchanging(), evaluate_eq_attr(), main(), make_canonical(), simplify_test_exp(), simplify_test_exp_in_temp(), and walk_attr_value().

◆ ATTR_NONE

#define ATTR_NONE   0
Flags for make_internal_attr's `special' parameter.   

Referenced by expand_delays(), make_automaton_attrs(), and make_length_attrs().

◆ ATTR_PERMANENT_P

#define ATTR_PERMANENT_P ( RTX)
Value:
(RTX_FLAG ((RTX), return_val))

Referenced by attr_equal_p(), attr_rtx_1(), and main().

◆ ATTR_SPECIAL

#define ATTR_SPECIAL   (1 << 0)

◆ DEBUG

#define DEBUG   0

Referenced by get_attr_order().

◆ DEF_ATTR_STRING

#define DEF_ATTR_STRING ( S)
Value:
(attr_string ((S), strlen (S)))
#define S(p, v)
static char * attr_string(const char *, int)
Definition genattrtab.cc:634

Referenced by attr_printf(), attr_rtx_1(), copy_boolean(), evaluate_eq_attr(), find_attr(), gen_insn_reserv(), main(), and make_canonical().

◆ FLG_AFTER

#define FLG_AFTER   2
Set if cached attribute will be known initialized in else block after
this condition.  This is true for LHS of toplevel && and || and
even for RHS of ||, but not for RHS of &&.   

Referenced by write_attr_set(), and write_test_expr().

◆ FLG_BITWISE

#define FLG_BITWISE   1
Given a piece of RTX, print a C expression to test its truth value to OUTF.
We use AND and IOR both for logical and bit-wise operations, so
interpret them as logical unless they are inside a comparison expression.

An outermost pair of parentheses is emitted around this C expression unless
EMIT_PARENS is false.   
Interpret AND/IOR as bit-wise operations instead of logical.   

Referenced by write_test_expr().

◆ FLG_INSIDE

#define FLG_INSIDE   4
Set if cached attribute will be known initialized in then block after
this condition.  This is true for LHS of toplevel && and || and
even for RHS of &&, but not for RHS of ||.   

Referenced by write_attr_set(), and write_test_expr().

◆ FLG_OUTSIDE_AND

#define FLG_OUTSIDE_AND   8
Cleared when an operand of &&.   

Referenced by write_attr_set(), and write_test_expr().

◆ MAX_ATTRS_INDEX

#define MAX_ATTRS_INDEX   256
Listheads of above structures.   
This one is indexed by the first character of the attribute name.   

Referenced by find_attr(), get_attr_order(), and main().

◆ MAX_DIGITS

#define MAX_DIGITS   (HOST_BITS_PER_INT * 3 / 10 + 3)
enough space to reserve for printing out ints  

Referenced by expand_delays(), and make_numeric_value().

◆ oballoc

#define oballoc ( T)
Value:
XOBNEW (hash_obstack, T)
static struct obstack * hash_obstack
Definition genattrtab.cc:123

Referenced by add_attr_value(), fill_attr(), find_attr(), gen_bypass_1(), gen_delay(), gen_insn(), gen_insn_reserv(), get_attr_value(), and make_length_attrs().

◆ oballocvec

#define oballocvec ( T,
N )
Value:
XOBNEWVEC (hash_obstack, T, (N))
#define N
Definition gensupport.cc:202

Referenced by main().

◆ RTL_HASH

#define RTL_HASH ( RTL)
Value:
((intptr_t) (RTL) & 0777777)
Here is how primitive or already-shared RTL's hash
codes are made.   

Referenced by attr_rtx_1().

◆ RTL_HASH_SIZE

#define RTL_HASH_SIZE   4093
Now here is the hash table.  When recording an RTL, it is added to
the slot whose index is the hash code mod the table size.  Note
that the hash table is used for several kinds of RTL (see attr_rtx)
and for strings.  While all these live in the same table, they are
completely independent, and the hash code is computed differently
for each.   

Referenced by attr_hash_add_rtx(), attr_hash_add_string(), attr_rtx_1(), and attr_string().

◆ SIMPLIFY_TEST_EXP

#define SIMPLIFY_TEST_EXP ( EXP,
INSN_CODE,
INSN_INDEX )
Value:
: simplify_test_exp (EXP, INSN_CODE, INSN_INDEX))
#define ATTR_CURR_SIMPLIFIED_P(RTX)
Definition genattrtab.cc:94
#define ATTR_IND_SIMPLIFIED_P(RTX)
Definition genattrtab.cc:93
static rtx simplify_test_exp(rtx, int, int)
Definition genattrtab.cc:2418
#define INSN_CODE(INSN)
Definition rtl.h:1534
Simplify an expression.  Only call the routine if there is something to
simplify.   

Referenced by eliminate_known_true(), and simplify_test_exp().

◆ strcmp_check

#define strcmp_check ( S1,
S2 )

Typedef Documentation

◆ alternative_mask

typedef uint64_t alternative_mask
Stores, for each insn code, a bitmap that has bits on for each possible
alternative.   
Keep this in sync with recog.h.   

Function Documentation

◆ add_attr_value()

static void add_attr_value ( class attr_desc * attr,
const char * name )
static
Add attribute value NAME to the beginning of ATTR's list.   

References attr_rtx(), attr_value::first_insn, attr_desc::first_value, attr_value::has_asm_insn, attr_value::next, NULL, attr_value::num_insns, oballoc, and attr_value::value.

Referenced by gen_attr().

◆ attr_alt_complement()

static rtx attr_alt_complement ( rtx s)
static
Return EQ_ATTR_ALT expression representing complement of S.   

References attr_rtx(), HOST_WIDE_INT_1, and XWINT.

Referenced by simplify_test_exp().

◆ attr_alt_intersection()

static rtx attr_alt_intersection ( rtx s1,
rtx s2 )
static
Return EQ_ATTR_ALT expression representing intersection of S1 and S2.   

References attr_rtx(), gcc_unreachable, and XWINT.

Referenced by simplify_test_exp().

◆ attr_alt_subset_of_compl_p()

static bool attr_alt_subset_of_compl_p ( rtx s1,
rtx s2 )
static
Returns true if S1 is a subset of complement of S2.   

References gcc_unreachable, and XWINT.

Referenced by simplify_and_tree().

◆ attr_alt_subset_p()

static bool attr_alt_subset_p ( rtx s1,
rtx s2 )
static
Returns true if S1 is a subset of S2.   

References gcc_unreachable, and XWINT.

Referenced by simplify_and_tree().

◆ attr_alt_union()

static rtx attr_alt_union ( rtx s1,
rtx s2 )
static
Return EQ_ATTR_ALT expression representing union of S1 and S2.   

References attr_rtx(), gcc_unreachable, and XWINT.

Referenced by simplify_test_exp().

◆ attr_eq()

static rtx attr_eq ( const char * name,
const char * value )
static

◆ attr_equal_p()

static int attr_equal_p ( rtx x,
rtx y )
static
Check two rtx's for equality of contents,
taking advantage of the fact that if both are hashed
then they can't be equal unless they are the same object.   

References ATTR_PERMANENT_P, rtx_equal_p(), and y.

Referenced by get_attr_value(), insert_right_side(), make_canonical(), simplify_and_tree(), simplify_cond(), simplify_or_tree(), and simplify_test_exp().

◆ attr_hash_add_rtx()

static void attr_hash_add_rtx ( unsigned int hashcode,
rtx rtl )
static
Add an entry to the hash table for RTL with hash code HASHCODE.   

References attr_hash_table, hash_obstack, attr_hash::hashcode, attr_hash::next, attr_hash::rtl, RTL_HASH_SIZE, and attr_hash::u.

Referenced by attr_rtx_1().

◆ attr_hash_add_string()

static void attr_hash_add_string ( unsigned int hashcode,
char * str )
static
Add an entry to the hash table for STRING with hash code HASHCODE.   

References attr_hash_table, hash_obstack, attr_hash::hashcode, attr_hash::next, RTL_HASH_SIZE, attr_hash::str, and attr_hash::u.

Referenced by attr_string().

◆ attr_numeral()

static const char * attr_numeral ( int n)
static

References make_numeric_value(), and XSTR.

Referenced by convert_set_attr_alternative().

◆ attr_printf()

static char * attr_printf ( unsigned int len,
const char * fmt,
... )
static
Create a new string printed with the printf line arguments into a space
of at most LEN bytes:

rtx attr_printf (len, format, [arg1, ..., argn])   

References DEF_ATTR_STRING, and gcc_assert.

Referenced by expand_delays(), and make_numeric_value().

◆ attr_rtx()

◆ attr_rtx_1()

static rtx attr_rtx_1 ( enum rtx_code code,
va_list p )
static
Generate an RTL expression, but avoid duplicates.
Set the ATTR_PERMANENT_P flag for these permanent objects.

In some cases we cannot uniquify; then we return an ordinary
impermanent rtx with ATTR_PERMANENT_P clear.

Args are as follows:

rtx attr_rtx (code, [element1, ..., elementn])   

References ATTR_CURR_SIMPLIFIED_P, attr_hash_add_rtx(), attr_hash_table, ATTR_PERMANENT_P, DEF_ATTR_STRING, false_rtx, gcc_unreachable, GET_CODE, GET_RTX_CLASS, GET_RTX_FORMAT, GET_RTX_LENGTH, hash_obstack, attr_hash::hashcode, i, attr_hash::next, NULL_RTX, obstack, attr_hash::rtl, RTL_HASH, RTL_HASH_SIZE, rtl_obstack, rtx_alloc(), RTX_BIN_ARITH, RTX_COMM_ARITH, RTX_COMM_COMPARE, RTX_COMPARE, RTX_UNARY, true_rtx, attr_hash::u, X0EXP, XEXP, XINT, XSTR, XVEC, and XWINT.

Referenced by attr_rtx().

◆ attr_rtx_cost()

static int attr_rtx_cost ( rtx x)
static
Compute approximate cost of the expression.  Used to decide whether
expression is cheap enough for inline.   

References alternative_name, attr_rtx_cost(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, strcmp_check, XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by attr_rtx_cost(), optimize_attrs(), and simplify_test_exp().

◆ attr_string()

static char * attr_string ( const char * str,
int len )
static
Forward declarations of functions used before their definitions, only.   
Return a permanent (possibly shared) copy of a string STR (not assumed
to be null terminated) with LEN bytes.   

References attr_hash_add_string(), attr_hash_table, md_reader::copy_md_ptr_loc(), hash_obstack, attr_hash::hashcode, i, attr_hash::next, RTL_HASH_SIZE, rtx_reader_ptr, attr_hash::str, and attr_hash::u.

Referenced by gen_bypass_1(), and next_comma_elt().

◆ attr_value_alignment()

static unsigned int attr_value_alignment ( rtx exp)
static
Given an attribute value expression, return the alignment of values.
Return 0 if EXP is known to be zero, and 1 if the value can't be
calculated by this function.   

References attr_value_alignment(), exp(), GET_CODE, i, INTVAL, XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by attr_value_alignment(), and write_length_unit_log().

◆ check_attr_test()

static rtx check_attr_test ( file_location loc,
rtx exp,
attr_desc * attr )
static
Given a test expression EXP for attribute ATTR, ensure it is validly
formed.  LOC is the location of the .md construct that contains EXP.

Convert (eq_attr "att" "a1,a2") to (ior (eq_attr ... ) (eq_attrq ..))
and (eq_attr "att" "!a1") to (not (eq_attr "att" "a1")).  Do the latter
test first so that (eq_attr "att" "!a1,a2,a3") works as expected.

Update the string address in EQ_ATTR expression to be the same used
in the attribute (or `alternative_name') to speed up subsequent
`find_attr' calls and eliminate most `strcmp' calls.

Return the new expression, if any.   

References attr_eq(), ATTR_IND_SIMPLIFIED_P, attr_rtx(), check_attr_test(), exp(), false_rtx, fatal_at(), find_attr(), attr_desc::first_value, GET_CODE, GET_RTX_NAME, insert_right_side(), attr_desc::is_const, attr_desc::is_numeric, mk_attr_alt(), n_comma_elts(), attr_desc::name, attr_value::next, next_comma_elt(), NULL, true_rtx, attr_value::value, XEXP, XSTR, and XWINT.

Referenced by check_attr_test(), check_attr_value(), and gen_insn_reserv().

◆ check_attr_value()

static rtx check_attr_value ( file_location loc,
rtx exp,
class attr_desc * attr )
static
Given an expression EXP, ensure that it is validly formed and that
all named attribute values are valid for ATTR.  Issue an error if not.
LOC is the location of the .md construct that contains EXP.

Return a perhaps modified replacement expression for the value.   

References attr_rtx(), check_attr_test(), check_attr_value(), error_at(), exp(), find_attr(), attr_desc::first_value, GET_CODE, GET_RTX_NAME, i, INTVAL, attr_desc::is_const, attr_desc::is_numeric, attr_desc::loc, attr_desc::name, attr_value::next, NULL, attr_value::value, XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by check_attr_value(), check_defs(), gen_attr(), main(), and make_canonical().

◆ check_defs()

static void check_defs ( void )
static
Scan all definitions, checking for validity.  Also, convert any SET_ATTR
and SET_ATTR_ALTERNATIVE expressions to the corresponding SET
expressions.   

References check_attr_value(), convert_set_attr(), convert_set_attr_alternative(), defs, error_at(), find_attr(), GET_CODE, GET_RTX_NAME, i, id::next, NULL, NULL_RTX, SET, XEXP, XSTR, XVEC, XVECEXP, and XVECLEN.

Referenced by main(), and maybe_warn_operand().

◆ check_tune_attr()

static bool check_tune_attr ( const char * name,
rtx exp )
static
Check that attribute NAME is used in define_insn_reservation condition
EXP.  Return true if it is.   

References check_tune_attr(), exp(), GET_CODE, insn_reserv::name, XEXP, and XSTR.

Referenced by check_tune_attr(), and find_tune_attr().

◆ clear_struct_flag()

static void clear_struct_flag ( rtx x)
static
Clear the ATTR_CURR_SIMPLIFIED_P flag in EXP and its subexpressions.   

References ATTR_CURR_SIMPLIFIED_P, ATTR_IND_SIMPLIFIED_P, CASE_CONST_ANY, clear_struct_flag(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, XEXP, XVECEXP, and XVECLEN.

Referenced by clear_struct_flag(), and optimize_attrs().

◆ compares_alternatives_p()

static int compares_alternatives_p ( rtx exp)
static
Returns nonzero if the given expression contains an EQ_ATTR with the
`alternative' attribute.   

References alternative_name, compares_alternatives_p(), exp(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by compares_alternatives_p(), and get_attr_value().

◆ compute_alternative_mask()

static alternative_mask compute_alternative_mask ( rtx exp,
enum rtx_code code )
static
If we have an expression which AND's a bunch of
     (not (eq_attrq "alternative" "n"))
terms, we may have covered all or all but one of the possible alternatives.
If so, we can optimize.  Similarly for IOR's of EQ_ATTR.

This routine is passed an expression and either AND or IOR.  It returns a
bitmask indicating which alternatives are mentioned within EXP.   

References alternative_name, compute_alternative_mask(), exp(), GET_CODE, XEXP, XSTR, and XWINT.

Referenced by compute_alternative_mask(), and simplify_test_exp().

◆ convert_set_attr()

static rtx convert_set_attr ( rtx exp,
class insn_def * id )
static
Given a SET_ATTR, convert to the appropriate SET.  If a comma-separated
list of values is given, convert to SET_ATTR_ALTERNATIVE first.   

References attr_rtx(), convert_set_attr_alternative(), exp(), n_comma_elts(), next_comma_elt(), NULL, rtvec_alloc(), rtx_alloc(), SET, XSTR, XVEC, and XVECEXP.

Referenced by check_defs().

◆ convert_set_attr_alternative()

static rtx convert_set_attr_alternative ( rtx exp,
class insn_def * id )
static
Given an SET_ATTR_ALTERNATIVE expression, convert to the canonical SET.
It becomes a COND with each test being (eq_attr "alternative" "n")  

References alternative_name, attr_eq(), attr_numeral(), attr_rtx(), error_at(), exp(), i, NULL_RTX, rtvec_alloc(), rtx_alloc(), SET, XEXP, XSTR, XVEC, XVECEXP, and XVECLEN.

Referenced by check_defs(), and convert_set_attr().

◆ copy_boolean()

static rtx copy_boolean ( rtx exp)
static

◆ copy_rtx_unchanging()

static rtx copy_rtx_unchanging ( rtx orig)
static

◆ count_alternatives()

static int count_alternatives ( rtx exp)
static
Given a pattern for DEFINE_PEEPHOLE or DEFINE_INSN, return the number of
alternatives in the constraints.  Assume all MATCH_OPERANDs have the same
number of alternatives as this should be checked elsewhere.   

References count_alternatives(), exp(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, n_comma_elts(), NULL, XEXP, XSTR, XVEC, XVECEXP, and XVECLEN.

Referenced by count_alternatives(), and gen_insn().

◆ eliminate_known_true()

static rtx eliminate_known_true ( rtx known_true,
rtx exp,
int insn_code,
int insn_index )
static
Given an AND tree of known true terms (because we are inside an `if' with
that as the condition or are in an `else' clause) and an expression,
replace any known true terms with TRUE.  Use `simplify_and_tree' to do
the bulk of the work.   

References eliminate_known_true(), exp(), GET_CODE, simplify_and_tree(), SIMPLIFY_TEST_EXP, and XEXP.

Referenced by eliminate_known_true(), and write_attr_set().

◆ evaluate_eq_attr()

static rtx evaluate_eq_attr ( rtx exp,
class attr_desc * attr,
rtx value,
int insn_code,
int insn_index )
static
If we are processing an (eq_attr "attr" "value") test, we find the value
of "attr" for this insn code.  From that value, we can compute a test
showing when the EQ_ATTR will be true.  This routine performs that
computation.  If a test condition involves an address, we leave the EQ_ATTR
intact because addresses are only valid for the `length' attribute.

EXP is the EQ_ATTR expression and ATTR is the attribute to which
it refers.  VALUE is the value of that attribute for the insn
corresponding to INSN_CODE and INSN_INDEX.   

References address_used, attr_value_list::attr, ATTR_IND_SIMPLIFIED_P, attr_rtx(), attr_value_list::av, copy_rtx_unchanging(), insn_ent::def, DEF_ATTR_STRING, attr_desc::enum_name, evaluate_eq_attr(), exp(), false_rtx, find_attr(), attr_value::first_insn, attr_desc::first_value, gcc_assert, gcc_unreachable, GET_CODE, i, insert_right_side(), insn_def::insn_code, insn_code_values, attr_desc::name, attr_value::next, insn_ent::next, NULL, simplify_test_exp_in_temp(), strcmp_check, true_rtx, attr_value::value, walk_attr_value(), XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by evaluate_eq_attr(), simplify_test_exp(), and write_test_expr().

◆ expand_delays()

static void expand_delays ( void )
static
After all DEFINE_DELAYs have been read in, create internal attributes
to generate the required routines.

First, we compute the number of delay slots for each insn (as a COND of
each of the test expressions in DEFINE_DELAYs).  Then, if more than one
delay type is specified, we compute a similar function giving the
DEFINE_DELAY ordinal for each insn.

Finally, for each [DEFINE_DELAY, slot #] pair, we compute an attribute that
tells whether a given insn can be in that delay slot.

Normal attribute filling and optimization expands these to contain the
information needed to handle delay slots.   

References ATTR_NONE, attr_printf(), attr_rtx(), ATTR_SPECIAL, delay_desc::def, delay_type_str, delays, false_rtx, have_annul_false, have_annul_true, i, make_internal_attr(), make_numeric_value(), MAX_DIGITS, delay_desc::next, delay_desc::num, num_delay_slots_str, num_delays, rtvec_alloc(), rtx_alloc(), XEXP, XVEC, XVECEXP, and XVECLEN.

Referenced by main().

◆ fill_attr()

static void fill_attr ( class attr_desc * attr)
static
Once all attributes and insns have been read and checked, we construct for
each attribute value a list of all the insns that have that value for
the attribute.   

References insn_ent::def, attr_desc::default_val, defs, get_attr_value(), i, insert_insn_ent(), attr_desc::is_const, attr_desc::name, id::next, NULL, oballoc, strcmp_check, XEXP, XSTR, XVEC, XVECEXP, and XVECLEN.

Referenced by main().

◆ find_attr()

static class attr_desc * find_attr ( const char ** name_p,
int create )
static

◆ find_attrs_to_cache()

static void find_attrs_to_cache ( rtx exp,
bool create )
static
Finds non-const attributes that could be possibly cached.
When create is TRUE, fills in cached_attrs array.
Computes ATTRS_SEEN_ONCE and ATTRS_SEEN_MORE_THAN_ONCE
bitmasks.   

References alternative_name, attrs_seen_more_than_once, attrs_seen_once, cached_attr_count, cached_attrs, exp(), find_attr(), find_attrs_to_cache(), gcc_assert, GET_CODE, i, attr_desc::is_const, attr_desc::name, NULL, XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by find_attrs_to_cache(), write_attr_get(), and write_attr_set().

◆ find_most_used()

static struct attr_value * find_most_used ( class attr_desc * attr)
static
Find the most used value of an attribute.   

References attr_desc::first_value, attr_value::next, NULL, and attr_value::num_insns.

Referenced by write_attr_get(), and write_eligible_delay().

◆ find_tune_attr()

static class attr_desc * find_tune_attr ( rtx exp)
static
Try to find a const attribute (usually cpu or tune) that is used
in all define_insn_reservation conditions.   

References all_insn_reservs, alternative_name, check_tune_attr(), exp(), find_attr(), find_tune_attr(), gcc_assert, GET_CODE, attr_desc::is_const, attr_desc::is_special, attr_desc::name, NULL, XEXP, and XSTR.

Referenced by find_tune_attr(), and make_automaton_attrs().

◆ gen_attr()

◆ gen_bypass()

static void gen_bypass ( md_rtx_info * info)
static

References md_rtx_info::def, gen_bypass_1(), and XSTR.

Referenced by main().

◆ gen_bypass_1()

static void gen_bypass_1 ( const char * s,
size_t len )
static

◆ gen_delay()

static void gen_delay ( md_rtx_info * info)
static
Process a DEFINE_DELAY.  Validate the vector length, check if annul
true or annul false is specified, and make a `struct delay_desc'.   

References delay_desc::def, md_rtx_info::def, delays, error_at(), have_annul_false, have_annul_true, i, delay_desc::loc, md_rtx_info::loc, delay_desc::next, delay_desc::num, num_delays, oballoc, XVECEXP, and XVECLEN.

Referenced by main().

◆ gen_insn()

static void gen_insn ( md_rtx_info * info)
static
Process DEFINE_PEEPHOLE, DEFINE_INSN, and DEFINE_ASM_ATTRIBUTES.   

References count_alternatives(), insn_def::def, md_rtx_info::def, defs, gcc_unreachable, GET_CODE, got_define_asm_attributes, md_rtx_info::index, insn_index_number, md_rtx_info::loc, and oballoc.

Referenced by main().

◆ gen_insn_reserv()

static void gen_insn_reserv ( md_rtx_info * info)
static
Store information from a DEFINE_INSN_RESERVATION for future
attribute generation.   

References check_attr_test(), md_rtx_info::def, DEF_ATTR_STRING, last_insn_reserv_p, attr_desc::loc, md_rtx_info::loc, n_insn_reservs, attr_desc::name, oballoc, XEXP, XINT, and XSTR.

Referenced by main().

◆ get_attr_order()

static int get_attr_order ( class attr_desc *** ret)
static
Calculate a topological sorting of all attributes so that
all attributes only depend on attributes in front of it.
Place the result in *RET (which is a pointer to an array of
attr_desc pointers), and return the size of that array.   

References DEBUG, attr_desc::first_value, free(), i, attr_desc::is_const, MAX_ATTRS_INDEX, attr_desc::name, attr_desc::next, attr_value::next, attr_value::num_insns, tests_attr_p(), and attr_value::value.

Referenced by optimize_attrs().

◆ get_attr_value()

static struct attr_value * get_attr_value ( file_location loc,
rtx value,
class attr_desc * attr,
int insn_code )
static
Given a value and an attribute description, return a `struct attr_value *'
that represents that value.  This is either an existing structure, if the
value has been previously encountered, or a newly-created structure.

`insn_code' is the code of an insn whose attribute has the specified
value (-2 if not processing an insn).  We ensure that all insns for
a given value have the same number of alternatives if the value checks
alternatives.  LOC is the location to use for error reporting.   

References attr_equal_p(), compares_alternatives_p(), insn_ent::def, fatal_at(), attr_value::first_insn, attr_desc::first_value, attr_value::has_asm_insn, insn_alternatives, insn_def::insn_code, make_canonical(), attr_value::next, NULL, attr_value::num_insns, oballoc, and attr_value::value.

Referenced by fill_attr(), gen_attr(), make_internal_attr(), make_length_attrs(), and optimize_attrs().

◆ handle_arg()

static bool handle_arg ( const char * arg)
static

References attr_file_name, dfa_file_name, and latency_file_name.

Referenced by main().

◆ identity_fn()

static rtx identity_fn ( rtx exp)
static
Utility functions called from above routine.   

References exp().

Referenced by make_length_attrs().

◆ insert_insn_ent()

static void insert_insn_ent ( struct attr_value * av,
struct insn_ent * ie )
static

◆ insert_right_side()

static rtx insert_right_side ( enum rtx_code code,
rtx exp,
rtx term,
int insn_code,
int insn_index )
static
This is a utility routine to take an expression that is a tree of either
AND or IOR expressions and insert a new term.  The new term will be
inserted at the right side of the first node whose code does not match
the root.  A new node will be created with the root's code.  Its left
side will be the old right side and its right side will be the new
term.

If the `term' is itself a tree, all its leaves will be inserted.   

References attr_equal_p(), attr_rtx(), exp(), false_rtx, GET_CODE, insert_right_side(), simplify_test_exp_in_temp(), true_rtx, and XEXP.

Referenced by check_attr_test(), evaluate_eq_attr(), insert_right_side(), simplify_cond(), and write_attr_set().

◆ main()

◆ make_alternative_compare()

static rtx make_alternative_compare ( alternative_mask mask)
static
Given I, a single-bit mask, return RTX to compare the `alternative'
attribute with the value represented by that bit.   

References mk_attr_alt().

Referenced by simplify_test_exp().

◆ make_automaton_attrs()

static void make_automaton_attrs ( void )
static

◆ make_canonical()

static rtx make_canonical ( file_location loc,
class attr_desc * attr,
rtx exp )
static
Given a valid expression for an attribute value, remove any IF_THEN_ELSE
expressions by converting them into a COND.  This removes cases from this
program.  Also, replace an attribute value of "*" with the default attribute
value.  LOC is the location to use for error reporting.   

References attr_equal_p(), ATTR_IND_SIMPLIFIED_P, check_attr_value(), copy_boolean(), DEF_ATTR_STRING, attr_desc::default_val, exp(), fatal_at(), gcc_fallthrough, GET_CODE, i, INTVAL, attr_desc::is_const, attr_desc::loc, make_canonical(), make_numeric_value(), rtvec_alloc(), rtx_alloc(), attr_value::value, XEXP, XSTR, XVEC, XVECEXP, and XVECLEN.

Referenced by get_attr_value(), and make_canonical().

◆ make_internal_attr()

static void make_internal_attr ( const char * name,
rtx value,
int special )
static

◆ make_length_attrs()

static void make_length_attrs ( void )
static
Make new attributes from the `length' attribute.  The following are made,
each corresponding to a function called from `shorten_branches' or
`get_attr_length':

*insn_default_length            This is the length of the insn to be returned
                        by `get_attr_length' before `shorten_branches'
                        has been called.  In each case where the length
                        depends on relative addresses, the largest
                        possible is used.  This routine is also used
                        to compute the initial size of the insn.

*insn_variable_length_p This returns 1 if the insn's length depends
                        on relative addresses, zero otherwise.

*insn_current_length            This is only called when it is known that the
                        insn has a variable length and returns the
                        current length, based on relative addresses.

References ATTR_NONE, insn_ent::def, attr_desc::default_val, fatal_at(), find_attr(), attr_value::first_insn, attr_desc::first_value, get_attr_value(), i, identity_fn(), insert_insn_ent(), insn_def::insn_code, attr_desc::is_const, attr_desc::is_numeric, attr_desc::is_special, length_str, attr_desc::loc, insn_def::loc, make_internal_attr(), max_fn(), min_fn(), attr_value::next, insn_ent::next, oballoc, one_fn(), substitute_address(), attr_value::value, and zero_fn().

Referenced by main().

◆ make_numeric_value()

static rtx make_numeric_value ( int n)
static

◆ max_attr_value()

static int max_attr_value ( rtx exp)
static
Given an attribute value expression, return the maximum value that
might be evaluated.  Return INT_MAX if the value can't be
calculated by this function.   

References exp(), GET_CODE, i, INT_MAX, INTVAL, max_attr_value(), min_attr_value(), XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by max_attr_value(), max_fn(), and min_attr_value().

◆ max_fn()

static rtx max_fn ( rtx exp)
static

◆ min_attr_value()

static int min_attr_value ( rtx exp)
static
Given an attribute value expression, return the minimum value that
might be evaluated.  Return INT_MAX if the value can't be
calculated by this function.  Note that when this function can
calculate one value inside IF_THEN_ELSE or some but not all values
inside COND, then it returns the minimum among those values it can
calculate.   

References exp(), GET_CODE, i, INT_MAX, INTVAL, max_attr_value(), min_attr_value(), XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by max_attr_value(), min_attr_value(), and min_fn().

◆ min_fn()

static rtx min_fn ( rtx exp)
static

◆ mk_attr_alt()

static rtx mk_attr_alt ( alternative_mask e)
static
Return EQ_ATTR_ALT expression representing set containing elements set
in E.   

References attr_rtx(), and HOST_WIDE_INT_0.

Referenced by check_attr_test(), make_alternative_compare(), and simplify_test_exp().

◆ next_comma_elt()

static char * next_comma_elt ( const char ** pstr)
static
This page contains miscellaneous utility routines.   
Given a pointer to a (char *), return a malloc'ed string containing the
next comma-separated element.  Advance the pointer to after the string
scanned, or the end-of-string.  Return NULL if at end of string.   

References attr_string(), NULL, and scan_comma_elt().

Referenced by check_attr_test(), convert_set_attr(), and gen_attr().

◆ one_fn()

static rtx one_fn ( rtx exp)
static

References make_numeric_value().

Referenced by make_length_attrs().

◆ open_outfile()

static FILE * open_outfile ( const char * file_name)
static

References errno, fatal(), fopen, and write_header().

Referenced by main().

◆ optimize_attrs()

static void optimize_attrs ( int num_insn_codes)
static
Optimize the attribute lists by seeing if we can determine conditional
values from the known values of other attributes.  This will save subroutine
calls during the compilation.  NUM_INSN_CODES is the number of unique
instruction codes.   

References attr_rtx_cost(), clear_struct_flag(), insn_ent::def, attr_value::first_insn, attr_desc::first_value, free(), gcc_assert, get_attr_order(), get_attr_value(), GET_CODE, i, insert_insn_ent(), insn_def::insn_code, insn_code_values, insn_def::insn_index, insn_def::loc, attr_value::next, insn_ent::next, NULL, num_insn_ents, obstack, remove_insn_ent(), rtl_obstack, simplify_cond(), temp_obstack, and attr_value::value.

Referenced by main().

◆ process_bypasses()

static void process_bypasses ( void )
static
Find and mark all of the bypassed insns.   

References all_bypasses, all_insn_reservs, b, n_bypassed, bypass_list::next, insn_reserv::next, and r.

Referenced by make_automaton_attrs().

◆ remove_insn_ent()

static void remove_insn_ent ( struct attr_value * av,
struct insn_ent * ie )
static

◆ simplify_and_tree()

static rtx simplify_and_tree ( rtx exp,
rtx * pterm,
int insn_code,
int insn_index )
static
This routine is called when an AND of a term with a tree of AND's is
encountered.  If the term or its complement is present in the tree, it
can be replaced with TRUE or FALSE, respectively.

Note that (eq_attr "att" "v1") and (eq_attr "att" "v2") cannot both
be true and hence are complementary.

There is one special case:  If we see
     (and (not (eq_attr "att" "v1"))
          (eq_attr "att" "v2"))
this can be replaced by (eq_attr "att" "v2").  To do this we need to
replace the term, not anything in the AND tree.  So we pass a pointer to
the term.   

References attr_alt_subset_of_compl_p(), attr_alt_subset_p(), attr_equal_p(), attr_rtx(), exp(), false_rtx, GET_CODE, simplify_and_tree(), simplify_test_exp_in_temp(), strcmp_check, true_rtx, XEXP, and XSTR.

Referenced by eliminate_known_true(), make_automaton_attrs(), simplify_and_tree(), and simplify_test_exp().

◆ simplify_cond()

static rtx simplify_cond ( rtx exp,
int insn_code,
int insn_index )
static
Take a COND expression and see if any of the conditions in it can be
simplified.  If any are known true or known false for the particular insn
code, the COND can be further simplified.

Also call ourselves on any COND operations that are values of this COND.

We do not modify EXP; rather, we make and return a new rtx.   

References attr_equal_p(), exp(), false_rtx, free(), GET_CODE, i, insert_right_side(), rtl_obstack, rtvec_alloc(), rtx_alloc(), simplify_cond(), simplify_test_exp_in_temp(), true_rtx, XEXP, XVEC, XVECEXP, and XVECLEN.

Referenced by optimize_attrs(), and simplify_cond().

◆ simplify_or_tree()

static rtx simplify_or_tree ( rtx exp,
rtx * pterm,
int insn_code,
int insn_index )
static
Similar to `simplify_and_tree', but for IOR trees.   

References attr_equal_p(), attr_rtx(), exp(), false_rtx, GET_CODE, simplify_or_tree(), simplify_test_exp_in_temp(), true_rtx, XEXP, and XSTR.

Referenced by simplify_or_tree(), and simplify_test_exp().

◆ simplify_test_exp()

static rtx simplify_test_exp ( rtx exp,
int insn_code,
int insn_index )
static
Given an expression, see if it can be simplified for a particular insn
code based on the values of other attributes being tested.  This can
eliminate nested get_attr_... calls.

Note that if an endless recursion is specified in the patterns, the
optimization will loop.  However, it will do so in precisely the cases where
an infinite recursion loop could occur during compilation.  It's better that
it occurs here!   

References alternative_name, attr_value_list::attr, attr_alt_complement(), attr_alt_intersection(), attr_alt_union(), ATTR_CURR_SIMPLIFIED_P, attr_equal_p(), ATTR_IND_SIMPLIFIED_P, attr_rtx(), attr_rtx_cost(), attr_value_list::av, compute_alternative_mask(), copy_rtx_unchanging(), insn_ent::def, evaluate_eq_attr(), exp(), false_rtx, fatal(), find_attr(), attr_value::first_insn, attr_desc::first_value, GET_CODE, i, attr_value_list::ie, insn_alternatives, insn_def::insn_code, insn_code_values, make_alternative_compare(), mk_attr_alt(), attr_value::next, insn_ent::next, NULL, simplify_and_tree(), simplify_or_tree(), SIMPLIFY_TEST_EXP, simplify_test_exp(), true_rtx, attr_value::value, XEXP, XSTR, and XWINT.

Referenced by simplify_test_exp(), and simplify_test_exp_in_temp().

◆ simplify_test_exp_in_temp()

static rtx simplify_test_exp_in_temp ( rtx exp,
int insn_code,
int insn_index )
static
Simplify test expression and use temporary obstack in order to avoid
memory bloat.  Use ATTR_IND_SIMPLIFIED to avoid unnecessary simplifications
and avoid unnecessary copying if possible.   

References ATTR_IND_SIMPLIFIED_P, exp(), obstack, rtl_obstack, simplify_test_exp(), and temp_obstack.

Referenced by evaluate_eq_attr(), insert_right_side(), simplify_and_tree(), simplify_cond(), and simplify_or_tree().

◆ substitute_address()

static rtx substitute_address ( rtx exp,
rtx(* no_address_fn )(rtx),
rtx(* address_fn )(rtx) )
static
Given an expression EXP, see if it is a COND or IF_THEN_ELSE that has a
test that checks relative positions of insns (uses MATCH_DUP or PC).
If so, replace it with what is obtained by passing the expression to
ADDRESS_FN.  If not but it is a COND or IF_THEN_ELSE, call this routine
recursively on each value (including the default value).  Otherwise,
return the value returned by NO_ADDRESS_FN applied to EXP.   

References address_used, attr_rtx(), exp(), GET_CODE, i, rtvec_alloc(), rtx_alloc(), substitute_address(), walk_attr_value(), XEXP, XVEC, XVECEXP, and XVECLEN.

Referenced by make_length_attrs(), and substitute_address().

◆ tests_attr_p()

static int tests_attr_p ( rtx p,
class attr_desc * attr )
static
Return 1 if any EQ_ATTR subexpression of P refers to ATTR,
otherwise return 0.   

References attr_value_list::attr, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, attr_value_list::ie, attr_desc::name, tests_attr_p(), XEXP, XSTR, XVECEXP, and XVECLEN.

Referenced by get_attr_order(), and tests_attr_p().

◆ walk_attr_value()

static void walk_attr_value ( rtx exp)
static
Scan an attribute value, possibly a conditional, and record what actions
 will be required to do any conditional tests in it.

 Specifically, set
      `must_extract'      if we need to extract the insn operands
      `must_constrain'  if we must compute `which_alternative'
      `address_used'      if an address expression was used
      `length_used'       if an (eq_attr "length" ...) was used

References address_used, alternative_name, ATTR_IND_SIMPLIFIED_P, exp(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, length_str, length_used, must_constrain, must_extract, NULL, RTX_CODE, strcmp_check, walk_attr_value(), XEXP, XSTR, XVEC, XVECEXP, and XVECLEN.

Referenced by evaluate_eq_attr(), substitute_address(), walk_attr_value(), write_attr_case(), and write_const_num_delay_slots().

◆ write_attr_case()

static void write_attr_case ( FILE * outf,
class attr_desc * attr,
struct attr_value * av,
int write_case_lines,
const char * prefix,
const char * suffix,
int indent,
rtx known_true )
static

◆ write_attr_get()

◆ write_attr_set()

static void write_attr_set ( FILE * outf,
class attr_desc * attr,
int indent,
rtx value,
const char * prefix,
const char * suffix,
rtx known_true,
int insn_code,
int insn_index,
unsigned int attrs_cached )
static
Write out a series of tests and assignment statements to perform tests and
sets of an attribute value.  We are passed an indentation amount and prefix
and suffix strings to write around each attribute value (e.g., "return"
and ";").   

References attr_rtx(), attrs_cached_after, attrs_cached_inside, attrs_seen_more_than_once, attrs_seen_once, attrs_to_cache, cached_attr_count, attr_desc::default_val, eliminate_known_true(), false_rtx, find_attrs_to_cache(), FLG_AFTER, FLG_INSIDE, FLG_OUTSIDE_AND, GET_CODE, i, insert_right_side(), true_rtx, write_attr_set(), write_attr_value(), write_indent(), write_test_expr(), XEXP, XVECEXP, and XVECLEN.

Referenced by write_attr_case(), write_attr_get(), and write_attr_set().

◆ write_attr_value()

◆ write_attr_valueq()

static void write_attr_valueq ( FILE * outf,
class attr_desc * attr,
const char * s )
static
Utilities to write in various forms.   

References attr_desc::enum_name, attr_desc::is_numeric, attr_desc::name, and write_upcase().

Referenced by write_attr_value(), and write_test_expr().

◆ write_const_num_delay_slots()

static void write_const_num_delay_slots ( FILE * outf)
static
Determine if an insn has a constant number of delay slots, i.e., the
number of delay slots is not a function of the length of the insn.   

References find_attr(), attr_value::first_insn, attr_desc::first_value, length_used, attr_value::next, num_delay_slots_str, attr_value::value, walk_attr_value(), and write_insn_cases().

Referenced by main().

◆ write_dummy_eligible_delay()

static void write_dummy_eligible_delay ( FILE * outf,
const char * kind )
static
If the target does not have annul-true or annul-false delay slots, this
function will create a dummy eligible_for function on OUTF which always
returns false.  KIND will be annul_true or annul_false.   

Referenced by main().

◆ write_eligible_delay()

static void write_eligible_delay ( FILE * outf,
const char * kind )
static
Write a subroutine that is given an insn that requires a delay slot, a
delay slot ordinal, and a candidate insn.  It returns nonzero if the
candidate can be placed in the specified delay slot of the insn.

We can write as many as three subroutines.  `eligible_for_delay'
handles normal delay slots, `eligible_for_annul_true' indicates that
the specified insn can be annulled if the branch is true, and likewise
for `eligible_for_annul_false'.

KIND is a string distinguishing these three cases ("delay", "annul_true",
or "annul_false").   

References delay_desc::def, delay_1_0_str, delay_type_str, delays, find_attr(), find_most_used(), attr_desc::first_value, gcc_assert, i, attr_value::next, delay_desc::next, delay_desc::num, num_delays, true_rtx, write_attr_case(), and XVECLEN.

Referenced by main().

◆ write_header()

static void write_header ( FILE * outf)
static

◆ write_indent()

static void write_indent ( FILE * outf,
int indent )
static

◆ write_insn_cases()

static void write_insn_cases ( FILE * outf,
struct insn_ent * ie,
int indent )
static
Write a series of case statements for every instruction in list IE.
INDENT is the amount of indentation to write before each case.   

References insn_def::def, insn_ent::def, file_location::filename, GET_CODE, insn_def::insn_code, file_location::lineno, insn_def::loc, insn_ent::next, write_indent(), and XSTR.

Referenced by write_attr_case(), and write_const_num_delay_slots().

◆ write_length_unit_log()

◆ write_test_expr()

◆ write_upcase()

static void write_upcase ( FILE * outf,
const char * str )
static

References fputc().

Referenced by write_attr_valueq().

◆ zero_fn()

static rtx zero_fn ( rtx exp)
static

References make_numeric_value().

Referenced by make_length_attrs().

Variable Documentation

◆ address_used

int address_used
static

◆ all_bypasses

struct bypass_list* all_bypasses
static

Referenced by gen_bypass_1(), and process_bypasses().

◆ all_insn_reservs

struct insn_reserv* all_insn_reservs = 0
static

◆ alternative_name

◆ attr_file

FILE* attr_file
static

Referenced by main(), and make_automaton_attrs().

◆ attr_file_name

const char* attr_file_name = NULL
static
This gen* file is unique, in that it writes out multiple files.

Before GCC 4.8, insn-attrtab.cc was written out containing many large
functions and tables.  This made insn-attrtab.cc _the_ bottle-neck in
a parallel build, and even made it impossible to build GCC on machines
with relatively small RAM space (PR other/29442).  Therefore, the
atrribute functions/tables are now written out to three separate
files: all "*insn_default_latency" functions go to LATENCY_FILE_NAME,
all "*internal_dfa_insn_code" functions go to DFA_FILE_NAME, and the
rest goes to ATTR_FILE_NAME.   

Referenced by handle_arg(), and main().

◆ attr_hash_table

struct attr_hash* attr_hash_table[RTL_HASH_SIZE]
static

◆ attrs

◆ attrs_cached_after

unsigned int attrs_cached_after
static

Referenced by write_attr_set(), and write_test_expr().

◆ attrs_cached_inside

unsigned int attrs_cached_inside
static

Referenced by write_attr_set(), and write_test_expr().

◆ attrs_seen_more_than_once

unsigned int attrs_seen_more_than_once
static

◆ attrs_seen_once

unsigned int attrs_seen_once
static
Bitmasks of possibly cached attributes.   

Referenced by find_attrs_to_cache(), write_attr_get(), and write_attr_set().

◆ attrs_to_cache

unsigned int attrs_to_cache
static

◆ cached_attr_count

int cached_attr_count
static
Number of such attributes.   

Referenced by find_attrs_to_cache(), write_attr_get(), write_attr_set(), and write_test_expr().

◆ cached_attrs

const char* cached_attrs[32]
static
Names of attributes that could be possibly cached.   

Referenced by find_attrs_to_cache(), write_attr_get(), and write_test_expr().

◆ defs

◆ delay_1_0_str

const char* delay_1_0_str
static

Referenced by main(), and write_eligible_delay().

◆ delay_type_str

const char* delay_type_str
static

◆ delays

class delay_desc* delays
static

◆ dfa_file

FILE * dfa_file
static

Referenced by main(), and make_automaton_attrs().

◆ dfa_file_name

const char* dfa_file_name = NULL
static

Referenced by handle_arg(), and main().

◆ false_rtx

◆ got_define_asm_attributes

int got_define_asm_attributes
static

Referenced by gen_insn(), and main().

◆ hash_obstack

struct obstack* hash_obstack = &obstack1
static

◆ have_annul_false

int have_annul_false
static

Referenced by expand_delays(), gen_delay(), and main().

◆ have_annul_true

int have_annul_true
static

Referenced by expand_delays(), gen_delay(), and main().

◆ insn_alternatives

alternative_mask* insn_alternatives
static

◆ insn_code_values

struct attr_value_list** insn_code_values

◆ insn_index_number

int insn_index_number
static
Other variables.   

Referenced by gen_insn(), and main().

◆ insn_n_alternatives

int* insn_n_alternatives
static
Stores, for each insn code, the number of constraint alternatives.   

Referenced by main().

◆ last_insn_reserv_p

struct insn_reserv** last_insn_reserv_p = &all_insn_reservs
static

Referenced by gen_insn_reserv().

◆ latency_file

FILE * latency_file
static

Referenced by main(), and make_automaton_attrs().

◆ latency_file_name

const char* latency_file_name = NULL
static

Referenced by handle_arg(), and main().

◆ length_str

const char* length_str
static

◆ length_used

int length_used
static

◆ must_constrain

int must_constrain
static

Referenced by walk_attr_value(), and write_attr_case().

◆ must_extract

int must_extract
static

Referenced by walk_attr_value(), and write_attr_case().

◆ n_bypassed

size_t n_bypassed
static

◆ n_bypasses

size_t n_bypasses
static

◆ n_insn_reservs

size_t n_insn_reservs
static

◆ num_delay_slots_str

const char* num_delay_slots_str
static

◆ num_delays

int num_delays
static

◆ num_insn_ents

int num_insn_ents
static

◆ obstack2

struct obstack obstack1 obstack2
static

◆ temp_obstack

struct obstack* temp_obstack = &obstack2
static

◆ true_rtx