diff options
Diffstat (limited to 'gcc/recog.cc')
-rw-r--r-- | gcc/recog.cc | 137 |
1 files changed, 69 insertions, 68 deletions
diff --git a/gcc/recog.cc b/gcc/recog.cc index fd09145..3743208 100644 --- a/gcc/recog.cc +++ b/gcc/recog.cc @@ -133,7 +133,7 @@ asm_labels_ok (rtx body) /* Check that X is an insn-body for an `asm' with operands and that the operands mentioned in it are legitimate. */ -int +bool check_asm_operands (rtx x) { int noperands; @@ -142,7 +142,7 @@ check_asm_operands (rtx x) int i; if (!asm_labels_ok (x)) - return 0; + return false; /* Post-reload, be more strict with things. */ if (reload_completed) @@ -156,9 +156,9 @@ check_asm_operands (rtx x) noperands = asm_noperands (x); if (noperands < 0) - return 0; + return false; if (noperands == 0) - return 1; + return true; operands = XALLOCAVEC (rtx, noperands); constraints = XALLOCAVEC (const char *, noperands); @@ -171,10 +171,10 @@ check_asm_operands (rtx x) if (c[0] == '%') c++; if (! asm_operand_ok (operands[i], c, constraints)) - return 0; + return false; } - return 1; + return true; } /* Static data for the next two routines. */ @@ -212,8 +212,8 @@ static int temporarily_undone_changes = 0; If IN_GROUP is zero, this is a single change. Try to recognize the insn or validate the memory reference with the change applied. If the result - is not valid for the machine, suppress the change and return zero. - Otherwise, perform the change and return 1. */ + is not valid for the machine, suppress the change and return false. + Otherwise, perform the change and return true. */ static bool validate_change_1 (rtx object, rtx *loc, rtx new_rtx, bool in_group, @@ -232,7 +232,7 @@ validate_change_1 (rtx object, rtx *loc, rtx new_rtx, bool in_group, if ((old == new_rtx || rtx_equal_p (old, new_rtx)) && (new_len < 0 || XVECLEN (new_rtx, 0) == new_len)) - return 1; + return true; gcc_assert ((in_group != 0 || num_changes == 0) && (new_len < 0 || new_rtx == *loc)); @@ -275,7 +275,7 @@ validate_change_1 (rtx object, rtx *loc, rtx new_rtx, bool in_group, change group we made. */ if (in_group) - return 1; + return true; else return apply_change_group (); } @@ -348,7 +348,7 @@ check_invalid_inc_dec (rtx reg, const_rtx, void *data) match the instructions will be added to the current change group. Otherwise the changes will take effect immediately. */ -int +bool insn_invalid_p (rtx_insn *insn, bool in_group) { rtx pat = PATTERN (insn); @@ -360,14 +360,14 @@ insn_invalid_p (rtx_insn *insn, bool in_group) && ! reload_completed && ! reload_in_progress) ? &num_clobbers : 0); - int is_asm = icode < 0 && asm_noperands (PATTERN (insn)) >= 0; + bool is_asm = icode < 0 && asm_noperands (PATTERN (insn)) >= 0; /* If this is an asm and the operand aren't legal, then fail. Likewise if this is not an asm and the insn wasn't recognized. */ if ((is_asm && ! check_asm_operands (PATTERN (insn))) || (!is_asm && icode < 0)) - return 1; + return true; /* If we have to add CLOBBERs, fail if we have to add ones that reference hard registers since our callers can't know if they are live or not. @@ -377,7 +377,7 @@ insn_invalid_p (rtx_insn *insn, bool in_group) rtx newpat; if (added_clobbers_hard_reg_p (icode)) - return 1; + return true; newpat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (num_clobbers + 1)); XVECEXP (newpat, 0, 0) = pat; @@ -394,7 +394,7 @@ insn_invalid_p (rtx_insn *insn, bool in_group) extract_insn (insn); if (! constrain_operands (1, get_preferred_alternatives (insn))) - return 1; + return true; } /* Punt if REG_INC argument overlaps some stored REG. */ @@ -405,11 +405,11 @@ insn_invalid_p (rtx_insn *insn, bool in_group) rtx reg = XEXP (link, 0); note_stores (insn, check_invalid_inc_dec, ®); if (reg == NULL_RTX) - return 1; + return true; } INSN_CODE (insn) = icode; - return 0; + return false; } /* Return number of changes made and not validated yet. */ @@ -420,9 +420,9 @@ num_changes_pending (void) } /* Tentatively apply the changes numbered NUM and up. - Return 1 if all changes are valid, zero otherwise. */ + Return true if all changes are valid, false otherwise. */ -int +bool verify_changes (int num) { int i; @@ -554,21 +554,21 @@ confirm_change_group (void) } /* Apply a group of changes previously issued with `validate_change'. - If all changes are valid, call confirm_change_group and return 1, - otherwise, call cancel_changes and return 0. */ + If all changes are valid, call confirm_change_group and return true, + otherwise, call cancel_changes and return false. */ -int +bool apply_change_group (void) { if (verify_changes (0)) { confirm_change_group (); - return 1; + return true; } else { cancel_changes (0); - return 0; + return false; } } @@ -894,7 +894,7 @@ validate_replace_rtx_1 (rtx *loc, rtx from, rtx to, rtx_insn *object, with TO. After all changes have been made, validate by seeing if INSN is still valid. */ -int +bool validate_replace_rtx_subexp (rtx from, rtx to, rtx_insn *insn, rtx *loc) { validate_replace_rtx_1 (loc, from, to, insn, true); @@ -904,7 +904,7 @@ validate_replace_rtx_subexp (rtx from, rtx to, rtx_insn *insn, rtx *loc) /* Try replacing every occurrence of FROM in INSN with TO. After all changes have been made, validate by seeing if INSN is still valid. */ -int +bool validate_replace_rtx (rtx from, rtx to, rtx_insn *insn) { validate_replace_rtx_1 (&PATTERN (insn), from, to, insn, true); @@ -917,7 +917,7 @@ validate_replace_rtx (rtx from, rtx to, rtx_insn *insn) validate_replace_rtx (from, to, insn) is equivalent to validate_replace_rtx_part (from, to, &PATTERN (insn), insn). */ -int +bool validate_replace_rtx_part (rtx from, rtx to, rtx *where, rtx_insn *insn) { validate_replace_rtx_1 (where, from, to, insn, true); @@ -925,7 +925,7 @@ validate_replace_rtx_part (rtx from, rtx to, rtx *where, rtx_insn *insn) } /* Same as above, but do not simplify rtx afterwards. */ -int +bool validate_replace_rtx_part_nosimplify (rtx from, rtx to, rtx *where, rtx_insn *insn) { @@ -953,7 +953,7 @@ struct validate_replace_src_data { rtx from; /* Old RTX */ rtx to; /* New RTX */ - rtx_insn *insn; /* Insn in which substitution is occurring. */ + rtx_insn *insn; /* Insn in which substitution is occurring. */ }; static void @@ -2705,13 +2705,13 @@ extract_constrain_insn_cached (rtx_insn *insn) } /* Do cached constrain_operands on INSN and complain about failures. */ -int +bool constrain_operands_cached (rtx_insn *insn, int strict) { if (which_alternative == -1) return constrain_operands (strict, get_enabled_alternatives (insn)); else - return 1; + return true; } /* Analyze INSN and fill in recog_data. */ @@ -3029,7 +3029,7 @@ struct funny_match int this_op, other; }; -int +bool constrain_operands (int strict, alternative_mask alternatives) { const char *constraints[MAX_RECOG_OPERANDS]; @@ -3042,7 +3042,7 @@ constrain_operands (int strict, alternative_mask alternatives) which_alternative = 0; if (recog_data.n_operands == 0 || recog_data.n_alternatives == 0) - return 1; + return true; for (c = 0; c < recog_data.n_operands; c++) constraints[c] = recog_data.constraints[c]; @@ -3051,7 +3051,7 @@ constrain_operands (int strict, alternative_mask alternatives) { int seen_earlyclobber_at = -1; int opno; - int lose = 0; + bool lose = false; funny_match_index = 0; if (!TEST_BIT (alternatives, which_alternative)) @@ -3074,7 +3074,7 @@ constrain_operands (int strict, alternative_mask alternatives) machine_mode mode = GET_MODE (op); const char *p = constraints[opno]; int offset = 0; - int win = 0; + bool win = false; int val; int len; @@ -3101,7 +3101,7 @@ constrain_operands (int strict, alternative_mask alternatives) /* An empty constraint or empty alternative allows anything which matched the pattern. */ if (*p == 0 || *p == ',') - win = 1; + win = true; do switch (c = *p, len = CONSTRAINT_LEN (c, p), c) @@ -3167,7 +3167,7 @@ constrain_operands (int strict, alternative_mask alternatives) matching_operands[match] = opno; if (val != 0) - win = 1; + win = true; /* If output is *x and input is *--x, arrange later to change the output to *--x as well, since the @@ -3192,7 +3192,7 @@ constrain_operands (int strict, alternative_mask alternatives) && (strict <= 0 || (strict_memory_address_p (recog_data.operand_mode[opno], op)))) - win = 1; + win = true; break; /* No need to check general_operand again; @@ -3209,10 +3209,10 @@ constrain_operands (int strict, alternative_mask alternatives) || (reload_in_progress && REGNO (op) >= FIRST_PSEUDO_REGISTER) || reg_fits_class_p (op, GENERAL_REGS, offset, mode)) - win = 1; + win = true; } else if (strict < 0 || general_operand (op, mode)) - win = 1; + win = true; break; default: @@ -3228,11 +3228,11 @@ constrain_operands (int strict, alternative_mask alternatives) || (strict == 0 && GET_CODE (op) == SCRATCH) || (REG_P (op) && reg_fits_class_p (op, cl, offset, mode))) - win = 1; + win = true; } else if (constraint_satisfied_p (op, cn)) - win = 1; + win = true; else if ((insn_extra_memory_constraint (cn) || insn_extra_relaxed_memory_constraint (cn)) @@ -3247,11 +3247,11 @@ constrain_operands (int strict, alternative_mask alternatives) /* During reload, accept a pseudo */ || (reload_in_progress && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER))) - win = 1; + win = true; else if (insn_extra_address_constraint (cn) /* Every address operand can be reloaded to fit. */ && strict < 0) - win = 1; + win = true; /* Cater to architectures like IA-64 that define extra memory constraints without using define_memory_constraint. */ else if (reload_in_progress @@ -3261,7 +3261,7 @@ constrain_operands (int strict, alternative_mask alternatives) && reg_equiv_mem (REGNO (op)) != 0 && constraint_satisfied_p (reg_equiv_mem (REGNO (op)), cn)) - win = 1; + win = true; break; } } @@ -3271,7 +3271,7 @@ constrain_operands (int strict, alternative_mask alternatives) /* If this operand did not win somehow, this alternative loses. */ if (! win) - lose = 1; + lose = true; } /* This alternative won; the operands are ok. Change whichever operands this alternative says to change. */ @@ -3302,7 +3302,7 @@ constrain_operands (int strict, alternative_mask alternatives) recog_data.operand[eopno])) && ! safe_from_earlyclobber (recog_data.operand[opno], recog_data.operand[eopno])) - lose = 1; + lose = true; if (! lose) { @@ -3328,14 +3328,14 @@ constrain_operands (int strict, alternative_mask alternatives) if (strchr (recog_data.constraints[opno], '<') == NULL && strchr (recog_data.constraints[opno], '>') == NULL) - return 0; + return false; break; default: break; } } - return 1; + return true; } } @@ -3349,7 +3349,7 @@ constrain_operands (int strict, alternative_mask alternatives) if (strict == 0) return constrain_operands (-1, alternatives); else - return 0; + return false; } /* Return true iff OPERAND (assumed to be a REG rtx) @@ -3517,7 +3517,7 @@ split_all_insns (void) /* Same as split_all_insns, but do not expect CFG to be available. Used by machine dependent reorg passes. */ -unsigned int +void split_all_insns_noflow (void) { rtx_insn *next, *insn; @@ -3547,7 +3547,6 @@ split_all_insns_noflow (void) split_insn (insn); } } - return 0; } struct peep2_insn_data @@ -3596,7 +3595,7 @@ peep2_next_insn (int n) /* Return true if REGNO is dead before the Nth non-note insn after `current'. */ -int +bool peep2_regno_dead_p (int ofs, int regno) { gcc_assert (ofs < MAX_INSNS_PER_PEEP2 + 1); @@ -3610,7 +3609,7 @@ peep2_regno_dead_p (int ofs, int regno) /* Similarly for a REG. */ -int +bool peep2_reg_dead_p (int ofs, rtx reg) { gcc_assert (ofs < MAX_INSNS_PER_PEEP2 + 1); @@ -3622,8 +3621,8 @@ peep2_reg_dead_p (int ofs, rtx reg) unsigned int end_regno = END_REGNO (reg); for (unsigned int regno = REGNO (reg); regno < end_regno; ++regno) if (REGNO_REG_SET_P (peep2_insn_data[ofs].live_before, regno)) - return 0; - return 1; + return false; + return true; } /* Regno offset to be used in the register search. */ @@ -3673,7 +3672,8 @@ peep2_find_free_register (int from, int to, const char *class_str, for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { - int raw_regno, regno, success, j; + int raw_regno, regno, j; + bool success; /* Distribute the free registers as much as possible. */ raw_regno = search_ofs + i; @@ -3689,38 +3689,38 @@ peep2_find_free_register (int from, int to, const char *class_str, if (!targetm.hard_regno_mode_ok (regno, mode)) continue; - success = 1; + success = true; for (j = 0; success && j < hard_regno_nregs (regno, mode); j++) { /* Don't allocate fixed registers. */ if (fixed_regs[regno + j]) { - success = 0; + success = false; break; } /* Don't allocate global registers. */ if (global_regs[regno + j]) { - success = 0; + success = false; break; } /* Make sure the register is of the right class. */ if (! TEST_HARD_REG_BIT (reg_class_contents[cl], regno + j)) { - success = 0; + success = false; break; } /* And that we don't create an extra save/restore. */ if (! crtl->abi->clobbers_full_reg_p (regno + j) && ! df_regs_ever_live_p (regno + j)) { - success = 0; + success = false; break; } if (! targetm.hard_regno_scratch_ok (regno + j)) { - success = 0; + success = false; break; } @@ -3729,14 +3729,14 @@ peep2_find_free_register (int from, int to, const char *class_str, || regno + j == HARD_FRAME_POINTER_REGNUM) && (! reload_completed || frame_pointer_needed)) { - success = 0; + success = false; break; } if (TEST_HARD_REG_BIT (*reg_set, regno + j) || TEST_HARD_REG_BIT (live, regno + j)) { - success = 0; + success = false; break; } } @@ -4244,7 +4244,7 @@ store_data_bypass_p_1 (rtx_insn *out_insn, rtx in_set) data not the address operand(s) of the store. IN_INSN and OUT_INSN must be either a single_set or a PARALLEL with SETs inside. */ -int +bool store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn) { rtx in_set = single_set (in_insn); @@ -4276,7 +4276,7 @@ store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn) or multiple set; IN_INSN should be single_set for truth, but for convenience of insn categorization may be any JUMP or CALL insn. */ -int +bool if_test_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn) { rtx out_set, in_set; @@ -4618,7 +4618,8 @@ public: unsigned int execute (function *) final override { - return split_all_insns_noflow (); + split_all_insns_noflow (); + return 0; } }; // class pass_split_for_shorten_branches |