blob: 7f441db5383ba923a7fe73f48e1e3e272ee87b5e [file] [log] [blame]
Nick Kledzik670d09f2009-10-29 22:31:39 +00001//===-- save_restore_regs.S - Implement save/restore* ---------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnant9ad441f2010-11-16 22:13:33 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Nick Kledzik670d09f2009-10-29 22:31:39 +00007//
8//===----------------------------------------------------------------------===//
9
10#include "../assembly.h"
11
12//
13// When compiling C++ functions that need to handle thrown exceptions the
Daniel Dunbard057f7d2010-01-19 00:01:10 +000014// compiler is required to save all registers and call __Unwind_SjLj_Register
15// in the function prolog. But when compiling for thumb1, there are
Nick Kledzik670d09f2009-10-29 22:31:39 +000016// no instructions to access the floating point registers, so the
17// compiler needs to add a call to the helper function _save_vfp_d8_d15_regs
Daniel Dunbard057f7d2010-01-19 00:01:10 +000018// written in ARM to save the float registers. In the epilog, the compiler
Nick Kledzik670d09f2009-10-29 22:31:39 +000019// must also add a call to __restore_vfp_d8_d15_regs to restore those registers.
20//
21
22 .text
Daniel Dunbard057f7d2010-01-19 00:01:10 +000023 .syntax unified
Nick Kledzik670d09f2009-10-29 22:31:39 +000024
25//
26// Restore registers d8-d15 from stack
27//
Nick Kledzikd016b382010-04-21 22:36:23 +000028 .align 2
Nick Kledzik670d09f2009-10-29 22:31:39 +000029DEFINE_COMPILERRT_PRIVATE_FUNCTION(__restore_vfp_d8_d15_regs)
30 vldmia sp!, {d8-d15} // pop registers d8-d15 off stack
31 bx lr // return to prolog
32
33
34
35 // tell linker it can break up file at label boundaries
36 .subsections_via_symbols
Daniel Dunbard057f7d2010-01-19 00:01:10 +000037