summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfilingRuntime.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/profile/InstrProfilingRuntime.cc')
-rw-r--r--lib/profile/InstrProfilingRuntime.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/profile/InstrProfilingRuntime.cc b/lib/profile/InstrProfilingRuntime.cc
new file mode 100644
index 0000000000000..081ecb29e9874
--- /dev/null
+++ b/lib/profile/InstrProfilingRuntime.cc
@@ -0,0 +1,30 @@
+//===- InstrProfilingRuntime.cpp - PGO runtime initialization -------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+extern "C" {
+
+#include "InstrProfiling.h"
+
+__attribute__((visibility("hidden"))) int __llvm_profile_runtime;
+
+}
+
+namespace {
+
+class RegisterRuntime {
+public:
+ RegisterRuntime() {
+ __llvm_profile_register_write_file_atexit();
+ __llvm_profile_initialize_file();
+ }
+};
+
+RegisterRuntime Registration;
+
+}