1 ;; Machine Descriptions for R8C/M16C/M32C
2 ;; Copyright (C) 2005, 2007
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Red Hat.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 3, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;; Prologue and epilogue patterns
24 (define_expand "prologue"
27 "m32c_emit_prologue(); DONE;"
30 ; For the next two, operands[0] is the amount of stack space we want
33 ; We assume dwarf2out will process each set in sequence.
34 (define_insn "prologue_enter_16"
35 [(set (mem:HI (plus:HI (reg:HI SP_REGNO) (const_int -2)))
37 (set (reg:HI FB_REGNO)
39 (set (reg:HI SP_REGNO)
40 (minus:HI (reg:HI SP_REGNO)
41 (match_operand 0 "const_int_operand" "i")))
45 /* This is due to binutils bug gas/4659. */
46 if (INTVAL (operands[0]) == 2)
50 [(set_attr "flags" "x")]
53 (define_insn "prologue_enter_24"
54 [(set (mem:SI (plus:PSI (reg:PSI SP_REGNO) (const_int -4)))
56 (set (reg:PSI FB_REGNO)
58 (set (reg:PSI SP_REGNO)
59 (minus:PSI (reg:PSI SP_REGNO)
60 (match_operand 0 "const_int_operand" "i")))
64 /* This is due to binutils bug gas/4659. */
65 if (INTVAL (operands[0]) == 4)
69 [(set_attr "flags" "x")]
72 ; Just a comment, for debugging the assembler output.
73 (define_insn "prologue_end"
74 [(unspec_volatile [(const_int 0)] UNS_PROLOGUE_END)]
77 [(set_attr "flags" "n")]
82 (define_expand "epilogue"
85 "m32c_emit_epilogue(); DONE;"
88 (define_expand "eh_return"
89 [(match_operand:PSI 0 "" "")]
91 "m32c_emit_eh_epilogue(operands[0]); DONE;"
94 (define_insn "eh_epilogue"
96 (unspec_volatile [(match_operand 0 "m32c_r1_operand" "")
97 (match_operand 1 "m32c_r0_operand" "")
100 "jmp.a\t__m32c_eh_return"
101 [(set_attr "flags" "x")]
104 (define_insn "epilogue_exitd_16"
105 [(set (reg:HI SP_REGNO)
106 (plus:HI (reg:HI FB_REGNO)
108 (set (reg:HI FB_REGNO)
109 (mem:HI (reg:HI FB_REGNO)))
114 [(set_attr "flags" "x")]
117 (define_insn "epilogue_reit_16"
118 [(set (reg:HI SP_REGNO)
119 (plus:HI (reg:HI SP_REGNO)
125 [(set_attr "flags" "x")]
128 (define_insn "epilogue_exitd_24"
129 [(set (reg:PSI SP_REGNO)
130 (plus:PSI (reg:PSI FB_REGNO)
132 (set (reg:PSI FB_REGNO)
133 (mem:PSI (reg:PSI FB_REGNO)))
138 [(set_attr "flags" "x")]
141 (define_insn "epilogue_reit_24"
142 [(set (reg:PSI SP_REGNO)
143 (plus:PSI (reg:PSI SP_REGNO)
149 [(set_attr "flags" "x")]
152 (define_insn "epilogue_rts"
157 [(set_attr "flags" "x")]
160 (define_insn "epilogue_start"
161 [(unspec_volatile [(const_int 0)] UNS_EPILOGUE_START)]
163 "; start of epilogue"
164 [(set_attr "flags" "n")]
168 ; These are used by the prologue/epilogue code.
171 [(unspec [(match_operand 0 "const_int_operand" "i")] UNS_PUSHM)]
174 [(set_attr "flags" "n")]
178 [(unspec [(match_operand 0 "const_int_operand" "i")] UNS_POPM)]
181 [(set_attr "flags" "n")]