summaryrefslogtreecommitdiff
path: root/gcc/gensupport.h
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-12 07:49:00 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-12 07:49:00 +0000
commitcbf464bd936b926a34bbc04e8ccd39afd4c5815a (patch)
tree35550b19b3978c830f6043f43687018fe8198d2d /gcc/gensupport.h
parent307719b97143646f73530f046493efc507351385 (diff)
downloadgcc-cbf464bd936b926a34bbc04e8ccd39afd4c5815a.tar.gz
* genpreds.c: Add capability to generate predicate bodies as
well as function prototypes. Write function prototypes for the generic predicates too. (process_define_predicate, write_tm_preds_h, write_insn_preds_c) (write_predicate_subfunction, mark_mode_tests, add_mode_tests) (write_match_code, write_predicate_expr, write_one_predicate_function) (parse_option): New functions. (output_predicate_decls): Delete. (main): Read the machine description, process DEFINE_PREDICATE or DEFINE_SPECIAL_PREDICATE patterns, write tm-preds.h or insn-preds.c as appropriate. * genrecog.c (struct decision_test): Replace index with struct pred_data pointer. (next_index): Remove, unused. (pred_table, preds, special_mode_pred_table): Delete. (compute_predicate_codes, process_define_predicate): New functions. (validate_pattern, add_to_sequence, write_switch): Update for new data structures. (main): Handle DEFINE_PREDICATE and DEFINE_SPECIAL_PREDICATE. Check both error_count and have_error. * gensupport.c (in_fname, first_predicate): New globals. (define_pred_queue, define_pred_tail): New RTL-pattern queue. (predicate_table, last_predicate, old_pred_table) (old_special_pred_table): New statics. (hash_struct_pred_data, eq_struct_pred_data, lookup_predicate) (add_predicate, init_predicate_table): New functions. (process_rtx): Handle DEFINE_PREDICATE and DEFINE_SPECIAL_PREDICATE. (init_md_reader_args_cb): Use the global in_fname. No need to zero it or max_include_len. Call init_predicate_table. (read_rtx): Run the predicate queue after the attribute queue but before all the others. * gensupport.h (in_fname, struct pred_data, first_predicate) (lookup_predicate, add_predicate, FOR_ALL_PREDICATES): Declare. * rtl.def (MATCH_CODE, MATCH_TEST, DEFINE_PREDICATE) (DEFINE_SPECIAL_PREDICATE): New RTL codes. * dummy-conditions.c: Don't include bconfig.h, system.h, coretypes.h, tm.h, or system.h. Do include stddef.h. Duplicate declaration of struct c_test from gensupport.h. * Makefile.in (OBJS-common): Add insn-preds.o. (STAGESTUFF, .PRECIOUS): Add insn-preds.c. (insn-preds.c, insn-preds.o): New rules. (s-preds): Also generate insn-preds.c. (dummy-conditions.o, genpreds$(build_exeext), genpreds.o): Update dependencies. (print-rtl.o, print-rtl1.o): Correct dependencies. * recog.h: Delete prototypes of predicate functions. * doc/md.texi (Predicates): New section with complete documentation of operand/operator predicates. Remove some incomplete documentation of predicates from other places. * doc/tm.texi (Misc): Move SPECIAL_MODE_PREDICATES next to PREDICATE_CODES; indicate that both are deprecated in favor of define_predicate/define_special_predicate. * config/ia64/ia64.c: All predicate function definitions moved to ia64.md, except (small_addr_symbolic_operand, tls_symbolic_operand): Delete. (ia64_expand_load_address, ia64_expand_move): Check SYMBOL_REF_TLS_MODEL directly, don't use tls_symbolic_operand. * config/ia64/ia64.md: All predicates now defined here. (symbolic_operand): Is now a special predicate. * config/ia64/ia64.h: Declare ia64_section_threshold. (PREDICATE_CODES): Delete. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85855 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gensupport.h')
-rw-r--r--gcc/gensupport.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/gensupport.h b/gcc/gensupport.h
index ea78b247d5d..90f866a2f56 100644
--- a/gcc/gensupport.h
+++ b/gcc/gensupport.h
@@ -23,6 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
struct obstack;
extern struct obstack *rtl_obstack;
+extern const char *in_fname;
extern int init_md_reader_args_cb (int, char **, bool (*)(const char *));
extern int init_md_reader_args (int, char **);
@@ -66,4 +67,29 @@ extern int cmp_c_test (const void *, const void *);
extern int n_comma_elts (const char *);
extern const char *scan_comma_elt (const char **);
+/* Predicate handling: helper functions and data structures. */
+
+struct pred_data
+{
+ struct pred_data *next; /* for iterating over the set of all preds */
+ const char *name; /* predicate name */
+ bool special; /* special handling of modes? */
+
+ /* data used primarily by genpreds.c */
+ const char *c_block; /* C test block */
+ rtx exp; /* RTL test expression */
+
+ /* data used primarily by genrecog.c */
+ enum rtx_code singleton; /* if pred takes only one code, that code */
+ bool allows_non_lvalue; /* if pred allows non-lvalue expressions */
+ bool allows_non_const; /* if pred allows non-const expressions */
+ bool codes[NUM_RTX_CODE]; /* set of codes accepted */
+};
+
+extern struct pred_data *first_predicate;
+extern struct pred_data *lookup_predicate (const char *);
+extern void add_predicate (struct pred_data *);
+
+#define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
+
#endif /* GCC_GENSUPPORT_H */