]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gensupport.h
S/390: Make constant checking more strict
[thirdparty/gcc.git] / gcc / gensupport.h
CommitLineData
c88c0d42 1/* Declarations for rtx-reader support for gen* routines.
5624e564 2 Copyright (C) 2000-2015 Free Software Foundation, Inc.
c88c0d42 3
1322177d 4This file is part of GCC.
c88c0d42 5
1322177d
LB
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
1322177d 9version.
c88c0d42 10
1322177d
LB
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
c88c0d42
CP
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
c88c0d42 19
2199e5fa
ZW
20#ifndef GCC_GENSUPPORT_H
21#define GCC_GENSUPPORT_H
22
5d2d3e43
RS
23#include "read-md.h"
24
3916d6d8
RH
25struct obstack;
26extern struct obstack *rtl_obstack;
27
5d2d3e43
RS
28/* Information about an .md define_* rtx. */
29struct 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
313d38e3 42extern rtx add_implicit_parallel (rtvec);
600ab3fc
RS
43extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
44extern bool init_rtx_reader_args (int, char **);
5d2d3e43 45extern bool read_md_rtx (md_rtx_info *);
ba0ee63d 46extern unsigned int get_num_insn_codes ();
c88c0d42 47
2199e5fa
ZW
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. */
51extern int insn_elision;
52
d1427a17
RS
53/* Return the C test that says whether a definition rtx can be used,
54 or "" if it can be used unconditionally. */
55extern const char *get_c_test (rtx);
56
2199e5fa
ZW
57/* If the C test passed as the argument can be evaluated at compile
58 time, return its truth value; else return -1. The test must have
59 appeared somewhere in the machine description when genconditions
60 was run. */
3d7aafde 61extern int maybe_eval_c_test (const char *);
2199e5fa 62
1c7352cd
ZW
63/* Add an entry to the table of conditions. Used by genconditions and
64 by read-rtl.c. */
65extern void add_c_test (const char *, int);
66
67/* This structure is used internally by gensupport.c and genconditions.c. */
2199e5fa
ZW
68struct c_test
69{
70 const char *expr;
71 int value;
72};
73
2199e5fa 74#ifdef __HASHTAB_H__
3d7aafde
AJ
75extern hashval_t hash_c_test (const void *);
76extern int cmp_c_test (const void *, const void *);
1c7352cd 77extern void traverse_c_tests (htab_trav, void *);
2199e5fa
ZW
78#endif
79
e543e219
ZW
80/* Predicate handling: helper functions and data structures. */
81
82struct pred_data
83{
84 struct pred_data *next; /* for iterating over the set of all preds */
85 const char *name; /* predicate name */
86 bool special; /* special handling of modes? */
87
88 /* data used primarily by genpreds.c */
89 const char *c_block; /* C test block */
90 rtx exp; /* RTL test expression */
91
92 /* data used primarily by genrecog.c */
93 enum rtx_code singleton; /* if pred takes only one code, that code */
e663da80 94 int num_codes; /* number of codes accepted */
e543e219
ZW
95 bool allows_non_lvalue; /* if pred allows non-lvalue expressions */
96 bool allows_non_const; /* if pred allows non-const expressions */
97 bool codes[NUM_RTX_CODE]; /* set of codes accepted */
98};
99
100extern struct pred_data *first_predicate;
101extern struct pred_data *lookup_predicate (const char *);
e663da80 102extern void add_predicate_code (struct pred_data *, enum rtx_code);
e543e219
ZW
103extern void add_predicate (struct pred_data *);
104
105#define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
106
e792559a
RS
107struct pattern_stats
108{
109 /* The largest match_operand, match_operator or match_parallel
110 number found. */
111 int max_opno;
112
113 /* The largest match_dup, match_op_dup or match_par_dup number found. */
114 int max_dup_opno;
115
116 /* The largest match_scratch number found. */
117 int max_scratch_opno;
118
119 /* The number of times match_dup, match_op_dup or match_par_dup appears
120 in the pattern. */
121 int num_dups;
122
123 /* The number of rtx arguments to the generator function. */
124 int num_generator_args;
125
126 /* The number of rtx operands in an insn. */
127 int num_insn_operands;
128
129 /* The number of operand variables that are needed. */
130 int num_operand_vars;
131};
132
133extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec);
c9f84f2e 134extern void compute_test_codes (rtx, file_location, char *);
58d745ec 135extern file_location get_file_location (rtx);
3beaff21
RS
136extern const char *get_emit_function (rtx);
137extern bool needs_barrier_p (rtx);
e792559a 138
2199e5fa 139#endif /* GCC_GENSUPPORT_H */