Commit 84e6f1ba by Marek Michalkiewicz Committed by Denis Chertykov

avr.md: Document UNSPEC usage.

	* config/avr/avr.md: Document UNSPEC usage.
	(*tablejump_rjmp, *tablejump_lib, *tablejump_enh, *tablejump):
	Make operand 0 input only, clobber it.  Use UNSPEC, not a bogus
	MEM for program memory word reference.  Do not add the label to
	the table index in each of the asm output templates, instead ...
	(casesi): ... do it in RTL.  Adjust to match the above change.

From-SVN: r37951
parent 0884b60c
2000-11-23 Marek Michalkiewicz <marekm@linux.org.pl>
* config/avr/avr.md: Document UNSPEC usage.
(*tablejump_rjmp, *tablejump_lib, *tablejump_enh, *tablejump):
Make operand 0 input only, clobber it. Use UNSPEC, not a bogus
MEM for program memory word reference. Do not add the label to
the table index in each of the asm output templates, instead ...
(casesi): ... do it in RTL. Adjust to match the above change.
2000-12-02 Bernd Schmidt <bernds@redhat.co.uk> 2000-12-02 Bernd Schmidt <bernds@redhat.co.uk>
* c-common.c (PTRDIFF_TYPE): Provide default here, ... * c-common.c (PTRDIFF_TYPE): Provide default here, ...
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
;; the Free Software Foundation, 59 Temple Place - Suite 330, ;; the Free Software Foundation, 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA. ;; Boston, MA 02111-1307, USA.
;; UNSPEC usage:
;; 0 Length of a string, see "strlenhi".
;; 1 Read from a word address in program memory, see "casesi".
;; Condition code settings. ;; Condition code settings.
(define_attr "cc" "none,set_czn,set_zn,set_n,compare,clobber" (define_attr "cc" "none,set_czn,set_zn,set_n,compare,clobber"
(const_string "none")) (const_string "none"))
...@@ -1850,61 +1854,48 @@ ...@@ -1850,61 +1854,48 @@
;; table jump ;; table jump
;; Note: the (mem:HI (...)) memory references here are special - actually
;; the data is read from a word address in program memory (r31:r30 is the
;; index in the table, not multiplied by 2 - see the "casesi" pattern).
;; Table made from "rjmp" instructions for <=8K devices. ;; Table made from "rjmp" instructions for <=8K devices.
(define_insn "*tablejump_rjmp" (define_insn "*tablejump_rjmp"
[(set (pc) (mem:HI [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "!z,*r")] 1))
(plus:HI (match_operand:HI 0 "register_operand" "=&z") (use (label_ref (match_operand 1 "" "")))
(label_ref (match_operand 2 "" ""))))) (clobber (match_dup 0))]
(use (label_ref (match_operand 1 "" "")))]
"!AVR_MEGA" "!AVR_MEGA"
"subi r30,pm_lo8(-(%2)) "@
sbci r31,pm_hi8(-(%2)) ijmp
ijmp" push %A0\;push %B0\;ret"
[(set_attr "length" "3") [(set_attr "length" "1,3")
(set_attr "cc" "clobber")]) (set_attr "cc" "none,none")])
;; Not a prologue, but similar idea - move the common piece of code to libgcc. ;; Not a prologue, but similar idea - move the common piece of code to libgcc.
(define_insn "*tablejump_lib" (define_insn "*tablejump_lib"
[(set (pc) (mem:HI (plus:HI (match_operand:HI 0 "register_operand" "=&z") [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")] 1))
(label_ref (match_operand 2 "" ""))))) (use (label_ref (match_operand 1 "" "")))
(use (label_ref (match_operand 1 "" "")))] (clobber (match_dup 0))]
"AVR_MEGA && TARGET_CALL_PROLOGUES" "AVR_MEGA && TARGET_CALL_PROLOGUES"
"subi r30,pm_lo8(-(%2)) "jmp __tablejump2__"
sbci r31,pm_hi8(-(%2)) [(set_attr "length" "2")
jmp __tablejump2__"
[(set_attr "length" "4")
(set_attr "cc" "clobber")]) (set_attr "cc" "clobber")])
(define_insn "*tablejump_enh" (define_insn "*tablejump_enh"
[(set (pc) (mem:HI [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")] 1))
(plus:HI (match_operand:HI 0 "register_operand" "=&z") (use (label_ref (match_operand 1 "" "")))
(label_ref (match_operand 2 "" ""))))) (clobber (match_dup 0))]
(use (label_ref (match_operand 1 "" "")))]
"AVR_MEGA && AVR_ENHANCED" "AVR_MEGA && AVR_ENHANCED"
"subi r30,pm_lo8(-(%2)) "lsl r30
sbci r31,pm_hi8(-(%2))
lsl r30
rol r31 rol r31
lpm __tmp_reg__,Z+ lpm __tmp_reg__,Z+
lpm r31,Z lpm r31,Z
mov r30,__tmp_reg__ mov r30,__tmp_reg__
ijmp" ijmp"
[(set_attr "length" "8") [(set_attr "length" "6")
(set_attr "cc" "clobber")]) (set_attr "cc" "clobber")])
(define_insn "*tablejump" (define_insn "*tablejump"
[(set (pc) (mem:HI [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")] 1))
(plus:HI (match_operand:HI 0 "register_operand" "=&z") (use (label_ref (match_operand 1 "" "")))
(label_ref (match_operand 2 "" ""))))) (clobber (match_dup 0))]
(use (label_ref (match_operand 1 "" "")))]
"AVR_MEGA" "AVR_MEGA"
"subi r30,pm_lo8(-(%2)) "lsl r30
sbci r31,pm_hi8(-(%2))
lsl r30
rol r31 rol r31
lpm lpm
inc r30 inc r30
...@@ -1912,7 +1903,7 @@ ...@@ -1912,7 +1903,7 @@
lpm lpm
push r0 push r0
ret" ret"
[(set_attr "length" "10") [(set_attr "length" "8")
(set_attr "cc" "clobber")]) (set_attr "cc" "clobber")])
(define_expand "casesi" (define_expand "casesi"
...@@ -1929,16 +1920,13 @@ ...@@ -1929,16 +1920,13 @@
(const_int 0)) (const_int 0))
(label_ref (match_operand 4 "" "")) (label_ref (match_operand 4 "" ""))
(pc))) (pc)))
;; (set (match_dup 6)
;; (plus:HI (match_dup 6) (set (match_dup 6)
;; (match_dup 6))) (plus:HI (match_dup 6) (label_ref (match_operand:HI 3 "" ""))))
;; (set (match_dup 6)
;; (plus:HI (match_dup 6) (label_ref (match_operand:HI 3 "" "")))) (parallel [(set (pc) (unspec:HI [(match_dup 6)] 1))
(use (label_ref (match_dup 3)))
(parallel [(set (pc) (mem:HI (clobber (match_dup 6))])]
(plus:HI (match_dup 6)
(label_ref (match_operand:HI 3 "" "")))))
(use (label_ref (match_dup 3)))])]
"" ""
" "
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment