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

Data Structures

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

Functions

static void validate_const_int (const char *)
 
static void one_time_initialization (void)
 
HOST_WIDE_INT atoll (const char *)
 
static HOST_WIDE_INT find_mode (const char *name)
 
static void apply_mode_iterator (rtx x, unsigned int, HOST_WIDE_INT mode)
 
static const charget_mode_token (int mode)
 
static rtx_code maybe_find_code (const char *name)
 
static HOST_WIDE_INT find_code (const char *name)
 
static void apply_code_iterator (rtx x, unsigned int, HOST_WIDE_INT code)
 
static const charget_code_token (int code)
 
static HOST_WIDE_INT find_int (const char *name)
 
static void apply_int_iterator (rtx x, unsigned int index, HOST_WIDE_INT value)
 
static const charget_int_token (int value)
 
static charfind_subst_iter_by_attr (const char *attr)
 
static struct map_valuemap_attr_string (file_location loc, const char *p, mapping **iterator_out=0)
 
static struct mappingadd_mapping (struct iterator_group *group, htab_t table, const char *name)
 
static struct map_value ** add_map_value (struct map_value **end_ptr, int number, const char *string)
 
static void initialize_iterators (void)
 
static void validate_const_wide_int (const char *string)
 
static void record_iterator_use (struct mapping *iterator, rtx x, unsigned int index)
 
static void record_attribute_use (struct iterator_group *group, file_location loc, rtx x, unsigned int index, const char *value)
 
static void read_flags (rtx return_rtx)
 
static int parse_reg_note_name (const char *string)
 

Variables

htab_t subst_attr_to_iter_map = NULL
 
const charcurrent_iterator_name
 
rtx_readerrtx_reader_ptr = NULL
 
static struct iterator_group modes codes ints substs
 
static vec< mapping * > current_iterators
 
static vec< iterator_useiterator_uses
 
static vec< attribute_useattribute_uses
 
static const compact_insn_name compact_insn_names []
 

Function Documentation

◆ add_map_value()

static struct map_value ** add_map_value ( struct map_value ** end_ptr,
int number,
const char * string )
static
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 ggc_alloc(), map_value::next, map_value::number, and map_value::string.

Referenced by initialize_iterators().

◆ add_mapping()

static struct mapping * add_mapping ( struct iterator_group * group,
htab_t table,
const char * name )
static
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(), ggc_alloc(), mapping::group, mapping::name, NULL, table, and mapping::values.

Referenced by initialize_iterators().

◆ apply_code_iterator()

static void apply_code_iterator ( rtx x,
unsigned int ,
HOST_WIDE_INT code )
static

References PUT_CODE.

Referenced by initialize_iterators().

◆ apply_int_iterator()

static void apply_int_iterator ( rtx x,
unsigned int index,
HOST_WIDE_INT value )
static

◆ apply_mode_iterator()

static void apply_mode_iterator ( rtx x,
unsigned int ,
HOST_WIDE_INT mode )
static

References PUT_MODE().

Referenced by initialize_iterators().

◆ atoll()

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

References ggc_alloc(), and HOST_WIDE_INT_M1U.

Referenced by find_int().

◆ find_code()

static HOST_WIDE_INT find_code ( const char * name)
static
Implementations of the iterator_group callbacks for codes.   

References fatal_with_file_and_line(), ggc_alloc(), and maybe_find_code().

Referenced by initialize_iterators().

◆ find_int()

static HOST_WIDE_INT find_int ( const char * name)
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 atoll(), md_reader::get_md_constants(), ggc_alloc(), md_constant::name, rtx_reader_ptr, and validate_const_int().

Referenced by initialize_iterators().

◆ find_mode()

static HOST_WIDE_INT find_mode ( const char * name)
static
Implementations of the iterator_group callbacks for modes.   

References fatal_with_file_and_line(), GET_MODE_NAME, ggc_alloc(), and i.

Referenced by initialize_iterators().

◆ find_subst_iter_by_attr()

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

References ggc_alloc(), subst_attr_to_iter_mapping::iter_name, NULL, and subst_attr_to_iter_map.

Referenced by map_attr_string(), and rtx_reader::read_rtx_operand().

◆ get_code_token()

static const char * get_code_token ( int code)
static

References GET_RTX_NAME, ggc_alloc(), and i.

Referenced by initialize_iterators().

◆ get_int_token()

static const char * get_int_token ( int value)
static

◆ get_mode_token()

static const char * get_mode_token ( int mode)
static

References GET_MODE_NAME, ggc_alloc(), and NULL.

Referenced by initialize_iterators().

◆ initialize_iterators()

◆ map_attr_string()

static struct map_value * map_attr_string ( file_location loc,
const char * p,
mapping ** iterator_out = 0 )
static
Map attribute string P to its current value.  Return null if the attribute
isn't known.  If ITERATOR_OUT is nonnull, store the associated iterator
there.  Report any errors against location LOC.   

References iterator_group::attrs, current_iterators, mapping::current_value, error_at(), find_subst_iter_by_attr(), FOR_EACH_VEC_ELT, iterator_group::get_c_token, ggc_alloc(), mapping::group, iterator_group::has_self_attr, i, mapping::name, map_value::next, NULL, map_value::number, map_value::string, substs, and mapping::values.

Referenced by md_reader::apply_iterator_to_string().

◆ maybe_find_code()

static rtx_code maybe_find_code ( const char * name)
static
Return the rtx code for NAME, or UNKNOWN if NAME isn't a valid rtx code.   

References compact_insn_names, GET_RTX_NAME, ggc_alloc(), i, and NUM_RTX_CODE.

Referenced by find_code().

◆ one_time_initialization()

static void one_time_initialization ( void )
static
Do one-time initialization.   

References initialize_iterators(), and initialized.

Referenced by rtx_reader::rtx_reader().

◆ parse_reg_note_name()

static int parse_reg_note_name ( const char * string)
static
Return the numeric value n for GET_REG_NOTE_NAME (n) for STRING,
or fail if STRING isn't recognized.   

References fatal_with_file_and_line(), GET_REG_NOTE_NAME, ggc_alloc(), i, and REG_NOTE_MAX.

Referenced by rtx_reader::read_rtx_code().

◆ read_flags()

static void read_flags ( rtx return_rtx)
static
Subroutine of read_rtx_code, for parsing zero or more flags.   

References fatal_with_file_and_line(), ggc_alloc(), read_char(), RTX_FLAG, and unread_char().

Referenced by rtx_reader::read_rtx_code().

◆ record_attribute_use()

static void record_attribute_use ( struct iterator_group * group,
file_location loc,
rtx x,
unsigned int index,
const char * value )
static
Record that X uses attribute VALUE at location LOC, where VALUE must
match a built-in value from group GROUP.  If the use is in an operand
of X, INDEX is the index of that operand, otherwise it is ignored.   

References attribute_uses, ggc_alloc(), attribute_use::group, attribute_use::index, attribute_use::loc, attribute_use::value, and attribute_use::x.

Referenced by md_reader::record_potential_iterator_use(), and rtx_reader::rtx_alloc_for_name().

◆ record_iterator_use()

static void record_iterator_use ( struct mapping * iterator,
rtx x,
unsigned int index )
static
Record that X uses iterator ITERATOR.  If the use is in an operand
of X, INDEX is the index of that operand, otherwise it is ignored.   

References ggc_alloc(), iterator_use::index, iterator_use::iterator, iterator_uses, and iterator_use::x.

Referenced by rtx_reader::read_rtx_operand(), md_reader::record_potential_iterator_use(), and rtx_reader::rtx_alloc_for_name().

◆ validate_const_int()

static void validate_const_int ( const char * string)
static

◆ validate_const_wide_int()

static void validate_const_wide_int ( const char * string)
static

Variable Documentation

◆ attribute_uses

vec<attribute_use> attribute_uses
static
The list of all attribute uses in the current rtx.   

Referenced by record_attribute_use().

◆ compact_insn_names

const compact_insn_name compact_insn_names[]
static
Initial value:
= {
{ DEBUG_INSN, "cdebug_insn" },
{ INSN, "cinsn" },
{ JUMP_INSN, "cjump_insn" },
{ CALL_INSN, "ccall_insn" },
{ JUMP_TABLE_DATA, "cjump_table_data" },
{ BARRIER, "cbarrier" },
{ CODE_LABEL, "clabel" },
{ NOTE, "cnote" }
}
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184

Referenced by maybe_find_code().

◆ current_iterator_name

const char* current_iterator_name
This global stores name of subst-iterator which is currently being
processed.   

◆ current_iterators

vec<mapping *> current_iterators
static
All iterators used in the current rtx.   

Referenced by map_attr_string().

◆ iterator_uses

vec<iterator_use> iterator_uses
static
The list of all iterator uses in the current rtx.   

Referenced by record_iterator_use().

◆ rtx_reader_ptr

◆ subst_attr_to_iter_map

htab_t subst_attr_to_iter_map = NULL
Hash-table to store links between subst-attributes and
define_substs.   

Referenced by find_subst_iter_by_attr().

◆ substs

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

Referenced by initialize_iterators(), map_attr_string(), and rtx_reader::read_rtx_operand().