sh.c (fixup_addr_diff_vecs): Emit braf reference label.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Thu, 3 Jun 1999 20:00:16 +0000 (20:00 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Thu, 3 Jun 1999 20:00:16 +0000 (21:00 +0100)
* 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
gcc/config/sh/sh.c
gcc/config/sh/sh.h
gcc/config/sh/sh.md

index eed6ef18697d8276d8849bff8ecc10849f8438cd..310c918e5c3a439873313e3689a6144c810f3d7b 100644 (file)
@@ -1,3 +1,14 @@
+Fri Jun  4 03:20:40 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * 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 <ddsinc09@ix.netcom.com>
 
        *fixinc/inclhack.def(Io_Def_Quotes): corrected sed expression
index 41c5ac5ecac06c049000f796c2c6cad974576dc3..feca33e1b227c93b722a393fe20a4f0fa683f0e8 100644 (file)
@@ -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;
index 83e296904e55ecd057f611fa6ef892aa62c6a6df..644668f903949737573d76e79e0b68767d9c89d7 100644 (file)
@@ -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}},                        \
index 04992a18773e0f6b86b8a4d9284881fcebfebafc..e4648bb325fa62faee0a2b3194721a99b255da2f 100644 (file)
 ;; 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.
 
                           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.  */