xref: /src/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingRuntime.cpp (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1ca9211ecSDimitry Andric //===- InstrProfilingRuntime.cpp - PGO runtime initialization -------------===//
2ca9211ecSDimitry Andric //
38f3cadc2SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
48f3cadc2SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
58f3cadc2SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6ca9211ecSDimitry Andric //
7ca9211ecSDimitry Andric //===----------------------------------------------------------------------===//
8ca9211ecSDimitry Andric 
9ca9211ecSDimitry Andric extern "C" {
10ca9211ecSDimitry Andric 
11ca9211ecSDimitry Andric #include "InstrProfiling.h"
12ca9211ecSDimitry Andric 
RegisterRuntime()13e3b55780SDimitry Andric static int RegisterRuntime() {
14cfca06d7SDimitry Andric   __llvm_profile_initialize();
15e3b55780SDimitry Andric #ifdef _AIX
16e3b55780SDimitry Andric   extern COMPILER_RT_VISIBILITY void *__llvm_profile_keep[];
17e3b55780SDimitry Andric   (void)*(void *volatile *)__llvm_profile_keep;
18e3b55780SDimitry Andric #endif
19e3b55780SDimitry Andric   return 0;
20ca9211ecSDimitry Andric }
21ca9211ecSDimitry Andric 
22e3b55780SDimitry Andric /* int __llvm_profile_runtime  */
23e3b55780SDimitry Andric COMPILER_RT_VISIBILITY int INSTR_PROF_PROFILE_RUNTIME_VAR = RegisterRuntime();
24ca9211ecSDimitry Andric }
25