[PGO] Move Value Profile Kind to InstrProfData.inc
authorXinliang David Li <davidxl@google.com>
Sun, 22 Nov 2015 01:39:07 +0000 (01:39 +0000)
committerXinliang David Li <davidxl@google.com>
Sun, 22 Nov 2015 01:39:07 +0000 (01:39 +0000)
ValueProfKind value affects runtime data structure and
definition is shared between compiler-rt and LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253806 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ProfileData/InstrProf.h
include/llvm/ProfileData/InstrProfData.inc

index b93d5d0b96619d7f6abe733b5874fe72f33c485c..571e2881dce8c6a810c2d4be2b5af56b11c9aeec 100644 (file)
@@ -169,10 +169,8 @@ inline std::error_code make_error_code(instrprof_error E) {
 }
 
 enum InstrProfValueKind : uint32_t {
-  IPVK_IndirectCallTarget = 0,
-
-  IPVK_First = IPVK_IndirectCallTarget,
-  IPVK_Last = IPVK_IndirectCallTarget
+#define VALUE_PROF_KIND(Enumerator, Value) Enumerator = Value,
+#include "llvm/ProfileData/InstrProfData.inc"
 };
 
 struct InstrProfStringTable {
index c422787859aac8337100170e620a960be25ff55b..cf7e2884ed63950a8b76b4c299f4a37b8043d996 100644 (file)
@@ -107,6 +107,24 @@ VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx))
 #undef INSTR_PROF_COMMA
 /* VALUE_PROF_FUNC_PARAM end */
 
+/* VALUE_PROF_KIND start */
+#ifndef VALUE_PROF_KIND
+#define VALUE_PROF_KIND(Enumerator, Value)
+#else
+#define INSTR_PROF_DATA_DEFINED
+#endif
+VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0)
+/* These two kinds must be the last to be
+ * declared. This is to make sure the string
+ * array created with the template can be
+ * indexed with the kind value.
+ */
+VALUE_PROF_KIND(IPVK_First, IPVK_IndirectCallTarget)
+VALUE_PROF_KIND(IPVK_Last, IPVK_IndirectCallTarget)
+
+#undef VALUE_PROF_KIND
+/* VALUE_PROF_KIND end */
+
 /* COVMAP_FUNC_RECORD start */
 /* Definition of member fields of the function record structure in coverage
  * map.