1 /* Callee-saved register spill and fill routines for RISC-V.
3 Copyright (C) 2016-2017 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)
297 FUNC_BEGIN (__riscv_save_12)
299 # __riscv_save_* routine use t0/x5 as return address
302 .cfi_def_cfa_offset 64
308 FUNC_BEGIN (__riscv_save_11)
309 FUNC_BEGIN (__riscv_save_10)
310 FUNC_BEGIN (__riscv_save_9)
311 FUNC_BEGIN (__riscv_save_8)
314 .cfi_def_cfa_offset 64
327 FUNC_BEGIN (__riscv_save_7)
328 FUNC_BEGIN (__riscv_save_6)
329 FUNC_BEGIN (__riscv_save_5)
330 FUNC_BEGIN (__riscv_save_4)
337 .cfi_def_cfa_offset 64
356 # CFA info is not correct in next 2 instruction since t1's
357 # value is depend on how may register really save.
361 FUNC_END (__riscv_save_12)
362 FUNC_END (__riscv_save_11)
363 FUNC_END (__riscv_save_10)
364 FUNC_END (__riscv_save_9)
365 FUNC_END (__riscv_save_8)
366 FUNC_END (__riscv_save_7)
367 FUNC_END (__riscv_save_6)
368 FUNC_END (__riscv_save_5)
369 FUNC_END (__riscv_save_4)
371 FUNC_BEGIN (__riscv_save_3)
372 FUNC_BEGIN (__riscv_save_2)
373 FUNC_BEGIN (__riscv_save_1)
374 FUNC_BEGIN (__riscv_save_0)
376 # __riscv_save_* routine use t0/x5 as return address
379 .cfi_def_cfa_offset 16
389 FUNC_END (__riscv_save_3)
390 FUNC_END (__riscv_save_2)
391 FUNC_END (__riscv_save_1)
392 FUNC_END (__riscv_save_0)
394 FUNC_BEGIN (__riscv_restore_12)
396 .cfi_def_cfa_offset 64
414 FUNC_BEGIN (__riscv_restore_11)
415 FUNC_BEGIN (__riscv_restore_10)
416 FUNC_BEGIN (__riscv_restore_9)
417 FUNC_BEGIN (__riscv_restore_8)
419 .cfi_def_cfa_offset 48
430 FUNC_BEGIN (__riscv_restore_7)
431 FUNC_BEGIN (__riscv_restore_6)
432 FUNC_BEGIN (__riscv_restore_5)
433 FUNC_BEGIN (__riscv_restore_4)
439 .cfi_def_cfa_offset 32
450 FUNC_BEGIN (__riscv_restore_3)
451 FUNC_BEGIN (__riscv_restore_2)
452 FUNC_BEGIN (__riscv_restore_1)
453 FUNC_BEGIN (__riscv_restore_0)
462 .cfi_def_cfa_offset 16
472 .cfi_def_cfa_offset 0
475 FUNC_END (__riscv_restore_12)
476 FUNC_END (__riscv_restore_11)
477 FUNC_END (__riscv_restore_10)
478 FUNC_END (__riscv_restore_9)
479 FUNC_END (__riscv_restore_8)
480 FUNC_END (__riscv_restore_7)
481 FUNC_END (__riscv_restore_6)
482 FUNC_END (__riscv_restore_5)
483 FUNC_END (__riscv_restore_4)
484 FUNC_END (__riscv_restore_3)
485 FUNC_END (__riscv_restore_2)
486 FUNC_END (__riscv_restore_1)
487 FUNC_END (__riscv_restore_0)