GCC Middle and Back End API Reference
|
#include <read-md.h>
Data Structures | |
struct | file_name_list |
struct | ptr_loc |
Private Member Functions | |
void | handle_file () |
void | handle_toplevel_file () |
void | handle_include (file_location loc) |
void | add_include_path (const char *arg) |
bool | read_name_1 (struct md_name *name, file_location *out_loc) |
A class for reading .md files and RTL dump files. Implemented in read-md.cc. This class has responsibility for reading chars from input files, and for certain common top-level directives including the "include" directive. It does not handle parsing the hierarchically-nested expressions of rtl.def; for that see the rtx_reader subclass below (implemented in read-rtl.cc).
md_reader::md_reader | ( | bool | compact | ) |
Constructor for md_reader.
References ggc_alloc(), leading_ptr_eq_p(), leading_ptr_hash(), leading_string_eq_p(), leading_string_hash(), m_enum_types, m_joined_conditions, m_joined_conditions_obstack, m_md_constants, m_ptr_loc_obstack, m_ptr_locs, m_string_obstack, and md_reader_ptr.
|
virtual |
md_reader's destructor.
References free(), ggc_alloc(), m_base_dir, m_enum_types, m_joined_conditions, m_joined_conditions_obstack, m_md_constants, m_ptr_loc_obstack, m_ptr_locs, m_string_obstack, md_reader_ptr, and NULL.
Parse a -I option with argument ARG.
References ggc_alloc(), and m_last_dir_md_include_ptr.
Apply the current iterator values to STRING. Return the new string if any changes were needed, otherwise return STRING itself.
References copy_md_ptr_loc(), end(), get_md_ptr_loc(), ggc_alloc(), md_reader::ptr_loc::loc, m_string_obstack, map_attr_string(), and map_value::string.
Referenced by copy_rtx_for_iterators().
Associate NEW_PTR with the same file position as OLD_PTR.
References get_md_ptr_loc(), ggc_alloc(), md_reader::ptr_loc::loc, and set_md_ptr_loc().
Referenced by apply_iterator_to_string(), attr_string(), process_rtx(), and rtx_reader::read_rtx_operand().
Return a deep copy of X, substituting the current iterator values into any strings.
References apply_iterator_to_string(), copy_rtx_for_iterators(), GET_CODE, GET_RTX_FORMAT, ggc_alloc(), i, rtvec_alloc(), rtx_alloc(), RTX_CODE_SIZE, XEXP, XSTR, XTMPL, XVEC, XVECEXP, and XVECLEN.
Referenced by copy_rtx_for_iterators().
Print condition COND to OUTF, wrapped in brackets. If COND was created by join_c_conditions, recursively invoke this function for the original conditions and join the result with "&&". Otherwise print a #line directive for COND if its original file position is known.
References fprint_c_condition(), fprint_md_ptr_loc(), fputc(), ggc_alloc(), and m_joined_conditions.
Referenced by fprint_c_condition(), print_c_condition(), write_attr_value(), and write_test_expr().
If PTR is associated with a known file position, print a #line directive for it to OUTF.
References file_location::filename, get_md_ptr_loc(), ggc_alloc(), file_location::lineno, and md_reader::ptr_loc::loc.
Referenced by fprint_c_condition(), and print_md_ptr_loc().
|
inline |
References m_read_md_colno.
Referenced by fatal_with_file_and_line().
file_location md_reader::get_current_location | ( | ) | const |
References m_read_md_colno, m_read_md_filename, and m_read_md_lineno.
Referenced by function_reader::handle_any_trailing_information(), handle_file(), function_reader::maybe_read_location(), function_reader::parse_block(), function_reader::parse_edge(), function_reader::parse_function(), function_reader::parse_insn_chain(), function_reader::parse_param(), read_name_1(), read_name_or_nil(), function_reader::read_rtx_operand_r(), read_string(), and rtx_reader::rtx_alloc_for_name().
References m_read_md_filename.
Referenced by fatal_with_file_and_line(), read_escape(), and rtx_reader::read_rtx_operand().
|
inline |
References m_read_md_lineno.
Referenced by fatal_with_file_and_line(), read_braced_string(), read_escape(), and rtx_reader::read_rtx_operand().
|
inline |
References m_md_constants.
Referenced by find_int(), handle_enum(), and traverse_md_constants().
const md_reader::ptr_loc * md_reader::get_md_ptr_loc | ( | const void * | ptr | ) |
Return the position associated with pointer PTR. Return null if no position was set.
References ggc_alloc(), and m_ptr_locs.
Referenced by apply_iterator_to_string(), copy_md_ptr_loc(), and fprint_md_ptr_loc().
|
inline |
References m_first_overload.
Referenced by main().
References m_string_obstack.
Referenced by gen_mnemonic_attr(), gen_mnemonic_setattr(), mnemonic_htab_callback(), rtx_reader::read_rtx_operand(), and rtx_reader::rtx_alloc_for_name().
References m_toplevel_fname.
Referenced by write_insn_preds_c(), write_tm_constrs_h(), and write_tm_preds_h().
void md_reader::handle_constants | ( | ) |
Process a define_constants directive, starting with the optional space after the "define_constants".
References add_constant(), defs, fatal_expected_char(), ggc_alloc(), m_md_constants, read_name(), read_skip_spaces(), require_char_ws(), and md_name::string.
Referenced by handle_file().
void md_reader::handle_enum | ( | file_location | loc, |
bool | md_p ) |
Process a define_enum or define_c_enum directive, starting with the optional space after the "define_enum". LINENO is the line number on which the directive started and MD_P is true if the directive is a define_enum rather than a define_c_enum.
References add_constant(), error_at(), get_md_constants(), ggc_alloc(), m_enum_types, md_decimal_string(), NULL, read_name(), read_skip_spaces(), read_string(), require_char_ws(), md_name::string, unread_char(), and upcase_string().
Referenced by handle_file().
|
private |
Process the current file, assuming that read_md_file and read_md_filename are valid. Use HANDLE_DIRECTIVE to handle unknown directives.
References fatal_expected_char(), get_current_location(), ggc_alloc(), handle_constants(), handle_enum(), handle_include(), handle_unknown_directive(), m_read_md_colno, m_read_md_file, m_read_md_lineno, read_name(), read_skip_spaces(), and require_char_ws().
Referenced by handle_include(), and handle_toplevel_file().
|
private |
Process an "include" directive, starting with the optional space after the "include". Read in the file and use HANDLE_DIRECTIVE to process each unknown directive. LINENO is the line number on which the "include" occurred.
References DIR_SEPARATOR, error_at(), fopen, free(), ggc_alloc(), handle_file(), include_callback, m_base_dir, m_first_dir_md_include, m_read_md_colno, m_read_md_file, m_read_md_filename, m_read_md_lineno, NULL, and read_string().
Referenced by handle_file().
overloaded_name * md_reader::handle_overloaded_name | ( | rtx | , |
vec< mapping * > * | ) |
|
private |
Like handle_file, but for top-level files. Set up m_toplevel_fname and m_base_dir accordingly.
References ggc_alloc(), handle_file(), m_base_dir, m_read_md_filename, m_toplevel_fname, and NULL.
Referenced by read_file(), and read_file_fragment().
|
pure virtual |
Implemented in gen_reader, function_reader, and noop_reader.
Referenced by handle_file().
|
inline |
References m_compact.
Referenced by function_reader::read_rtx_operand(), function_reader::read_rtx_operand_i_or_n(), and function_reader::read_rtx_operand_u().
Return a condition that satisfies both COND1 and COND2. Either string may be null or empty.
References ggc_alloc(), m_joined_conditions, m_joined_conditions_obstack, and NULL.
Referenced by alter_test_for_insn(), process_rtx(), and process_substs_on_one_elem().
Try to find the definition of the given enum. Return null on failure.
References ggc_alloc(), and m_enum_types.
Referenced by gen_attr().
int md_reader::peek_char | ( | void | ) |
Peek at the next character from the file without consuming it.
References read_char(), and unread_char().
Referenced by function_reader::handle_any_trailing_information(), and rtx_reader::read_nested_rtx().
Special fprint_c_condition for writing to STDOUT.
References fprint_c_condition(), and ggc_alloc().
Referenced by def_target_insn(), print_test(), write_init_reg_class_start_regs(), write_one_condition(), and write_predicate_expr().
Special fprint_md_ptr_loc for writing to STDOUT.
References fprint_md_ptr_loc().
Referenced by emit_c_code(), process_template(), write_one_condition(), and write_predicate_subfunction().
char * md_reader::read_braced_string | ( | ) |
Read a braced string (a la Tcl) onto the string obstack. Caller has scanned the leading brace. Note that unlike quoted strings, the outermost braces _are_ included in the string constant.
References fatal_with_file_and_line(), get_lineno(), ggc_alloc(), m_string_obstack, read_char(), and read_escape().
Referenced by read_string().
int md_reader::read_char | ( | void | ) |
Read the next character from the file.
References ggc_alloc(), m_first_line, m_last_line, m_last_line_colno, m_read_md_colno, m_read_md_file, and m_read_md_lineno.
Referenced by function_reader::extra_parsing_for_operand_code_0(), function_reader::handle_any_trailing_information(), function_reader::maybe_read_location(), peek_char(), read_braced_string(), read_char(), read_escape(), read_name_1(), read_name_or_nil(), read_quoted_string(), rtx_reader::read_rtx_code(), rtx_reader::read_until(), and require_char().
void md_reader::read_conditions | ( | ) |
void md_reader::read_escape | ( | ) |
Subroutine of the string readers. Handles backslash escapes. Caller has read the backslash, but not placed it into the obstack.
References get_filename(), get_lineno(), ggc_alloc(), m_string_obstack, and read_char().
Referenced by read_braced_string(), and read_quoted_string().
Read FILENAME.
References fopen, ggc_alloc(), handle_toplevel_file(), have_error, m_read_md_file, and m_read_md_filename.
Read FILENAME, filtering to just the given lines.
References fopen, ggc_alloc(), handle_toplevel_file(), have_error, m_first_line, m_last_line, m_read_md_file, and m_read_md_filename.
struct mapping * md_reader::read_mapping | ( | struct iterator_group * | group, |
htab_t | table ) |
file_location md_reader::read_name | ( | struct md_name * | name | ) |
Read an rtx code name into NAME. It is terminated by any of the punctuation chars of rtx printed syntax.
References fatal_with_file_and_line(), and read_name_1().
Referenced by function_reader::extra_parsing_for_operand_code_0(), function_reader::handle_any_trailing_information(), handle_constants(), handle_enum(), handle_file(), function_reader::maybe_read_location(), function_reader::parse_bb_idx(), function_reader::parse_block(), function_reader::parse_enum_value(), function_reader::parse_function(), function_reader::parse_insn_chain(), function_reader::parse_rtx(), rtx_reader::read_nested_rtx(), rtx_reader::read_rtx_code(), rtx_reader::read_rtx_operand(), function_reader::read_rtx_operand(), function_reader::read_rtx_operand_i_or_n(), function_reader::read_rtx_operand_r(), function_reader::read_rtx_operand_u(), read_skip_construct(), and require_word_ws().
|
private |
Read an rtx code name into NAME. It is terminated by any of the punctuation chars of rtx printed syntax.
References md_name::buffer, fatal_with_file_and_line(), get_current_location(), ggc_alloc(), i, m_md_constants, read_char(), read_skip_spaces(), md_name::string, and unread_char().
Referenced by read_name(), and read_name_or_nil().
file_location md_reader::read_name_or_nil | ( | struct md_name * | name | ) |
References md_name::buffer, get_current_location(), read_char(), read_name_1(), read_skip_construct(), and md_name::string.
char * md_reader::read_quoted_string | ( | ) |
Read a double-quoted string onto the obstack. Caller has scanned the leading quote.
References ggc_alloc(), m_string_obstack, read_char(), and read_escape().
Referenced by function_reader::maybe_read_location(), function_reader::parse_edge(), function_reader::parse_param(), and read_string().
void md_reader::read_skip_construct | ( | int | depth, |
file_location | loc ) |
Skip the rest of a construct that started at line LINENO and that is currently nested by DEPTH levels of parentheses.
References error_at(), ggc_alloc(), read_name(), read_skip_spaces(), read_string(), and unread_char().
Referenced by noop_reader::handle_unknown_directive(), and read_name_or_nil().
char * md_reader::read_string | ( | int | star_if_braced | ) |
Read some kind of string constant. This is the high-level routine used by read_rtx. It handles surrounding parentheses, leading star, and dispatch to the appropriate string constant reader.
References fatal_with_file_and_line(), get_current_location(), ggc_alloc(), m_string_obstack, NULL, read_braced_string(), read_quoted_string(), read_skip_spaces(), require_char(), require_char_ws(), and set_md_ptr_loc().
Referenced by handle_enum(), handle_include(), function_reader::parse_function(), rtx_reader::read_rtx_operand(), and read_skip_construct().
void md_reader::record_potential_iterator_use | ( | struct iterator_group * | group, |
file_location | loc, | ||
rtx | x, | ||
unsigned int | index, | ||
const char * | name ) |
Interpret NAME as either a built-in value, iterator or attribute for group GROUP. X and INDEX are the values to pass to GROUP's apply_iterator callback. LOC is the location of the use.
References iterator_group::apply_iterator, iterator_group::find_builtin, ggc_alloc(), iterator_group::iterators, m_string_obstack, record_attribute_use(), and record_iterator_use().
Referenced by rtx_reader::read_rtx_code(), and rtx_reader::read_rtx_operand().
Consume the next character, issuing a fatal error if it is not EXPECTED.
References fatal_expected_char(), ggc_alloc(), and read_char().
Referenced by function_reader::extra_parsing_for_operand_code_0(), function_reader::handle_any_trailing_information(), function_reader::maybe_read_location(), function_reader::parse_function(), and read_string().
Consume any whitespace, then consume the next non-whitespace character, issuing a fatal error if it is not EXPECTED.
References fatal_expected_char(), ggc_alloc(), and read_skip_spaces().
Referenced by function_reader::extra_parsing_for_operand_code_0(), function_reader::handle_any_trailing_information(), handle_constants(), handle_enum(), handle_file(), function_reader::parse_crtl(), function_reader::parse_edge(), function_reader::parse_insn(), function_reader::parse_param(), function_reader::parse_rtx(), rtx_reader::read_nested_rtx(), rtx_reader::read_rtx_operand(), function_reader::read_rtx_operand(), function_reader::read_rtx_operand_r(), and read_string().
Consume any whitespace, then consume the next word (as per read_name), issuing a fatal error if it is not EXPECTED.
References fatal_with_file_and_line(), ggc_alloc(), read_name(), and md_name::string.
Referenced by function_reader::parse_crtl(), function_reader::parse_edge(), and function_reader::parse_param().
void md_reader::set_md_ptr_loc | ( | const void * | ptr, |
file_location | file_loc ) |
Associate PTR with the file position given by FILE_LOC.
References ggc_alloc(), md_reader::ptr_loc::loc, m_ptr_loc_obstack, m_ptr_locs, and md_reader::ptr_loc::ptr.
Referenced by copy_md_ptr_loc(), and read_string().
For every enum definition, call CALLBACK with two arguments: a pointer to the constant definition and INFO. Stop when CALLBACK returns zero.
References ggc_alloc(), and m_enum_types.
For every constant definition, call CALLBACK with two arguments: a pointer a pointer to the constant definition and INFO. Stop when CALLBACK returns zero.
References get_md_constants(), and ggc_alloc().
void md_reader::unread_char | ( | int | ch | ) |
Put back CH, which was the last character read from the file.
References ggc_alloc(), m_last_line_colno, m_read_md_colno, m_read_md_file, and m_read_md_lineno.
Referenced by function_reader::extra_parsing_for_operand_code_0(), function_reader::handle_any_trailing_information(), handle_enum(), function_reader::maybe_read_location(), function_reader::parse_edge(), function_reader::parse_function(), peek_char(), read_name_1(), rtx_reader::read_rtx_code(), rtx_reader::read_rtx_operand(), function_reader::read_rtx_operand_r(), rtx_reader::read_rtx_variadic(), read_skip_construct(), rtx_reader::read_until(), and unread_char().
|
private |
Referenced by handle_include(), handle_toplevel_file(), and ~md_reader().
|
private |
Referenced by is_compact().
|
private |
Referenced by handle_enum(), lookup_enum_type(), md_reader(), traverse_enum_types(), and ~md_reader().
|
private |
Referenced by handle_include().
|
private |
Referenced by read_char(), and read_file_fragment().
|
private |
Referenced by get_overloads().
|
private |
Referenced by fprint_c_condition(), join_c_conditions(), md_reader(), and ~md_reader().
Referenced by join_c_conditions(), md_reader(), and ~md_reader().
|
private |
Referenced by add_include_path().
|
private |
Referenced by read_char(), and read_file_fragment().
|
private |
Referenced by read_char(), and unread_char().
|
private |
Referenced by get_md_constants(), handle_constants(), md_reader(), read_name_1(), and ~md_reader().
|
private |
|
private |
Referenced by md_reader(), set_md_ptr_loc(), and ~md_reader().
|
private |
Referenced by get_md_ptr_loc(), md_reader(), set_md_ptr_loc(), and ~md_reader().
|
private |
Referenced by get_colno(), get_current_location(), handle_file(), handle_include(), read_char(), and unread_char().
|
private |
Referenced by handle_file(), handle_include(), read_char(), read_file(), read_file_fragment(), and unread_char().
Referenced by get_current_location(), get_filename(), handle_include(), handle_toplevel_file(), read_file(), and read_file_fragment().
|
private |
Referenced by get_current_location(), get_lineno(), handle_file(), handle_include(), read_char(), and unread_char().
Referenced by get_top_level_filename(), and handle_toplevel_file().