]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/gensupport.h
gensupport.h (get_num_insn_codes): Declare.
[thirdparty/gcc.git] / gcc / gensupport.h
1 /* Declarations for rtx-reader support for gen* routines.
2 Copyright (C) 2000-2015 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
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.
10
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.
15
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/>. */
19
20 #ifndef GCC_GENSUPPORT_H
21 #define GCC_GENSUPPORT_H
22
23 #include "read-md.h"
24
25 struct obstack;
26 extern struct obstack *rtl_obstack;
27
28 /* Information about an .md define_* rtx. */
29 struct md_rtx_info {
30 /* The rtx itself. */
31 rtx def;
32
33 /* The location of the first line of the rtx. */
34 file_location loc;
35
36 /* The unique number attached to the rtx. Currently all define_insns,
37 define_expands, define_splits, define_peepholes and define_peephole2s
38 share the same insn_code index space. */
39 int index;
40 };
41
42 extern rtx add_implicit_parallel (rtvec);
43 extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
44 extern bool init_rtx_reader_args (int, char **);
45 extern bool read_md_rtx (md_rtx_info *);
46 extern unsigned int get_num_insn_codes ();
47
48 /* Set this to 0 to disable automatic elision of insn patterns which
49 can never be used in this configuration. See genconditions.c.
50 Must be set before calling init_md_reader. */
51 extern int insn_elision;
52
53 /* If the C test passed as the argument can be evaluated at compile
54 time, return its truth value; else return -1. The test must have
55 appeared somewhere in the machine description when genconditions
56 was run. */
57 extern int maybe_eval_c_test (const char *);
58
59 /* Add an entry to the table of conditions. Used by genconditions and
60 by read-rtl.c. */
61 extern void add_c_test (const char *, int);
62
63 /* This structure is used internally by gensupport.c and genconditions.c. */
64 struct c_test
65 {
66 const char *expr;
67 int value;
68 };
69
70 #ifdef __HASHTAB_H__
71 extern hashval_t hash_c_test (const void *);
72 extern int cmp_c_test (const void *, const void *);
73 extern void traverse_c_tests (htab_trav, void *);
74 #endif
75
76 /* Predicate handling: helper functions and data structures. */
77
78 struct pred_data
79 {
80 struct pred_data *next; /* for iterating over the set of all preds */
81 const char *name; /* predicate name */
82 bool special; /* special handling of modes? */
83
84 /* data used primarily by genpreds.c */
85 const char *c_block; /* C test block */
86 rtx exp; /* RTL test expression */
87
88 /* data used primarily by genrecog.c */
89 enum rtx_code singleton; /* if pred takes only one code, that code */
90 int num_codes; /* number of codes accepted */
91 bool allows_non_lvalue; /* if pred allows non-lvalue expressions */
92 bool allows_non_const; /* if pred allows non-const expressions */
93 bool codes[NUM_RTX_CODE]; /* set of codes accepted */
94 };
95
96 extern struct pred_data *first_predicate;
97 extern struct pred_data *lookup_predicate (const char *);
98 extern void add_predicate_code (struct pred_data *, enum rtx_code);
99 extern void add_predicate (struct pred_data *);
100
101 #define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
102
103 struct pattern_stats
104 {
105 /* The largest match_operand, match_operator or match_parallel
106 number found. */
107 int max_opno;
108
109 /* The largest match_dup, match_op_dup or match_par_dup number found. */
110 int max_dup_opno;
111
112 /* The largest match_scratch number found. */
113 int max_scratch_opno;
114
115 /* The number of times match_dup, match_op_dup or match_par_dup appears
116 in the pattern. */
117 int num_dups;
118
119 /* The number of rtx arguments to the generator function. */
120 int num_generator_args;
121
122 /* The number of rtx operands in an insn. */
123 int num_insn_operands;
124
125 /* The number of operand variables that are needed. */
126 int num_operand_vars;
127 };
128
129 extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec);
130 extern void compute_test_codes (rtx, file_location, char *);
131 extern const char *get_emit_function (rtx);
132 extern bool needs_barrier_p (rtx);
133
134 #endif /* GCC_GENSUPPORT_H */