1214152Sed//===-- save_restore_regs.S - Implement save/restore* ---------------------===//
2214152Sed//
3214152Sed//                     The LLVM Compiler Infrastructure
4214152Sed//
5222656Sed// This file is dual licensed under the MIT and the University of Illinois Open
6222656Sed// Source Licenses. See LICENSE.TXT for details.
7214152Sed//
8214152Sed//===----------------------------------------------------------------------===//
9214152Sed
10214152Sed#include "../assembly.h"
11214152Sed
12214152Sed//
13214152Sed// When compiling C++ functions that need to handle thrown exceptions the
14214152Sed// compiler is required to save all registers and call __Unwind_SjLj_Register
15214152Sed// in the function prolog.  But when compiling for thumb1, there are
16214152Sed// no instructions to access the floating point registers, so the
17214152Sed// compiler needs to add a call to the helper function _save_vfp_d8_d15_regs
18214152Sed// written in ARM to save the float registers.  In the epilog, the compiler
19214152Sed// must also add a call to __restore_vfp_d8_d15_regs to restore those registers.
20214152Sed//
21214152Sed
22214152Sed	.text
23214152Sed	.syntax unified
24214152Sed
25214152Sed//
26214152Sed// Save registers d8-d15 onto stack
27214152Sed//
28214152Sed	.align 2
29214152SedDEFINE_COMPILERRT_PRIVATE_FUNCTION(__save_vfp_d8_d15_regs)
30214152Sed	vstmdb	sp!, {d8-d15}           // push registers d8-d15 onto stack
31214152Sed	bx      lr                      // return to prolog
32214152Sed
33214152Sed	// tell linker it can break up file at label boundaries
34214152Sed	.subsections_via_symbols
35214152Sed
36