[llvm] r257108 - [PGO] Minor refactoring /NFC
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 7 14:46:30 PST 2016
Author: davidxl
Date: Thu Jan 7 16:46:29 2016
New Revision: 257108
URL: http://llvm.org/viewvc/llvm-project?rev=257108&view=rev
Log:
[PGO] Minor refactoring /NFC
Move common defs into common header files.
Modified:
llvm/trunk/include/llvm/ProfileData/CoverageMapping.h
llvm/trunk/include/llvm/ProfileData/InstrProf.h
llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
Modified: llvm/trunk/include/llvm/ProfileData/CoverageMapping.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/CoverageMapping.h?rev=257108&r1=257107&r2=257108&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/CoverageMapping.h (original)
+++ llvm/trunk/include/llvm/ProfileData/CoverageMapping.h Thu Jan 7 16:46:29 2016
@@ -35,8 +35,6 @@ class CoverageMappingReader;
class CoverageMapping;
struct CounterExpressions;
-enum CoverageMappingVersion { CoverageMappingVersion1 };
-
/// \brief A Counter is an abstract value that describes how to compute the
/// execution count for a region of code using the collected profile count data.
struct Counter {
Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=257108&r1=257107&r2=257108&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Thu Jan 7 16:46:29 2016
@@ -30,7 +30,6 @@
#include <system_error>
#include <vector>
-#define INSTR_PROF_INDEX_VERSION 3
namespace llvm {
class Function;
@@ -66,7 +65,8 @@ inline StringRef getInstrProfValueProfFu
/// Return the name of the section containing function coverage mapping
/// data.
inline StringRef getInstrProfCoverageSectionName(bool AddSegment) {
- return AddSegment ? "__DATA,__llvm_covmap" : "__llvm_covmap";
+ return AddSegment ? "__DATA," INSTR_PROF_COVMAP_SECT_NAME_STR
+ : INSTR_PROF_COVMAP_SECT_NAME_STR;
}
/// Return the name prefix of variables containing instrumented function names.
@@ -626,6 +626,12 @@ struct CovMapHeader {
};
LLVM_PACKED_END
+
+enum CoverageMappingVersion {
+ CoverageMappingVersion1 = 0,
+ // The current versin is Version1
+ CoverageMappingCurrentVersion = INSTR_PROF_COVMAP_VERSION
+};
}
} // end namespace llvm
Modified: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=257108&r1=257107&r2=257108&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc Thu Jan 7 16:46:29 2016
@@ -696,18 +696,23 @@ serializeValueProfDataFromRT(const Value
/* Raw profile format version. */
#define INSTR_PROF_RAW_VERSION 2
+#define INSTR_PROF_INDEX_VERSION 3
+#define INSTR_PROF_COVMAP_VERSION 0
/* Runtime section names and name strings. */
#define INSTR_PROF_DATA_SECT_NAME __llvm_prf_data
#define INSTR_PROF_NAME_SECT_NAME __llvm_prf_names
#define INSTR_PROF_CNTS_SECT_NAME __llvm_prf_cnts
+#define INSTR_PROF_COVMAP_SECT_NAME __llvm_covmap
-#define INSTR_PROF_DATA_SECT_NAME_STR \
- INSTR_PROF_QUOTE(INSTR_PROF_DATA_SECT_NAME)
-#define INSTR_PROF_NAME_SECT_NAME_STR \
- INSTR_PROF_QUOTE(INSTR_PROF_NAME_SECT_NAME)
-#define INSTR_PROF_CNTS_SECT_NAME_STR \
- INSTR_PROF_QUOTE(INSTR_PROF_CNTS_SECT_NAME)
+#define INSTR_PROF_DATA_SECT_NAME_STR \
+ INSTR_PROF_QUOTE(INSTR_PROF_DATA_SECT_NAME)
+#define INSTR_PROF_NAME_SECT_NAME_STR \
+ INSTR_PROF_QUOTE(INSTR_PROF_NAME_SECT_NAME)
+#define INSTR_PROF_CNTS_SECT_NAME_STR \
+ INSTR_PROF_QUOTE(INSTR_PROF_CNTS_SECT_NAME)
+#define INSTR_PROF_COVMAP_SECT_NAME_STR \
+ INSTR_PROF_QUOTE(INSTR_PROF_COVMAP_SECT_NAME)
/* Macros to define start/stop section symbol for a given
* section on Linux. For instance
Modified: llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp?rev=257108&r1=257107&r2=257108&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp Thu Jan 7 16:46:29 2016
@@ -328,12 +328,8 @@ static std::error_code readCoverageMappi
uint32_t Version = endian::byte_swap<uint32_t, Endian>(CovHeader->Version);
Buf = reinterpret_cast<const char *>(++CovHeader);
- switch (Version) {
- case CoverageMappingVersion1:
- break;
- default:
+ if (Version > coverage::CoverageMappingCurrentVersion)
return coveragemap_error::unsupported_version;
- }
// Skip past the function records, saving the start and end for later.
const char *FunBuf = Buf;
More information about the llvm-commits
mailing list