xref: /llvm-project/compiler-rt/lib/profile/InstrProfilingRuntime.cpp (revision c8eb932ce6408e09c739097b325008c10797846d)
162a05855SNico Weber //===- InstrProfilingRuntime.cpp - PGO runtime initialization -------------===//
262a05855SNico Weber //
362a05855SNico Weber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
462a05855SNico Weber // See https://llvm.org/LICENSE.txt for license information.
562a05855SNico Weber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
662a05855SNico Weber //
762a05855SNico Weber //===----------------------------------------------------------------------===//
862a05855SNico Weber 
962a05855SNico Weber extern "C" {
1062a05855SNico Weber 
1162a05855SNico Weber #include "InstrProfiling.h"
1262a05855SNico Weber 
RegisterRuntime()13461a1836SWael Yehia static int RegisterRuntime() {
14461a1836SWael Yehia   __llvm_profile_initialize();
15*c8eb932cSWael Yehia #ifdef _AIX
16*c8eb932cSWael Yehia   extern COMPILER_RT_VISIBILITY void *__llvm_profile_keep[];
17*c8eb932cSWael Yehia   (void)*(void *volatile *)__llvm_profile_keep;
18*c8eb932cSWael Yehia #endif
19461a1836SWael Yehia   return 0;
20461a1836SWael Yehia }
21461a1836SWael Yehia 
2262a05855SNico Weber /* int __llvm_profile_runtime  */
23*c8eb932cSWael Yehia COMPILER_RT_VISIBILITY int INSTR_PROF_PROFILE_RUNTIME_VAR = RegisterRuntime();
2462a05855SNico Weber }
25