1*7c3d14c8STreehugger Robot//===-- sync_synchronize - Implement memory barrier * ----------------------===// 2*7c3d14c8STreehugger Robot// 3*7c3d14c8STreehugger Robot// The LLVM Compiler Infrastructure 4*7c3d14c8STreehugger Robot// 5*7c3d14c8STreehugger Robot// This file is dual licensed under the MIT and the University of Illinois Open 6*7c3d14c8STreehugger Robot// Source Licenses. See LICENSE.TXT for details. 7*7c3d14c8STreehugger Robot// 8*7c3d14c8STreehugger Robot//===----------------------------------------------------------------------===// 9*7c3d14c8STreehugger Robot 10*7c3d14c8STreehugger Robot#include "../assembly.h" 11*7c3d14c8STreehugger Robot 12*7c3d14c8STreehugger Robot// 13*7c3d14c8STreehugger Robot// When compiling a use of the gcc built-in __sync_synchronize() in thumb1 mode 14*7c3d14c8STreehugger Robot// the compiler may emit a call to __sync_synchronize. 15*7c3d14c8STreehugger Robot// On Darwin the implementation jumps to an OS supplied function named 16*7c3d14c8STreehugger Robot// OSMemoryBarrier 17*7c3d14c8STreehugger Robot// 18*7c3d14c8STreehugger Robot 19*7c3d14c8STreehugger Robot .text 20*7c3d14c8STreehugger Robot .syntax unified 21*7c3d14c8STreehugger Robot 22*7c3d14c8STreehugger Robot#if __APPLE__ 23*7c3d14c8STreehugger Robot 24*7c3d14c8STreehugger Robot .p2align 2 25*7c3d14c8STreehugger RobotDEFINE_COMPILERRT_PRIVATE_FUNCTION(__sync_synchronize) 26*7c3d14c8STreehugger Robot stmfd sp!, {r7, lr} 27*7c3d14c8STreehugger Robot add r7, sp, #0 28*7c3d14c8STreehugger Robot bl _OSMemoryBarrier 29*7c3d14c8STreehugger Robot ldmfd sp!, {r7, pc} 30*7c3d14c8STreehugger RobotEND_COMPILERRT_FUNCTION(__sync_synchronize) 31*7c3d14c8STreehugger Robot 32*7c3d14c8STreehugger Robot // tell linker it can break up file at label boundaries 33*7c3d14c8STreehugger Robot .subsections_via_symbols 34*7c3d14c8STreehugger Robot 35*7c3d14c8STreehugger Robot#endif 36*7c3d14c8STreehugger Robot 37*7c3d14c8STreehugger RobotNO_EXEC_STACK_DIRECTIVE 38*7c3d14c8STreehugger Robot 39