1//===-- save_restore_regs.S - Implement save/restore* ---------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "../assembly.h"
10
11//
12// When compiling C++ functions that need to handle thrown exceptions the
13// compiler is required to save all registers and call __Unwind_SjLj_Register
14// in the function prolog. But when compiling for thumb1, there are
15// no instructions to access the floating point registers, so the
16// compiler needs to add a call to the helper function _save_vfp_d8_d15_regs
17// written in ARM to save the float registers. In the epilog, the compiler
18// must also add a call to __restore_vfp_d8_d15_regs to restore those registers.
19//
20
21 .text
22 .syntax unified
23
24//
25// Restore registers d8-d15 from stack
26//
27 .p2align 2
28DEFINE_COMPILERRT_PRIVATE_FUNCTION(__restore_vfp_d8_d15_regs)
29 vldmia sp!, {d8-d15} // pop registers d8-d15 off stack
30 bx lr // return to prolog
31END_COMPILERRT_FUNCTION(__restore_vfp_d8_d15_regs)
32
33NO_EXEC_STACK_DIRECTIVE
34
35

source code of compiler-rt/lib/builtins/arm/restore_vfp_d8_d15_regs.S