1 /* Callee-saved register spill and fill routines for RISC-V.
3 Copyright (C) 2016-2018 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
26 #include "riscv-asm.h"
30 #if __riscv_xlen == 64
32 FUNC_BEGIN (__riscv_save_12)
34 # __riscv_save_* routine use t0/x5 as return address
37 .cfi_def_cfa_offset 112
43 FUNC_BEGIN (__riscv_save_11)
44 FUNC_BEGIN (__riscv_save_10)
47 .cfi_def_cfa_offset 112
56 FUNC_BEGIN (__riscv_save_9)
57 FUNC_BEGIN (__riscv_save_8)
62 .cfi_def_cfa_offset 112
71 FUNC_BEGIN (__riscv_save_7)
72 FUNC_BEGIN (__riscv_save_6)
79 .cfi_def_cfa_offset 112
88 FUNC_BEGIN (__riscv_save_5)
89 FUNC_BEGIN (__riscv_save_4)
101 .cfi_def_cfa_offset 112
110 FUNC_BEGIN (__riscv_save_3)
111 FUNC_BEGIN (__riscv_save_2)
125 .cfi_def_cfa_offset 112
136 # CFA info is not correct in next 2 instruction since t1's
137 # value is depend on how may register really save.
141 FUNC_END (__riscv_save_12)
142 FUNC_END (__riscv_save_11)
143 FUNC_END (__riscv_save_10)
144 FUNC_END (__riscv_save_9)
145 FUNC_END (__riscv_save_8)
146 FUNC_END (__riscv_save_7)
147 FUNC_END (__riscv_save_6)
148 FUNC_END (__riscv_save_5)
149 FUNC_END (__riscv_save_4)
150 FUNC_END (__riscv_save_3)
151 FUNC_END (__riscv_save_2)
153 FUNC_BEGIN (__riscv_save_1)
154 FUNC_BEGIN (__riscv_save_0)
156 # __riscv_save_* routine use t0/x5 as return address
159 .cfi_def_cfa_offset 16
166 FUNC_END (__riscv_save_1)
167 FUNC_END (__riscv_save_0)
169 FUNC_BEGIN (__riscv_restore_12)
171 .cfi_def_cfa_offset 112
189 FUNC_BEGIN (__riscv_restore_11)
190 FUNC_BEGIN (__riscv_restore_10)
192 .cfi_def_cfa_offset 96
199 FUNC_BEGIN (__riscv_restore_9)
200 FUNC_BEGIN (__riscv_restore_8)
204 .cfi_def_cfa_offset 80
211 FUNC_BEGIN (__riscv_restore_7)
212 FUNC_BEGIN (__riscv_restore_6)
218 .cfi_def_cfa_offset 64
225 FUNC_BEGIN (__riscv_restore_5)
226 FUNC_BEGIN (__riscv_restore_4)
234 .cfi_def_cfa_offset 48
241 FUNC_BEGIN (__riscv_restore_3)
242 FUNC_BEGIN (__riscv_restore_2)
252 .cfi_def_cfa_offset 32
259 FUNC_BEGIN (__riscv_restore_1)
260 FUNC_BEGIN (__riscv_restore_0)
272 .cfi_def_cfa_offset 16
278 .cfi_def_cfa_offset 0
281 FUNC_END (__riscv_restore_12)
282 FUNC_END (__riscv_restore_11)
283 FUNC_END (__riscv_restore_10)
284 FUNC_END (__riscv_restore_9)
285 FUNC_END (__riscv_restore_8)
286 FUNC_END (__riscv_restore_7)
287 FUNC_END (__riscv_restore_6)
288 FUNC_END (__riscv_restore_5)
289 FUNC_END (__riscv_restore_4)
290 FUNC_END (__riscv_restore_3)
291 FUNC_END (__riscv_restore_2)
292 FUNC_END (__riscv_restore_1)
293 FUNC_END (__riscv_restore_0)
298 FUNC_BEGIN(__riscv_save_2)
299 FUNC_BEGIN(__riscv_save_1)
300 FUNC_BEGIN(__riscv_save_0)
302 # __riscv_save_* routine use t0/x5 as return address
305 .cfi_def_cfa_offset 12
314 FUNC_END(__riscv_save_2)
315 FUNC_END(__riscv_save_1)
316 FUNC_END(__riscv_save_0)
318 FUNC_BEGIN(__riscv_restore_2)
319 FUNC_BEGIN(__riscv_restore_1)
320 FUNC_BEGIN(__riscv_restore_0)
322 .cfi_def_cfa_offset 14
330 .cfi_def_cfa_offset 0
333 FUNC_END(__riscv_restore_2)
334 FUNC_END(__riscv_restore_1)
335 FUNC_END(__riscv_restore_0)
339 FUNC_BEGIN (__riscv_save_12)
341 # __riscv_save_* routine use t0/x5 as return address
344 .cfi_def_cfa_offset 64
350 FUNC_BEGIN (__riscv_save_11)
351 FUNC_BEGIN (__riscv_save_10)
352 FUNC_BEGIN (__riscv_save_9)
353 FUNC_BEGIN (__riscv_save_8)
356 .cfi_def_cfa_offset 64
369 FUNC_BEGIN (__riscv_save_7)
370 FUNC_BEGIN (__riscv_save_6)
371 FUNC_BEGIN (__riscv_save_5)
372 FUNC_BEGIN (__riscv_save_4)
379 .cfi_def_cfa_offset 64
398 # CFA info is not correct in next 2 instruction since t1's
399 # value is depend on how may register really save.
403 FUNC_END (__riscv_save_12)
404 FUNC_END (__riscv_save_11)
405 FUNC_END (__riscv_save_10)
406 FUNC_END (__riscv_save_9)
407 FUNC_END (__riscv_save_8)
408 FUNC_END (__riscv_save_7)
409 FUNC_END (__riscv_save_6)
410 FUNC_END (__riscv_save_5)
411 FUNC_END (__riscv_save_4)
413 FUNC_BEGIN (__riscv_save_3)
414 FUNC_BEGIN (__riscv_save_2)
415 FUNC_BEGIN (__riscv_save_1)
416 FUNC_BEGIN (__riscv_save_0)
418 # __riscv_save_* routine use t0/x5 as return address
421 .cfi_def_cfa_offset 16
431 FUNC_END (__riscv_save_3)
432 FUNC_END (__riscv_save_2)
433 FUNC_END (__riscv_save_1)
434 FUNC_END (__riscv_save_0)
436 FUNC_BEGIN (__riscv_restore_12)
438 .cfi_def_cfa_offset 64
456 FUNC_BEGIN (__riscv_restore_11)
457 FUNC_BEGIN (__riscv_restore_10)
458 FUNC_BEGIN (__riscv_restore_9)
459 FUNC_BEGIN (__riscv_restore_8)
461 .cfi_def_cfa_offset 48
472 FUNC_BEGIN (__riscv_restore_7)
473 FUNC_BEGIN (__riscv_restore_6)
474 FUNC_BEGIN (__riscv_restore_5)
475 FUNC_BEGIN (__riscv_restore_4)
481 .cfi_def_cfa_offset 32
492 FUNC_BEGIN (__riscv_restore_3)
493 FUNC_BEGIN (__riscv_restore_2)
494 FUNC_BEGIN (__riscv_restore_1)
495 FUNC_BEGIN (__riscv_restore_0)
504 .cfi_def_cfa_offset 16
514 .cfi_def_cfa_offset 0
517 FUNC_END (__riscv_restore_12)
518 FUNC_END (__riscv_restore_11)
519 FUNC_END (__riscv_restore_10)
520 FUNC_END (__riscv_restore_9)
521 FUNC_END (__riscv_restore_8)
522 FUNC_END (__riscv_restore_7)
523 FUNC_END (__riscv_restore_6)
524 FUNC_END (__riscv_restore_5)
525 FUNC_END (__riscv_restore_4)
526 FUNC_END (__riscv_restore_3)
527 FUNC_END (__riscv_restore_2)
528 FUNC_END (__riscv_restore_1)
529 FUNC_END (__riscv_restore_0)
531 #endif /* __riscv_32e */
533 #endif /* __riscv_xlen == 64 */