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. */ 13COMPILER_RT_VISIBILITY 14extern __llvm_profile_data 15 DataStart __asm("section$start$__DATA$" INSTR_PROF_DATA_SECT_NAME); 16COMPILER_RT_VISIBILITY 17extern __llvm_profile_data 18 DataEnd __asm("section$end$__DATA$" INSTR_PROF_DATA_SECT_NAME); 19COMPILER_RT_VISIBILITY 20extern char 21 NamesStart __asm("section$start$__DATA$" INSTR_PROF_NAME_SECT_NAME); 22COMPILER_RT_VISIBILITY 23extern char NamesEnd __asm("section$end$__DATA$" INSTR_PROF_NAME_SECT_NAME); 24COMPILER_RT_VISIBILITY 25extern uint64_t 26 CountersStart __asm("section$start$__DATA$" INSTR_PROF_CNTS_SECT_NAME); 27COMPILER_RT_VISIBILITY 28extern uint64_t 29 CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME); 30COMPILER_RT_VISIBILITY 31extern uint32_t 32 OrderFileStart __asm("section$start$__DATA$" INSTR_PROF_ORDERFILE_SECT_NAME); 33 34COMPILER_RT_VISIBILITY 35extern ValueProfNode 36 VNodesStart __asm("section$start$__DATA$" INSTR_PROF_VNODES_SECT_NAME); 37COMPILER_RT_VISIBILITY 38extern ValueProfNode 39 VNodesEnd __asm("section$end$__DATA$" INSTR_PROF_VNODES_SECT_NAME); 40 41COMPILER_RT_VISIBILITY 42const __llvm_profile_data *__llvm_profile_begin_data(void) { 43 return &DataStart; 44} 45COMPILER_RT_VISIBILITY 46const __llvm_profile_data *__llvm_profile_end_data(void) { return &DataEnd; } 47COMPILER_RT_VISIBILITY 48const char *__llvm_profile_begin_names(void) { return &NamesStart; } 49COMPILER_RT_VISIBILITY 50const char *__llvm_profile_end_names(void) { return &NamesEnd; } 51COMPILER_RT_VISIBILITY 52uint64_t *__llvm_profile_begin_counters(void) { return &CountersStart; } 53COMPILER_RT_VISIBILITY 54uint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; } 55COMPILER_RT_VISIBILITY 56uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; } 57 58COMPILER_RT_VISIBILITY 59ValueProfNode *__llvm_profile_begin_vnodes(void) { 60 return &VNodesStart; 61} 62COMPILER_RT_VISIBILITY 63ValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; } 64 65COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = &VNodesStart; 66COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = &VNodesEnd; 67#endif 68