[PATCH] D14692: [PGO] Refactor common profile dumping code for File and Buffer API
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 16 12:33:55 PST 2015
vsk added a comment.
Lgtm.
================
Comment at: lib/profile/InstrProfilingBuffer.c:44-50
@@ -44,13 +43,9 @@
-__attribute__((visibility("hidden")))
-int __llvm_profile_write_buffer(char *Buffer) {
- /* Match logic in __llvm_profile_get_size_for_buffer().
- * Match logic in __llvm_profile_write_file().
- */
- const __llvm_profile_data *DataBegin = __llvm_profile_begin_data();
- const __llvm_profile_data *DataEnd = __llvm_profile_end_data();
- const uint64_t *CountersBegin = __llvm_profile_begin_counters();
- const uint64_t *CountersEnd = __llvm_profile_end_counters();
- const char *NamesBegin = __llvm_profile_begin_names();
- const char *NamesEnd = __llvm_profile_end_names();
+static size_t BufferWriter(const void *Data, size_t ElmSize, size_t NumElm,
+ void **Buffer) {
+ size_t Length = ElmSize * NumElm;
+ memcpy(*Buffer, Data, Length);
+ *(char **)Buffer += Length;
+ return NumElm;
+}
----------------
Ah ok
http://reviews.llvm.org/D14692
More information about the llvm-commits
mailing list