gcc/
[official-gcc.git] / gcc / gensupport.h
blobbb36f21d3eaa2dcd64e6ab99553dceecaac93dad
1 /* Declarations for rtx-reader support for gen* routines.
2 Copyright (C) 2000-2015 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_GENSUPPORT_H
21 #define GCC_GENSUPPORT_H
23 struct obstack;
24 extern struct obstack *rtl_obstack;
26 extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
27 extern bool init_rtx_reader_args (int, char **);
28 extern rtx read_md_rtx (int *, int *);
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. */
33 extern int insn_elision;
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. */
39 extern int maybe_eval_c_test (const char *);
41 /* Add an entry to the table of conditions. Used by genconditions and
42 by read-rtl.c. */
43 extern void add_c_test (const char *, int);
45 /* This structure is used internally by gensupport.c and genconditions.c. */
46 struct c_test
48 const char *expr;
49 int value;
52 #ifdef __HASHTAB_H__
53 extern hashval_t hash_c_test (const void *);
54 extern int cmp_c_test (const void *, const void *);
55 extern void traverse_c_tests (htab_trav, void *);
56 #endif
58 /* Predicate handling: helper functions and data structures. */
60 struct pred_data
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? */
66 /* data used primarily by genpreds.c */
67 const char *c_block; /* C test block */
68 rtx exp; /* RTL test expression */
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 */
78 extern struct pred_data *first_predicate;
79 extern struct pred_data *lookup_predicate (const char *);
80 extern void add_predicate_code (struct pred_data *, enum rtx_code);
81 extern void add_predicate (struct pred_data *);
83 #define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
85 struct pattern_stats
87 /* The largest match_operand, match_operator or match_parallel
88 number found. */
89 int max_opno;
91 /* The largest match_dup, match_op_dup or match_par_dup number found. */
92 int max_dup_opno;
94 /* The largest match_scratch number found. */
95 int max_scratch_opno;
97 /* The number of times match_dup, match_op_dup or match_par_dup appears
98 in the pattern. */
99 int num_dups;
101 /* The number of rtx arguments to the generator function. */
102 int num_generator_args;
104 /* The number of rtx operands in an insn. */
105 int num_insn_operands;
107 /* The number of operand variables that are needed. */
108 int num_operand_vars;
111 extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec);
113 #endif /* GCC_GENSUPPORT_H */