summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/CoverageMappingReader.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-11-05 00:47:26 +0000
committerXinliang David Li <davidxl@google.com>2015-11-05 00:47:26 +0000
commit192c74802798a7cead3f5b53d74bed654f82c3d4 (patch)
tree30717e69e47a282bc8b09bbf5a0d0f33ecc7bd3e /llvm/lib/ProfileData/CoverageMappingReader.cpp
parent5f92a130ffc225c8120ae7e8fd80e695dd4e51f6 (diff)
downloadbcm5719-llvm-192c74802798a7cead3f5b53d74bed654f82c3d4.tar.gz
bcm5719-llvm-192c74802798a7cead3f5b53d74bed654f82c3d4.zip
[PGO] Use template file to define runtime structures
With this change, instrumentation code and reader/write code related to profile data structs are kept strictly in-sync. THis will be extended to cfe and compile-rt references as well. Differential Revision: http://reviews.llvm.org/D13843 llvm-svn: 252113
Diffstat (limited to 'llvm/lib/ProfileData/CoverageMappingReader.cpp')
-rw-r--r--llvm/lib/ProfileData/CoverageMappingReader.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/ProfileData/CoverageMappingReader.cpp b/llvm/lib/ProfileData/CoverageMappingReader.cpp
index 7fd5f009a91..ed737d8f04e 100644
--- a/llvm/lib/ProfileData/CoverageMappingReader.cpp
+++ b/llvm/lib/ProfileData/CoverageMappingReader.cpp
@@ -343,7 +343,7 @@ std::error_code readCoverageMappingData(
// Skip past the function records, saving the start and end for later.
const char *FunBuf = Buf;
- Buf += NRecords * (sizeof(T) + 2 * sizeof(uint32_t) + sizeof(uint64_t));
+ Buf += NRecords * sizeof(coverage::CovMapFunctionRecord<T>);
const char *FunEnd = Buf;
// Get the filenames.
@@ -366,12 +366,15 @@ std::error_code readCoverageMappingData(
// before reading the next map.
Buf += alignmentAdjustment(Buf, 8);
- while (FunBuf < FunEnd) {
+ auto CFR =
+ reinterpret_cast<const coverage::CovMapFunctionRecord<T> *>(FunBuf);
+ while ((const char *)CFR < FunEnd) {
// Read the function information
- T NamePtr = endian::readNext<T, Endian, unaligned>(FunBuf);
- uint32_t NameSize = endian::readNext<uint32_t, Endian, unaligned>(FunBuf);
- uint32_t DataSize = endian::readNext<uint32_t, Endian, unaligned>(FunBuf);
- uint64_t FuncHash = endian::readNext<uint64_t, Endian, unaligned>(FunBuf);
+ T NamePtr = endian::byte_swap<T, Endian>(CFR->NamePtr);
+ uint32_t NameSize = endian::byte_swap<uint32_t, Endian>(CFR->NameSize);
+ uint32_t DataSize = endian::byte_swap<uint32_t, Endian>(CFR->DataSize);
+ uint64_t FuncHash = endian::byte_swap<uint64_t, Endian>(CFR->FuncHash);
+ CFR++;
// Now use that to read the coverage data.
if (CovBuf + DataSize > CovEnd)
OpenPOWER on IntegriCloud