1 ;; Machine Descriptions for R8C/M16C/M32C
2 ;; Copyright (C) 2005-2013 Free Software Foundation, Inc.
3 ;; Contributed by Red Hat.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;; Prologue and epilogue patterns
23 (define_expand "prologue"
26 "m32c_emit_prologue(); DONE;"
29 ; For the next two, operands[0] is the amount of stack space we want
32 ; We assume dwarf2out will process each set in sequence.
33 (define_insn "prologue_enter_16"
34 [(set (mem:HI (plus:HI (reg:HI SP_REGNO) (const_int -2)))
36 (set (reg:HI FB_REGNO)
37 (plus:HI (reg:HI SP_REGNO) (const_int -2)))
38 (set (reg:HI SP_REGNO)
39 (minus:HI (reg:HI SP_REGNO)
40 (match_operand 0 "const_int_operand" "i")))
44 /* This is due to binutils bug gas/4659. */
45 if (INTVAL (operands[0]) == 2)
49 [(set_attr "flags" "x")]
52 (define_insn "prologue_enter_24"
53 [(set (mem:SI (plus:PSI (reg:PSI SP_REGNO) (const_int -4)))
55 (set (reg:PSI FB_REGNO)
56 (plus:PSI (reg:PSI SP_REGNO) (const_int -4)))
57 (set (reg:PSI SP_REGNO)
58 (minus:PSI (reg:PSI SP_REGNO)
59 (match_operand 0 "const_int_operand" "i")))
63 /* This is due to binutils bug gas/4659. */
64 if (INTVAL (operands[0]) == 4)
68 [(set_attr "flags" "x")]
71 ; Just a comment, for debugging the assembler output.
72 (define_insn "prologue_end"
73 [(unspec_volatile [(const_int 0)] UNS_PROLOGUE_END)]
76 [(set_attr "flags" "n")]
81 (define_expand "epilogue"
84 "m32c_emit_epilogue(); DONE;"
87 (define_expand "eh_return"
88 [(match_operand:PSI 0 "" "")]
90 "m32c_emit_eh_epilogue(operands[0]);
95 (define_insn "eh_epilogue"
97 (unspec_volatile [(match_operand 0 "m32c_r1_operand" "")
98 (match_operand 1 "m32c_r0_operand" "")
102 "jmp.a\t__m32c_eh_return"
103 [(set_attr "flags" "x")]
106 (define_insn "epilogue_exitd_16"
107 [(set (reg:HI SP_REGNO)
108 (plus:HI (reg:HI FB_REGNO)
110 (set (reg:HI FB_REGNO)
111 (mem:HI (reg:HI FB_REGNO)))
116 [(set_attr "flags" "x")]
119 (define_insn "epilogue_reit_16"
120 [(set (reg:HI SP_REGNO)
121 (plus:HI (reg:HI SP_REGNO)
127 [(set_attr "flags" "x")]
130 (define_insn "epilogue_exitd_24"
131 [(set (reg:PSI SP_REGNO)
132 (plus:PSI (reg:PSI FB_REGNO)
134 (set (reg:PSI FB_REGNO)
135 (mem:PSI (reg:PSI FB_REGNO)))
140 [(set_attr "flags" "x")]
143 (define_insn "epilogue_reit_24"
144 [(set (reg:PSI SP_REGNO)
145 (plus:PSI (reg:PSI SP_REGNO)
151 [(set_attr "flags" "x")]
154 (define_insn "epilogue_freit"
155 [(unspec [(const_int 0)] UNS_FREIT)
160 [(set_attr "flags" "x")]
163 (define_insn "epilogue_rts"
168 [(set_attr "flags" "x")]
171 (define_insn "epilogue_start"
172 [(unspec_volatile [(const_int 0)] UNS_EPILOGUE_START)]
174 "; start of epilogue"
175 [(set_attr "flags" "n")]
179 ; These are used by the prologue/epilogue code.
182 [(unspec [(match_operand 0 "const_int_operand" "i")] UNS_PUSHM)]
185 [(set_attr "flags" "n")]
189 [(unspec [(match_operand 0 "const_int_operand" "i")] UNS_POPM)]
192 [(set_attr "flags" "n")]
195 (define_insn "fset_b"
196 [(unspec [(const_int 0)] UNS_FSETB)]
199 [(set_attr "flags" "n")]