* 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. From-SVN: r85855
96 lines
3.3 KiB
C
96 lines
3.3 KiB
C
/* Declarations for rtx-reader support for gen* routines.
|
|
Copyright (C) 2000, 2002, 2003 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 2, 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 COPYING. If not, write to the Free
|
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
02111-1307, USA. */
|
|
|
|
#ifndef GCC_GENSUPPORT_H
|
|
#define GCC_GENSUPPORT_H
|
|
|
|
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 **);
|
|
extern rtx read_md_rtx (int *, int *);
|
|
|
|
extern void message_with_line (int, const char *, ...)
|
|
ATTRIBUTE_PRINTF_2;
|
|
|
|
/* Set this to 0 to disable automatic elision of insn patterns which
|
|
can never be used in this configuration. See genconditions.c.
|
|
Must be set before calling init_md_reader. */
|
|
extern int insn_elision;
|
|
|
|
/* If this is 1, the insn elision table doesn't even exist yet;
|
|
maybe_eval_c_test will always return -1. This is distinct from
|
|
insn_elision because genflags and gencodes need to see all the
|
|
patterns, but treat elided patterns differently. */
|
|
extern const int insn_elision_unavailable;
|
|
|
|
/* If the C test passed as the argument can be evaluated at compile
|
|
time, return its truth value; else return -1. The test must have
|
|
appeared somewhere in the machine description when genconditions
|
|
was run. */
|
|
extern int maybe_eval_c_test (const char *);
|
|
|
|
/* This table should not be accessed directly; use maybe_eval_c_test. */
|
|
struct c_test
|
|
{
|
|
const char *expr;
|
|
int value;
|
|
};
|
|
|
|
extern const struct c_test insn_conditions[];
|
|
extern const size_t n_insn_conditions;
|
|
|
|
#ifdef __HASHTAB_H__
|
|
extern hashval_t hash_c_test (const void *);
|
|
extern int cmp_c_test (const void *, const void *);
|
|
#endif
|
|
|
|
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 */
|