[compiler-rt] r204391 - PGO: Change runtime prefix from pgo to profile

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Mar 20 13:00:44 PDT 2014


Author: dexonsmith
Date: Thu Mar 20 15:00:44 2014
New Revision: 204391

URL: http://llvm.org/viewvc/llvm-project?rev=204391&view=rev
Log:
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>

Modified:
    compiler-rt/trunk/lib/profile/InstrProfiling.c
    compiler-rt/trunk/lib/profile/InstrProfiling.h
    compiler-rt/trunk/lib/profile/InstrProfilingExtras.c
    compiler-rt/trunk/lib/profile/InstrProfilingExtras.h
    compiler-rt/trunk/lib/profile/InstrProfilingPlatformDarwin.c
    compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c
    compiler-rt/trunk/lib/profile/InstrProfilingRuntime.cc

Modified: compiler-rt/trunk/lib/profile/InstrProfiling.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.c?rev=204391&r1=204390&r2=204391&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfiling.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfiling.c Thu Mar 20 15:00:44 2014
@@ -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 *OutputFi
   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));
 }

Modified: compiler-rt/trunk/lib/profile/InstrProfiling.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.h?rev=204391&r1=204390&r2=204391&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfiling.h (original)
+++ compiler-rt/trunk/lib/profile/InstrProfiling.h Thu Mar 20 15:00:44 2014
@@ -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);
+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();

Modified: compiler-rt/trunk/lib/profile/InstrProfilingExtras.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingExtras.c?rev=204391&r1=204390&r2=204391&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingExtras.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingExtras.c Thu Mar 20 15:00:44 2014
@@ -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);
   }
 }

Modified: compiler-rt/trunk/lib/profile/InstrProfilingExtras.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingExtras.h?rev=204391&r1=204390&r2=204391&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingExtras.h (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingExtras.h Thu Mar 20 15:00:44 2014
@@ -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();

Modified: compiler-rt/trunk/lib/profile/InstrProfilingPlatformDarwin.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPlatformDarwin.c?rev=204391&r1=204390&r2=204391&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingPlatformDarwin.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingPlatformDarwin.c Thu Mar 20 15:00:44 2014
@@ -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; }

Modified: compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c?rev=204391&r1=204390&r2=204391&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c Thu Mar 20 15:00:44 2014
@@ -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 *
 #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; }

Modified: compiler-rt/trunk/lib/profile/InstrProfilingRuntime.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingRuntime.cc?rev=204391&r1=204390&r2=204391&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingRuntime.cc (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingRuntime.cc Thu Mar 20 15:00:44 2014
@@ -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;





More information about the llvm-commits mailing list