X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Freorg.c;h=104ad8e467f559265571642bfb857f19b7d1e831;hp=46154f1fd3a780023b26e317bd82e4e142cf1bd4;hb=f9c6f14d623ddb87a40b7815a3b052d57a1f2c38;hpb=fafa1b4027cf6f2b496b75e0a4c083f1c2fd1561 diff --git a/gcc/reorg.c b/gcc/reorg.c index 46154f1fd3a..104ad8e467f 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -964,8 +964,7 @@ mostly_true_jump (rtx jump_insn, rtx condition) { rtx target_label = JUMP_LABEL (jump_insn); rtx insn, note; - int rare_dest = rare_destination (target_label); - int rare_fallthrough = rare_destination (NEXT_INSN (jump_insn)); + int rare_dest, rare_fallthrough; /* If branch probabilities are available, then use that number since it always gives a correct answer. */ @@ -984,32 +983,10 @@ mostly_true_jump (rtx jump_insn, rtx condition) return -1; } - /* ??? Ought to use estimate_probability instead. */ - - /* If this is a branch outside a loop, it is highly unlikely. */ - if (GET_CODE (PATTERN (jump_insn)) == SET - && GET_CODE (SET_SRC (PATTERN (jump_insn))) == IF_THEN_ELSE - && ((GET_CODE (XEXP (SET_SRC (PATTERN (jump_insn)), 1)) == LABEL_REF - && LABEL_OUTSIDE_LOOP_P (XEXP (SET_SRC (PATTERN (jump_insn)), 1))) - || (GET_CODE (XEXP (SET_SRC (PATTERN (jump_insn)), 2)) == LABEL_REF - && LABEL_OUTSIDE_LOOP_P (XEXP (SET_SRC (PATTERN (jump_insn)), 2))))) - return -1; - - if (target_label) - { - /* If this is the test of a loop, it is very likely true. We scan - backwards from the target label. If we find a NOTE_INSN_LOOP_BEG - before the next real insn, we assume the branch is to the top of - the loop. */ - for (insn = PREV_INSN (target_label); - insn && NOTE_P (insn); - insn = PREV_INSN (insn)) - if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG) - return 2; - } - /* Look at the relative rarities of the fallthrough and destination. If they differ, we can predict the branch that way. */ + rare_dest = rare_destination (target_label); + rare_fallthrough = rare_destination (NEXT_INSN (jump_insn)); switch (rare_fallthrough - rare_dest) { @@ -1030,33 +1007,6 @@ mostly_true_jump (rtx jump_insn, rtx condition) if (condition == 0) return 0; - /* EQ tests are usually false and NE tests are usually true. Also, - most quantities are positive, so we can make the appropriate guesses - about signed comparisons against zero. */ - switch (GET_CODE (condition)) - { - case CONST_INT: - /* Unconditional branch. */ - return 1; - case EQ: - return 0; - case NE: - return 1; - case LE: - case LT: - if (XEXP (condition, 1) == const0_rtx) - return 0; - break; - case GE: - case GT: - if (XEXP (condition, 1) == const0_rtx) - return 1; - break; - - default: - break; - } - /* Predict backward branches usually take, forward branches usually not. If we don't know whether this is forward or backward, assume the branch will be taken, since most are. */