recog.h revision 52284
162587Sitojun/* Declarations for interface to insn recognizer and insn-output.c.
278064Sume   Copyright (C) 1987, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
362587Sitojun
4139823SimpThis file is part of GNU CC.
562587Sitojun
653541SshinGNU CC is free software; you can redistribute it and/or modify
753541Sshinit under the terms of the GNU General Public License as published by
853541Sshinthe Free Software Foundation; either version 2, or (at your option)
953541Sshinany later version.
1053541Sshin
1153541SshinGNU CC is distributed in the hope that it will be useful,
1253541Sshinbut WITHOUT ANY WARRANTY; without even the implied warranty of
1353541SshinMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1453541SshinGNU General Public License for more details.
1553541Sshin
1653541SshinYou should have received a copy of the GNU General Public License
1753541Sshinalong with GNU CC; see the file COPYING.  If not, write to
1853541Sshinthe Free Software Foundation, 59 Temple Place - Suite 330,
1953541SshinBoston, MA 02111-1307, USA.  */
2053541Sshin
2153541Sshin/* Random number that should be large enough for all purposes.  */
2253541Sshin#define MAX_RECOG_ALTERNATIVES 30
2353541Sshin
2453541Sshin/* Types of operands.  */
2553541Sshinenum op_type {
2653541Sshin  OP_IN,
2753541Sshin  OP_OUT,
2853541Sshin  OP_INOUT
2953541Sshin};
3053541Sshin
3162587Sitojunstruct operand_alternative
3262587Sitojun{
33139823Simp  /* Pointer to the beginning of the constraint string for this alternative,
3462587Sitojun     for easier access by alternative number.  */
3562587Sitojun  const char *constraint;
3653541Sshin
3762587Sitojun  /* The register class valid for this alternative (possibly NO_REGS).  */
3862587Sitojun  enum reg_class class;
3962587Sitojun
4062587Sitojun  /* "Badness" of this alternative, computed from number of '?' and '!'
4162587Sitojun     characters in the constraint string.  */
4262587Sitojun  unsigned int reject;
4362587Sitojun
4462587Sitojun  /* -1 if no matching constraint was found, or an operand number.  */
4562587Sitojun  int matches;
4662587Sitojun  /* The same information, but reversed: -1 if this operand is not
4762587Sitojun     matched by any other, or the operand number of the operand that
4862587Sitojun     matches this one.  */
4962587Sitojun  int matched;
5062587Sitojun
5162587Sitojun  /* Nonzero if '&' was found in the constraint string.  */
5262587Sitojun  unsigned int earlyclobber:1;
5362587Sitojun  /* Nonzero if 'm' was found in the constraint string.  */
5462587Sitojun  unsigned int memory_ok:1;
5562587Sitojun  /* Nonzero if 'o' was found in the constraint string.  */
5662587Sitojun  unsigned int offmem_ok:1;
5762587Sitojun  /* Nonzero if 'V' was found in the constraint string.  */
5862587Sitojun  unsigned int nonoffmem_ok:1;
5962587Sitojun  /* Nonzero if '<' was found in the constraint string.  */
6062587Sitojun  unsigned int decmem_ok:1;
6162587Sitojun  /* Nonzero if '>' was found in the constraint string.  */
6253541Sshin  unsigned int incmem_ok:1;
6353541Sshin  /* Nonzero if 'X' was found in the constraint string, or if the constraint
6462587Sitojun     string for this alternative was empty.  */
6562587Sitojun  unsigned int anything_ok:1;
6662587Sitojun};
6762587Sitojun
6862587Sitojun
6962587Sitojunextern void init_recog			PROTO((void));
7062587Sitojunextern void init_recog_no_volatile	PROTO((void));
7162587Sitojunextern int recog_memoized		PROTO((rtx));
7262587Sitojunextern int check_asm_operands		PROTO((rtx));
7362587Sitojunextern int asm_operand_ok		PROTO((rtx, const char *));
7462587Sitojunextern int validate_change		PROTO((rtx, rtx *, rtx, int));
7562587Sitojunextern int apply_change_group		PROTO((void));
7662587Sitojunextern int num_validated_changes	PROTO((void));
7762587Sitojunextern void cancel_changes		PROTO((int));
7862587Sitojunextern int constrain_operands		PROTO((int));
7962587Sitojunextern int memory_address_p		PROTO((enum machine_mode, rtx));
8062587Sitojunextern int strict_memory_address_p	PROTO((enum machine_mode, rtx));
8162587Sitojunextern int validate_replace_rtx		PROTO((rtx, rtx, rtx));
8262587Sitojunextern void validate_replace_rtx_group	PROTO((rtx, rtx, rtx));
8362587Sitojunextern int validate_replace_src		PROTO((rtx, rtx, rtx));
84121499Sume#ifdef HAVE_cc0
8562587Sitojunextern int next_insn_tests_no_inequality PROTO ((rtx));
8662587Sitojun#endif
8762587Sitojunextern int reg_fits_class_p		PROTO((rtx, enum reg_class, int,
8862587Sitojun					       enum machine_mode));
8962587Sitojunextern rtx *find_single_use		PROTO((rtx, rtx, rtx *));
9062587Sitojun
9162587Sitojunextern int general_operand		PROTO((rtx, enum machine_mode));
9262587Sitojunextern int address_operand		PROTO((rtx, enum machine_mode));
9362587Sitojunextern int register_operand		PROTO((rtx, enum machine_mode));
9462587Sitojunextern int scratch_operand		PROTO((rtx, enum machine_mode));
9562587Sitojunextern int immediate_operand		PROTO((rtx, enum machine_mode));
9662587Sitojunextern int const_int_operand		PROTO((rtx, enum machine_mode));
9762587Sitojunextern int const_double_operand		PROTO((rtx, enum machine_mode));
9862587Sitojunextern int nonimmediate_operand		PROTO((rtx, enum machine_mode));
9962587Sitojunextern int nonmemory_operand		PROTO((rtx, enum machine_mode));
10062587Sitojunextern int push_operand			PROTO((rtx, enum machine_mode));
10162587Sitojunextern int pop_operand			PROTO((rtx, enum machine_mode));
10262587Sitojunextern int memory_operand		PROTO((rtx, enum machine_mode));
10362587Sitojunextern int indirect_operand		PROTO((rtx, enum machine_mode));
10462587Sitojunextern int mode_independent_operand	PROTO((rtx, enum machine_mode));
10578064Sumeextern int comparison_operator		PROTO((rtx, enum machine_mode));
10662587Sitojun
10762587Sitojunextern int offsettable_memref_p		PROTO((rtx));
10862587Sitojunextern int offsettable_nonstrict_memref_p	PROTO((rtx));
10978064Sumeextern int offsettable_address_p	PROTO((int, enum machine_mode, rtx));
11062587Sitojunextern int mode_dependent_address_p	PROTO((rtx));
11162587Sitojun
11262587Sitojunextern int recog			PROTO((rtx, rtx, int *));
11362587Sitojunextern void add_clobbers		PROTO((rtx, int));
11462587Sitojunextern void insn_extract		PROTO((rtx));
11562587Sitojunextern void extract_insn		PROTO((rtx));
11678064Sumeextern void preprocess_constraints	PROTO((void));
11778064Sume
118121499Sume/* Nonzero means volatile operands are recognized.  */
11962587Sitojunextern int volatile_ok;
12062587Sitojun
12162587Sitojun/* Set by constrain_operands to the number of the alternative that
12262587Sitojun   matched.  */
12362587Sitojunextern int which_alternative;
12462587Sitojun
12562587Sitojun/* The following vectors hold the results from insn_extract.  */
126121499Sume
12762587Sitojun/* Indexed by N, gives value of operand N.  */
12862587Sitojunextern rtx recog_operand[];
12962587Sitojun
13062587Sitojun/* Indexed by N, gives location where operand N was found.  */
13162587Sitojunextern rtx *recog_operand_loc[];
13262587Sitojun
13362587Sitojun/* Indexed by N, gives location where the Nth duplicate-appearance of
134121499Sume   an operand was found.  This is something that matched MATCH_DUP.  */
13562587Sitojunextern rtx *recog_dup_loc[];
13662587Sitojun
13762587Sitojun/* Indexed by N, gives the operand number that was duplicated in the
13862587Sitojun   Nth duplicate-appearance of an operand.  */
13962587Sitojunextern char recog_dup_num[];
14078064Sume
14178064Sume/* The next variables are set up by extract_insn.  */
142121472Sume
14378064Sume/* The number of operands of the insn.  */
144121472Sumeextern int recog_n_operands;
145121472Sume
14678064Sume/* The number of MATCH_DUPs in the insn.  */
14762587Sitojunextern int recog_n_dups;
14862587Sitojun
14962587Sitojun/* The number of alternatives in the constraints for the insn.  */
15062587Sitojunextern int recog_n_alternatives;
15162587Sitojun
15262587Sitojun/* Indexed by N, gives the mode of operand N.  */
15378064Sumeextern enum machine_mode recog_operand_mode[];
15478064Sume
15562587Sitojun/* Indexed by N, gives the constraint string for operand N.  */
15662587Sitojunextern const char *recog_constraints[];
15762587Sitojun
15862587Sitojun/* Indexed by N, gives the type (in, out, inout) for operand N.  */
15962587Sitojunextern enum op_type recog_op_type[];
16062587Sitojun
16162587Sitojun#ifndef REGISTER_CONSTRAINTS
16262587Sitojun/* Indexed by N, nonzero if operand N should be an address.  */
16378064Sumeextern char recog_operand_address_p[];
16478064Sume#endif
16562587Sitojun
16662587Sitojun/* Contains a vector of operand_alternative structures for every operand.
16762587Sitojun   Set up by preprocess_constraints.  */
16862587Sitojunextern struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALTERNATIVES];
16962587Sitojun
17062587Sitojun/* Access the output function for CODE.  */
17162587Sitojun
172121499Sume#define OUT_FCN(CODE) (*insn_outfun[(int) (CODE)])
17362587Sitojun
17462587Sitojun/* Tables defined in insn-output.c that give information about
17562587Sitojun   each insn-code value.  */
17662587Sitojun
17762587Sitojun/* These are vectors indexed by insn-code.  Details in genoutput.c.  */
17862587Sitojun
17962587Sitojunextern const char *const insn_template[];
180121478Sume
181121478Sumeextern const char *(*const insn_outfun[]) PROTO ((rtx *, rtx));
182121499Sume
18362587Sitojunextern const int insn_n_operands[];
18462587Sitojun
18562587Sitojunextern const int insn_n_dups[];
18662587Sitojun
18762587Sitojun/* Indexed by insn code number, gives # of constraint alternatives.  */
18862587Sitojun
18962587Sitojunextern const int insn_n_alternatives[];
190121499Sume
19162587Sitojun/* These are two-dimensional arrays indexed first by the insn-code
19262587Sitojun   and second by the operand number.  Details in genoutput.c.  */
19362587Sitojun
19462587Sitojun#ifdef REGISTER_CONSTRAINTS  /* Avoid undef sym in certain broken linkers.  */
19562587Sitojunextern const char *const insn_operand_constraint[][MAX_RECOG_OPERANDS];
19662587Sitojun#endif
19762587Sitojun
19862587Sitojun#ifndef REGISTER_CONSTRAINTS  /* Avoid undef sym in certain broken linkers.  */
19962587Sitojunextern const char insn_operand_address_p[][MAX_RECOG_OPERANDS];
20062587Sitojun#endif
20162587Sitojun
20262587Sitojunextern const enum machine_mode insn_operand_mode[][MAX_RECOG_OPERANDS];
20362587Sitojun
20462587Sitojunextern const char insn_operand_strict_low[][MAX_RECOG_OPERANDS];
20562587Sitojun
20662587Sitojunextern int (*const insn_operand_predicate[][MAX_RECOG_OPERANDS]) PROTO ((rtx, enum machine_mode));
20762587Sitojun
20862587Sitojunextern const char * insn_name[];
20962587Sitojun