blob: 679186ef83094d0692e3c21fa65d9e77a2db61dc [file] [log] [blame]
Duncan P. N. Exon Smith775c178a2014-03-20 19:23:53 +00001//===- InstrProfilingRuntime.cpp - PGO runtime initialization -------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Duncan P. N. Exon Smith775c178a2014-03-20 19:23:53 +00006//
7//===----------------------------------------------------------------------===//
8
9extern "C" {
10
Duncan P. N. Exon Smithbe0a5e12014-03-21 18:29:15 +000011#include "InstrProfiling.h"
Duncan P. N. Exon Smith775c178a2014-03-20 19:23:53 +000012
Xinliang David Lif0e0a742016-07-22 04:08:16 +000013/* int __llvm_profile_runtime */
14COMPILER_RT_VISIBILITY int INSTR_PROF_PROFILE_RUNTIME_VAR;
Duncan P. N. Exon Smith775c178a2014-03-20 19:23:53 +000015}
16
17namespace {
18
Duncan P. N. Exon Smith08439882014-05-16 01:30:24 +000019class RegisterRuntime {
Duncan P. N. Exon Smith775c178a2014-03-20 19:23:53 +000020public:
Duncan P. N. Exon Smith08439882014-05-16 01:30:24 +000021 RegisterRuntime() {
22 __llvm_profile_register_write_file_atexit();
Duncan P. N. Exon Smith55e4d662014-05-17 01:27:30 +000023 __llvm_profile_initialize_file();
Duncan P. N. Exon Smith08439882014-05-16 01:30:24 +000024 }
Duncan P. N. Exon Smith775c178a2014-03-20 19:23:53 +000025};
26
Duncan P. N. Exon Smith08439882014-05-16 01:30:24 +000027RegisterRuntime Registration;
Duncan P. N. Exon Smith775c178a2014-03-20 19:23:53 +000028
29}