xref: /freebsd-src/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingInternal.c (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
15ffd83dbSDimitry Andric /*===- InstrProfilingInternal.c - Support library for PGO instrumentation -===*\
25ffd83dbSDimitry Andric |*
35ffd83dbSDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45ffd83dbSDimitry Andric |* See https://llvm.org/LICENSE.txt for license information.
55ffd83dbSDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65ffd83dbSDimitry Andric |*
75ffd83dbSDimitry Andric \*===----------------------------------------------------------------------===*/
85ffd83dbSDimitry Andric 
9*e8d8bef9SDimitry Andric // Note: This is linked into the Darwin kernel, and must remain compatible
10*e8d8bef9SDimitry Andric // with freestanding compilation. See `darwin_add_builtin_libraries`.
11*e8d8bef9SDimitry Andric 
125ffd83dbSDimitry Andric #if !defined(__Fuchsia__)
135ffd83dbSDimitry Andric 
145ffd83dbSDimitry Andric #include "InstrProfilingInternal.h"
155ffd83dbSDimitry Andric 
165ffd83dbSDimitry Andric static unsigned ProfileDumped = 0;
175ffd83dbSDimitry Andric 
185ffd83dbSDimitry Andric COMPILER_RT_VISIBILITY unsigned lprofProfileDumped() {
195ffd83dbSDimitry Andric   return ProfileDumped;
205ffd83dbSDimitry Andric }
215ffd83dbSDimitry Andric 
225ffd83dbSDimitry Andric COMPILER_RT_VISIBILITY void lprofSetProfileDumped(unsigned Value) {
235ffd83dbSDimitry Andric   ProfileDumped = Value;
245ffd83dbSDimitry Andric }
255ffd83dbSDimitry Andric 
265ffd83dbSDimitry Andric static unsigned RuntimeCounterRelocation = 0;
275ffd83dbSDimitry Andric 
285ffd83dbSDimitry Andric COMPILER_RT_VISIBILITY unsigned lprofRuntimeCounterRelocation(void) {
295ffd83dbSDimitry Andric   return RuntimeCounterRelocation;
305ffd83dbSDimitry Andric }
315ffd83dbSDimitry Andric 
325ffd83dbSDimitry Andric COMPILER_RT_VISIBILITY void lprofSetRuntimeCounterRelocation(unsigned Value) {
335ffd83dbSDimitry Andric   RuntimeCounterRelocation = Value;
345ffd83dbSDimitry Andric }
355ffd83dbSDimitry Andric 
365ffd83dbSDimitry Andric #endif
37