GCC Middle and Back End API Reference
read-rtl.c File Reference

Data Structures

struct  map_value
struct  mapping
struct  iterator_group
struct  iterator_use
struct  attribute_use
struct  subst_attr_to_iter_mapping

Typedefs

typedef struct mappingmapping_ptr
typedef struct iterator_use iterator_use
typedef struct attribute_use attribute_use

Functions

static void validate_const_int (const char *)
static rtx read_rtx_code (const char *)
static rtx read_nested_rtx (void)
static rtx read_rtx_variadic (rtx)
static int find_mode ()
static void apply_mode_iterator ()
static int find_code ()
static void apply_code_iterator ()
static int find_int ()
static void apply_int_iterator ()
static void apply_subst_iterator ()
static void bind_subst_iter_and_attr ()
static char * find_subst_iter_by_attr ()
static struct map_valuemap_attr_string ()
static const char * apply_iterator_to_string ()
static rtx copy_rtx_for_iterators ()
static const char * add_condition_to_string ()
static void add_condition_to_rtx ()
static void apply_attribute_uses ()
static int add_current_iterators ()
static void apply_iterators ()
static struct mappingadd_mapping ()
static struct map_value ** add_map_value ()
static void initialize_iterators ()
HOST_WIDE_INT atoll (const char *)
HOST_WIDE_INT atoll ()
static void read_conditions ()
static void validate_const_int ()
static void record_iterator_use ()
static void record_attribute_use (struct iterator_group *group, void *ptr, const char *value)
static void record_potential_iterator_use (struct iterator_group *group, void *ptr, const char *name)
static struct mappingread_mapping ()
static void add_define_attr_for_define_subst ()
static void add_define_subst_attr ()
static void read_subst_mapping (htab_t subst_iters_table, htab_t subst_attrs_table, rtx *queue)
static void check_code_iterator ()
bool read_rtx ()
static rtx read_rtx_code ()
static rtx read_rtx_variadic ()

Variables

htab_t subst_attr_to_iter_map = NULL
const char * current_iterator_name
static struct iterator_group
modes codes ints 
substs
static vec< mapping_ptrcurrent_iterators
static vec< iterator_useiterator_uses
static vec< attribute_useattribute_uses

Typedef Documentation

typedef struct attribute_use attribute_use
Vector definitions for the above.   
typedef struct iterator_use iterator_use
Vector definitions for the above.   
typedef struct mapping* mapping_ptr
Vector definitions for the above.   

Function Documentation

static void add_condition_to_rtx ( )
static
Like add_condition, but applied to all conditions in rtx X.   

References add_condition_to_string().

Referenced by apply_iterators().

static const char* add_condition_to_string ( )
static
Return a condition that must satisfy both ORIGINAL and EXTRA.  If ORIGINAL
   has the form "&& ..." (as used in define_insn_and_splits), assume that
   EXTRA is already satisfied.  Empty strings are treated like "true".   

References join_c_conditions().

Referenced by add_condition_to_rtx().

static int add_current_iterators ( )
static
A htab_traverse callback for iterators.  Add all used iterators
   to current_iterators.   

References mapping::current_value.

Referenced by apply_iterators().

static void add_define_attr_for_define_subst ( )
static
For iterator with name ATTR_NAME generate define_attr with values
   'yes' and 'no'.  This attribute is used to mark templates to which
   define_subst ATTR_NAME should be applied.  This attribute is set and
   defined implicitly and automatically.   

Referenced by read_subst_mapping().

static void add_define_subst_attr ( )
static
This routine generates DEFINE_SUBST_ATTR expression with operands
   ATTR_OPERANDS and places it to QUEUE.   

Referenced by read_subst_mapping().

static struct map_value** add_map_value ( )
staticread
Add the pair (NUMBER, STRING) to a list of map_value structures.
   END_PTR points to the current null terminator for the list; return
   a pointer the new null terminator.   

References map_value::next, map_value::number, and map_value::string.

Referenced by initialize_iterators(), read_mapping(), and read_subst_mapping().

static struct mapping* add_mapping ( )
staticread
Add a new "mapping" structure to hashtable TABLE.  NAME is the name
   of the mapping and GROUP is the group to which it belongs.   

References mapping::current_value, fatal_with_file_and_line(), mapping::group, mapping::name, and mapping::values.

Referenced by initialize_iterators(), read_mapping(), and read_subst_mapping().

static void apply_attribute_uses ( )
static
static void apply_code_iterator ( )
static

Referenced by initialize_iterators().

static void apply_int_iterator ( )
static

Referenced by initialize_iterators().

static const char* apply_iterator_to_string ( )
static
Apply the current iterator values to STRING.  Return the new string
   if any changes were needed, otherwise return STRING itself.   

References copy(), copy_md_ptr_loc(), map_attr_string(), map_value::string, string_obstack, and strlen().

Referenced by copy_rtx_for_iterators().

static void apply_iterators ( )
static
static void apply_mode_iterator ( )
static

Referenced by initialize_iterators().

static void apply_subst_iterator ( )
static
This routine adds attribute or does nothing depending on VALUE.  When
   VALUE is 1, it does nothing - the first duplicate of original
   template is kept untouched when it's subjected to a define_subst.
   When VALUE isn't 1, the routine modifies RTL-template LOC, adding
   attribute, named exactly as define_subst, which later will be
   applied.  If such attribute has already been added, then no the
   routine has no effect.   

References current_iterator_name, rtvec_def::elem, memcpy(), and rtvec_alloc().

Referenced by initialize_iterators().

HOST_WIDE_INT atoll ( const char *  )
Provide a version of a function to read a long long if the system does
   not provide one.   

Referenced by read_rtx_code().

HOST_WIDE_INT atoll ( )

References HOST_WIDE_INT.

static void bind_subst_iter_and_attr ( )
static
static void check_code_iterator ( )
static
Check newly-created code iterator ITERATOR to see whether every code has the
   same format.   

References fatal_with_file_and_line(), mapping::name, map_value::next, map_value::number, and mapping::values.

Referenced by read_rtx().

static rtx copy_rtx_for_iterators ( )
static
Return a deep copy of X, substituting the current iterator
   values into any strings.   

References apply_iterator_to_string(), memcpy(), and rtvec_alloc().

Referenced by apply_iterators().

static int find_code ( )
static
Implementations of the iterator_group callbacks for codes.   

References fatal_with_file_and_line(), and NUM_RTX_CODE.

Referenced by initialize_iterators().

static int find_int ( )
static
Implementations of the iterator_group callbacks for ints.   
Since GCC does not construct a table of valid constants,
   we have to accept any int as valid.  No cross-checking can
   be done.   

References validate_const_int().

Referenced by initialize_iterators().

static int find_mode ( )
static
Implementations of the iterator_group callbacks for modes.   

References fatal_with_file_and_line().

Referenced by initialize_iterators().

static char* find_subst_iter_by_attr ( )
static
Return name of a subst-iterator, corresponding to subst-attribute ATTR.   

References subst_attr_to_iter_mapping::iter_name, and subst_attr_to_iter_map.

Referenced by map_attr_string(), and read_rtx_code().

static struct map_value* map_attr_string ( )
staticread
Map attribute string P to its current value.  Return null if the attribute
   isn't known.   

References iterator_group::attrs, mapping::current_value, find_subst_iter_by_attr(), mapping::group, mapping::name, map_value::next, map_value::number, substs, and mapping::values.

Referenced by apply_attribute_uses(), and apply_iterator_to_string().

static void read_conditions ( )
static
Process a define_conditions directive, starting with the optional
   space after the "define_conditions".  The directive looks like this:

     (define_conditions [
        (number "string")
        (number "string")
        ...
     ])

   It's not intended to appear in machine descriptions.  It is
   generated by (the program generated by) genconditions.c, and
   slipped in at the beginning of the sequence of MD files read by
   most of the other generators.   

References add_c_test(), fatal_expected_char(), read_name(), read_quoted_string(), read_skip_spaces(), md_name::string, and validate_const_int().

Referenced by read_rtx().

static struct mapping* read_mapping ( )
staticread
Finish reading a declaration of the form:

       (define... <name> [<value1> ... <valuen>])

   from the MD file, where each <valuei> is either a bare symbol name or a
   "(<name> <string>)" pair.  The "(define..." part has already been read.

   Represent the declaration as a "mapping" structure; add it to TABLE
   (which belongs to GROUP) and return it.   

References add_map_value(), add_mapping(), fatal_expected_char(), iterator_group::find_builtin, map_value::number, read_name(), read_skip_spaces(), read_string(), md_name::string, map_value::string, unread_char(), and mapping::values.

Referenced by read_rtx().

static rtx read_nested_rtx ( )
static
Read a nested rtx construct from the MD file and return it.   

References fatal_expected_char(), read_name(), read_rtx_code(), read_skip_spaces(), and md_name::string.

Referenced by read_rtx_code(), and read_rtx_variadic().

bool read_rtx ( )
Read an rtx-related declaration from the MD file, given that it
   starts with directive name RTX_NAME.  Return true if it expands to
   one or more rtxes (as defined by rtx.def).  When returning true,
   store the list of rtxes as an EXPR_LIST in *X.   

References apply_iterators(), iterator_group::attrs, check_code_iterator(), initialize_iterators(), iterator_group::iterators, modes, read_conditions(), read_mapping(), read_rtx_code(), read_subst_mapping(), and substs.

Referenced by rtx_handle_directive().

static rtx read_rtx_code ( const char *  )
static

Referenced by read_nested_rtx(), and read_rtx().

static rtx read_rtx_variadic ( rtx  )
static

Referenced by read_rtx_code().

static rtx read_rtx_variadic ( )
static
Mutually recursive subroutine of read_rtx which reads
   (thing x1 x2 x3 ...) and produces RTL as if
   (thing x1 (thing x2 (thing x3 ...)))  had been written.
   When called, FORM is (thing x1 x2), and the file position
   is just past the leading parenthesis of x3.  Only works
   for THINGs which are dyadic expressions, e.g. AND, IOR.   

References read_nested_rtx(), read_skip_spaces(), and unread_char().

static void read_subst_mapping ( htab_t  subst_iters_table,
htab_t  subst_attrs_table,
rtx queue 
)
static
Read define_subst_attribute construction.  It has next form:
        (define_subst_attribute <attribute_name> <iterator_name> <value1> <value2>)
   Attribute is substituted with value1 when no subst is applied and with
   value2 in the opposite case.
   Attributes are added to SUBST_ATTRS_TABLE.
   In case the iterator is encountered for the first time, it's added to
   SUBST_ITERS_TABLE.  Also, implicit define_attr is generated.   

References add_define_attr_for_define_subst(), add_define_subst_attr(), add_map_value(), add_mapping(), bind_subst_iter_and_attr(), iterator_group::iterators, queue, read_string(), substs, and mapping::values.

Referenced by read_rtx().

static void record_attribute_use ( struct iterator_group group,
void *  ptr,
const char *  value 
)
static
Record that PTR uses attribute VALUE, which must match a built-in
   value from group GROUP.   

References attribute_use::group, and attribute_use::value.

Referenced by record_potential_iterator_use().

static void record_iterator_use ( )
static
Record that PTR uses iterator ITERATOR.   

References iterator_use::iterator.

Referenced by read_rtx_code(), and record_potential_iterator_use().

static void record_potential_iterator_use ( struct iterator_group group,
void *  ptr,
const char *  name 
)
static
Interpret NAME as either a built-in value, iterator or attribute
   for group GROUP.  PTR is the value to pass to GROUP's apply_iterator
   callback.   

References iterator_group::apply_iterator, iterator_group::find_builtin, iterator_group::iterators, len, record_attribute_use(), record_iterator_use(), string_obstack, and strlen().

Referenced by read_rtx_code().

static void validate_const_int ( const char *  )
static
static void validate_const_int ( )
static

Variable Documentation

vec<attribute_use> attribute_uses
static
The list of all attribute uses in the current rtx.   
const char* current_iterator_name
This global stores name of subst-iterator which is currently being
   processed.   

Referenced by apply_iterators(), and apply_subst_iterator().

vec<mapping_ptr> current_iterators
static
All iterators used in the current rtx.   
vec<iterator_use> iterator_uses
static
The list of all iterator uses in the current rtx.   
htab_t subst_attr_to_iter_map = NULL
Hash-table to store links between subst-attributes and
   define_substs.   

Referenced by bind_subst_iter_and_attr(), and find_subst_iter_by_attr().

struct iterator_group modes codes ints substs
static
The mode and code iterator structures.   

Referenced by apply_iterators(), initialize_iterators(), map_attr_string(), read_rtx(), read_rtx_code(), and read_subst_mapping().