Nick Kledzik | 670d09f | 2009-10-29 22:31:39 +0000 | [diff] [blame] | 1 | //===-- save_restore_regs.S - Implement save/restore* ---------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | 9ad441f | 2010-11-16 22:13:33 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Nick Kledzik | 670d09f | 2009-10-29 22:31:39 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "../assembly.h" |
| 11 | |
| 12 | // |
| 13 | // When compiling C++ functions that need to handle thrown exceptions the |
Daniel Dunbar | d057f7d | 2010-01-19 00:01:10 +0000 | [diff] [blame] | 14 | // 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 Kledzik | 670d09f | 2009-10-29 22:31:39 +0000 | [diff] [blame] | 16 | // 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 Dunbar | d057f7d | 2010-01-19 00:01:10 +0000 | [diff] [blame] | 18 | // written in ARM to save the float registers. In the epilog, the compiler |
Nick Kledzik | 670d09f | 2009-10-29 22:31:39 +0000 | [diff] [blame] | 19 | // must also add a call to __restore_vfp_d8_d15_regs to restore those registers. |
| 20 | // |
| 21 | |
| 22 | .text |
Daniel Dunbar | d057f7d | 2010-01-19 00:01:10 +0000 | [diff] [blame] | 23 | .syntax unified |
Nick Kledzik | 670d09f | 2009-10-29 22:31:39 +0000 | [diff] [blame] | 24 | |
| 25 | // |
| 26 | // Save registers d8-d15 onto stack |
| 27 | // |
Nick Kledzik | d016b38 | 2010-04-21 22:36:23 +0000 | [diff] [blame] | 28 | .align 2 |
Nick Kledzik | 670d09f | 2009-10-29 22:31:39 +0000 | [diff] [blame] | 29 | DEFINE_COMPILERRT_PRIVATE_FUNCTION(__save_vfp_d8_d15_regs) |
| 30 | vstmdb sp!, {d8-d15} // push registers d8-d15 onto stack |
| 31 | bx lr // return to prolog |
| 32 | |
Nick Kledzik | 670d09f | 2009-10-29 22:31:39 +0000 | [diff] [blame] | 33 | // tell linker it can break up file at label boundaries |
| 34 | .subsections_via_symbols |
Daniel Dunbar | d057f7d | 2010-01-19 00:01:10 +0000 | [diff] [blame] | 35 | |