From eb3881bf7d73c7c7d10ca01e9cda4182ad0d07b9 Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Thu, 3 Jun 1999 20:00:16 +0000 Subject: [PATCH] sh.c (fixup_addr_diff_vecs): Emit braf reference label. * sh.c (fixup_addr_diff_vecs): Emit braf reference label. (braf_label_ref_operand): Delete. * sh.h (PREDICATE_CODES): Remove braf_label_ref_operand. * sh.md (casesi_jump_2): Operand1 is now the inside of a label_ref, and has no predicate. The patten has a predicate to guard against invalid substitutions. (dummy_jump): Delete. (casesi): Update use of casesi_jump_2. From-SVN: r27329 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/sh/sh.c | 34 ++++++++-------------------------- gcc/config/sh/sh.h | 1 - gcc/config/sh/sh.md | 25 ++++--------------------- 4 files changed, 23 insertions(+), 48 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eed6ef18697..310c918e5c3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +Fri Jun 4 03:20:40 1999 J"orn Rennecke + + * sh.c (fixup_addr_diff_vecs): Emit braf reference label. + (braf_label_ref_operand): Delete. + * sh.h (PREDICATE_CODES): Remove braf_label_ref_operand. + * sh.md (casesi_jump_2): Operand1 is now the inside of a + label_ref, and has no predicate. + The patten has a predicate to guard against invalid substitutions. + (dummy_jump): Delete. + (casesi): Update use of casesi_jump_2. + Thu Jun 3 07:48 1999 Bruce Korb *fixinc/inclhack.def(Io_Def_Quotes): corrected sed expression diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 41c5ac5ecac..feca33e1b22 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -2641,7 +2641,7 @@ fixup_addr_diff_vecs (first) for (insn = first; insn; insn = NEXT_INSN (insn)) { - rtx vec_lab, pat, prev, prevpat, x; + rtx vec_lab, pat, prev, prevpat, x, braf_label; if (GET_CODE (insn) != JUMP_INSN || GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC) @@ -2664,10 +2664,15 @@ fixup_addr_diff_vecs (first) if (GET_CODE (x) == LABEL_REF && XEXP (x, 0) == vec_lab) break; } + + /* Emit the reference label of the braf where it belongs, right after + the casesi_jump_2 (i.e. braf). */ + braf_label = XEXP (XEXP (SET_SRC (XVECEXP (prevpat, 0, 0)), 1), 0); + emit_label_after (braf_label, prev); + /* Fix up the ADDR_DIF_VEC to be relative to the reference address of the braf. */ - XEXP (XEXP (pat, 0), 0) - = XEXP (XEXP (SET_SRC (XVECEXP (prevpat, 0, 0)), 1), 0); + XEXP (XEXP (pat, 0), 0) = braf_label; } } @@ -4303,29 +4308,6 @@ fp_one_operand (op) return REAL_VALUES_EQUAL (r, dconst1); } -int -braf_label_ref_operand(op, mode) - rtx op; - enum machine_mode mode; -{ - rtx prev; - - if (GET_CODE (op) != LABEL_REF) - return 0; - prev = prev_real_insn (XEXP (op, 0)); - if (GET_CODE (prev) != JUMP_INSN) - return 0; - prev = PATTERN (prev); - if (GET_CODE (prev) != PARALLEL || XVECLEN (prev, 0) != 2) - return 0; - prev = XVECEXP (prev, 0, 0); - if (GET_CODE (prev) != SET) - return 0; - prev = SET_SRC (prev); - if (GET_CODE (prev) != PLUS || XEXP (prev, 1) != op) - return 0; -} - int tertiary_reload_operand (op, mode) rtx op; diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 83e296904e5..644668f9039 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2129,7 +2129,6 @@ extern struct rtx_def *get_fpscr_rtx (); {"arith_reg_operand", {SUBREG, REG}}, \ {"arith_reg_or_0_operand", {SUBREG, REG, CONST_INT}}, \ {"binary_float_operator", {PLUS, MULT}}, \ - {"braf_label_ref_operand", {LABEL_REF}}, \ {"commutative_float_operator", {PLUS, MULT}}, \ {"fp_arith_reg_operand", {SUBREG, REG}}, \ {"fp_extended_operand", {SUBREG, REG, FLOAT_EXTEND}}, \ diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 04992a18773..e4648bb325f 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -3203,19 +3203,13 @@ ;; For all later processors. (define_insn "casesi_jump_2" [(set (pc) (plus:SI (match_operand:SI 0 "register_operand" "r") - (match_operand 1 "braf_label_ref_operand" ""))) + (label_ref (match_operand 1 "" "")))) (use (label_ref (match_operand 2 "" "")))] - "" + "! INSN_UID (operands[1]) || prev_real_insn (operands[1]) == insn" "braf %0%#" [(set_attr "needs_delay_slot" "yes") (set_attr "type" "jump_ind")]) -(define_insn "dummy_jump" - [(set (pc) (const_int 0))] - "" - "" - [(set_attr "length" "0")]) - ;; Call subroutine returning any type. ;; ??? This probably doesn't work. @@ -3302,20 +3296,9 @@ reg)); emit_insn (gen_casesi_worker_0 (reg2, reg, operands[3])); if (TARGET_SH2) - { - rtx lab = gen_label_rtx (); - emit_jump_insn (gen_casesi_jump_2 (reg2, - gen_rtx (LABEL_REF, VOIDmode, lab), - operands[3])); - emit_label (lab); - /* Put a fake jump after the label, lest some optimization might - delete the barrier and LAB. */ - emit_jump_insn (gen_dummy_jump ()); - } + emit_jump_insn (gen_casesi_jump_2 (reg2, gen_label_rtx (), operands[3])); else - { - emit_jump_insn (gen_casesi_jump_1 (reg2, operands[3])); - } + emit_jump_insn (gen_casesi_jump_1 (reg2, operands[3])); /* For SH2 and newer, the ADDR_DIFF_VEC is not actually relative to operands[3], but to lab. We will fix this up in machine_dependent_reorg. */ -- 2.30.2