Nick Kledzik | 8ed1651 | 2010-02-02 21:34:04 +0000 | [diff] [blame] | 1 | //===-- sync_synchronize - Implement memory barrier * ----------------------===// |
| 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 | 8ed1651 | 2010-02-02 21:34:04 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "../assembly.h" |
| 11 | |
| 12 | // |
| 13 | // When compiling a use of the gcc built-in __sync_synchronize() in thumb1 mode |
| 14 | // the compiler may emit a call to __sync_synchronize. |
| 15 | // On Darwin the implementation jumps to an OS supplied function named |
| 16 | // OSMemoryBarrier |
| 17 | // |
| 18 | |
| 19 | .text |
| 20 | .syntax unified |
| 21 | |
| 22 | #if __APPLE__ |
| 23 | |
Nick Kledzik | d016b38 | 2010-04-21 22:36:23 +0000 | [diff] [blame] | 24 | .align 2 |
Nick Kledzik | 8ed1651 | 2010-02-02 21:34:04 +0000 | [diff] [blame] | 25 | DEFINE_COMPILERRT_PRIVATE_FUNCTION(__sync_synchronize) |
| 26 | stmfd sp!, {r7, lr} |
| 27 | add r7, sp, #0 |
| 28 | bl _OSMemoryBarrier |
| 29 | ldmfd sp!, {r7, pc} |
| 30 | |
| 31 | // tell linker it can break up file at label boundaries |
| 32 | .subsections_via_symbols |
| 33 | |
| 34 | #endif |