Commit f62a15e3 by Bernd Schmidt Committed by Bernd Schmidt

final.c (cleanup_subreg_operands): Delete some unused code.

	* final.c (cleanup_subreg_operands): Delete some unused code.
	* recog.h (MAX_RECOG_ALTERNATIVES): New macro.
	(struct insn_alternative): New structure definition.
	(recog_op_alt): Declare variable.
	(preprocess_constraints): Declare function.
	* recog.c (recog_op_alt): New variable.
	(extract_insn): Verify number of alternatives is in range.
	(preprocess_constraints): New function.
	* reg-stack.c: Include recog.h.
	(constrain_asm_operands): Delete.
	(get_asm_operand_lengths): Delete.
	(get_asm_operand_n_inputs): New function.
	(record_asm_reg_life): Delete OPERANDS, CONSTRAINTS, N_INPUTS and
	N_OUTPUTS args.  All callers changed.
	Compute number of inputs and outputs here by calling
	get_asm_operand_n_inputs.
	Instead of constrain_asm_operands, call extract_insn,
	constrain_operands and preprocess_constaints.  Use information
	computed by these functions throughout.
	(record_reg_life): Delete code that is unused due to changes in
	record_asm_reg_life.
	(subst_asm_stack_regs): Delete OPERANDS, OPERAND_LOC, CONSTRAINTS,
	N_INPUTS and N_OUTPUTS args.  All callers changed.
	Similar changes as in record_asm_reg_life.
	(subst_stack_regs): Move n_operands declaration into the if statement
	where it's used.
	Delete code that is unused due to changes in subst_asm_stack_regs.
	* stmt.c (expand_asm_operands): Verify number of alternatives is in
	range.
	* Makefile.in (reg-stack.o): Depend on recog.h.

From-SVN: r24090
parent 71eb0b9e
Fri Dec 4 20:15:57 1998 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* final.c (cleanup_subreg_operands): Delete some unused code.
* recog.h (MAX_RECOG_ALTERNATIVES): New macro.
(struct insn_alternative): New structure definition.
(recog_op_alt): Declare variable.
(preprocess_constraints): Declare function.
* recog.c (recog_op_alt): New variable.
(extract_insn): Verify number of alternatives is in range.
(preprocess_constraints): New function.
* reg-stack.c: Include recog.h.
(constrain_asm_operands): Delete.
(get_asm_operand_lengths): Delete.
(get_asm_operand_n_inputs): New function.
(record_asm_reg_life): Delete OPERANDS, CONSTRAINTS, N_INPUTS and
N_OUTPUTS args. All callers changed.
Compute number of inputs and outputs here by calling
get_asm_operand_n_inputs.
Instead of constrain_asm_operands, call extract_insn,
constrain_operands and preprocess_constaints. Use information
computed by these functions throughout.
(record_reg_life): Delete code that is unused due to changes in
record_asm_reg_life.
(subst_asm_stack_regs): Delete OPERANDS, OPERAND_LOC, CONSTRAINTS,
N_INPUTS and N_OUTPUTS args. All callers changed.
Similar changes as in record_asm_reg_life.
(subst_stack_regs): Move n_operands declaration into the if statement
where it's used.
Delete code that is unused due to changes in subst_asm_stack_regs.
* stmt.c (expand_asm_operands): Verify number of alternatives is in
range.
* Makefile.in (reg-stack.o): Depend on recog.h.
Fri Dec 4 02:23:24 1998 Jeffrey A Law (law@cygnus.com)
* except.c (set_exception_version_code): Argument is an "int".
......
......@@ -1535,7 +1535,7 @@ final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(REGS_H) \
recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) \
$(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
insn-flags.h insn-codes.h real.h toplev.h
reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) \
reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) recog.h \
$(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h
dyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h
......
......@@ -3031,23 +3031,8 @@ void
cleanup_subreg_operands (insn)
rtx insn;
{
int insn_code_number, i;
/* Ignore things we can not handle. */
if (GET_RTX_CLASS (GET_CODE (insn)) != 'i'
|| GET_CODE (PATTERN (insn)) == USE
|| GET_CODE (PATTERN (insn)) == ADDR_VEC
|| GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
|| GET_CODE (PATTERN (insn)) == ASM_INPUT
|| asm_noperands (PATTERN (insn)) >= 0)
return;
/* Try to recognize the instruction.
If successful, verify that the operands satisfy the
constraints for the instruction. Crash if they don't,
since `reload' should have changed them so that they do. */
int i;
insn_code_number = recog_memoized (insn);
extract_insn (insn);
for (i = 0; i < recog_n_operands; i++)
{
......
......@@ -96,6 +96,10 @@ enum op_type recog_op_type[MAX_RECOG_OPERANDS];
char recog_operand_address_p[MAX_RECOG_OPERANDS];
#endif
/* Contains a vector of operand_alternative structures for every operand.
Set up by preprocess_constraints. */
struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALTERNATIVES];
/* On return from `constrain_operands', indicate which alternative
was satisfied. */
......@@ -1803,8 +1807,115 @@ extract_insn (insn)
recog_op_type[i] = (recog_constraints[i][0] == '=' ? OP_OUT
: recog_constraints[i][0] == '+' ? OP_INOUT
: OP_IN);
if (recog_n_alternatives > MAX_RECOG_ALTERNATIVES)
abort ();
}
/* After calling extract_insn, you can use this function to extract some
information from the constraint strings into a more usable form.
The collected data is stored in recog_op_alt. */
void
preprocess_constraints ()
{
int i;
for (i = 0; i < recog_n_operands; i++)
{
int j;
struct operand_alternative *op_alt;
char *p = recog_constraints[i];
op_alt = recog_op_alt[i];
for (j = 0; j < recog_n_alternatives; j++)
{
op_alt[j].class = NO_REGS;
op_alt[j].constraint = p;
op_alt[j].matches = -1;
op_alt[j].matched = -1;
if (*p == '\0' || *p == ',')
{
op_alt[j].anything_ok = 1;
continue;
}
for (;;)
{
char c = *p++;
if (c == '#')
do
c = *p++;
while (c != ',' && c != '\0');
if (c == ',' || c == '\0')
break;
switch (c)
{
case '=': case '+': case '*': case '%':
case 'E': case 'F': case 'G': case 'H':
case 's': case 'i': case 'n':
case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P':
#ifdef EXTRA_CONSTRAINT
case 'Q': case 'R': case 'S': case 'T': case 'U':
#endif
/* These don't say anything we care about. */
break;
case '?':
op_alt[j].reject += 6;
break;
case '!':
op_alt[j].reject += 600;
break;
case '&':
op_alt[j].earlyclobber = 1;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
op_alt[j].matches = c - '0';
op_alt[op_alt[j].matches].matched = i;
break;
case 'm':
op_alt[j].memory_ok = 1;
break;
case '<':
op_alt[j].decmem_ok = 1;
break;
case '>':
op_alt[j].incmem_ok = 1;
break;
case 'V':
op_alt[j].nonoffmem_ok = 1;
break;
case 'o':
op_alt[j].offmem_ok = 1;
break;
case 'X':
op_alt[j].anything_ok = 1;
break;
case 'p':
op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) BASE_REG_CLASS];
break;
case 'g': case 'r':
op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) GENERAL_REGS];
break;
default:
op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) REG_CLASS_FROM_LETTER (c)];
break;
}
}
}
}
}
#ifdef REGISTER_CONSTRAINTS
/* Check the operands of an insn against the insn's operand constraints
......
......@@ -18,6 +18,9 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Random number that should be large enough for all purposes. */
#define MAX_RECOG_ALTERNATIVES 30
/* Types of operands. */
enum op_type {
OP_IN,
......@@ -25,6 +28,44 @@ enum op_type {
OP_INOUT
};
struct operand_alternative
{
/* Pointer to the beginning of the constraint string for this alternative,
for easier access by alternative number. */
char *constraint;
/* The register class valid for this alternative (possibly NO_REGS). */
enum reg_class class;
/* "Badness" of this alternative, computed from number of '?' and '!'
characters in the constraint string. */
unsigned int reject;
/* -1 if no matching constraint was found, or an operand number. */
int matches;
/* The same information, but reversed: -1 if this operand is not
matched by any other, or the operand number of the operand that
matches this one. */
int matched;
/* Nonzero if '&' was found in the constraint string. */
unsigned int earlyclobber:1;
/* Nonzero if 'm' was found in the constraint string. */
unsigned int memory_ok:1;
/* Nonzero if 'o' was found in the constraint string. */
unsigned int offmem_ok:1;
/* Nonzero if 'V' was found in the constraint string. */
unsigned int nonoffmem_ok:1;
/* Nonzero if '<' was found in the constraint string. */
unsigned int decmem_ok:1;
/* Nonzero if '>' was found in the constraint string. */
unsigned int incmem_ok:1;
/* Nonzero if 'X' was found in the constraint string, or if the constraint
string for this alternative was empty. */
unsigned int anything_ok:1;
};
extern void init_recog PROTO((void));
extern void init_recog_no_volatile PROTO((void));
extern int recog_memoized PROTO((rtx));
......@@ -67,6 +108,7 @@ extern int recog PROTO((rtx, rtx, int *));
extern void add_clobbers PROTO((rtx, int));
extern void insn_extract PROTO((rtx));
extern void extract_insn PROTO((rtx));
extern void preprocess_constraints PROTO((void));
/* Nonzero means volatile operands are recognized. */
extern int volatile_ok;
......@@ -116,6 +158,10 @@ extern enum op_type recog_op_type[];
extern char recog_operand_address_p[];
#endif
/* Contains a vector of operand_alternative structures for every operand.
Set up by preprocess_constraints. */
struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALTERNATIVES];
/* Access the output function for CODE. */
#define OUT_FCN(CODE) (*insn_outfun[(int) (CODE)])
......
......@@ -1219,6 +1219,12 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
int nalternatives = n_occurrences (',', TREE_STRING_POINTER (tmp));
tree next = inputs;
if (nalternatives + 1 > MAX_RECOG_ALTERNATIVES)
{
error ("too many alternatives in `asm'");
return;
}
tmp = outputs;
while (tmp)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment