1/* Declarations for rtx-reader support for gen* routines. 2 Copyright (C) 2000-2015 Free Software Foundation, Inc. 3 4This file is part of GCC. 5 6GCC is free software; you can redistribute it and/or modify it under 7the terms of the GNU General Public License as published by the Free 8Software Foundation; either version 3, or (at your option) any later 9version. 10 11GCC is distributed in the hope that it will be useful, but WITHOUT ANY 12WARRANTY; without even the implied warranty of MERCHANTABILITY or 13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14for more details. 15 16You should have received a copy of the GNU General Public License 17along with GCC; see the file COPYING3. If not see 18<http://www.gnu.org/licenses/>. */ 19 20#ifndef GCC_GENSUPPORT_H 21#define GCC_GENSUPPORT_H 22 23struct obstack; 24extern struct obstack *rtl_obstack; 25 26extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *)); 27extern bool init_rtx_reader_args (int, char **); 28extern rtx read_md_rtx (int *, int *); 29 30/* Set this to 0 to disable automatic elision of insn patterns which 31 can never be used in this configuration. See genconditions.c. 32 Must be set before calling init_md_reader. */ 33extern int insn_elision; 34 35/* If the C test passed as the argument can be evaluated at compile 36 time, return its truth value; else return -1. The test must have 37 appeared somewhere in the machine description when genconditions 38 was run. */ 39extern int maybe_eval_c_test (const char *); 40 41/* Add an entry to the table of conditions. Used by genconditions and 42 by read-rtl.c. */ 43extern void add_c_test (const char *, int); 44 45/* This structure is used internally by gensupport.c and genconditions.c. */ 46struct c_test 47{ 48 const char *expr; 49 int value; 50}; 51 52#ifdef __HASHTAB_H__ 53extern hashval_t hash_c_test (const void *); 54extern int cmp_c_test (const void *, const void *); 55extern void traverse_c_tests (htab_trav, void *); 56#endif 57 58/* Predicate handling: helper functions and data structures. */ 59 60struct pred_data 61{ 62 struct pred_data *next; /* for iterating over the set of all preds */ 63 const char *name; /* predicate name */ 64 bool special; /* special handling of modes? */ 65 66 /* data used primarily by genpreds.c */ 67 const char *c_block; /* C test block */ 68 rtx exp; /* RTL test expression */ 69 70 /* data used primarily by genrecog.c */ 71 enum rtx_code singleton; /* if pred takes only one code, that code */ 72 int num_codes; /* number of codes accepted */ 73 bool allows_non_lvalue; /* if pred allows non-lvalue expressions */ 74 bool allows_non_const; /* if pred allows non-const expressions */ 75 bool codes[NUM_RTX_CODE]; /* set of codes accepted */ 76}; 77 78extern struct pred_data *first_predicate; 79extern struct pred_data *lookup_predicate (const char *); 80extern void add_predicate_code (struct pred_data *, enum rtx_code); 81extern void add_predicate (struct pred_data *); 82 83#define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next) 84 85struct pattern_stats 86{ 87 /* The largest match_operand, match_operator or match_parallel 88 number found. */ 89 int max_opno; 90 91 /* The largest match_dup, match_op_dup or match_par_dup number found. */ 92 int max_dup_opno; 93 94 /* The largest match_scratch number found. */ 95 int max_scratch_opno; 96 97 /* The number of times match_dup, match_op_dup or match_par_dup appears 98 in the pattern. */ 99 int num_dups; 100 101 /* The number of rtx arguments to the generator function. */ 102 int num_generator_args; 103 104 /* The number of rtx operands in an insn. */ 105 int num_insn_operands; 106 107 /* The number of operand variables that are needed. */ 108 int num_operand_vars; 109}; 110 111extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec); 112 113#endif /* GCC_GENSUPPORT_H */ 114