GCC Middle and Back End API Reference
gensupport.h
Go to the documentation of this file.
1 /* Declarations for rtx-reader support for gen* routines.
2  Copyright (C) 2000-2013 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 struct obstack;
24 extern struct obstack *rtl_obstack;
25 
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 *);
29 
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;
34 
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 *);
40 
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);
44 
45 /* This structure is used internally by gensupport.c and genconditions.c. */
46 struct c_test
47 {
48  const char *expr;
49  int value;
50 };
51 
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
57 
58 /* Predicate handling: helper functions and data structures. */
59 
60 struct pred_data
61 {
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? */
65 
66  /* data used primarily by genpreds.c */
67  const char *c_block; /* C test block */
68  rtx exp; /* RTL test expression */
69 
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 */
76 };
77 
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 *);
82 
83 #define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
84 
85 struct pattern_stats
86 {
87  /* The largest match_operand, match_operator or match_parallel
88  number found. */
89  int max_opno;
90 
91  /* The largest match_dup, match_op_dup or match_par_dup number found. */
92  int max_dup_opno;
93 
94  /* The largest match_scratch number found. */
95  int max_scratch_opno;
96 
97  /* The number of times match_dup, match_op_dup or match_par_dup appears
98  in the pattern. */
99  int num_dups;
100 
101  /* The number of rtx arguments to the generator function. */
103 
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;
109 };
110 
111 extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec);
112 
113 #endif /* GCC_GENSUPPORT_H */