xref: /dflybsd-src/contrib/gcc-4.7/gcc/gensupport.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Declarations for rtx-reader support for gen* routines.
2*e4b17023SJohn Marino    Copyright (C) 2000, 2002, 2003, 2004, 2007, 2008, 2010
3*e4b17023SJohn Marino    Free Software Foundation, Inc.
4*e4b17023SJohn Marino 
5*e4b17023SJohn Marino This file is part of GCC.
6*e4b17023SJohn Marino 
7*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
8*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
9*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
10*e4b17023SJohn Marino version.
11*e4b17023SJohn Marino 
12*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15*e4b17023SJohn Marino for more details.
16*e4b17023SJohn Marino 
17*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
18*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
19*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
20*e4b17023SJohn Marino 
21*e4b17023SJohn Marino #ifndef GCC_GENSUPPORT_H
22*e4b17023SJohn Marino #define GCC_GENSUPPORT_H
23*e4b17023SJohn Marino 
24*e4b17023SJohn Marino struct obstack;
25*e4b17023SJohn Marino extern struct obstack *rtl_obstack;
26*e4b17023SJohn Marino 
27*e4b17023SJohn Marino extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
28*e4b17023SJohn Marino extern bool init_rtx_reader_args (int, char **);
29*e4b17023SJohn Marino extern rtx read_md_rtx (int *, int *);
30*e4b17023SJohn Marino 
31*e4b17023SJohn Marino /* Set this to 0 to disable automatic elision of insn patterns which
32*e4b17023SJohn Marino    can never be used in this configuration.  See genconditions.c.
33*e4b17023SJohn Marino    Must be set before calling init_md_reader.  */
34*e4b17023SJohn Marino extern int insn_elision;
35*e4b17023SJohn Marino 
36*e4b17023SJohn Marino /* If the C test passed as the argument can be evaluated at compile
37*e4b17023SJohn Marino    time, return its truth value; else return -1.  The test must have
38*e4b17023SJohn Marino    appeared somewhere in the machine description when genconditions
39*e4b17023SJohn Marino    was run.  */
40*e4b17023SJohn Marino extern int maybe_eval_c_test (const char *);
41*e4b17023SJohn Marino 
42*e4b17023SJohn Marino /* Add an entry to the table of conditions.  Used by genconditions and
43*e4b17023SJohn Marino    by read-rtl.c.  */
44*e4b17023SJohn Marino extern void add_c_test (const char *, int);
45*e4b17023SJohn Marino 
46*e4b17023SJohn Marino /* This structure is used internally by gensupport.c and genconditions.c.  */
47*e4b17023SJohn Marino struct c_test
48*e4b17023SJohn Marino {
49*e4b17023SJohn Marino   const char *expr;
50*e4b17023SJohn Marino   int value;
51*e4b17023SJohn Marino };
52*e4b17023SJohn Marino 
53*e4b17023SJohn Marino #ifdef __HASHTAB_H__
54*e4b17023SJohn Marino extern hashval_t hash_c_test (const void *);
55*e4b17023SJohn Marino extern int cmp_c_test (const void *, const void *);
56*e4b17023SJohn Marino extern void traverse_c_tests (htab_trav, void *);
57*e4b17023SJohn Marino #endif
58*e4b17023SJohn Marino 
59*e4b17023SJohn Marino /* Predicate handling: helper functions and data structures.  */
60*e4b17023SJohn Marino 
61*e4b17023SJohn Marino struct pred_data
62*e4b17023SJohn Marino {
63*e4b17023SJohn Marino   struct pred_data *next;	/* for iterating over the set of all preds */
64*e4b17023SJohn Marino   const char *name;		/* predicate name */
65*e4b17023SJohn Marino   bool special;			/* special handling of modes? */
66*e4b17023SJohn Marino 
67*e4b17023SJohn Marino   /* data used primarily by genpreds.c */
68*e4b17023SJohn Marino   const char *c_block;		/* C test block */
69*e4b17023SJohn Marino   rtx exp;			/* RTL test expression */
70*e4b17023SJohn Marino 
71*e4b17023SJohn Marino   /* data used primarily by genrecog.c */
72*e4b17023SJohn Marino   enum rtx_code singleton;	/* if pred takes only one code, that code */
73*e4b17023SJohn Marino   int num_codes;		/* number of codes accepted */
74*e4b17023SJohn Marino   bool allows_non_lvalue;	/* if pred allows non-lvalue expressions */
75*e4b17023SJohn Marino   bool allows_non_const;	/* if pred allows non-const expressions */
76*e4b17023SJohn Marino   bool codes[NUM_RTX_CODE];	/* set of codes accepted */
77*e4b17023SJohn Marino };
78*e4b17023SJohn Marino 
79*e4b17023SJohn Marino extern struct pred_data *first_predicate;
80*e4b17023SJohn Marino extern struct pred_data *lookup_predicate (const char *);
81*e4b17023SJohn Marino extern void add_predicate_code (struct pred_data *, enum rtx_code);
82*e4b17023SJohn Marino extern void add_predicate (struct pred_data *);
83*e4b17023SJohn Marino 
84*e4b17023SJohn Marino #define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
85*e4b17023SJohn Marino 
86*e4b17023SJohn Marino struct pattern_stats
87*e4b17023SJohn Marino {
88*e4b17023SJohn Marino   /* The largest match_operand, match_operator or match_parallel
89*e4b17023SJohn Marino      number found.  */
90*e4b17023SJohn Marino   int max_opno;
91*e4b17023SJohn Marino 
92*e4b17023SJohn Marino   /* The largest match_dup, match_op_dup or match_par_dup number found.  */
93*e4b17023SJohn Marino   int max_dup_opno;
94*e4b17023SJohn Marino 
95*e4b17023SJohn Marino   /* The largest match_scratch number found.  */
96*e4b17023SJohn Marino   int max_scratch_opno;
97*e4b17023SJohn Marino 
98*e4b17023SJohn Marino   /* The number of times match_dup, match_op_dup or match_par_dup appears
99*e4b17023SJohn Marino      in the pattern.  */
100*e4b17023SJohn Marino   int num_dups;
101*e4b17023SJohn Marino 
102*e4b17023SJohn Marino   /* The number of rtx arguments to the generator function.  */
103*e4b17023SJohn Marino   int num_generator_args;
104*e4b17023SJohn Marino 
105*e4b17023SJohn Marino   /* The number of rtx operands in an insn.  */
106*e4b17023SJohn Marino   int num_insn_operands;
107*e4b17023SJohn Marino 
108*e4b17023SJohn Marino   /* The number of operand variables that are needed.  */
109*e4b17023SJohn Marino   int num_operand_vars;
110*e4b17023SJohn Marino };
111*e4b17023SJohn Marino 
112*e4b17023SJohn Marino extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec);
113*e4b17023SJohn Marino 
114*e4b17023SJohn Marino #endif /* GCC_GENSUPPORT_H */
115