GCC Middle and Back End API 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 "vec.h"
#include "optabs.def"
Data Structures | |
class | queue_elem |
class | conlist |
class | gen_reader |
struct | std_pred_table |
Macros | |
#define | INCLUDE_STRING |
#define | INCLUDE_VECTOR |
#define | MAX_OPERANDS 40 |
#define | MNEMONIC_ATTR_NAME "mnemonic" |
#define | MNEMONIC_HTAB_SIZE 1024 |
#define | N 0 |
#define | Y 1 |
#define | I 2 |
#define | TRISTATE_AND(a, b) |
#define | TRISTATE_OR(a, b) |
#define | TRISTATE_NOT(a) |
#define | NUM_KNOWN_STD_PREDS ARRAY_SIZE (std_preds) |
#define | NS "NULL" |
#define | ZS "'\\0'" |
#define | OPTAB_CL(o, p, c, b, l) |
#define | OPTAB_CX(o, p) |
#define | OPTAB_CD(o, p) |
#define | OPTAB_NL(o, p, c, b, s, l) |
#define | OPTAB_NC(o, p, c) |
#define | OPTAB_NX(o, p) |
#define | OPTAB_VL(o, p, c, b, s, l) |
#define | OPTAB_VC(o, p, c) |
#define | OPTAB_VX(o, p) |
#define | OPTAB_DC(o, p, c) |
#define | OPTAB_D(o, p) |
Typedefs | |
typedef const char *(* | constraints_handler_t) (const char *, int) |
typedef std::vector< conlist > | vec_conlist |
Functions | |
static void | remove_constraints (rtx) |
static int | is_predicable (class queue_elem *) |
static void | identify_predicable_attribute (void) |
static int | n_alternatives (const char *) |
static void | collect_insn_data (rtx, int *, int *) |
static const char * | alter_test_for_insn (class queue_elem *, class queue_elem *) |
static char * | shift_output_template (char *, const char *, int) |
static const char * | alter_output_for_insn (class queue_elem *, class queue_elem *, int, int) |
static void | process_one_cond_exec (class queue_elem *) |
static void | process_define_cond_exec (void) |
static void | init_predicate_table (void) |
static void | record_insn_name (int, const char *) |
static bool | has_subst_attribute (class queue_elem *, class queue_elem *) |
static const char * | alter_output_for_subst_insn (rtx, int) |
static void | alter_attrs_for_subst_insn (class queue_elem *, int) |
static void | process_substs_on_one_elem (class queue_elem *, class queue_elem *) |
static rtx | subst_dup (rtx, int, int) |
static void | process_define_subst (void) |
static const char * | duplicate_alternatives (const char *, int) |
static const char * | duplicate_each_alternative (const char *str, int n_dup) |
static rtx | alter_constraints (rtx, int, constraints_handler_t) |
static rtx | adjust_operands_numbers (rtx) |
static rtx | replace_duplicating_operands_in_pattern (rtx) |
rtx | gen_rtx_CONST_INT (machine_mode ARG_UNUSED(mode), HOST_WIDE_INT arg) |
rtx | add_implicit_parallel (rtvec vec) |
void | compute_test_codes (rtx exp, file_location loc, char *codes) |
static bool | valid_predicate_name_p (const char *name) |
static void | process_define_predicate (rtx desc, file_location loc) |
unsigned int | get_register_filter_id (const char *filter) |
static void | process_define_register_constraint (rtx desc, file_location loc) |
static class queue_elem * | queue_pattern (rtx pattern, class queue_elem ***list_tail, file_location loc) |
static void | remove_from_queue (class queue_elem *elem, class queue_elem **queue) |
static void | add_define_attr (const char *name) |
static rtx | replace_operands_with_dups (rtx x) |
static rtvec | gen_rewrite_sequence (rtvec vec) |
static void | add_constraints (rtx part, file_location loc, vec_conlist &cons) |
static void | add_attributes (rtx x, vec_conlist &attrs) |
static void | skip_spaces (const char **str) |
static bool | expect_char (const char **str, char c) |
static void | parse_section_layout (file_location loc, const char **templ, const char *label, vec_conlist &list, bool numeric) |
static void | parse_section (const char **templ, unsigned int n_elems, unsigned int alt_no, vec_conlist &list, file_location loc, const char *name) |
static void | preprocess_compact_syntax (file_location loc, int alt_no, std::string &line, std::string &last_line) |
static void | convert_syntax (rtx x, file_location loc) |
static void | process_rtx (rtx desc, file_location loc) |
static void | change_subst_attribute (class queue_elem *elem, class queue_elem *subst_elem, const char *new_value) |
static bool | subst_pattern_match (rtx x, rtx pt, file_location loc) |
static int | get_alternatives_number (rtx pattern, int *n_alt, file_location loc) |
static rtx | alter_predicate_for_insn (rtx pattern, int alt, int max_op, file_location loc) |
static rtx | modify_attr_enabled_ce (rtx val) |
static void | alter_attrs_for_insn (rtx insn) |
static void | mark_operands_from_match_dup (rtx pattern) |
static void | mark_operands_used_in_match_dup (rtx pattern) |
static int | find_first_unused_number_of_operand () |
static void | renumerate_operands_in_pattern (rtx pattern) |
static rtx | generate_match_dup (int opno) |
static void | add_mnemonic_string (htab_t mnemonic_htab, const char *str, size_t len) |
static void | gen_mnemonic_setattr (htab_t mnemonic_htab, rtx insn) |
static int | mnemonic_htab_callback (void **slot, void *info) |
static void | gen_mnemonic_attr (void) |
static void | check_define_attr_duplicates () |
rtx_reader * | init_rtx_reader_args_cb (int argc, const char **argv, bool(*parse_opt)(const char *)) |
rtx_reader * | init_rtx_reader_args (int argc, const char **argv) |
int | count_patterns () |
bool | read_md_rtx (md_rtx_info *info) |
file_location | get_file_location (rtx x) |
unsigned int | get_num_insn_codes () |
const char * | get_c_test (rtx x) |
hashval_t | hash_c_test (const void *x) |
int | cmp_c_test (const void *x, const void *y) |
int | maybe_eval_c_test (const char *expr) |
void | add_c_test (const char *expr, int value) |
void | traverse_c_tests (htab_trav callback, void *info) |
static hashval_t | hash_struct_pred_data (const void *ptr) |
static int | eq_struct_pred_data (const void *a, const void *b) |
struct pred_data * | lookup_predicate (const char *name) |
void | add_predicate_code (struct pred_data *pred, enum rtx_code code) |
void | add_predicate (struct pred_data *pred) |
const char * | get_insn_name (int code) |
static void | get_pattern_stats_1 (struct pattern_stats *stats, rtx x) |
void | get_pattern_stats (struct pattern_stats *stats, rtvec pattern) |
const char * | get_emit_function (rtx x) |
bool | needs_barrier_p (rtx x) |
static bool | match_pattern (optab_pattern *p, const char *name, const char *pat) |
bool | find_optab (optab_pattern *p, const char *name) |
#define I 2 |
Referenced by compute_test_codes().
#define INCLUDE_STRING |
Support routines for the various generation passes. Copyright (C) 2000-2024 Free Software Foundation, Inc. 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/>.
#define INCLUDE_VECTOR |
#define MAX_OPERANDS 40 |
#define MNEMONIC_ATTR_NAME "mnemonic" |
Referenced by gen_mnemonic_attr(), and gen_mnemonic_setattr().
#define MNEMONIC_HTAB_SIZE 1024 |
Referenced by gen_mnemonic_attr().
#define N 0 |
Predicate handling. We construct from the machine description a table mapping each predicate to a list of the rtl codes it can possibly match. The function 'maybe_both_true' uses it to deduce that there are no expressions that can be matches by certain pairs of tree nodes. Also, if a predicate can match only one code, we can hardwire that code into the node testing the predicate. Some predicates are flagged as special. validate_pattern will not warn about modeless match_operand expressions if they have a special predicate. Predicates that allow only constants are also treated as special, for this purpose. validate_pattern will warn about predicates that allow non-lvalues when they appear in destination operands. Calculating the set of rtx codes that can possibly be accepted by a predicate expression EXP requires a three-state logic: any given subexpression may definitively accept a code C (Y), definitively reject a code C (N), or may have an indeterminate effect (I). N and I is N; Y or I is Y; Y and I, N or I are both I. Here are full truth tables. a b a&b a|b Y Y Y Y N Y N Y N N N N I Y I Y I N N I I I I I We represent Y with 1, N with 0, I with 2. If any code is left in an I state by the complete expression, we must assume that that code can be accepted.
Referenced by inchash::hash::add_poly_hwi(), inchash::hash::add_poly_int(), auto_vec< T, N >::auto_vec(), auto_vec< T, N >::auto_vec(), bitmap_tree_splay(), coeffs_in_range_p(), compute_test_codes(), wi::extended_tree< N >::extended_tree(), trailing_wide_ints< N >::extra_size(), FIXED_WIDE_INT(), FIXED_WIDE_INT(), fixed_wide_int_storage< N >::fixed_wide_int_storage(), poly_int< N, C >::force_shwi(), poly_int< N, C >::force_uhwi(), poly_int< N, C >::from(), poly_int< N, C >::from(), wi::int_traits< fixed_wide_int_storage< N > >::get_binary_precision(), wi::int_traits< widest_int_storage< N > >::get_binary_precision(), wi::extended_tree< N >::get_len(), fixed_wide_int_storage< N >::get_precision(), wi::extended_tree< N >::get_precision(), widest_int_storage< N >::get_precision(), poly_int< N, C >::is_constant(), make_item_for_dump_dec(), bbitmap< N >::operator&=(), poly_int< N, C >::operator*=(), poly_int< N, C >::operator+=(), poly_int< N, C >::operator-=(), poly_int< N, C >::operator=(), poly_int< N, C >::operator=(), widest_int_storage< N >::operator=(), bbitmap< N >::operator^=(), bbitmap< N >::operator|=(), poly_int< N, C >::poly_int(), pp_wide_integer(), process_define_predicate(), fixed_wide_int_storage< N >::set_len(), widest_int_storage< N >::set_len(), trailing_wide_ints< N >::set_precision(), wi::shwi(), array_traits< T[N]>::size(), poly_int< N, C >::to_shwi(), poly_int< N, C >::to_uhwi(), wi::uhwi(), WIDEST_INT(), WIDEST_INT(), and widest_int_storage< N >::widest_int_storage().
#define NS "NULL" |
#define NUM_KNOWN_STD_PREDS ARRAY_SIZE (std_preds) |
Referenced by init_predicate_table().
#define OPTAB_CD | ( | o, | |
p ) |
#define OPTAB_CL | ( | o, | |
p, | |||
c, | |||
b, | |||
l ) |
#define OPTAB_CX | ( | o, | |
p ) |
#define Y 1 |
Referenced by compute_test_codes().
#define ZS "'\\0'" |
typedef const char *(* constraints_handler_t) (const char *, int) |
typedef std::vector<conlist> vec_conlist |
|
static |
Add ATTRS to definition X's attribute list.
References rtvec_def::elem, GET_CODE, i, rtvec_alloc(), rtx_alloc(), XSTR, XVEC, XVECEXP, and XVECLEN.
Referenced by convert_syntax().
void add_c_test | ( | const char * | expr, |
int | value ) |
Record the C test expression EXPR in the condition_table, with value VAL. Duplicates clobber previous entries.
References condition_table, c_test::expr, expr, and c_test::value.
Referenced by main().
|
static |
Add constraints to an rtx. This function is similar to remove_constraints. Errors if adding the constraints would overwrite existing constraints.
References add_constraints(), error_at(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, NULL, NULL_RTX, XEXP, XINT, XSTR, XVEC, XVECEXP, and XVECLEN.
Referenced by add_constraints(), and convert_syntax().
|
static |
Build a define_attr for an binary attribute with name NAME and possible values "yes" and "no", and queue it.
References queue_elem::data, define_attr_queue, queue_elem::loc, queue_elem::next, rtx_alloc(), XEXP, and XSTR.
Referenced by alter_attrs_for_insn().
Return the rtx pattern specified by the list of rtxes in a define_insn or define_split.
References GET_NUM_ELEM, RTVEC_ELT, rtx_alloc(), and XVEC.
Referenced by gen_insn(), gen_rewrite_sequence(), main(), and process_one_cond_exec().
|
static |
Add mnemonic STR with length LEN to the mnemonic hash table MNEMONIC_HTAB. A trailing zero end character is appended to STR and a permanent heap copy of STR is created.
References alloca.
Referenced by gen_mnemonic_attr(), and gen_mnemonic_setattr().
void add_predicate | ( | struct pred_data * | pred | ) |
References error(), last_predicate, pred_data::name, pred_data::next, and predicate_table.
Referenced by init_predicate_table(), and process_define_predicate().
Record that predicate PRED can accept CODE.
References pred_data::allows_non_const, pred_data::allows_non_lvalue, pred_data::codes, GET_RTX_CLASS, pred_data::num_codes, RTX_CONST_OBJ, and pred_data::singleton.
Referenced by init_predicate_table(), and process_define_predicate().
If output pattern of define_subst contains MATCH_DUP, then this expression would be replaced with the pattern, matched with MATCH_OPERAND from input pattern. This pattern could contain any number of MATCH_OPERANDs, MATCH_OPERATORs etc., so it's possible that a MATCH_OPERAND from output_pattern (if any) would have the same number, as MATCH_OPERAND from copied pattern. To avoid such indexes overlapping, we assign new indexes to MATCH_OPERANDs, laying in the output pattern outside of MATCH_DUPs.
References mark_operands_used_in_match_dup(), and renumerate_operands_in_pattern().
Referenced by process_substs_on_one_elem().
|
static |
Alter the attribute vector of INSN, which is a COND_EXEC variant created from a define_insn pattern. We must modify the "predicable" attribute to be named "ce_enabled", and also change any "enabled" attribute that's present so that it takes ce_enabled into account. We rely on the fact that INSN was created with copy_rtx, and modify data in-place.
References add_define_attr(), queue_elem::data, define_attr_queue, gcc_unreachable, GET_CODE, GET_NUM_ELEM, i, modify_attr_enabled_ce(), queue_elem::next, rtvec_alloc(), RTVEC_ELT, rtx_alloc(), SET, SET_DEST, SET_SRC, XEXP, XSTR, and XVEC.
Referenced by process_one_cond_exec().
|
static |
As number of constraints is changed after define_subst, we need to process attributes as well - we need to duplicate them the same way that we duplicated constraints in original pattern ELEM is a queue element, containing our rtl-template, N_DUP - multiplication factor.
References queue_elem::data, duplicate_alternatives(), error_at(), gcc_unreachable, GET_CODE, GET_NUM_ELEM, i, queue_elem::loc, NULL, RTVEC_ELT, SET, XSTR, and XVEC.
Referenced by process_substs_on_one_elem().
|
static |
Duplicate constraints in PATTERN. If pattern is from original rtl-template, we need to duplicate each alternative - for that we need to use duplicate_each_alternative () as a functor ALTER. If pattern is from output-pattern of define_subst, we need to duplicate constraints in another way - with duplicate_alternatives (). N_DUP is multiplication factor.
References alter_constraints(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, NULL, r, XEXP, XSTR, XVECEXP, and XVECLEN.
Referenced by alter_constraints(), process_substs_on_one_elem(), and subst_dup().
|
static |
References queue_elem::data, shift_output_template(), XSTR, and XTMPL.
Referenced by process_one_cond_exec().
|
static |
Alter the output of INSN whose pattern was modified by DEFINE_SUBST. We must replicate output strings according to the new number of alternatives ALT in substituted pattern. If ALT equals 1, output has one alternative or defined by C code, then output is returned without any changes.
References XTMPL.
Referenced by process_substs_on_one_elem().
|
static |
References alter_predicate_for_insn(), error_at(), gcc_unreachable, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, queue_elem::loc, n_alternatives(), NULL, r, XEXP, XINT, XSTR, XVECEXP, and XVECLEN.
Referenced by alter_predicate_for_insn(), and process_one_cond_exec().
|
static |
References queue_elem::data, md_reader::join_c_conditions(), rtx_reader_ptr, and XSTR.
Referenced by process_one_cond_exec().
|
static |
Find attribute SUBST in ELEM and assign NEW_VALUE to it.
References queue_elem::data, GET_CODE, GET_NUM_ELEM, i, RTVEC_ELT, XSTR, and XVEC.
Referenced by process_substs_on_one_elem().
|
static |
Check if there are DEFINE_ATTRs with the same name.
References queue_elem::data, define_attr_queue, error_at(), queue_elem::loc, queue_elem::next, NULL, and XSTR.
Referenced by init_rtx_reader_args_cb().
int cmp_c_test | ( | const void * | x, |
const void * | y ) |
Compare two c_test expression structures.
Referenced by init_rtx_reader_args_cb().
|
static |
Determine how many alternatives there are in INSN, and how many operands.
References collect_insn_data(), gcc_unreachable, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, n_alternatives(), NULL, XEXP, XINT, XSTR, XVEC, XVECEXP, and XVECLEN.
Referenced by collect_insn_data(), and process_one_cond_exec().
void compute_test_codes | ( | rtx | exp, |
file_location | loc, | ||
char * | codes ) |
Recursively calculate the set of rtx codes accepted by the predicate expression EXP, writing the result to CODES. LOC is the .md file location of the directive containing EXP.
References pred_data::codes, compute_test_codes(), did_you_mean_codes, error_at(), exp(), GET_CODE, GET_RTX_NAME, I, i, queue_elem::loc, lookup_predicate(), message_at(), N, NUM_RTX_CODE, scan_comma_elt(), TRISTATE_AND, TRISTATE_NOT, TRISTATE_OR, XEXP, XSTR, and Y.
Referenced by add_constraint(), compute_test_codes(), and process_define_predicate().
|
static |
Converts an rtx from compact syntax to normal syntax if possible.
References add_attributes(), add_constraints(), compact_syntax, expect_char(), fatal_at(), gcc_assert, GET_CODE, parse_section(), parse_section_layout(), preprocess_compact_syntax(), skip_spaces(), and XTMPL.
Referenced by process_rtx().
int count_patterns | ( | ) |
Count the number of patterns in all queues and return the count.
References count, queue_elem::data, define_attr_queue, define_insn_queue, define_pred_queue, get_c_test(), insn_elision, maybe_eval_c_test(), queue_elem::next, and other_queue.
Referenced by main().
|
static |
From string STR "a,b,c" produce "a,b,c,a,b,c,a,b,c", i.e. original string, duplicated N_DUP times.
References i.
Referenced by alter_attrs_for_subst_insn(), and subst_dup().
|
static |
From string STR "a,b,c" produce "a,a,a,b,b,b,c,c,c", i.e. string where each alternative from the original string is duplicated N_DUP times.
Referenced by process_substs_on_one_elem().
|
static |
References a, b, and pred_data::name.
Referenced by init_predicate_table().
|
inlinestatic |
Consumes the given character, if it's there.
Referenced by convert_syntax().
|
static |
This is subroutine of renumerate_operands_in_pattern. It finds first not-occupied operand-index.
References i, MAX_OPERANDS, and used_operands_numbers.
Referenced by renumerate_operands_in_pattern().
bool find_optab | ( | optab_pattern * | p, |
const char * | name ) |
Return true if NAME is the name of an optab, describing it in P if so.
References optab_pattern::m1, optab_pattern::m2, match_pattern(), optab_pattern::name, pred_data::name, optab_def::op, optab_pattern::op, optabs, and optab_pattern::sort_num.
Referenced by gen_expand(), and gen_insn().
|
static |
Generate (set_attr "mnemonic" "..") RTXs and append them to every insn definition in case the back end requests it by defining the mnemonic attribute. The values for the attribute will be extracted from the output patterns of the insn definitions as far as possible.
References add_mnemonic_string(), queue_elem::data, define_attr_queue, define_attr_tail, define_insn_queue, free(), gen_mnemonic_setattr(), GET_CODE, md_reader::get_string_obstack(), have_error, i, MNEMONIC_ATTR_NAME, mnemonic_htab_callback(), MNEMONIC_HTAB_SIZE, queue_elem::next, NULL, obstack, rtx_reader_ptr, scan_comma_elt(), SET, SET_DEST, XSTR, XVEC, XVECEXP, and XVECLEN.
Referenced by init_rtx_reader_args_cb().
|
static |
Scan INSN for mnemonic strings and add them to the mnemonic hash table in MNEMONIC_HTAB. The mnemonics cannot be found if they are emitted using C code. If a mnemonic string contains ';' or a newline the string assumed to consist of more than a single instruction. The attribute value will then be set to the user defined default value.
References add_mnemonic_string(), md_reader::get_string_obstack(), i, MNEMONIC_ATTR_NAME, obstack, rtvec_alloc(), RTVEC_ELT, rtx_alloc(), rtx_reader_ptr, XSTR, XTMPL, XVEC, XVECEXP, and XVECLEN.
Referenced by gen_mnemonic_attr().
Convert matching pattern VEC from a DEFINE_INSN_AND_REWRITE into a sequence that should be generated by the splitter.
References add_implicit_parallel(), replace_operands_with_dups(), rtvec_alloc(), and RTVEC_ELT.
Referenced by process_rtx().
rtx gen_rtx_CONST_INT | ( | machine_mode | ARG_UNUSEDmode, |
HOST_WIDE_INT | arg ) |
Make a version of gen_rtx_CONST_INT so that GEN_INT can be used in the gensupport programs.
References rtx_alloc(), and XWINT.
|
static |
Generate RTL expression (match_dup OPNO)
References PUT_CODE, rtx_alloc(), and XINT.
Referenced by replace_duplicating_operands_in_pattern().
|
static |
The routine scans rtl PATTERN, find match_operand in it and counts number of alternatives. If PATTERN contains several match_operands with different number of alternatives, error is emitted, and the routine returns 0. If all match_operands in PATTERN have the same number of alternatives, it's stored in N_ALT, and the routine returns 1. LOC is the location of PATTERN, for error reporting.
References error_at(), gcc_unreachable, get_alternatives_number(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, queue_elem::loc, n_alternatives(), NULL, XEXP, XINT, XSTR, XVEC, XVECEXP, and XVECLEN.
Referenced by get_alternatives_number(), and process_substs_on_one_elem().
const char * get_c_test | ( | rtx | x | ) |
Return the C test that says whether definition rtx DEF can be used, or "" if it can be used unconditionally.
References GET_CODE, and XSTR.
Referenced by count_patterns(), main(), match_pattern_1(), read_md_rtx(), and validate_pattern().
const char * get_emit_function | ( | rtx | x | ) |
Return the emit_* function that should be used for pattern X, or NULL if we can't pick a particular type at compile time and should instead fall back to "emit".
References classify_insn(), gcc_unreachable, and NULL.
Referenced by gen_emit_seq().
file_location get_file_location | ( | rtx | x | ) |
Return the file location of DEFINE_* rtx X, which was previously returned by read_md_rtx.
References gcc_assert, and rtx_locs.
Referenced by def_target_insn().
const char * get_insn_name | ( | int | code | ) |
References insn_name_ptr, insn_name_ptr_size, and NULL.
Referenced by curr_insn_transform(), main(), print_acceptance(), rtx_writer::print_rtx_operand_code_i(), record_reg_classes(), and scan_one_insn().
unsigned int get_num_insn_codes | ( | ) |
Return the number of possible INSN_CODEs. Only meaningful once the whole file has been processed.
References insn_sequence_num.
Referenced by main().
void get_pattern_stats | ( | struct pattern_stats * | stats, |
rtvec | pattern ) |
Make STATS describe the operands that appear in instruction pattern PATTERN.
References GET_NUM_ELEM, get_pattern_stats_1(), i, MAX, and RTVEC_ELT.
Referenced by def_target_insn(), gen_expand(), gen_expand(), gen_insn(), gen_insn(), gen_peephole(), gen_split(), handle_overloaded_gen(), and handle_overloaded_gen().
|
static |
Make STATS describe the operands that appear in rtx X.
References GET_CODE, get_pattern_stats_1(), GET_RTX_FORMAT, GET_RTX_LENGTH, i, MAX, MIN, NULL_RTX, RTX_CODE, XEXP, XINT, XVECEXP, and XVECLEN.
Referenced by get_pattern_stats(), and get_pattern_stats_1().
unsigned int get_register_filter_id | ( | const char * | filter | ) |
Return the unique identifier for filter condition FILTER. Identifiers are assigned automatically when the define_register_constraint is parsed.
References gcc_assert, and register_filter_map.
Referenced by preprocess_constraints(), write_get_register_filter(), and write_get_register_filter_id().
|
static |
Return true if ELEM has the attribute with the name of DEFINE_SUBST represented by SUBST_ELEM and this attribute has value SUBST_TRUE. DEFINE_SUBST isn't applied to patterns without such attribute. In other words, we suppose the default value of the attribute to be 'no' since it is always generated automatically in read-rtl.cc.
References queue_elem::data, error_at(), gcc_unreachable, GET_CODE, GET_NUM_ELEM, i, queue_elem::loc, RTVEC_ELT, SET, SET_DEST, SET_SRC, subst_false, subst_true, XSTR, and XVEC.
Referenced by process_substs_on_one_elem().
hashval_t hash_c_test | ( | const void * | x | ) |
Helper functions for insn elision.
Compute a hash function of a c_test structure, which is keyed by its ->expr field.
References a, and c_test::expr.
Referenced by init_rtx_reader_args_cb().
|
static |
References pred_data::name.
Referenced by init_predicate_table().
|
static |
Examine the attribute "predicable"; discover its boolean values and its default.
References queue_elem::data, define_attr_queue, define_cond_exec_queue, error_at(), free(), GET_CODE, queue_elem::loc, queue_elem::next, NULL, predicable_default, predicable_false, predicable_true, XEXP, and XSTR.
Referenced by process_define_cond_exec().
|
static |
Initialize the table of predicate definitions, starting with the information we have on generic predicates.
References add_predicate(), add_predicate_code(), pred_data::codes, std_pred_table::codes, eq_struct_pred_data(), free(), GET_RTX_CLASS, hash_struct_pred_data(), i, pred_data::name, std_pred_table::name, NUM_KNOWN_STD_PREDS, NUM_RTX_CODE, predicate_table, RTX_CONST_OBJ, pred_data::special, std_pred_table::special, and std_preds.
Referenced by init_rtx_reader_args_cb().
rtx_reader * init_rtx_reader_args | ( | int | argc, |
const char ** | argv ) |
Programs that don't have their own options can use this entry point instead.
References init_rtx_reader_args_cb().
rtx_reader * init_rtx_reader_args_cb | ( | int | argc, |
const char ** | argv, | ||
bool(* | parse_opt )(const char *) ) |
The entry point for initializing the reader.
References check_define_attr_duplicates(), cmp_c_test(), condition_table, define_attr_queue, define_cond_exec_queue, define_subst_queue, gen_mnemonic_attr(), hash_c_test(), have_error, init_predicate_table(), insn_sequence_num, NULL, peephole2_sequence_num, process_define_cond_exec(), process_define_subst(), md_reader::read_md_files(), rtl_obstack, and split_sequence_num.
Referenced by init_rtx_reader_args(), and main().
|
static |
Return true if attribute PREDICABLE is true for ELEM, which holds a DEFINE_INSN.
References queue_elem::data, error_at(), gcc_unreachable, GET_CODE, GET_NUM_ELEM, i, queue_elem::loc, NULL, predicable_default, predicable_false, predicable_true, RTVEC_ELT, SET, SET_DEST, SET_SRC, XSTR, and XVEC.
Referenced by process_one_cond_exec().
struct pred_data * lookup_predicate | ( | const char * | name | ) |
References pred_data::name, and predicate_table.
Referenced by compute_test_codes(), mark_mode_tests(), match_pattern_2(), output_operand_data(), special_predicate_operand_p(), subst_pattern_match(), and validate_pattern().
|
static |
This is a subroutine of mark_operands_used_in_match_dup. This routine is marks all MATCH_OPERANDs inside PATTERN as occupied.
References gcc_assert, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, mark_operands_from_match_dup(), MAX_OPERANDS, used_operands_numbers, XEXP, XINT, XVECEXP, and XVECLEN.
Referenced by mark_operands_from_match_dup(), and mark_operands_used_in_match_dup().
|
static |
This is a subroutine of adjust_operands_numbers. It goes through all expressions in PATTERN and when MATCH_DUP is met, all MATCH_OPERANDs inside it is marked as occupied. The process of marking is done by routin mark_operands_from_match_dup.
References gcc_assert, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, mark_operands_from_match_dup(), mark_operands_used_in_match_dup(), MAX_OPERANDS, XEXP, XINT, XVECEXP, and XVECLEN.
Referenced by adjust_operands_numbers(), and mark_operands_used_in_match_dup().
|
static |
Return true if instruction NAME matches pattern PAT, storing information about the match in P if so.
References gcc_unreachable, GET_MODE_NAME, i, optab_pattern::m1, optab_pattern::m2, pred_data::name, and NULL.
Referenced by find_optab().
int maybe_eval_c_test | ( | const char * | expr | ) |
Given a string representing a C test expression, look it up in the condition_table and report whether or not its value is known at compile time. Returns a tristate: 1 for known true, 0 for known false, -1 for unknown.
References condition_table, c_test::expr, expr, and c_test::value.
Referenced by count_patterns(), def_target_insn(), gen_insn(), gen_insn(), gen_proto(), match_pattern_1(), and read_md_rtx().
|
static |
This function is called for the elements in the mnemonic hashtable and generates a comma separated list of the mnemonics.
References md_reader::get_string_obstack(), obstack, and rtx_reader_ptr.
Referenced by gen_mnemonic_attr().
Modify VAL, which is an attribute expression for the "enabled" attribute, to take "ce_enabled" into account. Return the new expression.
References rtx_alloc(), XEXP, and XSTR.
Referenced by alter_attrs_for_insn().
|
static |
Return the number of alternatives in constraint S.
Referenced by alter_predicate_for_insn(), collect_insn_data(), curr_insn_transform(), find_reloads(), get_alternatives_number(), get_bool_attr_mask_uncached(), lra_set_insn_recog_data(), make_early_clobber_and_input_conflicts(), output_asm_name(), preprocess_constraints(), preprocess_constraints(), preprocess_insn_constraints(), and process_alt_operands().
Return true if we must emit a barrier after pattern X.
References GET_CODE, SET, SET_DEST, and SET_SRC.
Referenced by gen_emit_seq().
|
static |
Parse a section, a section is defined as a named space separated list, e.g. foo: a, b, c is a section named "foo" with entries a, b and c.
References fatal_at(), and i.
Referenced by convert_syntax().
|
static |
Parses the section layout that follows a "{@" if using new syntax. Builds a vector for a single section. E.g. if we have "attrs: length, arch]..." then list will have two elements, the first for "length" and the second for "arch".
References fatal_at(), and skip_spaces().
Referenced by convert_syntax().
|
static |
The compact syntax has more convience syntaxes. As such we post process the lines to get them back to something the normal syntax understands.
References fatal_at(), and skip_spaces().
Referenced by convert_syntax().
|
static |
If we have any DEFINE_COND_EXEC patterns, expand the DEFINE_INSN patterns appropriately.
References define_cond_exec_queue, have_error, identify_predicable_attribute(), queue_elem::next, and process_one_cond_exec().
Referenced by init_rtx_reader_args_cb().
|
static |
Process define_predicate directive DESC, which appears at location LOC. Compute the set of codes that can be matched, and record this as a known predicate.
References add_predicate(), add_predicate_code(), pred_data::c_block, pred_data::codes, compute_test_codes(), error_at(), pred_data::exp, GET_CODE, i, N, pred_data::name, NUM_RTX_CODE, pred_data::special, valid_predicate_name_p(), XEXP, and XSTR.
Referenced by process_rtx().
|
static |
Process define_register_constraint directive DESC, at location LOC.
References fatal_at(), register_filter_map, register_filters, and XSTR.
Referenced by process_rtx().
|
static |
If we have any DEFINE_SUBST patterns, expand DEFINE_INSN and DEFINE_EXPAND patterns appropriately.
References queue_elem::data, define_insn_queue, define_subst_attr_queue, define_subst_queue, error_at(), GET_CODE, queue_elem::loc, queue_elem::next, other_queue, process_substs_on_one_elem(), and XSTR.
Referenced by init_rtx_reader_args_cb().
|
static |
Replicate insns as appropriate for the given DEFINE_COND_EXEC.
References add_implicit_parallel(), alter_attrs_for_insn(), alter_output_for_insn(), alter_predicate_for_insn(), alter_test_for_insn(), collect_insn_data(), copy_rtx(), queue_elem::data, define_insn_queue, error_at(), i, is_predicable(), queue_elem::loc, queue_elem::next, NULL, other_tail, queue_pattern(), rtvec_alloc(), RTVEC_ELT, rtx_alloc(), queue_elem::split, XEXP, XSTR, XTMPL, XVEC, XVECEXP, and XVECLEN.
Referenced by process_define_cond_exec().
|
static |
Process a top level rtx in some way, queuing as appropriate.
References convert_syntax(), md_reader::copy_md_ptr_loc(), copy_rtx(), define_attr_tail, define_cond_exec_tail, define_insn_tail, define_pred_tail, define_subst_attr_tail, define_subst_tail, error_at(), gen_rewrite_sequence(), GET_CODE, i, md_reader::join_c_conditions(), queue_elem::loc, other_tail, process_define_predicate(), process_define_register_constraint(), PUT_CODE, queue_pattern(), remove_constraints(), rtvec_alloc(), rtx_alloc(), rtx_reader_ptr, queue_elem::split, XSTR, XVEC, XVECEXP, and XVECLEN.
Referenced by gen_reader::handle_unknown_directive().
|
static |
Try to apply define_substs to the given ELEM. Only define_substs, specified via attributes would be applied. If attribute, requiring define_subst, is set, but no define_subst was applied, ELEM would be deleted.
References adjust_operands_numbers(), alter_attrs_for_subst_insn(), alter_constraints(), alter_output_for_subst_insn(), change_subst_attribute(), copy_rtx(), queue_elem::data, define_subst_queue, duplicate_each_alternative(), get_alternatives_number(), GET_CODE, has_subst_attribute(), i, md_reader::join_c_conditions(), queue_elem::loc, match_operand_entries_in_pattern, MAX_OPERANDS, queue_elem::next, NULL, queue, remove_constraints(), remove_from_queue(), replace_duplicating_operands_in_pattern(), rtvec_alloc(), RTVEC_ELT, rtx_reader_ptr, subst_dup(), subst_false, subst_pattern_match(), used_operands_numbers, XSTR, XTMPL, XVEC, XVECEXP, and XVECLEN.
Referenced by process_define_subst().
|
static |
Queue PATTERN on LIST_TAIL. Return the address of the new queue element.
References queue_elem::data, queue_elem::loc, queue_elem::next, NULL, and queue_elem::split.
Referenced by process_one_cond_exec(), and process_rtx().
bool read_md_rtx | ( | md_rtx_info * | info | ) |
Try to read a single rtx from the file. Return true on success, describing it in *INFO.
References queue_elem::data, md_rtx_info::def, define_attr_queue, define_insn_queue, define_pred_queue, free(), get_c_test(), GET_CODE, md_rtx_info::index, insn_elision, insn_sequence_num, md_rtx_info::loc, queue_elem::loc, maybe_eval_c_test(), queue_elem::next, NULL, other_queue, peephole2_sequence_num, queue, record_insn_name(), rtx_locs, split_sequence_num, and XSTR.
|
static |
References insn_name_ptr, insn_name_ptr_size, and pred_data::name.
Referenced by read_md_rtx().
|
static |
Recursively remove constraints from an rtx.
References GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, NULL, remove_constraints(), XEXP, XSTR, XVEC, XVECEXP, and XVECLEN.
Referenced by process_rtx(), process_substs_on_one_elem(), and remove_constraints().
|
static |
Remove element ELEM from QUEUE.
References queue_elem::next, NULL, and queue.
Referenced by process_substs_on_one_elem().
|
static |
This is subroutine of adjust_operands_numbers. It visits all expressions in PATTERN and assigns not-occupied operand indexes to MATCH_OPERANDs and MATCH_OPERATORs of this PATTERN.
References find_first_unused_number_of_operand(), gcc_assert, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, MAX_OPERANDS, renumerate_operands_in_pattern(), used_operands_numbers, XEXP, XINT, XVECEXP, and XVECLEN.
Referenced by adjust_operands_numbers(), and renumerate_operands_in_pattern().
This routine checks all match_operands in PATTERN and if some of have the same index, it replaces all of them except the first one to match_dup. Usually, match_operands with the same indexes are forbidden, but after define_subst copy an RTL-expression from original template, indexes of existed and just-copied match_operands could coincide. To fix it, we replace one of them with match_dup.
References error(), gcc_assert, generate_match_dup(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, match_operand_entries_in_pattern, MAX_OPERANDS, NULL, replace_duplicating_operands_in_pattern(), XEXP, XINT, XSTR, XVECEXP, and XVECLEN.
Referenced by process_substs_on_one_elem(), and replace_duplicating_operands_in_pattern().
Recursively replace MATCH_OPERANDs with MATCH_DUPs and MATCH_OPERATORs with MATCH_OP_DUPs in X.
References GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, NULL, replace_operands_with_dups(), rtvec_alloc(), rtx_alloc(), shallow_copy_rtx(), XEXP, XINT, XVEC, XVECEXP, and XVECLEN.
Referenced by gen_rewrite_sequence(), and replace_operands_with_dups().
|
static |
Adjust all of the operand numbers in SRC to match the shift they'll get from an operand displacement of DISP. Return a pointer after the adjusted string.
Referenced by alter_output_for_insn().
|
inlinestatic |
Consumes spaces and tabs.
Referenced by convert_syntax(), parse_section_layout(), and preprocess_compact_syntax().
The routine modifies given input PATTERN of define_subst, replacing MATCH_DUP and MATCH_OP_DUP with operands from define_insn original pattern, whose operands are stored in OPERAND_DATA array. It also duplicates constraints in operands - constraints from define_insn operands are duplicated N_SUBST_ALT times, constraints from define_subst operands are duplicated N_ALT times. After the duplication, returned output rtl-pattern contains every combination of input constraints Vs constraints from define_subst output.
References alter_constraints(), copy_rtx(), duplicate_alternatives(), gcc_assert, gcc_unreachable, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, MAX_OPERANDS, NULL, subst_dup(), XEXP, XINT, XVEC, XVECEXP, and XVECLEN.
Referenced by process_substs_on_one_elem(), and subst_dup().
|
static |
Compare RTL-template of original define_insn X to input RTL-template of define_subst PT. Return 1 if the templates match, 0 otherwise. During the comparison, the routine also fills global_array OPERAND_DATA.
References error_at(), gcc_assert, gcc_unreachable, GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, GET_RTX_NAME, i, lookup_predicate(), MAX_OPERANDS, RTX_CODE, subst_pattern_match(), XEXP, XINT, XSTR, XVECEXP, and XVECLEN.
Referenced by process_substs_on_one_elem(), and subst_pattern_match().
void traverse_c_tests | ( | htab_trav | callback, |
void * | info ) |
For every C test, call CALLBACK with two arguments: a pointer to the condition structure and INFO. Stops when CALLBACK returns zero.
References condition_table.
Referenced by write_conditions().
|
static |
Return true if NAME is a valid predicate name.
References pred_data::name.
Referenced by process_define_predicate().
List of entries which are part of the new syntax.
Referenced by convert_syntax(), and gen_insn().
|
static |
Referenced by add_c_test(), init_rtx_reader_args_cb(), maybe_eval_c_test(), and traverse_c_tests().
|
static |
|
static |
Referenced by gen_mnemonic_attr(), and process_rtx().
|
static |
Referenced by identify_predicable_attribute(), init_rtx_reader_args_cb(), and process_define_cond_exec().
|
static |
Referenced by process_rtx().
|
static |
Referenced by count_patterns(), gen_mnemonic_attr(), process_define_subst(), process_one_cond_exec(), and read_md_rtx().
|
static |
Referenced by process_rtx().
|
static |
Referenced by count_patterns(), and read_md_rtx().
|
static |
Referenced by process_rtx().
|
static |
Referenced by process_define_subst().
|
static |
Referenced by process_rtx().
|
static |
Referenced by init_rtx_reader_args_cb(), process_define_subst(), and process_substs_on_one_elem().
|
static |
Referenced by process_rtx().
|
static |
0 means no warning about that code yet, 1 means warned.
Referenced by compute_test_codes().
struct pred_data* first_predicate |
int insn_elision = 1 |
Set this to 0 to disable automatic elision of insn patterns which can never be used in this configuration. See genconditions.cc. Must be set before calling init_md_reader.
Referenced by count_patterns(), main(), and read_md_rtx().
|
static |
These functions allow linkage with print-rtl.cc. Also, some generators like to annotate their output with insn names.
Holds an array of names indexed by insn_code_number.
Referenced by get_insn_name(), and record_insn_name().
|
static |
Referenced by get_insn_name(), and record_insn_name().
|
static |
Counter for named patterns and INSN_CODEs.
Referenced by get_num_insn_codes(), init_rtx_reader_args_cb(), and read_md_rtx().
|
static |
Referenced by add_predicate(), evaluate_control_stmt_using_entry_checks(), and merge_last().
|
static |
Referenced by process_substs_on_one_elem(), and replace_duplicating_operands_in_pattern().
unsigned int num_optabs = ARRAY_SIZE (optabs) |
The number of entries in optabs[].
Referenced by main().
|
static |
Referenced by gen_mnemonic_attr(), gen_mnemonic_setattr(), and mnemonic_htab_callback().
|
static |
optab_def optabs[] |
An array of all optabs. Note that the same optab can appear more than once, with a different pattern.
Referenced by find_optab(), and main().
|
static |
Referenced by count_patterns(), process_define_subst(), and read_md_rtx().
|
static |
Referenced by process_one_cond_exec(), and process_rtx().
|
static |
Counter for define_peephole2s.
Referenced by init_rtx_reader_args_cb(), and read_md_rtx().
|
static |
Referenced by identify_predicable_attribute(), and is_predicable().
|
static |
Referenced by identify_predicable_attribute(), and is_predicable().
|
static |
Referenced by identify_predicable_attribute(), and is_predicable().
|
static |
Helper functions for define_predicate and define_special_predicate processing. Shared between genrecog.cc and genpreds.cc.
Referenced by add_predicate(), init_predicate_table(), and lookup_predicate().
|
static |
Maps register filter conditions to the associated filter identifier.
Referenced by get_register_filter_id(), and process_define_register_constraint().
vec<const char *> register_filters |
All register filter conditions, indexed by identifier.
Referenced by alternative_register_filters(), main(), process_define_register_constraint(), write_get_register_filter(), write_get_register_filter_id(), write_init_reg_class_start_regs(), and write_tm_preds_h().
|
static |
Mapping from DEFINE_* rtxes to their location in the source file.
Referenced by get_file_location(), and read_md_rtx().
|
static |
Counter for define_splits.
Referenced by init_rtx_reader_args_cb(), and read_md_rtx().
|
static |
Referenced by init_predicate_table().
|
static |
Referenced by has_subst_attribute(), and process_substs_on_one_elem().
|
static |
Referenced by has_subst_attribute().
int target_flags |
In case some macros used by files we include need it, define this here.
Referenced by default_get_pch_validity(), default_pch_valid_p(), and option_affects_pch_p().
|
static |