xref: /freebsd-src/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingRuntime.cpp (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
168d75effSDimitry Andric //===- InstrProfilingRuntime.cpp - PGO runtime initialization -------------===//
268d75effSDimitry Andric //
368d75effSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
468d75effSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
568d75effSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
668d75effSDimitry Andric //
768d75effSDimitry Andric //===----------------------------------------------------------------------===//
868d75effSDimitry Andric 
968d75effSDimitry Andric extern "C" {
1068d75effSDimitry Andric 
1168d75effSDimitry Andric #include "InstrProfiling.h"
1268d75effSDimitry Andric 
RegisterRuntime()13*bdd1243dSDimitry Andric static int RegisterRuntime() {
145ffd83dbSDimitry Andric   __llvm_profile_initialize();
15*bdd1243dSDimitry Andric #ifdef _AIX
16*bdd1243dSDimitry Andric   extern COMPILER_RT_VISIBILITY void *__llvm_profile_keep[];
17*bdd1243dSDimitry Andric   (void)*(void *volatile *)__llvm_profile_keep;
18*bdd1243dSDimitry Andric #endif
19*bdd1243dSDimitry Andric   return 0;
2068d75effSDimitry Andric }
2168d75effSDimitry Andric 
22*bdd1243dSDimitry Andric /* int __llvm_profile_runtime  */
23*bdd1243dSDimitry Andric COMPILER_RT_VISIBILITY int INSTR_PROF_PROFILE_RUNTIME_VAR = RegisterRuntime();
2468d75effSDimitry Andric }
25