GCC Middle and Back End API Reference
|
Data Structures | |
struct | ptr_loc |
struct | file_name_list |
Variables | |
struct obstack | string_obstack |
static htab_t | ptr_locs |
static struct obstack | ptr_loc_obstack |
static htab_t | joined_conditions |
static struct obstack | joined_conditions_obstack |
FILE * | read_md_file |
const char * | read_md_filename |
int | read_md_lineno |
const char * | in_fname |
static char * | base_dir |
static struct file_name_list * | first_dir_md_include |
static struct file_name_list ** | last_dir_md_include_ptr = &first_dir_md_include |
void(* | include_callback )(const char *) |
static size_t | max_include_len |
static htab_t | md_constants |
static htab_t | enum_types |
|
staticread |
Add a NAME = VALUE definition to md_constants-style hash table DEFS, where both NAME and VALUE are malloc()ed strings. PARENT_ENUM is the enum to which NAME belongs, or null if NAME is a stand-alone constant.
References fatal_with_file_and_line(), free(), md_constant::name, md_constant::parent_enum, and md_constant::value.
Referenced by handle_constants(), and handle_enum().
|
static |
A vfprintf-like function for reporting an error against line LINENO of the current MD file.
References read_md_filename.
void copy_md_ptr_loc | ( | ) |
Associate NEW_PTR with the same file position as OLD_PTR.
References ptr_loc::filename, get_md_ptr_loc(), ptr_loc::lineno, and set_md_ptr_loc().
Referenced by apply_iterator_to_string(), attr_string(), and process_rtx().
|
static |
Return a malloc()ed decimal string that represents number NUMBER.
References buffer.
Referenced by handle_enum().
void error_with_line | ( | ) |
Like message_with_line, but treat the condition as an error.
References have_error.
Referenced by add_constraint(), alter_attrs_for_subst_insn(), alter_predicate_for_insn(), check_attr_value(), check_define_attr_duplicates(), check_defs(), compute_predicate_codes(), convert_set_attr_alternative(), gen_attr(), gen_delay(), get_alternatives_number(), handle_enum(), handle_include(), has_subst_attribute(), identify_predicable_attribute(), is_predicable(), mdep_constraint_len(), merge_accept_insn(), note_constraint(), process_define_predicate(), process_define_subst(), process_one_cond_exec(), process_template(), read_skip_construct(), scan_operands(), subst_pattern_match(), validate_exp(), validate_insn_alternatives(), validate_insn_operands(), and validate_pattern().
void fatal_expected_char | ( | ) |
Report that we found character ACTUAL when we expected to find character EXPECTED.
References fatal_with_file_and_line().
Referenced by handle_constants(), handle_enum(), handle_file(), read_conditions(), read_mapping(), read_nested_rtx(), read_rtx_code(), and read_string().
void fatal_with_file_and_line | ( | ) |
A printf-like function for reporting an error against the current position in the MD file.
References read_char(), read_md_filename, read_md_lineno, and unread_char().
Referenced by add_constant(), add_mapping(), apply_attribute_uses(), check_code_iterator(), fatal_expected_char(), find_code(), find_mode(), read_braced_string(), read_name(), read_rtx_code(), read_skip_spaces(), read_string(), and validate_const_int().
void fprint_c_condition | ( | ) |
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_md_ptr_loc(), and joined_conditions.
Referenced by print_c_condition(), write_attr_value(), and write_test_expr().
void fprint_md_ptr_loc | ( | ) |
If PTR is associated with a known file position, print a #line directive for it to OUTF.
References ptr_loc::filename, get_md_ptr_loc(), and ptr_loc::lineno.
Referenced by fprint_c_condition(), and print_md_ptr_loc().
|
staticread |
Return the position associated with pointer PTR. Return null if no position was set.
References ptr_locs.
Referenced by copy_md_ptr_loc(), and fprint_md_ptr_loc().
|
static |
Process a define_constants directive, starting with the optional space after the "define_constants".
References add_constant(), defs, fatal_expected_char(), md_constants, read_name(), read_skip_spaces(), and md_name::string.
Referenced by handle_file().
|
static |
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(), decimal_string(), enum_value::def, enum_types, error_with_line(), fatal_expected_char(), md_constants, enum_type::md_p, enum_value::name, enum_type::name, enum_value::next, enum_type::num_values, read_name(), read_skip_spaces(), read_string(), md_name::string, enum_type::tail_ptr, unread_char(), upcase_string(), and enum_type::values.
Referenced by handle_file().
|
static |
Referenced by handle_include(), and handle_toplevel_file().
|
static |
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(), handle_constants(), handle_enum(), handle_include(), read_md_file, read_md_lineno, read_name(), read_skip_construct(), read_skip_spaces(), and md_name::string.
|
static |
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 base_dir, error_with_line(), file_name_list::fname, free(), handle_file(), include_callback, file_name_list::next, read_md_file, read_md_filename, read_md_lineno, and read_string().
Referenced by handle_file().
|
static |
Like handle_file, but for top-level files. Set up in_fname and base_dir accordingly.
References base_dir, handle_file(), in_fname, and read_md_filename.
Referenced by read_md_files().
const char* join_c_conditions | ( | ) |
Return a condition that satisfies both COND1 and COND2. Either string may be null or empty.
References joined_conditions, and joined_conditions_obstack.
Referenced by add_condition_to_string(), alter_test_for_insn(), apply_iterators(), process_rtx(), and process_substs_on_one_elem().
|
static |
Return true if DEF1 and DEF2 are pointers to the same pointer.
Referenced by read_md_files().
|
static |
Return a hash value for the pointer pointed to by DEF.
Referenced by read_md_files().
int leading_string_eq_p | ( | ) |
Given two objects that start with char * name fields, return true if they have the same name.
Referenced by bind_subst_iter_and_attr(), initialize_iterators(), and read_md_files().
hashval_t leading_string_hash | ( | ) |
Given an object that starts with a char * name field, return a hash code for its name.
Referenced by bind_subst_iter_and_attr(), initialize_iterators(), and read_md_files().
|
read |
Try to find the definition of the given enum. Return null on failure.
References enum_types.
Referenced by gen_attr().
void message_with_line | ( | ) |
A printf-like function for reporting an error against line LINENO in the current MD file.
Referenced by add_constraint(), add_to_sequence(), compute_predicate_codes(), gen_attr(), gen_insn(), mdep_constraint_len(), merge_accept_insn(), note_constraint(), process_template(), validate_exp(), validate_optab_operands(), validate_pattern(), and VEC_safe_set_locstr().
int n_comma_elts | ( | ) |
Given a string, return the number of comma-separated elements in it. Return 0 for the null string.
Referenced by check_attr_test(), convert_set_attr(), and count_alternatives().
|
static |
Parse a -I option with argument ARG.
References file_name_list::fname, max_include_len, file_name_list::next, and strlen().
Referenced by read_md_files().
void print_c_condition | ( | ) |
Special fprint_c_condition for writing to STDOUT.
References fprint_c_condition().
Referenced by write_cond(), write_one_condition(), and write_predicate_expr().
void print_md_ptr_loc | ( | ) |
Special fprint_md_ptr_loc for writing to STDOUT.
References fprint_md_ptr_loc().
Referenced by gen_expand(), gen_split(), process_template(), write_one_condition(), and write_predicate_subfunction().
|
static |
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(), read_char(), read_escape(), read_md_lineno, and string_obstack.
Referenced by read_string().
|
static |
Subroutine of the string readers. Handles backslash escapes. Caller has read the backslash, but not placed it into the obstack.
References read_char(), read_md_filename, read_md_lineno, and string_obstack.
Referenced by read_braced_string(), and read_quoted_string().
bool read_md_files | ( | int | argc, |
char ** | argv, | ||
bool(*)(const char *) | parse_opt, | ||
directive_handler_t | handle_directive | ||
) |
The main routine for reading .md files. Try to process all the .md files specified on the command line and return true if no error occurred. ARGC and ARGV are the arguments to main. PARSE_OPT, if nonnull, is passed all unknown command-line arguments. It should return true if it recognizes the argument or false if a generic error should be reported. If HANDLE_DIRECTIVE is nonnull, the parser calls it for each unknown directive, otherwise it just skips such directives. See the comment above the directive_handler_t definition for details about the callback's interface.
References enum_types, fatal(), handle_toplevel_file(), have_error, joined_conditions, joined_conditions_obstack, leading_ptr_eq_p(), leading_ptr_hash(), leading_string_eq_p(), leading_string_hash(), md_constants, parse_include(), ptr_loc_obstack, ptr_locs, read_md_file, read_md_filename, and string_obstack.
Referenced by init_rtx_reader_args_cb(), and main().
void read_name | ( | ) |
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(), md_constants, md_constant::name, read_char(), read_skip_spaces(), md_name::string, unread_char(), and md_constant::value.
Referenced by handle_constants(), handle_enum(), handle_file(), read_conditions(), read_mapping(), read_nested_rtx(), read_rtx_code(), and read_skip_construct().
char* read_quoted_string | ( | void | ) |
Read a double-quoted string onto the obstack. Caller has scanned the leading quote.
References read_char(), read_escape(), and string_obstack.
Referenced by read_conditions(), and read_string().
void read_skip_construct | ( | ) |
Skip the rest of a construct that started at line LINENO and that is currently nested by DEPTH levels of parentheses.
References error_with_line(), read_name(), read_skip_spaces(), read_string(), and unread_char().
Referenced by handle_file().
int read_skip_spaces | ( | void | ) |
Read chars from the MD file until a non-whitespace char and return that. Comments, both Lisp style and C style, are treated as whitespace.
References fatal_with_file_and_line(), read_char(), and unread_char().
Referenced by handle_constants(), handle_enum(), handle_file(), read_conditions(), read_mapping(), read_name(), read_nested_rtx(), read_rtx_code(), read_rtx_variadic(), read_skip_construct(), and read_string().
char* read_string | ( | ) |
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_expected_char(), fatal_with_file_and_line(), read_braced_string(), read_md_filename, read_md_lineno, read_quoted_string(), read_skip_spaces(), set_md_ptr_loc(), and string_obstack.
Referenced by handle_enum(), handle_include(), read_mapping(), read_rtx_code(), read_skip_construct(), and read_subst_mapping().
const char* scan_comma_elt | ( | ) |
Given a pointer to a (char *), return a pointer to the beginning of the next comma-separated element in the string. Advance the pointer given to the end of that element. Return NULL if at end of string. Caller is responsible for copying the string if necessary. White space between a comma and an element is ignored.
Referenced by compute_predicate_codes(), gen_attr(), gen_mnemonic_attr(), next_comma_elt(), write_match_code(), and write_match_code_switch().
|
static |
Associate PTR with the file position given by FILENAME and LINENO.
References ptr_loc::filename, ptr_loc::lineno, ptr_loc::ptr, ptr_loc_obstack, and ptr_locs.
Referenced by copy_md_ptr_loc(), and read_string().
void traverse_enum_types | ( | ) |
For every enum definition, call CALLBACK with two arguments: a pointer to the constant definition and INFO. Stop when CALLBACK returns zero.
References enum_types.
Referenced by main().
void traverse_md_constants | ( | ) |
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 md_constants.
Referenced by main().
void upcase_string | ( | ) |
Convert STRING to uppercase.
Referenced by handle_enum(), and print_enum_type().
|
static |
The directory part of IN_FNAME. NULL if IN_FNAME is a bare filename.
Referenced by handle_include(), and handle_toplevel_file().
|
static |
A table of enum_type structures, hashed by name.
Referenced by handle_enum(), lookup_enum_type(), read_md_files(), and traverse_enum_types().
|
static |
The first directory to search.
const char* in_fname |
The name of the toplevel file that indirectly included READ_MD_FILE.
Referenced by handle_toplevel_file(), write_insn_preds_c(), write_tm_constrs_h(), and write_tm_preds_h().
void(* include_callback)(const char *) |
This callback will be invoked whenever an md include directive is processed. To be used for creation of the dependency file.
Referenced by handle_include(), and main().
|
static |
A hash table of triples (A, B, C), where each of A, B and C is a condition and A is equivalent to "B && C". This is used to keep track of the source of conditions that are made up of separate MD strings (such as the split condition of a define_insn_and_split).
Referenced by fprint_c_condition(), join_c_conditions(), and read_md_files().
|
static |
An obstack for allocating joined_conditions entries.
Referenced by join_c_conditions(), and read_md_files().
|
static |
A pointer to the null terminator of the md include chain.
|
static |
The current maximum length of directory names in the search path for include files. (Altered as we get more of them.)
Referenced by parse_include().
|
static |
A table of md_constant structures, hashed by name. Null if no constant expansion should occur.
Referenced by handle_constants(), handle_enum(), read_md_files(), read_name(), and traverse_md_constants().
|
static |
An obstack for the above. Plain xmalloc is a bit heavyweight for a small structure like ptr_loc.
Referenced by read_md_files(), and set_md_ptr_loc().
|
static |
A table of ptr_locs, hashed on the PTR field.
Referenced by get_md_ptr_loc(), read_md_files(), and set_md_ptr_loc().
FILE* read_md_file |
The file we are reading.
Referenced by handle_file(), handle_include(), read_char(), read_md_files(), and unread_char().
const char* read_md_filename |
The filename of READ_MD_FILE.
Referenced by ATTRIBUTE_PRINTF(), fatal_with_file_and_line(), gen_expand(), gen_insn(), gen_peephole(), gen_split(), handle_include(), handle_toplevel_file(), main(), process_one_cond_exec(), process_rtx(), read_escape(), read_md_files(), read_md_rtx(), read_rtx_code(), and read_string().
int read_md_lineno |
The current line number in READ_MD_FILE.
Referenced by fatal_with_file_and_line(), handle_file(), handle_include(), read_braced_string(), read_char(), read_escape(), read_rtx_code(), read_string(), and unread_char().
struct obstack string_obstack |
Obstack used for allocating MD strings.
Referenced by apply_iterator_to_string(), gen_mnemonic_attr(), gen_mnemonic_setattr(), mnemonic_htab_callback(), read_braced_string(), read_escape(), read_md_files(), read_quoted_string(), read_rtx_code(), read_string(), and record_potential_iterator_use().