]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sh.c (fixup_addr_diff_vecs): Emit braf reference label.
authorJeffrey A Law <law@cygnus.com>
Mon, 2 Aug 1999 05:02:55 +0000 (05:02 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 2 Aug 1999 05:02:55 +0000 (23:02 -0600)
        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.
Bring over from the mainline tree.

From-SVN: r28384

gcc/ChangeLog
gcc/config/sh/sh.c
gcc/config/sh/sh.h
gcc/config/sh/sh.md

index 940cd8c026e6f88bdfdc821615d93d869d9627b2..391774ce11e73c0704ea4998be84db4d38213f0a 100644 (file)
@@ -3,6 +3,16 @@ Sun Aug  1 22:46:42 1999  Jeffrey A Law  (law@cygnus.com)
        * m68k.c (output_function_prologue): Fix typo in CPU32 case.
        (output_function_epilogue): Similarly.
 
+       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 Jul 31 12:34:45 1999  Joe Buck  <jbuck@synopsys.com>
 
        * gcc.texi: Use terms "GNU Compiler Collection" and "GCC".
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 2f2a000b89da8c5e20d262c2d9c29009fce82299..40b79363b6f190a4eeadc3feb1a3339918dc308b 100644 (file)
@@ -2120,7 +2120,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.  */