1 ; Subroutines for out of line prologues and epilogues on for the HPPA
2 ; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
4 ; This file is part of GNU CC.
6 ; GNU CC is free software; you can redistribute it and/or modify
7 ; it under the terms of the GNU General Public License as published by
8 ; the Free Software Foundation; either version 2, or (at your option)
11 ; GNU CC is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
16 ; You should have received a copy of the GNU General Public License
17 ; along with GNU CC; see the file COPYING. If not, write to
18 ; the Free Software Foundation, 59 Temple Place - Suite 330,
19 ; Boston, MA 02111-1307, USA.
22 .SUBSPA
$DATA$
,QUAD
=1,ALIGN=8,ACCESS
=31
23 .SUBSPA
$BSS$
,QUAD
=1,ALIGN=8,ACCESS
=31,ZERO
,SORT
=82
25 .SUBSPA $LIT$
,QUAD
=0,ALIGN=8,ACCESS
=44
26 .SUBSPA
$CODE$
,QUAD
=0,ALIGN=8,ACCESS
=44,CODE_ONLY
27 .SUBSPA $MILLICODE$
,QUAD
=0,ALIGN=8,ACCESS
=44,SORT
=8
30 ; This is an out-of-line prologue.
32 ; It performs the following operations:
34 ; * Saves the return pointer at sp - 20
36 ; * Creates a new stack frame (sp'), size of the frame is passed in %r21
38 ; * The old stack pointer is saved at sp (frame pointer version only).
40 ; * Saves grs (passed in low 16 bits of %r22 into the stack frame
41 ; at sp' + local_fsize (passed in %r19).
43 ; * Saves frs (passed in high 16 bits of %r22) into the stack
44 ; frame at sp' + local_fsize (passed in %r19).
46 ; * Sets up a frame pointer (in %r3) (frame pointer version only).
48 ; * Returns to the instruction _immediately_ after the call to
53 .EXPORT __outline_prologue_fp
,MILLICODE
57 .CALLINFO FRAME
=0,NO_CALLS
61 ; Subtract 4 from our return pointer so that we return to
71 ; Save our old stack pointer.
74 ; Add in local_fsize to our frame pointer so we do register
75 ; saves into the right place
78 ; %r22 tells us what registers we need to save. The upper half
79 ; is for fp registers, the lower half for integer registers.
80 ; We put the lower half in %r1 and the upper half into %r22
85 ; %r1 now olds a value 0-18 which corresponds to the number
86 ; of grs we need to save. We need to reverse that value so
87 ; we can just into the table and straight-line execute to the
88 ; end of the gr saves.
93 stws
,ma
%r18
,4(0,%r20
)
95 stws
,ma
%r17
,4(0,%r20
)
97 stws
,ma
%r16
,4(0,%r20
)
99 stws
,ma
%r15
,4(0,%r20
)
101 stws
,ma
%r14
,4(0,%r20
)
103 stws
,ma
%r13
,4(0,%r20
)
105 stws
,ma
%r12
,4(0,%r20
)
107 stws
,ma
%r11
,4(0,%r20
)
109 stws
,ma
%r10
,4(0,%r20
)
111 stws
,ma
%r9
,4(0,%r20
)
113 stws
,ma
%r8
,4(0,%r20
)
115 stws
,ma
%r7
,4(0,%r20
)
117 stws
,ma
%r6
,4(0,%r20
)
119 stws
,ma
%r5
,4(0,%r20
)
121 stws
,ma
%r4
,4(0,%r20
)
123 stws
,ma
%r3
,4(0,%r20
)
126 ; All gr saves are done. Align the temporary frame pointer and
131 comb
,= %r0
,%r22
,L
$0003
135 fstws
,ma
%fr21
,8(0,%r20
)
137 fstws
,ma
%fr20
,8(0,%r20
)
139 fstws
,ma
%fr19
,8(0,%r20
)
141 fstws
,ma
%fr18
,8(0,%r20
)
143 fstws
,ma
%fr17
,8(0,%r20
)
145 fstws
,ma
%fr16
,8(0,%r20
)
147 fstws
,ma
%fr15
,8(0,%r20
)
149 fstws
,ma
%fr14
,8(0,%r20
)
151 fstws
,ma
%fr13
,8(0,%r20
)
153 fstws
,ma
%fr12
,8(0,%r20
)
156 ; Return, setting up a frame pointer in the delay slot
163 ; This is an out-of-line epilogue. It's operation is basically the reverse
164 ; of the out-of-line prologue.
166 .EXPORT __outline_epilogue_fp
,MILLICODE
168 __outline_epilogue_fp
170 .CALLINFO FRAME
=0,NO_CALLS
172 ; Make a copy of our frame pointer into %r20
175 ; Subtract 4 from our return pointer so that we return to
176 ; the right location.
183 ; Load our old stack pointer, save it in %r21.
186 ; Add in local_fsize (%r19) to the frame pointer to find
187 ; the saved registers.
190 ; %r22 tells us what registers we need to restore. The upper half
191 ; is for fp registers, the lower half for integer registers.
192 ; We put the lower half in %r1 and the upper half into %r22
195 extrs
%r22
,15,16,%r22
197 ; %r1 now olds a value 0-18 which corresponds to the number
198 ; of grs we need to restore. We need to reverse that value so
199 ; we can just into the table and straight-line execute to the
200 ; end of the gr restore.
201 comb
,= %r0
,%r1
,L
$0006
205 ldws
,ma
4(0,%r20
),%r18
207 ldws
,ma
4(0,%r20
),%r17
209 ldws
,ma
4(0,%r20
),%r16
211 ldws
,ma
4(0,%r20
),%r15
213 ldws
,ma
4(0,%r20
),%r14
215 ldws
,ma
4(0,%r20
),%r13
217 ldws
,ma
4(0,%r20
),%r12
219 ldws
,ma
4(0,%r20
),%r11
221 ldws
,ma
4(0,%r20
),%r10
223 ldws
,ma
4(0,%r20
),%r9
225 ldws
,ma
4(0,%r20
),%r8
227 ldws
,ma
4(0,%r20
),%r7
229 ldws
,ma
4(0,%r20
),%r6
231 ldws
,ma
4(0,%r20
),%r5
233 ldws
,ma
4(0,%r20
),%r4
235 ldws
,ma
4(0,%r20
),%r3
238 ; All gr restore are done. Align the temporary frame pointer and
243 comb
,= %r0
,%r22
,L
$0007
247 fldws
,ma
8(0,%r20
),%fr21
249 fldws
,ma
8(0,%r20
),%fr20
251 fldws
,ma
8(0,%r20
),%fr19
253 fldws
,ma
8(0,%r20
),%fr18
255 fldws
,ma
8(0,%r20
),%fr17
257 fldws
,ma
8(0,%r20
),%fr16
259 fldws
,ma
8(0,%r20
),%fr15
261 fldws
,ma
8(0,%r20
),%fr14
263 fldws
,ma
8(0,%r20
),%fr13
265 fldws
,ma
8(0,%r20
),%fr12
268 ; Return and deallocate our frame.