diff options
author | J"orn Rennecke <joern.rennecke@superh.com> | 2002-07-30 17:39:27 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2002-07-30 18:39:27 +0100 |
commit | c608a6846408b980c58a301afcced74628dae731 (patch) | |
tree | 7612c3dc4c84583f8bcae27a3ea0730c2276857a /gcc | |
parent | 0a7564014ae889d9eea364e919d7b0367ecf8816 (diff) | |
download | gcc-c608a6846408b980c58a301afcced74628dae731.zip gcc-c608a6846408b980c58a301afcced74628dae731.tar.gz gcc-c608a6846408b980c58a301afcced74628dae731.tar.bz2 |
sh.md (cond_delay_slot): New attribute.
* sh.md (cond_delay_slot): New attribute.
(cbranch delay): Use it for anulled-true case.
(stuff_delay_slot): New pattern.
* sh.c (print_operand, case '.'): Don't print .s / /s fore zero-length
delay slot insn.
(gen_far_branch): Emit stuff_delay_slot pattern.
From-SVN: r55878
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/sh/sh.c | 8 | ||||
-rw-r--r-- | gcc/config/sh/sh.md | 18 |
3 files changed, 33 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 13ed48e..cd1da7b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +Tue Jul 30 18:31:31 2002 J"orn Rennecke <joern.rennecke@superh.com> + + * sh.md (cond_delay_slot): New attribute. + (cbranch delay): Use it for anulled-true case. + (stuff_delay_slot): New pattern. + * sh.c (print_operand, case '.'): Don't print .s / /s fore zero-length + delay slot insn. + (gen_far_branch): Emit stuff_delay_slot pattern. + Tue Jul 30 11:21:44 2002 J"orn Rennecke <joern.rennecke@superh.com> * unroll.c (copy_loop_body): Don't copy NOTE_INSN_LOOP_CONT. diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 6721502..d727a67 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -346,7 +346,8 @@ print_operand (stream, x, code) { case '.': if (final_sequence - && ! INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0))) + && ! INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)) + && get_attr_length (XVECEXP (final_sequence, 0, 1))) fprintf (stream, ASSEMBLER_DIALECT ? "/s" : ".s"); break; case ',': @@ -3212,6 +3213,11 @@ gen_far_branch (bp) JUMP_LABEL (jump) = bp->far_label; if (! invert_jump (insn, label, 1)) abort (); + (emit_insn_after + (gen_stuff_delay_slot + (GEN_INT (INSN_UID (XEXP (SET_SRC (PATTERN (jump)), 0))), + GEN_INT (recog_memoized (insn) == CODE_FOR_branch_false)), + insn)); /* Prevent reorg from undoing our splits. */ gen_block_redirect (jump, bp->address += 2, 2); } diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index aa64bf5..7016e74 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -696,6 +696,10 @@ (eq_attr "length" "2") (const_string "yes") ] (const_string "no"))) +(define_attr "cond_delay_slot" "yes,no" + (cond [(eq_attr "in_delay_slot" "yes") (const_string "yes") + ] (const_string "no"))) + (define_attr "is_sfunc" "" (if_then_else (eq_attr "type" "sfunc") (const_int 1) (const_int 0))) @@ -738,7 +742,7 @@ (define_delay (and (eq_attr "type" "cbranch") (ne (symbol_ref "TARGET_SH2") (const_int 0))) - [(eq_attr "in_delay_slot" "yes") (eq_attr "in_delay_slot" "yes") (nil)]) + [(eq_attr "in_delay_slot" "yes") (eq_attr "cond_delay_slot" "yes") (nil)]) ;; ------------------------------------------------------------------------- ;; SImode signed integer comparisons @@ -5141,6 +5145,18 @@ "TARGET_SH1" "" [(set_attr "length" "0")]) + +;; This one is used to preemt an insn from beyond the bra / braf / jmp +;; being pulled into the delay slot of a condbranch that has been made to +;; jump around the unconditional jump because it was out of range. +(define_insn "stuff_delay_slot" + [(set (pc) + (unspec [(match_operand 0 "const_int_operand" "") (pc)] UNSPEC_BBR)) + (set (reg:SI T_REG) (match_operand 1 "const_int_operand" ""))] + "TARGET_SH1" + "" + [(set_attr "length" "0") + (set_attr "cond_delay_slot" "yes")]) ;; Conditional branch insns |