diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-11-04 21:25:00 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-11-04 21:25:00 +0000 |
commit | 7f82be900335f5db3b3604365cc7f746789b43a4 (patch) | |
tree | 99a39e0c8a6a367f35a2aad560dc42aff38fce41 /gcc/recog.c | |
parent | 1d2be6a7034a4264ce912ee8c4cc15d858f1c4af (diff) | |
download | gcc-7f82be900335f5db3b3604365cc7f746789b43a4.tar.gz |
* recog.h (enum op_type): Define.
(constrain_operands): Adjust prototype.
(recog_op_type): Declare new variable.
* recog.c (recog_op_type): New variable.
(insn_invalid_p): Allow modifying an asm statement after reload.
(extract_insn): Set up recog_op_type.
(constrain_operands): Lose INSN_CODE_NUM arg. All callers changed.
Don't compute operand types, use recog_op_type.
Use the information computed by extract_insn instead of the previous
method of finding it by insn code number.
* caller-save.c (init_caller_save): Use extract_insn, not insn_extract.
* reorg.c (fill_slots_from_thread): Likewise.
* reload1.c (reload_as_needed): Likewise.
(gen_reload): Likewise.
(inc_for_reload): Likewise.
(reload_cse_simplify_operands): Likewise.
Use the information computed by extract_insn instead of the previous
method of finding it by insn code number.
* genattrtab.c (write_attr_case): Generate call to extract_insn, not
insn_extract.
* final.c (final_scan_insn): Use extract_insn, not insn_extract.
(cleanup_operand_subregs): Use extract_insn, not insn_extract.
Use the information computed by extract_insn instead of the previous
method of finding it by insn code number.
* regmove.c (find_matches): Likewise. Change meaning of the return
value to be nonzero if the optimization can be performed, zero if
not. All callers changed.
Shorten some variable names to fix formatting problems.
(regmove_optimize): Shorten some variable names to fix formatting
problems.
Use the information computed by extract_insn instead of the previous
method of finding it by insn code number.
* regclass.c (scan_one_insn): Likewise.
(record_reg_classes): Don't compute operand types, use recog_op_type.
* reload.c (find_reloads): Lose CONSTRAINTS1 variable; use
recog_constraints instead.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23529 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/recog.c')
-rw-r--r-- | gcc/recog.c | 80 |
1 files changed, 33 insertions, 47 deletions
diff --git a/gcc/recog.c b/gcc/recog.c index 17ec357f084..6ae7a31613d 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -56,7 +56,8 @@ static int insn_invalid_p PROTO((rtx)); int volatile_ok; -/* The following vectors hold the results from insn_extract. */ +/* The next variables are set up by extract_insn. The first four of them + are also set up during insn_extract. */ /* Indexed by N, gives value of operand N. */ rtx recog_operand[MAX_RECOG_OPERANDS]; @@ -72,9 +73,6 @@ rtx *recog_dup_loc[MAX_RECOG_OPERANDS]; Nth duplicate-appearance of an operand. */ char recog_dup_num[MAX_RECOG_OPERANDS]; - -/* The next variables are set up by extract_insn. */ - /* The number of operands of the insn. */ int recog_n_operands; @@ -90,6 +88,9 @@ enum machine_mode recog_operand_mode[MAX_RECOG_OPERANDS]; /* Indexed by N, gives the constraint string for operand N. */ char *recog_constraints[MAX_RECOG_OPERANDS]; +/* Indexed by N, gives the type (in, out, inout) for operand N. */ +enum op_type recog_op_type[MAX_RECOG_OPERANDS]; + #ifndef REGISTER_CONSTRAINTS /* Indexed by N, nonzero if operand N should be an address. */ char recog_operand_address_p[MAX_RECOG_OPERANDS]; @@ -264,25 +265,17 @@ insn_invalid_p (insn) int icode = recog_memoized (insn); int is_asm = icode < 0 && asm_noperands (PATTERN (insn)) >= 0; - if (is_asm) - { - if (! check_asm_operands (PATTERN (insn))) - return 1; - - /* Disallow modification of ASM_OPERANDS after reload; verifying the - constraints is too difficult. */ - if (reload_completed) - return 1; - } - else if (icode < 0) + if (is_asm && ! check_asm_operands (PATTERN (insn))) + return 1; + if (! is_asm && icode < 0) return 1; /* After reload, verify that all constraints are satisfied. */ if (reload_completed) { - insn_extract (insn); + extract_insn (insn); - if (! constrain_operands (INSN_CODE (insn), 1)) + if (! constrain_operands (1)) return 1; } @@ -304,8 +297,7 @@ apply_change_group () given a MEM and it still is a valid address, or if this is in insn and it is recognized. In the latter case, if reload has completed, we also require that the operands meet the constraints for - the insn. We do not allow modifying an ASM_OPERANDS after reload - has completed because verifying the constraints is too difficult. */ + the insn. */ for (i = 0; i < num_changes; i++) { @@ -1807,13 +1799,18 @@ extract_insn (insn) recog_operand_mode[i] = insn_operand_mode[icode][i]; } } + for (i = 0; i < noperands; i++) + recog_op_type[i] = (recog_constraints[i][0] == '=' ? OP_OUT + : recog_constraints[i][0] == '+' ? OP_INOUT + : OP_IN); } #ifdef REGISTER_CONSTRAINTS -/* Check the operands of an insn (found in recog_operands) - against the insn's operand constraints (found via INSN_CODE_NUM) +/* Check the operands of an insn against the insn's operand constraints and return 1 if they are valid. + The information about the insn's operands, constraints, operand modes + etc. is obtained from the global variables set up by extract_insn. WHICH_ALTERNATIVE is set to a number which indicates which alternative of constraints was matched: 0 for the first alternative, @@ -1843,40 +1840,35 @@ struct funny_match }; int -constrain_operands (insn_code_num, strict) - int insn_code_num; +constrain_operands (strict) int strict; { char *constraints[MAX_RECOG_OPERANDS]; int matching_operands[MAX_RECOG_OPERANDS]; - enum op_type {OP_IN, OP_OUT, OP_INOUT} op_types[MAX_RECOG_OPERANDS]; int earlyclobber[MAX_RECOG_OPERANDS]; register int c; - int noperands = insn_n_operands[insn_code_num]; struct funny_match funny_match[MAX_RECOG_OPERANDS]; int funny_match_index; - int nalternatives = insn_n_alternatives[insn_code_num]; - if (noperands == 0 || nalternatives == 0) + if (recog_n_operands == 0 || recog_n_alternatives == 0) return 1; - for (c = 0; c < noperands; c++) + for (c = 0; c < recog_n_operands; c++) { - constraints[c] = insn_operand_constraint[insn_code_num][c]; + constraints[c] = recog_constraints[c]; matching_operands[c] = -1; - op_types[c] = OP_IN; } which_alternative = 0; - while (which_alternative < nalternatives) + while (which_alternative < recog_n_alternatives) { register int opno; int lose = 0; funny_match_index = 0; - for (opno = 0; opno < noperands; opno++) + for (opno = 0; opno < recog_n_operands; opno++) { register rtx op = recog_operand[opno]; enum machine_mode mode = GET_MODE (op); @@ -1912,6 +1904,8 @@ constrain_operands (insn_code_num, strict) case '!': case '*': case '%': + case '=': + case '+': break; case '#': @@ -1921,14 +1915,6 @@ constrain_operands (insn_code_num, strict) p++; break; - case '=': - op_types[opno] = OP_OUT; - break; - - case '+': - op_types[opno] = OP_INOUT; - break; - case '&': earlyclobber[opno] = 1; break; @@ -1973,8 +1959,8 @@ constrain_operands (insn_code_num, strict) strictly valid, i.e., that all pseudos requiring hard regs have gotten them. */ if (strict <= 0 - || (strict_memory_address_p - (insn_operand_mode[insn_code_num][opno], op))) + || (strict_memory_address_p (recog_operand_mode[opno], + op))) win = 1; break; @@ -2154,18 +2140,18 @@ constrain_operands (insn_code_num, strict) operand. */ if (strict > 0) - for (eopno = 0; eopno < noperands; eopno++) + for (eopno = 0; eopno < recog_n_operands; eopno++) /* Ignore earlyclobber operands now in memory, because we would often report failure when we have two memory operands, one of which was formerly a REG. */ if (earlyclobber[eopno] && GET_CODE (recog_operand[eopno]) == REG) - for (opno = 0; opno < noperands; opno++) + for (opno = 0; opno < recog_n_operands; opno++) if ((GET_CODE (recog_operand[opno]) == MEM - || op_types[opno] != OP_OUT) + || recog_op_type[opno] != OP_OUT) && opno != eopno /* Ignore things like match_operator operands. */ - && *insn_operand_constraint[insn_code_num][opno] != 0 + && *recog_constraints[opno] != 0 && ! (matching_operands[opno] == eopno && operands_match_p (recog_operand[opno], recog_operand[eopno])) @@ -2191,7 +2177,7 @@ constrain_operands (insn_code_num, strict) /* If we are about to reject this, but we are not to test strictly, try a very loose test. Only return failure if it fails also. */ if (strict == 0) - return constrain_operands (insn_code_num, -1); + return constrain_operands (-1); else return 0; } |