1 /* Callee-saved register spill and fill routines for RISC-V.
3 Copyright (C) 2016-2024 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
137 # CFA info is not correct in next 2 instruction since t1's
138 # value is depend on how may register really save.
142 FUNC_END (__riscv_save_12)
143 FUNC_END (__riscv_save_11)
144 FUNC_END (__riscv_save_10)
145 FUNC_END (__riscv_save_9)
146 FUNC_END (__riscv_save_8)
147 FUNC_END (__riscv_save_7)
148 FUNC_END (__riscv_save_6)
149 FUNC_END (__riscv_save_5)
150 FUNC_END (__riscv_save_4)
151 FUNC_END (__riscv_save_3)
152 FUNC_END (__riscv_save_2)
154 FUNC_BEGIN (__riscv_save_1)
155 FUNC_BEGIN (__riscv_save_0)
157 # __riscv_save_* routine use t0/x5 as return address
160 .cfi_def_cfa_offset 16
167 FUNC_END (__riscv_save_1)
168 FUNC_END (__riscv_save_0)
170 FUNC_BEGIN (__riscv_restore_12)
172 .cfi_def_cfa_offset 112
190 FUNC_BEGIN (__riscv_restore_11)
191 FUNC_BEGIN (__riscv_restore_10)
193 .cfi_def_cfa_offset 96
200 FUNC_BEGIN (__riscv_restore_9)
201 FUNC_BEGIN (__riscv_restore_8)
205 .cfi_def_cfa_offset 80
212 FUNC_BEGIN (__riscv_restore_7)
213 FUNC_BEGIN (__riscv_restore_6)
219 .cfi_def_cfa_offset 64
226 FUNC_BEGIN (__riscv_restore_5)
227 FUNC_BEGIN (__riscv_restore_4)
235 .cfi_def_cfa_offset 48
242 FUNC_BEGIN (__riscv_restore_3)
243 FUNC_BEGIN (__riscv_restore_2)
253 .cfi_def_cfa_offset 32
260 FUNC_BEGIN (__riscv_restore_1)
261 FUNC_BEGIN (__riscv_restore_0)
273 .cfi_def_cfa_offset 16
279 .cfi_def_cfa_offset 0
282 FUNC_END (__riscv_restore_12)
283 FUNC_END (__riscv_restore_11)
284 FUNC_END (__riscv_restore_10)
285 FUNC_END (__riscv_restore_9)
286 FUNC_END (__riscv_restore_8)
287 FUNC_END (__riscv_restore_7)
288 FUNC_END (__riscv_restore_6)
289 FUNC_END (__riscv_restore_5)
290 FUNC_END (__riscv_restore_4)
291 FUNC_END (__riscv_restore_3)
292 FUNC_END (__riscv_restore_2)
293 FUNC_END (__riscv_restore_1)
294 FUNC_END (__riscv_restore_0)
298 #ifdef __riscv_abi_rve
299 FUNC_BEGIN(__riscv_save_2)
300 FUNC_BEGIN(__riscv_save_1)
301 FUNC_BEGIN(__riscv_save_0)
303 # __riscv_save_* routine use t0/x5 as return address
306 .cfi_def_cfa_offset 12
315 FUNC_END(__riscv_save_2)
316 FUNC_END(__riscv_save_1)
317 FUNC_END(__riscv_save_0)
319 FUNC_BEGIN(__riscv_restore_2)
320 FUNC_BEGIN(__riscv_restore_1)
321 FUNC_BEGIN(__riscv_restore_0)
323 .cfi_def_cfa_offset 14
331 .cfi_def_cfa_offset 0
334 FUNC_END(__riscv_restore_2)
335 FUNC_END(__riscv_restore_1)
336 FUNC_END(__riscv_restore_0)
340 FUNC_BEGIN (__riscv_save_12)
342 # __riscv_save_* routine use t0/x5 as return address
345 .cfi_def_cfa_offset 64
351 FUNC_BEGIN (__riscv_save_11)
352 FUNC_BEGIN (__riscv_save_10)
353 FUNC_BEGIN (__riscv_save_9)
354 FUNC_BEGIN (__riscv_save_8)
357 .cfi_def_cfa_offset 64
370 FUNC_BEGIN (__riscv_save_7)
371 FUNC_BEGIN (__riscv_save_6)
372 FUNC_BEGIN (__riscv_save_5)
373 FUNC_BEGIN (__riscv_save_4)
380 .cfi_def_cfa_offset 64
399 # CFA info is not correct in next 2 instruction since t1's
400 # value is depend on how may register really save.
404 FUNC_END (__riscv_save_12)
405 FUNC_END (__riscv_save_11)
406 FUNC_END (__riscv_save_10)
407 FUNC_END (__riscv_save_9)
408 FUNC_END (__riscv_save_8)
409 FUNC_END (__riscv_save_7)
410 FUNC_END (__riscv_save_6)
411 FUNC_END (__riscv_save_5)
412 FUNC_END (__riscv_save_4)
414 FUNC_BEGIN (__riscv_save_3)
415 FUNC_BEGIN (__riscv_save_2)
416 FUNC_BEGIN (__riscv_save_1)
417 FUNC_BEGIN (__riscv_save_0)
419 # __riscv_save_* routine use t0/x5 as return address
422 .cfi_def_cfa_offset 16
432 FUNC_END (__riscv_save_3)
433 FUNC_END (__riscv_save_2)
434 FUNC_END (__riscv_save_1)
435 FUNC_END (__riscv_save_0)
437 FUNC_BEGIN (__riscv_restore_12)
439 .cfi_def_cfa_offset 64
457 FUNC_BEGIN (__riscv_restore_11)
458 FUNC_BEGIN (__riscv_restore_10)
459 FUNC_BEGIN (__riscv_restore_9)
460 FUNC_BEGIN (__riscv_restore_8)
462 .cfi_def_cfa_offset 48
473 FUNC_BEGIN (__riscv_restore_7)
474 FUNC_BEGIN (__riscv_restore_6)
475 FUNC_BEGIN (__riscv_restore_5)
476 FUNC_BEGIN (__riscv_restore_4)
482 .cfi_def_cfa_offset 32
493 FUNC_BEGIN (__riscv_restore_3)
494 FUNC_BEGIN (__riscv_restore_2)
495 FUNC_BEGIN (__riscv_restore_1)
496 FUNC_BEGIN (__riscv_restore_0)
505 .cfi_def_cfa_offset 16
515 .cfi_def_cfa_offset 0
518 FUNC_END (__riscv_restore_12)
519 FUNC_END (__riscv_restore_11)
520 FUNC_END (__riscv_restore_10)
521 FUNC_END (__riscv_restore_9)
522 FUNC_END (__riscv_restore_8)
523 FUNC_END (__riscv_restore_7)
524 FUNC_END (__riscv_restore_6)
525 FUNC_END (__riscv_restore_5)
526 FUNC_END (__riscv_restore_4)
527 FUNC_END (__riscv_restore_3)
528 FUNC_END (__riscv_restore_2)
529 FUNC_END (__riscv_restore_1)
530 FUNC_END (__riscv_restore_0)
532 #endif /* __riscv_abi_rve */
534 #endif /* __riscv_xlen == 64 */