OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [recog.h] - Blame information for rev 328

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 280 jeremybenn
/* Declarations for interface to insn recognizer and insn-output.c.
2
   Copyright (C) 1987, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004,
3
   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify it under
8
the terms of the GNU General Public License as published by the Free
9
Software Foundation; either version 3, or (at your option) any later
10
version.
11
 
12
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13
WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15
for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING3.  If not see
19
<http://www.gnu.org/licenses/>.  */
20
 
21
/* Random number that should be large enough for all purposes.  */
22
#define MAX_RECOG_ALTERNATIVES 30
23
 
24
/* Types of operands.  */
25
enum op_type {
26
  OP_IN,
27
  OP_OUT,
28
  OP_INOUT
29
};
30
 
31
struct operand_alternative
32
{
33
  /* Pointer to the beginning of the constraint string for this alternative,
34
     for easier access by alternative number.  */
35
  const char *constraint;
36
 
37
  /* The register class valid for this alternative (possibly NO_REGS).  */
38
  enum reg_class cl;
39
 
40
  /* "Badness" of this alternative, computed from number of '?' and '!'
41
     characters in the constraint string.  */
42
  unsigned int reject;
43
 
44
  /* -1 if no matching constraint was found, or an operand number.  */
45
  int matches;
46
  /* The same information, but reversed: -1 if this operand is not
47
     matched by any other, or the operand number of the operand that
48
     matches this one.  */
49
  int matched;
50
 
51
  /* Nonzero if '&' was found in the constraint string.  */
52
  unsigned int earlyclobber:1;
53
  /* Nonzero if TARGET_MEM_CONSTRAINT was found in the constraint
54
     string.  */
55
  unsigned int memory_ok:1;
56
  /* Nonzero if 'o' was found in the constraint string.  */
57
  unsigned int offmem_ok:1;
58
  /* Nonzero if 'V' was found in the constraint string.  */
59
  unsigned int nonoffmem_ok:1;
60
  /* Nonzero if '<' was found in the constraint string.  */
61
  unsigned int decmem_ok:1;
62
  /* Nonzero if '>' was found in the constraint string.  */
63
  unsigned int incmem_ok:1;
64
  /* Nonzero if 'p' was found in the constraint string.  */
65
  unsigned int is_address:1;
66
  /* Nonzero if 'X' was found in the constraint string, or if the constraint
67
     string for this alternative was empty.  */
68
  unsigned int anything_ok:1;
69
};
70
 
71
 
72
extern void init_recog (void);
73
extern void init_recog_no_volatile (void);
74
extern int check_asm_operands (rtx);
75
extern int asm_operand_ok (rtx, const char *, const char **);
76
extern bool validate_change (rtx, rtx *, rtx, bool);
77
extern bool validate_unshare_change (rtx, rtx *, rtx, bool);
78
extern bool canonicalize_change_group (rtx insn, rtx x);
79
extern int insn_invalid_p (rtx);
80
extern int verify_changes (int);
81
extern void confirm_change_group (void);
82
extern int apply_change_group (void);
83
extern int num_validated_changes (void);
84
extern void cancel_changes (int);
85
extern int constrain_operands (int);
86
extern int constrain_operands_cached (int);
87
extern int memory_address_addr_space_p (enum machine_mode, rtx, addr_space_t);
88
#define memory_address_p(mode,addr) \
89
        memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
90
extern int strict_memory_address_addr_space_p (enum machine_mode, rtx,
91
                                               addr_space_t);
92
#define strict_memory_address_p(mode,addr) \
93
        strict_memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
94
extern int validate_replace_rtx_subexp (rtx, rtx, rtx, rtx *);
95
extern int validate_replace_rtx (rtx, rtx, rtx);
96
extern int validate_replace_rtx_part (rtx, rtx, rtx *, rtx);
97
extern int validate_replace_rtx_part_nosimplify (rtx, rtx, rtx *, rtx);
98
extern void validate_replace_rtx_group (rtx, rtx, rtx);
99
extern void validate_replace_src_group (rtx, rtx, rtx);
100
extern bool validate_simplify_insn (rtx insn);
101
extern int num_changes_pending (void);
102
#ifdef HAVE_cc0
103
extern int next_insn_tests_no_inequality (rtx);
104
#endif
105
extern int reg_fits_class_p (rtx, enum reg_class, int, enum machine_mode);
106
 
107
extern int offsettable_memref_p (rtx);
108
extern int offsettable_nonstrict_memref_p (rtx);
109
extern int offsettable_address_addr_space_p (int, enum machine_mode, rtx,
110
                                             addr_space_t);
111
#define offsettable_address_p(strict,mode,addr) \
112
        offsettable_address_addr_space_p ((strict), (mode), (addr), \
113
                                          ADDR_SPACE_GENERIC)
114
extern int mode_dependent_address_p (rtx);
115
 
116
extern int recog (rtx, rtx, int *);
117
#ifndef GENERATOR_FILE
118
static inline int recog_memoized (rtx insn);
119
#endif
120
extern void add_clobbers (rtx, int);
121
extern int added_clobbers_hard_reg_p (int);
122
extern void insn_extract (rtx);
123
extern void extract_insn (rtx);
124
extern void extract_constrain_insn_cached (rtx);
125
extern void extract_insn_cached (rtx);
126
extern void preprocess_constraints (void);
127
extern rtx peep2_next_insn (int);
128
extern int peep2_regno_dead_p (int, int);
129
extern int peep2_reg_dead_p (int, rtx);
130
#ifdef CLEAR_HARD_REG_SET
131
extern rtx peep2_find_free_register (int, int, const char *,
132
                                     enum machine_mode, HARD_REG_SET *);
133
#endif
134
extern rtx peephole2_insns (rtx, rtx, int *);
135
 
136
extern int store_data_bypass_p (rtx, rtx);
137
extern int if_test_bypass_p (rtx, rtx);
138
 
139
#ifndef GENERATOR_FILE
140
/* Try recognizing the instruction INSN,
141
   and return the code number that results.
142
   Remember the code so that repeated calls do not
143
   need to spend the time for actual rerecognition.
144
 
145
   This function is the normal interface to instruction recognition.
146
   The automatically-generated function `recog' is normally called
147
   through this one.  */
148
 
149
static inline int
150
recog_memoized (rtx insn)
151
{
152
  if (INSN_CODE (insn) < 0)
153
    INSN_CODE (insn) = recog (PATTERN (insn), insn, 0);
154
  return INSN_CODE (insn);
155
}
156
#endif
157
 
158
/* Skip chars until the next ',' or the end of the string.  This is
159
   useful to skip alternatives in a constraint string.  */
160
static inline const char *
161
skip_alternative (const char *p)
162
{
163
  const char *r = p;
164
  while (*r != '\0' && *r != ',')
165
    r++;
166
  if (*r == ',')
167
    r++;
168
  return r;
169
}
170
 
171
/* Nonzero means volatile operands are recognized.  */
172
extern int volatile_ok;
173
 
174
/* Set by constrain_operands to the number of the alternative that
175
   matched.  */
176
extern int which_alternative;
177
 
178
/* The following vectors hold the results from insn_extract.  */
179
 
180
struct recog_data
181
{
182
  /* It is very tempting to make the 5 operand related arrays into a
183
     structure and index on that.  However, to be source compatible
184
     with all of the existing md file insn constraints and output
185
     templates, we need `operand' as a flat array.  Without that
186
     member, making an array for the rest seems pointless.  */
187
 
188
  /* Gives value of operand N.  */
189
  rtx operand[MAX_RECOG_OPERANDS];
190
 
191
  /* Gives location where operand N was found.  */
192
  rtx *operand_loc[MAX_RECOG_OPERANDS];
193
 
194
  /* Gives the constraint string for operand N.  */
195
  const char *constraints[MAX_RECOG_OPERANDS];
196
 
197
  /* Gives the mode of operand N.  */
198
  enum machine_mode operand_mode[MAX_RECOG_OPERANDS];
199
 
200
  /* Gives the type (in, out, inout) for operand N.  */
201
  enum op_type operand_type[MAX_RECOG_OPERANDS];
202
 
203
  /* Gives location where the Nth duplicate-appearance of an operand
204
     was found.  This is something that matched MATCH_DUP.  */
205
  rtx *dup_loc[MAX_DUP_OPERANDS];
206
 
207
  /* Gives the operand number that was duplicated in the Nth
208
     duplicate-appearance of an operand.  */
209
  char dup_num[MAX_DUP_OPERANDS];
210
 
211
  /* ??? Note that these are `char' instead of `unsigned char' to (try to)
212
     avoid certain lossage from K&R C, wherein `unsigned char' default
213
     promotes to `unsigned int' instead of `int' as in ISO C.  As of 1999,
214
     the most common places to bootstrap from K&R C are SunOS and HPUX,
215
     both of which have signed characters by default.  The only other
216
     supported natives that have both K&R C and unsigned characters are
217
     ROMP and Irix 3, and neither have been seen for a while, but do
218
     continue to consider unsignedness when performing arithmetic inside
219
     a comparison.  */
220
 
221
  /* The number of operands of the insn.  */
222
  char n_operands;
223
 
224
  /* The number of MATCH_DUPs in the insn.  */
225
  char n_dups;
226
 
227
  /* The number of alternatives in the constraints for the insn.  */
228
  char n_alternatives;
229
 
230
  /* Specifies whether an insn alternative is enabled using the
231
     `enabled' attribute in the insn pattern definition.  For back
232
     ends not using the `enabled' attribute the array fields are
233
     always set to `true' in expand_insn.  */
234
  bool alternative_enabled_p [MAX_RECOG_ALTERNATIVES];
235
 
236
  /* In case we are caching, hold insn data was generated for.  */
237
  rtx insn;
238
};
239
 
240
extern struct recog_data recog_data;
241
 
242
/* Contains a vector of operand_alternative structures for every operand.
243
   Set up by preprocess_constraints.  */
244
extern struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALTERNATIVES];
245
 
246
/* A table defined in insn-output.c that give information about
247
   each insn-code value.  */
248
 
249
typedef int (*insn_operand_predicate_fn) (rtx, enum machine_mode);
250
typedef const char * (*insn_output_fn) (rtx *, rtx);
251
typedef rtx (*insn_gen_fn) (rtx, ...);
252
 
253
struct insn_operand_data
254
{
255
  const insn_operand_predicate_fn predicate;
256
 
257
  const char *const constraint;
258
 
259
  ENUM_BITFIELD(machine_mode) const mode : 16;
260
 
261
  const char strict_low;
262
 
263
  const char eliminable;
264
};
265
 
266
/* Legal values for insn_data.output_format.  Indicate what type of data
267
   is stored in insn_data.output.  */
268
#define INSN_OUTPUT_FORMAT_NONE         0        /* abort */
269
#define INSN_OUTPUT_FORMAT_SINGLE       1       /* const char * */
270
#define INSN_OUTPUT_FORMAT_MULTI        2       /* const char * const * */
271
#define INSN_OUTPUT_FORMAT_FUNCTION     3       /* const char * (*)(...) */
272
 
273
struct insn_data
274
{
275
  const char *const name;
276
#if HAVE_DESIGNATED_INITIALIZERS
277
  union {
278
    const char *single;
279
    const char *const *multi;
280
    insn_output_fn function;
281
  } output;
282
#else
283
  struct {
284
    const char *single;
285
    const char *const *multi;
286
    insn_output_fn function;
287
  } output;
288
#endif
289
  const insn_gen_fn genfun;
290
  const struct insn_operand_data *const operand;
291
 
292
  const char n_operands;
293
  const char n_dups;
294
  const char n_alternatives;
295
  const char output_format;
296
};
297
 
298
extern const struct insn_data insn_data[];
299
extern int peep2_current_count;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.