summaryrefslogtreecommitdiff
path: root/lib/profile
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-20 20:00:44 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-20 20:00:44 +0000
commit466c14d333316d80cdf0f3526988eb6cde998c30 (patch)
tree1eff7457191629e0366f63573395fc608e4097aa /lib/profile
parent26fd98f10dccdd6665e7308bb4835173f75628a0 (diff)
downloadcompiler-rt-466c14d333316d80cdf0f3526988eb6cde998c30.tar.gz
PGO: Change runtime prefix from pgo to profile
These functions are in the profile runtime. PGO comes later. Unfortunately, there's only room for 16 characters in a Darwin section, so use __llvm_prf_ instead of __llvm_profile_ for section names. <rdar://problem/15943240> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile')
-rw-r--r--lib/profile/InstrProfiling.c16
-rw-r--r--lib/profile/InstrProfiling.h22
-rw-r--r--lib/profile/InstrProfilingExtras.c16
-rw-r--r--lib/profile/InstrProfilingExtras.h10
-rw-r--r--lib/profile/InstrProfilingPlatformDarwin.c24
-rw-r--r--lib/profile/InstrProfilingPlatformOther.c20
-rw-r--r--lib/profile/InstrProfilingRuntime.cc6
7 files changed, 57 insertions, 57 deletions
diff --git a/lib/profile/InstrProfiling.c b/lib/profile/InstrProfiling.c
index 936b8def3..45c824c84 100644
--- a/lib/profile/InstrProfiling.c
+++ b/lib/profile/InstrProfiling.c
@@ -10,9 +10,9 @@
#include "InstrProfiling.h"
#include <string.h>
-/* TODO: void __llvm_pgo_get_size_for_buffer(void); */
+/* TODO: void __llvm_profile_get_size_for_buffer(void); */
-static void writeFunction(FILE *OutputFile, const __llvm_pgo_data *Data) {
+static void writeFunction(FILE *OutputFile, const __llvm_profile_data *Data) {
/* TODO: Requires libc: break requirement by writing directly to a buffer
* instead of a FILE stream.
*/
@@ -25,20 +25,20 @@ static void writeFunction(FILE *OutputFile, const __llvm_pgo_data *Data) {
fprintf(OutputFile, "\n");
}
-void __llvm_pgo_write_buffer(FILE *OutputFile) {
+void __llvm_profile_write_buffer(FILE *OutputFile) {
/* TODO: Requires libc: break requirement by taking a char* buffer instead of
* a FILE stream.
*/
- const __llvm_pgo_data *I, *E;
+ const __llvm_profile_data *I, *E;
- for (I = __llvm_pgo_data_begin(), E = __llvm_pgo_data_end();
+ for (I = __llvm_profile_data_begin(), E = __llvm_profile_data_end();
I != E; ++I)
writeFunction(OutputFile, I);
}
-void __llvm_pgo_reset_counters(void) {
- uint64_t *I = __llvm_pgo_counters_begin();
- uint64_t *E = __llvm_pgo_counters_end();
+void __llvm_profile_reset_counters(void) {
+ uint64_t *I = __llvm_profile_counters_begin();
+ uint64_t *E = __llvm_profile_counters_end();
memset(I, 0, sizeof(uint64_t)*(E - I));
}
diff --git a/lib/profile/InstrProfiling.h b/lib/profile/InstrProfiling.h
index 9a659c04a..9dd753974 100644
--- a/lib/profile/InstrProfiling.h
+++ b/lib/profile/InstrProfiling.h
@@ -32,15 +32,15 @@ typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif
-typedef struct __llvm_pgo_data {
+typedef struct __llvm_profile_data {
const uint32_t NameSize;
const uint32_t NumCounters;
const uint64_t FuncHash;
const char *const Name;
uint64_t *const Counters;
-} __llvm_pgo_data;
+} __llvm_profile_data;
-/* TODO: void __llvm_pgo_get_size_for_buffer(void); */
+/* TODO: void __llvm_profile_get_size_for_buffer(void); */
/*!
* \brief Write instrumentation data to the given buffer.
@@ -49,11 +49,11 @@ typedef struct __llvm_pgo_data {
* It should be changed to take a char* buffer, and write binary data directly
* to it.
*/
-void __llvm_pgo_write_buffer(FILE *OutputFile);
-
-const __llvm_pgo_data *__llvm_pgo_data_begin();
-const __llvm_pgo_data *__llvm_pgo_data_end();
-const char *__llvm_pgo_names_begin();
-const char *__llvm_pgo_names_end();
-uint64_t *__llvm_pgo_counters_begin();
-uint64_t *__llvm_pgo_counters_end();
+void __llvm_profile_write_buffer(FILE *OutputFile);
+
+const __llvm_profile_data *__llvm_profile_data_begin();
+const __llvm_profile_data *__llvm_profile_data_end();
+const char *__llvm_profile_names_begin();
+const char *__llvm_profile_names_end();
+uint64_t *__llvm_profile_counters_begin();
+uint64_t *__llvm_profile_counters_end();
diff --git a/lib/profile/InstrProfilingExtras.c b/lib/profile/InstrProfilingExtras.c
index 745bcb0db..908900423 100644
--- a/lib/profile/InstrProfilingExtras.c
+++ b/lib/profile/InstrProfilingExtras.c
@@ -9,27 +9,27 @@
#include "InstrProfiling.h"
-static void __llvm_pgo_write_file_with_name(const char *OutputName) {
+static void __llvm_profile_write_file_with_name(const char *OutputName) {
FILE *OutputFile;
if (!OutputName || !OutputName[0])
return;
OutputFile = fopen(OutputName, "w");
if (!OutputFile) return;
- /* TODO: mmap file to buffer of size __llvm_pgo_get_size_for_buffer() and
+ /* TODO: mmap file to buffer of size __llvm_profile_get_size_for_buffer() and
* pass the buffer in, instead of the file.
*/
- __llvm_pgo_write_buffer(OutputFile);
+ __llvm_profile_write_buffer(OutputFile);
fclose(OutputFile);
}
static const char *CurrentFilename = NULL;
-void __llvm_pgo_set_filename(const char *Filename) {
+void __llvm_profile_set_filename(const char *Filename) {
CurrentFilename = Filename;
}
-void __llvm_pgo_write_file() {
+void __llvm_profile_write_file() {
const char *Filename = CurrentFilename;
#define UPDATE_FILENAME(NextFilename) \
@@ -38,14 +38,14 @@ void __llvm_pgo_write_file() {
UPDATE_FILENAME("default.profdata");
#undef UPDATE_FILENAME
- __llvm_pgo_write_file_with_name(Filename);
+ __llvm_profile_write_file_with_name(Filename);
}
-void __llvm_pgo_register_write_file_atexit() {
+void __llvm_profile_register_write_file_atexit() {
static int HasBeenRegistered = 0;
if (!HasBeenRegistered) {
HasBeenRegistered = 1;
- atexit(__llvm_pgo_write_file);
+ atexit(__llvm_profile_write_file);
}
}
diff --git a/lib/profile/InstrProfilingExtras.h b/lib/profile/InstrProfilingExtras.h
index 1db612a7c..12eddf0f9 100644
--- a/lib/profile/InstrProfilingExtras.h
+++ b/lib/profile/InstrProfilingExtras.h
@@ -10,19 +10,19 @@
/*!
* \brief Write instrumentation data to the current file.
*
- * Writes to the file with the last name given to \a __llvm_pgo_set_filename(),
+ * Writes to the file with the last name given to \a __llvm_profile_set_filename(),
* or if it hasn't been called, the \c LLVM_PROFILE_FILE environment variable,
* or if that's not set, \c "default.profdata".
*/
-void __llvm_pgo_write_file();
+void __llvm_profile_write_file();
/*!
* \brief Set the filename for writing instrumentation data.
*
* Sets the filename to be used for subsequent calls to
- * \a __llvm_pgo_write_file().
+ * \a __llvm_profile_write_file().
*/
-void __llvm_pgo_set_filename(const char *Name);
+void __llvm_profile_set_filename(const char *Name);
/*! \brief Register to write instrumentation data to file at exit. */
-void __llvm_pgo_register_write_file_atexit();
+void __llvm_profile_register_write_file_atexit();
diff --git a/lib/profile/InstrProfilingPlatformDarwin.c b/lib/profile/InstrProfilingPlatformDarwin.c
index decd6b09b..3150a2392 100644
--- a/lib/profile/InstrProfilingPlatformDarwin.c
+++ b/lib/profile/InstrProfilingPlatformDarwin.c
@@ -10,16 +10,16 @@
#include "InstrProfiling.h"
/* Use linker magic to find the bounds of the Data section. */
-extern __llvm_pgo_data DataStart __asm("section$start$__DATA$__llvm_pgo_data");
-extern __llvm_pgo_data DataEnd __asm("section$end$__DATA$__llvm_pgo_data");
-extern char NamesStart __asm("section$start$__DATA$__llvm_pgo_names");
-extern char NamesEnd __asm("section$end$__DATA$__llvm_pgo_names");
-extern uint64_t CountersStart __asm("section$start$__DATA$__llvm_pgo_cnts");
-extern uint64_t CountersEnd __asm("section$end$__DATA$__llvm_pgo_cnts");
+extern __llvm_profile_data DataStart __asm("section$start$__DATA$__llvm_prf_data");
+extern __llvm_profile_data DataEnd __asm("section$end$__DATA$__llvm_prf_data");
+extern char NamesStart __asm("section$start$__DATA$__llvm_prf_names");
+extern char NamesEnd __asm("section$end$__DATA$__llvm_prf_names");
+extern uint64_t CountersStart __asm("section$start$__DATA$__llvm_prf_cnts");
+extern uint64_t CountersEnd __asm("section$end$__DATA$__llvm_prf_cnts");
-const __llvm_pgo_data *__llvm_pgo_data_begin() { return &DataStart; }
-const __llvm_pgo_data *__llvm_pgo_data_end() { return &DataEnd; }
-const char *__llvm_pgo_names_begin() { return &NamesStart; }
-const char *__llvm_pgo_names_end() { return &NamesEnd; }
-uint64_t *__llvm_pgo_counters_begin() { return &CountersStart; }
-uint64_t *__llvm_pgo_counters_end() { return &CountersEnd; }
+const __llvm_profile_data *__llvm_profile_data_begin() { return &DataStart; }
+const __llvm_profile_data *__llvm_profile_data_end() { return &DataEnd; }
+const char *__llvm_profile_names_begin() { return &NamesStart; }
+const char *__llvm_profile_names_end() { return &NamesEnd; }
+uint64_t *__llvm_profile_counters_begin() { return &CountersStart; }
+uint64_t *__llvm_profile_counters_end() { return &CountersEnd; }
diff --git a/lib/profile/InstrProfilingPlatformOther.c b/lib/profile/InstrProfilingPlatformOther.c
index dbd7d06ed..b20d5bfc3 100644
--- a/lib/profile/InstrProfilingPlatformOther.c
+++ b/lib/profile/InstrProfilingPlatformOther.c
@@ -9,8 +9,8 @@
#include "InstrProfiling.h"
-static const __llvm_pgo_data *DataFirst = NULL;
-static const __llvm_pgo_data *DataLast = NULL;
+static const __llvm_profile_data *DataFirst = NULL;
+static const __llvm_profile_data *DataLast = NULL;
static const char *NamesFirst = NULL;
static const char *NamesLast = NULL;
static uint64_t *CountersFirst = NULL;
@@ -23,9 +23,9 @@ static uint64_t *CountersLast = NULL;
* calls are only required (and only emitted) on targets where we haven't
* implemented linker magic to find the bounds of the sections.
*/
-void __llvm_pgo_register_function(void *Data_) {
+void __llvm_profile_register_function(void *Data_) {
/* TODO: Only emit this function if we can't use linker magic. */
- const __llvm_pgo_data *Data = (__llvm_pgo_data*)Data_;
+ const __llvm_profile_data *Data = (__llvm_profile_data*)Data_;
if (!DataFirst) {
DataFirst = Data;
DataLast = Data + 1;
@@ -51,9 +51,9 @@ void __llvm_pgo_register_function(void *Data_) {
#undef UPDATE_LAST
}
-const __llvm_pgo_data *__llvm_pgo_data_begin() { return DataFirst; }
-const __llvm_pgo_data *__llvm_pgo_data_end() { return DataLast; }
-const char *__llvm_pgo_names_begin() { return NamesFirst; }
-const char *__llvm_pgo_names_end() { return NamesLast; }
-uint64_t *__llvm_pgo_counters_begin() { return CountersFirst; }
-uint64_t *__llvm_pgo_counters_end() { return CountersLast; }
+const __llvm_profile_data *__llvm_profile_data_begin() { return DataFirst; }
+const __llvm_profile_data *__llvm_profile_data_end() { return DataLast; }
+const char *__llvm_profile_names_begin() { return NamesFirst; }
+const char *__llvm_profile_names_end() { return NamesLast; }
+uint64_t *__llvm_profile_counters_begin() { return CountersFirst; }
+uint64_t *__llvm_profile_counters_end() { return CountersLast; }
diff --git a/lib/profile/InstrProfilingRuntime.cc b/lib/profile/InstrProfilingRuntime.cc
index c493bf74a..6116b0c1f 100644
--- a/lib/profile/InstrProfilingRuntime.cc
+++ b/lib/profile/InstrProfilingRuntime.cc
@@ -11,8 +11,8 @@ extern "C" {
#include "InstrProfilingExtras.h"
-extern int __llvm_pgo_runtime;
-int __llvm_pgo_runtime;
+extern int __llvm_profile_runtime;
+int __llvm_profile_runtime;
}
@@ -20,7 +20,7 @@ namespace {
class RegisterAtExit {
public:
- RegisterAtExit() { __llvm_pgo_register_write_file_atexit(); }
+ RegisterAtExit() { __llvm_profile_register_write_file_atexit(); }
};
RegisterAtExit Registration;