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>

llvm-svn: 204391
diff --git a/compiler-rt/lib/profile/InstrProfiling.c b/compiler-rt/lib/profile/InstrProfiling.c
index 936b8de..45c824c 100644
--- a/compiler-rt/lib/profile/InstrProfiling.c
+++ b/compiler-rt/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 @@
   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/compiler-rt/lib/profile/InstrProfiling.h b/compiler-rt/lib/profile/InstrProfiling.h
index 9a659c0..9dd7539 100644
--- a/compiler-rt/lib/profile/InstrProfiling.h
+++ b/compiler-rt/lib/profile/InstrProfiling.h
@@ -32,15 +32,15 @@
 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 @@
  * It should be changed to take a char* buffer, and write binary data directly
  * to it.
  */
-void __llvm_pgo_write_buffer(FILE *OutputFile);
+void __llvm_profile_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();
+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/compiler-rt/lib/profile/InstrProfilingExtras.c b/compiler-rt/lib/profile/InstrProfilingExtras.c
index 745bcb0..9089004 100644
--- a/compiler-rt/lib/profile/InstrProfilingExtras.c
+++ b/compiler-rt/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 @@
   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/compiler-rt/lib/profile/InstrProfilingExtras.h b/compiler-rt/lib/profile/InstrProfilingExtras.h
index 1db612a..12eddf0 100644
--- a/compiler-rt/lib/profile/InstrProfilingExtras.h
+++ b/compiler-rt/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/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c b/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
index decd6b0..3150a23 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
+++ b/compiler-rt/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/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
index dbd7d06..b20d5bf 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
+++ b/compiler-rt/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 @@
  * 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 @@
 #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/compiler-rt/lib/profile/InstrProfilingRuntime.cc b/compiler-rt/lib/profile/InstrProfilingRuntime.cc
index c493bf7..6116b0c 100644
--- a/compiler-rt/lib/profile/InstrProfilingRuntime.cc
+++ b/compiler-rt/lib/profile/InstrProfilingRuntime.cc
@@ -11,8 +11,8 @@
 
 #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 @@
 
 class RegisterAtExit {
 public:
-  RegisterAtExit() { __llvm_pgo_register_write_file_atexit(); }
+  RegisterAtExit() { __llvm_profile_register_write_file_atexit(); }
 };
 
 RegisterAtExit Registration;