2009-08-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / gensupport.h
blob140f669b18f41dc1eca7386ced5d319878d09397
1 /* Declarations for rtx-reader support for gen* routines.
2 Copyright (C) 2000, 2002, 2003, 2004, 2007, 2008
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_GENSUPPORT_H
22 #define GCC_GENSUPPORT_H
24 struct obstack;
25 extern struct obstack *rtl_obstack;
26 extern const char *in_fname;
28 extern int init_md_reader_args_cb (int, char **, bool (*)(const char *));
29 extern int init_md_reader_args (int, char **);
30 extern rtx read_md_rtx (int *, int *);
32 extern void message_with_line (int, const char *, ...)
33 ATTRIBUTE_PRINTF_2;
35 /* Set this to 0 to disable automatic elision of insn patterns which
36 can never be used in this configuration. See genconditions.c.
37 Must be set before calling init_md_reader. */
38 extern int insn_elision;
40 /* If the C test passed as the argument can be evaluated at compile
41 time, return its truth value; else return -1. The test must have
42 appeared somewhere in the machine description when genconditions
43 was run. */
44 extern int maybe_eval_c_test (const char *);
46 /* Add an entry to the table of conditions. Used by genconditions and
47 by read-rtl.c. */
48 extern void add_c_test (const char *, int);
50 /* This structure is used internally by gensupport.c and genconditions.c. */
51 struct c_test
53 const char *expr;
54 int value;
57 #ifdef __HASHTAB_H__
58 extern hashval_t hash_c_test (const void *);
59 extern int cmp_c_test (const void *, const void *);
60 extern void traverse_c_tests (htab_trav, void *);
61 #endif
63 extern int n_comma_elts (const char *);
64 extern const char *scan_comma_elt (const char **);
66 /* Predicate handling: helper functions and data structures. */
68 struct pred_data
70 struct pred_data *next; /* for iterating over the set of all preds */
71 const char *name; /* predicate name */
72 bool special; /* special handling of modes? */
74 /* data used primarily by genpreds.c */
75 const char *c_block; /* C test block */
76 rtx exp; /* RTL test expression */
78 /* data used primarily by genrecog.c */
79 enum rtx_code singleton; /* if pred takes only one code, that code */
80 int num_codes; /* number of codes accepted */
81 bool allows_non_lvalue; /* if pred allows non-lvalue expressions */
82 bool allows_non_const; /* if pred allows non-const expressions */
83 bool codes[NUM_RTX_CODE]; /* set of codes accepted */
86 extern struct pred_data *first_predicate;
87 extern struct pred_data *lookup_predicate (const char *);
88 extern void add_predicate_code (struct pred_data *, enum rtx_code);
89 extern void add_predicate (struct pred_data *);
91 #define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
93 /* This callback will be invoked whenever an rtl include directive is
94 processed. To be used for creation of the dependency file. */
95 extern void (*include_callback) (const char *);
97 #endif /* GCC_GENSUPPORT_H */