summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-11-19 07:21:47 +0000
committerXinliang David Li <davidxl@google.com>2015-11-19 07:21:47 +0000
commite8efaeae4d9bd45d6569595ca35cfb4f82a74616 (patch)
treecf19e2d8bf574b4a3baf4e71d28efdcf391f7726 /compiler-rt
parent1ca72e1846fca95dcb4182c2672ff90c71511965 (diff)
downloadbcm5719-llvm-e8efaeae4d9bd45d6569595ca35cfb4f82a74616.tar.gz
bcm5719-llvm-e8efaeae4d9bd45d6569595ca35cfb4f82a74616.zip
[PGO] Minor cleanups (from review feedback)
1. fix naming problem of file/buffer writer 2. change BufferOrFile to WriterCtx 3. move writer and writerctx together llvm-svn: 253545
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/profile/InstrProfilingBuffer.c6
-rw-r--r--compiler-rt/lib/profile/InstrProfilingFile.c4
-rw-r--r--compiler-rt/lib/profile/InstrProfilingInternal.h7
-rw-r--r--compiler-rt/lib/profile/InstrProfilingWriter.c20
4 files changed, 19 insertions, 18 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingBuffer.c b/compiler-rt/lib/profile/InstrProfilingBuffer.c
index bb1f9ea9804..dc5958ea5f2 100644
--- a/compiler-rt/lib/profile/InstrProfilingBuffer.c
+++ b/compiler-rt/lib/profile/InstrProfilingBuffer.c
@@ -41,7 +41,7 @@ uint64_t __llvm_profile_get_size_for_buffer_internal(
PROFILE_RANGE_SIZE(Counters) * sizeof(uint64_t) + NamesSize + Padding;
}
-static size_t BufferWriter(const void *Data, size_t ElmSize, size_t NumElm,
+static size_t bufferWriter(const void *Data, size_t ElmSize, size_t NumElm,
void **Buffer) {
size_t Length = ElmSize * NumElm;
memcpy(*Buffer, Data, Length);
@@ -51,14 +51,14 @@ static size_t BufferWriter(const void *Data, size_t ElmSize, size_t NumElm,
__attribute__((visibility("hidden"))) int
__llvm_profile_write_buffer(char *Buffer) {
- return llvmWriteProfData(Buffer, 0, 0, BufferWriter);
+ return llvmWriteProfData(Buffer, bufferWriter, 0, 0);
}
__attribute__((visibility("hidden"))) int __llvm_profile_write_buffer_internal(
char *Buffer, const __llvm_profile_data *DataBegin,
const __llvm_profile_data *DataEnd, const uint64_t *CountersBegin,
const uint64_t *CountersEnd, const char *NamesBegin, const char *NamesEnd) {
- return llvmWriteProfDataImpl(Buffer, BufferWriter, DataBegin, DataEnd,
+ return llvmWriteProfDataImpl(Buffer, bufferWriter, DataBegin, DataEnd,
CountersBegin, CountersEnd, 0, 0, NamesBegin,
NamesEnd);
}
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index c226bfa0c0c..37d37292d06 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -17,7 +17,7 @@
#define UNCONST(ptr) ((void *)(uintptr_t)(ptr))
-static size_t FileWriter(const void *Data, size_t ElmSize, size_t NumElm,
+static size_t fileWriter(const void *Data, size_t ElmSize, size_t NumElm,
void **File) {
return fwrite(Data, ElmSize, NumElm, (FILE *)*File);
}
@@ -27,7 +27,7 @@ static int writeFile(FILE *File) {
uint8_t *ValueDataBegin = NULL;
const uint64_t ValueDataSize =
__llvm_profile_gather_value_data(&ValueDataBegin);
- int r = llvmWriteProfData(File, ValueDataBegin, ValueDataSize, FileWriter);
+ int r = llvmWriteProfData(File, fileWriter, ValueDataBegin, ValueDataSize);
free(ValueDataBegin);
return r;
}
diff --git a/compiler-rt/lib/profile/InstrProfilingInternal.h b/compiler-rt/lib/profile/InstrProfilingInternal.h
index c72ca106ebb..518e6a320fd 100644
--- a/compiler-rt/lib/profile/InstrProfilingInternal.h
+++ b/compiler-rt/lib/profile/InstrProfilingInternal.h
@@ -43,9 +43,10 @@ int __llvm_profile_write_buffer_internal(
*/
typedef size_t (*WriterCallback)(const void *Data, size_t ElmS, size_t NumElm,
void **BufferOrFile);
-int llvmWriteProfData(void *BufferOrFile, const uint8_t *ValueDataBegin,
- const uint64_t ValueDataSize, WriterCallback Writer);
-int llvmWriteProfDataImpl(void *BufferOrFile, WriterCallback Writer,
+int llvmWriteProfData(void *WriterCtx, WriterCallback Writer,
+ const uint8_t *ValueDataBegin,
+ const uint64_t ValueDataSize);
+int llvmWriteProfDataImpl(void *WriterCtx, WriterCallback Writer,
const __llvm_profile_data *DataBegin,
const __llvm_profile_data *DataEnd,
const uint64_t *CountersBegin,
diff --git a/compiler-rt/lib/profile/InstrProfilingWriter.c b/compiler-rt/lib/profile/InstrProfilingWriter.c
index cdeb66199f4..e837a351151 100644
--- a/compiler-rt/lib/profile/InstrProfilingWriter.c
+++ b/compiler-rt/lib/profile/InstrProfilingWriter.c
@@ -11,8 +11,8 @@
#include "InstrProfilingInternal.h"
__attribute__((visibility("hidden"))) int
-llvmWriteProfData(void *BufferOrFile, const uint8_t *ValueDataBegin,
- const uint64_t ValueDataSize, WriterCallback Writer) {
+llvmWriteProfData(void *WriterCtx, WriterCallback Writer,
+ const uint8_t *ValueDataBegin, const uint64_t ValueDataSize) {
/* Match logic in __llvm_profile_write_buffer(). */
const __llvm_profile_data *DataBegin = __llvm_profile_begin_data();
const __llvm_profile_data *DataEnd = __llvm_profile_end_data();
@@ -20,13 +20,13 @@ llvmWriteProfData(void *BufferOrFile, const uint8_t *ValueDataBegin,
const uint64_t *CountersEnd = __llvm_profile_end_counters();
const char *NamesBegin = __llvm_profile_begin_names();
const char *NamesEnd = __llvm_profile_end_names();
- return llvmWriteProfDataImpl(BufferOrFile, Writer, DataBegin, DataEnd,
+ return llvmWriteProfDataImpl(WriterCtx, Writer, DataBegin, DataEnd,
CountersBegin, CountersEnd, ValueDataBegin,
ValueDataSize, NamesBegin, NamesEnd);
}
__attribute__((visibility("hidden"))) int llvmWriteProfDataImpl(
- void *BufferOrFile, WriterCallback Writer,
+ void *WriterCtx, WriterCallback Writer,
const __llvm_profile_data *DataBegin, const __llvm_profile_data *DataEnd,
const uint64_t *CountersBegin, const uint64_t *CountersEnd,
const uint8_t *ValueDataBegin, const uint64_t ValueDataSize,
@@ -64,13 +64,13 @@ __attribute__((visibility("hidden"))) int llvmWriteProfDataImpl(
if (Writer(Data, Size, Length, &BuffOrFile) != Length) \
return -1; \
} while (0)
- CHECK_write(&Header, sizeof(__llvm_profile_header), 1, BufferOrFile);
- CHECK_write(DataBegin, sizeof(__llvm_profile_data), DataSize, BufferOrFile);
- CHECK_write(CountersBegin, sizeof(uint64_t), CountersSize, BufferOrFile);
- CHECK_write(NamesBegin, sizeof(char), NamesSize, BufferOrFile);
- CHECK_write(Zeroes, sizeof(char), Padding, BufferOrFile);
+ CHECK_write(&Header, sizeof(__llvm_profile_header), 1, WriterCtx);
+ CHECK_write(DataBegin, sizeof(__llvm_profile_data), DataSize, WriterCtx);
+ CHECK_write(CountersBegin, sizeof(uint64_t), CountersSize, WriterCtx);
+ CHECK_write(NamesBegin, sizeof(char), NamesSize, WriterCtx);
+ CHECK_write(Zeroes, sizeof(char), Padding, WriterCtx);
if (ValueDataBegin)
- CHECK_write(ValueDataBegin, sizeof(char), ValueDataSize, BufferOrFile);
+ CHECK_write(ValueDataBegin, sizeof(char), ValueDataSize, WriterCtx);
#undef CHECK_write
return 0;
}
OpenPOWER on IntegriCloud