]>
Commit | Line | Data |
---|---|---|
c5ddd6b5 | 1 | /* Declarations for rtx-reader support for gen* routines. |
d353bf18 | 2 | Copyright (C) 2000-2015 Free Software Foundation, Inc. |
c5ddd6b5 | 3 | |
f12b58b3 | 4 | This file is part of GCC. |
c5ddd6b5 | 5 | |
f12b58b3 | 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 | |
8c4c00c1 | 8 | Software Foundation; either version 3, or (at your option) any later |
f12b58b3 | 9 | version. |
c5ddd6b5 | 10 | |
f12b58b3 | 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. | |
c5ddd6b5 | 15 | |
16 | You should have received a copy of the GNU General Public License | |
8c4c00c1 | 17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
c5ddd6b5 | 19 | |
b70bd542 | 20 | #ifndef GCC_GENSUPPORT_H |
21 | #define GCC_GENSUPPORT_H | |
22 | ||
c04601c1 | 23 | #include "read-md.h" |
24 | ||
96d905e5 | 25 | struct obstack; |
26 | extern struct obstack *rtl_obstack; | |
27 | ||
c04601c1 | 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 | ||
2ff8d4ae | 42 | extern rtx add_implicit_parallel (rtvec); |
77ba95d0 | 43 | extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *)); |
44 | extern bool init_rtx_reader_args (int, char **); | |
c04601c1 | 45 | extern bool read_md_rtx (md_rtx_info *); |
c5ddd6b5 | 46 | |
b70bd542 | 47 | /* Set this to 0 to disable automatic elision of insn patterns which |
48 | can never be used in this configuration. See genconditions.c. | |
49 | Must be set before calling init_md_reader. */ | |
50 | extern int insn_elision; | |
51 | ||
b70bd542 | 52 | /* If the C test passed as the argument can be evaluated at compile |
53 | time, return its truth value; else return -1. The test must have | |
54 | appeared somewhere in the machine description when genconditions | |
55 | was run. */ | |
1a97be37 | 56 | extern int maybe_eval_c_test (const char *); |
b70bd542 | 57 | |
af908c02 | 58 | /* Add an entry to the table of conditions. Used by genconditions and |
59 | by read-rtl.c. */ | |
60 | extern void add_c_test (const char *, int); | |
61 | ||
62 | /* This structure is used internally by gensupport.c and genconditions.c. */ | |
b70bd542 | 63 | struct c_test |
64 | { | |
65 | const char *expr; | |
66 | int value; | |
67 | }; | |
68 | ||
b70bd542 | 69 | #ifdef __HASHTAB_H__ |
1a97be37 | 70 | extern hashval_t hash_c_test (const void *); |
71 | extern int cmp_c_test (const void *, const void *); | |
af908c02 | 72 | extern void traverse_c_tests (htab_trav, void *); |
b70bd542 | 73 | #endif |
74 | ||
cbf464bd | 75 | /* Predicate handling: helper functions and data structures. */ |
76 | ||
77 | struct pred_data | |
78 | { | |
79 | struct pred_data *next; /* for iterating over the set of all preds */ | |
80 | const char *name; /* predicate name */ | |
81 | bool special; /* special handling of modes? */ | |
82 | ||
83 | /* data used primarily by genpreds.c */ | |
84 | const char *c_block; /* C test block */ | |
85 | rtx exp; /* RTL test expression */ | |
86 | ||
87 | /* data used primarily by genrecog.c */ | |
88 | enum rtx_code singleton; /* if pred takes only one code, that code */ | |
c7a4c804 | 89 | int num_codes; /* number of codes accepted */ |
cbf464bd | 90 | bool allows_non_lvalue; /* if pred allows non-lvalue expressions */ |
91 | bool allows_non_const; /* if pred allows non-const expressions */ | |
92 | bool codes[NUM_RTX_CODE]; /* set of codes accepted */ | |
93 | }; | |
94 | ||
95 | extern struct pred_data *first_predicate; | |
96 | extern struct pred_data *lookup_predicate (const char *); | |
c7a4c804 | 97 | extern void add_predicate_code (struct pred_data *, enum rtx_code); |
cbf464bd | 98 | extern void add_predicate (struct pred_data *); |
99 | ||
100 | #define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next) | |
101 | ||
22add764 | 102 | struct pattern_stats |
103 | { | |
104 | /* The largest match_operand, match_operator or match_parallel | |
105 | number found. */ | |
106 | int max_opno; | |
107 | ||
108 | /* The largest match_dup, match_op_dup or match_par_dup number found. */ | |
109 | int max_dup_opno; | |
110 | ||
111 | /* The largest match_scratch number found. */ | |
112 | int max_scratch_opno; | |
113 | ||
114 | /* The number of times match_dup, match_op_dup or match_par_dup appears | |
115 | in the pattern. */ | |
116 | int num_dups; | |
117 | ||
118 | /* The number of rtx arguments to the generator function. */ | |
119 | int num_generator_args; | |
120 | ||
121 | /* The number of rtx operands in an insn. */ | |
122 | int num_insn_operands; | |
123 | ||
124 | /* The number of operand variables that are needed. */ | |
125 | int num_operand_vars; | |
126 | }; | |
127 | ||
128 | extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec); | |
5d1f1932 | 129 | extern void compute_test_codes (rtx, file_location, char *); |
03acb861 | 130 | extern const char *get_emit_function (rtx); |
131 | extern bool needs_barrier_p (rtx); | |
22add764 | 132 | |
b70bd542 | 133 | #endif /* GCC_GENSUPPORT_H */ |