OSDN Git Service

Replace no_new_pseudos in backends.
[pf3gnuchains/gcc-fork.git] / gcc / config / m32c / prologue.md
1 ;; Machine Descriptions for R8C/M16C/M32C
2 ;; Copyright (C) 2005, 2007
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Red Hat.
5 ;;
6 ;; This file is part of GCC.
7 ;;
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 2, or (at your
11 ;; option) any later version.
12 ;;
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.
17 ;;
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING.  If not, write to the Free
20 ;; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21 ;; 02110-1301, USA.
22
23 ;; Prologue and epilogue patterns
24
25 (define_expand "prologue"
26   [(const_int 1)]
27   ""
28   "m32c_emit_prologue(); DONE;"
29   )
30
31 ; For the next two, operands[0] is the amount of stack space we want
32 ; to reserve.
33
34 ; We assume dwarf2out will process each set in sequence.
35 (define_insn "prologue_enter_16"
36   [(set (mem:HI (plus:HI (reg:HI SP_REGNO) (const_int -2)))
37         (reg:HI FB_REGNO))
38    (set (reg:HI FB_REGNO)
39         (reg:HI SP_REGNO))
40    (set (reg:HI SP_REGNO)
41         (minus:HI (reg:HI SP_REGNO)
42                    (match_operand 0 "const_int_operand" "i")))
43    ]
44   "TARGET_A16"
45   {
46     /* This is due to binutils bug gas/4659.  */
47     if (INTVAL (operands[0]) == 2)
48       return "enter\t#0";
49     return "enter\t%0-2";
50   }
51   [(set_attr "flags" "x")]
52   )
53
54 (define_insn "prologue_enter_24"
55   [(set (mem:SI (plus:PSI (reg:PSI SP_REGNO) (const_int -4)))
56         (reg:SI FB_REGNO))
57    (set (reg:PSI FB_REGNO)
58         (reg:PSI SP_REGNO))
59    (set (reg:PSI SP_REGNO)
60         (minus:PSI (reg:PSI SP_REGNO)
61                    (match_operand 0 "const_int_operand" "i")))
62    ]
63   "TARGET_A24"
64   {
65     /* This is due to binutils bug gas/4659.  */
66     if (INTVAL (operands[0]) == 4)
67       return "enter\t#0";
68     return "enter\t%0-4";
69   }
70   [(set_attr "flags" "x")]
71   )
72
73 ; Just a comment, for debugging the assembler output.
74 (define_insn "prologue_end"
75   [(unspec_volatile [(const_int 0)] UNS_PROLOGUE_END)]
76   ""
77   "; end of prologue"
78   [(set_attr "flags" "n")]
79   )
80
81
82
83 (define_expand "epilogue"
84   [(const_int 1)]
85   ""
86   "m32c_emit_epilogue(); DONE;"
87   )
88
89 (define_expand "eh_return"
90   [(match_operand:PSI 0 "" "")]
91   ""
92   "m32c_emit_eh_epilogue(operands[0]); DONE;"
93   )
94
95 (define_insn "eh_epilogue"
96   [(set (pc)
97         (unspec_volatile [(match_operand 0 "m32c_r1_operand" "")
98                           (match_operand 1 "m32c_r0_operand" "")
99                           ] UNS_EH_EPILOGUE))]
100   ""
101   "jmp.a\t__m32c_eh_return"
102   [(set_attr "flags" "x")]
103   )
104
105 (define_insn "epilogue_exitd_16"
106   [(set (reg:HI SP_REGNO)
107         (plus:HI (reg:HI FB_REGNO)
108               (const_int 2)))
109    (set (reg:HI FB_REGNO)
110         (mem:HI (reg:HI FB_REGNO)))
111    (return)
112    ]
113   "TARGET_A16"
114   "exitd"
115   [(set_attr "flags" "x")]
116   )
117
118 (define_insn "epilogue_reit_16"
119   [(set (reg:HI SP_REGNO)
120         (plus:HI (reg:HI SP_REGNO)
121               (const_int 4)))
122    (return)
123    ]
124   "TARGET_A16"
125   "reit"
126   [(set_attr "flags" "x")]
127   )
128
129 (define_insn "epilogue_exitd_24"
130   [(set (reg:PSI SP_REGNO)
131         (plus:PSI (reg:PSI FB_REGNO)
132               (const_int 4)))
133    (set (reg:PSI FB_REGNO)
134         (mem:PSI (reg:PSI FB_REGNO)))
135    (return)
136    ]
137   "TARGET_A24"
138   "exitd"
139   [(set_attr "flags" "x")]
140   )
141
142 (define_insn "epilogue_reit_24"
143   [(set (reg:PSI SP_REGNO)
144         (plus:PSI (reg:PSI SP_REGNO)
145               (const_int 6)))
146    (return)
147    ]
148   "TARGET_A24"
149   "reit"
150   [(set_attr "flags" "x")]
151   )
152
153 (define_insn "epilogue_rts"
154   [(return)
155    ]
156   ""
157   "rts"
158   [(set_attr "flags" "x")]
159   )
160
161 (define_insn "epilogue_start"
162   [(unspec_volatile [(const_int 0)] UNS_EPILOGUE_START)]
163   ""
164   "; start of epilogue"
165   [(set_attr "flags" "n")]
166   )
167
168
169 ; These are used by the prologue/epilogue code.
170
171 (define_insn "pushm"
172   [(unspec [(match_operand 0 "const_int_operand" "i")] UNS_PUSHM)]
173   ""
174   "pushm\t%p0"
175   [(set_attr "flags" "n")]
176   )
177
178 (define_insn "popm"
179   [(unspec [(match_operand 0 "const_int_operand" "i")] UNS_POPM)]
180   ""
181   "popm\t%p0"
182   [(set_attr "flags" "n")]
183   )