summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfilingBuffer.c
diff options
context:
space:
mode:
authorBetul Buyukkurt <betulb@codeaurora.org>2015-11-18 18:12:35 +0000
committerBetul Buyukkurt <betulb@codeaurora.org>2015-11-18 18:12:35 +0000
commit70aaff4fae73a7e4317ccc4fa99fd6fc4790c61a (patch)
tree574825499a999f5eda6e6095cc46eb164524d1ab /lib/profile/InstrProfilingBuffer.c
parent8b80397af93ddfd07561e8d9c56681a49006d44a (diff)
[PGO] Runtime support for value profiling.
This change adds extends the data structures and adds in the routines for handling runtime calls for value profiling. The profile data format is modified and the version number is incremented. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253483 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfilingBuffer.c')
-rw-r--r--lib/profile/InstrProfilingBuffer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/profile/InstrProfilingBuffer.c b/lib/profile/InstrProfilingBuffer.c
index 620c1755b..f64765a2c 100644
--- a/lib/profile/InstrProfilingBuffer.c
+++ b/lib/profile/InstrProfilingBuffer.c
@@ -35,7 +35,7 @@ uint64_t __llvm_profile_get_size_for_buffer_internal(
const char *NamesEnd) {
/* Match logic in __llvm_profile_write_buffer(). */
const uint64_t NamesSize = PROFILE_RANGE_SIZE(Names) * sizeof(char);
- const uint64_t Padding = sizeof(uint64_t) - NamesSize % sizeof(uint64_t);
+ const uint8_t Padding = __llvm_profile_get_num_padding_bytes(NamesSize);
return sizeof(__llvm_profile_header) +
PROFILE_RANGE_SIZE(Data) * sizeof(__llvm_profile_data) +
PROFILE_RANGE_SIZE(Counters) * sizeof(uint64_t) +
@@ -72,7 +72,7 @@ int __llvm_profile_write_buffer_internal(
const uint64_t DataSize = DataEnd - DataBegin;
const uint64_t CountersSize = CountersEnd - CountersBegin;
const uint64_t NamesSize = NamesEnd - NamesBegin;
- const uint64_t Padding = sizeof(uint64_t) - NamesSize % sizeof(uint64_t);
+ const uint8_t Padding = __llvm_profile_get_num_padding_bytes(NamesSize);
/* Enough zeroes for padding. */
const char Zeroes[sizeof(uint64_t)] = {0};
@@ -90,6 +90,9 @@ int __llvm_profile_write_buffer_internal(
Header.NamesSize = NamesSize;
Header.CountersDelta = (uintptr_t)CountersBegin;
Header.NamesDelta = (uintptr_t)NamesBegin;
+ Header.ValueKindLast = VK_LAST;
+ Header.ValueDataSize = 0;
+ Header.ValueDataDelta = (uintptr_t)NULL;
/* Write the data. */
#define UPDATE_memcpy(Data, Size) \