1*7c3d14c8STreehugger Robot /*===- InstrProfilingPlatformDarwin.c - Profile data on Darwin ------------===*\ 2*7c3d14c8STreehugger Robot |* 3*7c3d14c8STreehugger Robot |* The LLVM Compiler Infrastructure 4*7c3d14c8STreehugger Robot |* 5*7c3d14c8STreehugger Robot |* This file is distributed under the University of Illinois Open Source 6*7c3d14c8STreehugger Robot |* License. See LICENSE.TXT for details. 7*7c3d14c8STreehugger Robot |* 8*7c3d14c8STreehugger Robot \*===----------------------------------------------------------------------===*/ 9*7c3d14c8STreehugger Robot 10*7c3d14c8STreehugger Robot #include "InstrProfiling.h" 11*7c3d14c8STreehugger Robot 12*7c3d14c8STreehugger Robot #if defined(__APPLE__) 13*7c3d14c8STreehugger Robot /* Use linker magic to find the bounds of the Data section. */ 14*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY 15*7c3d14c8STreehugger Robot extern __llvm_profile_data 16*7c3d14c8STreehugger Robot DataStart __asm("section$start$__DATA$" INSTR_PROF_DATA_SECT_NAME_STR); 17*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY 18*7c3d14c8STreehugger Robot extern __llvm_profile_data 19*7c3d14c8STreehugger Robot DataEnd __asm("section$end$__DATA$" INSTR_PROF_DATA_SECT_NAME_STR); 20*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY 21*7c3d14c8STreehugger Robot extern char 22*7c3d14c8STreehugger Robot NamesStart __asm("section$start$__DATA$" INSTR_PROF_NAME_SECT_NAME_STR); 23*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY 24*7c3d14c8STreehugger Robot extern char NamesEnd __asm("section$end$__DATA$" INSTR_PROF_NAME_SECT_NAME_STR); 25*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY 26*7c3d14c8STreehugger Robot extern uint64_t 27*7c3d14c8STreehugger Robot CountersStart __asm("section$start$__DATA$" INSTR_PROF_CNTS_SECT_NAME_STR); 28*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY 29*7c3d14c8STreehugger Robot extern uint64_t 30*7c3d14c8STreehugger Robot CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME_STR); 31*7c3d14c8STreehugger Robot 32*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY 33*7c3d14c8STreehugger Robot extern ValueProfNode 34*7c3d14c8STreehugger Robot VNodesStart __asm("section$start$__DATA$" INSTR_PROF_VNODES_SECT_NAME_STR); 35*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY 36*7c3d14c8STreehugger Robot extern ValueProfNode 37*7c3d14c8STreehugger Robot VNodesEnd __asm("section$end$__DATA$" INSTR_PROF_VNODES_SECT_NAME_STR); 38*7c3d14c8STreehugger Robot 39*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY __llvm_profile_begin_data(void)40*7c3d14c8STreehugger Robotconst __llvm_profile_data *__llvm_profile_begin_data(void) { 41*7c3d14c8STreehugger Robot return &DataStart; 42*7c3d14c8STreehugger Robot } 43*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY __llvm_profile_end_data(void)44*7c3d14c8STreehugger Robotconst __llvm_profile_data *__llvm_profile_end_data(void) { return &DataEnd; } 45*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY __llvm_profile_begin_names(void)46*7c3d14c8STreehugger Robotconst char *__llvm_profile_begin_names(void) { return &NamesStart; } 47*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY __llvm_profile_end_names(void)48*7c3d14c8STreehugger Robotconst char *__llvm_profile_end_names(void) { return &NamesEnd; } 49*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY __llvm_profile_begin_counters(void)50*7c3d14c8STreehugger Robotuint64_t *__llvm_profile_begin_counters(void) { return &CountersStart; } 51*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY __llvm_profile_end_counters(void)52*7c3d14c8STreehugger Robotuint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; } 53*7c3d14c8STreehugger Robot 54*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY __llvm_profile_begin_vnodes(void)55*7c3d14c8STreehugger RobotValueProfNode *__llvm_profile_begin_vnodes(void) { 56*7c3d14c8STreehugger Robot return &VNodesStart; 57*7c3d14c8STreehugger Robot } 58*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY __llvm_profile_end_vnodes(void)59*7c3d14c8STreehugger RobotValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; } 60*7c3d14c8STreehugger Robot 61*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = &VNodesStart; 62*7c3d14c8STreehugger Robot COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = &VNodesEnd; 63*7c3d14c8STreehugger Robot #endif 64