1 /*===- InstrProfilingPlatformDarwin.c - Profile data on Darwin ------------===*\ 2 |* 3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 |* See https://llvm.org/LICENSE.txt for license information. 5 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 |* 7 \*===----------------------------------------------------------------------===*/ 8 9 #include "InstrProfiling.h" 10 11 #if defined(__APPLE__) 12 /* Use linker magic to find the bounds of the Data section. */ 13 COMPILER_RT_VISIBILITY 14 extern __llvm_profile_data 15 DataStart __asm("section$start$__DATA$" INSTR_PROF_DATA_SECT_NAME); 16 COMPILER_RT_VISIBILITY 17 extern __llvm_profile_data 18 DataEnd __asm("section$end$__DATA$" INSTR_PROF_DATA_SECT_NAME); 19 COMPILER_RT_VISIBILITY 20 extern char 21 NamesStart __asm("section$start$__DATA$" INSTR_PROF_NAME_SECT_NAME); 22 COMPILER_RT_VISIBILITY 23 extern char NamesEnd __asm("section$end$__DATA$" INSTR_PROF_NAME_SECT_NAME); 24 COMPILER_RT_VISIBILITY 25 extern uint64_t 26 CountersStart __asm("section$start$__DATA$" INSTR_PROF_CNTS_SECT_NAME); 27 COMPILER_RT_VISIBILITY 28 extern uint64_t 29 CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME); 30 COMPILER_RT_VISIBILITY 31 extern uint32_t 32 OrderFileStart __asm("section$start$__DATA$" INSTR_PROF_ORDERFILE_SECT_NAME); 33 34 COMPILER_RT_VISIBILITY 35 extern ValueProfNode 36 VNodesStart __asm("section$start$__DATA$" INSTR_PROF_VNODES_SECT_NAME); 37 COMPILER_RT_VISIBILITY 38 extern ValueProfNode 39 VNodesEnd __asm("section$end$__DATA$" INSTR_PROF_VNODES_SECT_NAME); 40 41 COMPILER_RT_VISIBILITY 42 const __llvm_profile_data *__llvm_profile_begin_data(void) { 43 return &DataStart; 44 } 45 COMPILER_RT_VISIBILITY 46 const __llvm_profile_data *__llvm_profile_end_data(void) { return &DataEnd; } 47 COMPILER_RT_VISIBILITY 48 const char *__llvm_profile_begin_names(void) { return &NamesStart; } 49 COMPILER_RT_VISIBILITY 50 const char *__llvm_profile_end_names(void) { return &NamesEnd; } 51 COMPILER_RT_VISIBILITY 52 uint64_t *__llvm_profile_begin_counters(void) { return &CountersStart; } 53 COMPILER_RT_VISIBILITY 54 uint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; } 55 COMPILER_RT_VISIBILITY 56 uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; } 57 58 COMPILER_RT_VISIBILITY 59 ValueProfNode *__llvm_profile_begin_vnodes(void) { 60 return &VNodesStart; 61 } 62 COMPILER_RT_VISIBILITY 63 ValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; } 64 65 COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = &VNodesStart; 66 COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = &VNodesEnd; 67 #endif 68