[PGO] Define value profiling updater API signature in InstrProfData.inc (NFC)
authorXinliang David Li <davidxl@google.com>
Sun, 22 Nov 2015 00:22:07 +0000 (00:22 +0000)
committerXinliang David Li <davidxl@google.com>
Sun, 22 Nov 2015 00:22:07 +0000 (00:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253805 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ProfileData/InstrProfData.inc
lib/Transforms/Instrumentation/InstrProfiling.cpp

index 9893c59b1393d5a21b5d42ef2ddbb7114e604dbc..c422787859aac8337100170e620a960be25ff55b 100644 (file)
@@ -66,7 +66,6 @@ INSTR_PROF_DATA(IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, \
 INSTR_PROF_DATA(const uint16_t, Int16ArrayTy, NumValueSites[IPVK_Last+1], \
                 ConstantArray::get(Int16ArrayTy, Int16ArrayVals))
 #undef INSTR_PROF_DATA
 INSTR_PROF_DATA(const uint16_t, Int16ArrayTy, NumValueSites[IPVK_Last+1], \
                 ConstantArray::get(Int16ArrayTy, Int16ArrayVals))
 #undef INSTR_PROF_DATA
-
 /* INSTR_PROF_DATA end. */
 
 /* INSTR_PROF_RAW_HEADER  start */
 /* INSTR_PROF_DATA end. */
 
 /* INSTR_PROF_RAW_HEADER  start */
@@ -89,6 +88,24 @@ INSTR_PROF_RAW_HEADER(const uint64_t, ValueDataDelta, (uintptr_t)ValueDataBegin)
 #undef INSTR_PROF_RAW_HEADER
 /* INSTR_PROF_RAW_HEADER  end */
 
 #undef INSTR_PROF_RAW_HEADER
 /* INSTR_PROF_RAW_HEADER  end */
 
+/* VALUE_PROF_FUNC_PARAM start */
+/* Definition of parameter types of the runtime API used to do value profiling
+ * for a given value site.
+ */
+#ifndef VALUE_PROF_FUNC_PARAM
+#define VALUE_PROF_FUNC_PARAM(ArgType, ArgName, ArgLLVMType)
+#define INSTR_PROF_COMMA
+#else
+#define INSTR_PROF_DATA_DEFINED
+#define INSTR_PROF_COMMA ,
+#endif
+VALUE_PROF_FUNC_PARAM(uint64_t, TargetValue, Type::getInt64Ty(Ctx)) \
+                      INSTR_PROF_COMMA
+VALUE_PROF_FUNC_PARAM(void *, Data, Type::getInt8PtrTy(Ctx)) INSTR_PROF_COMMA
+VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx))
+#undef VALUE_PROF_FUNC_PARAM
+#undef INSTR_PROF_COMMA
+/* VALUE_PROF_FUNC_PARAM end */
 
 /* COVMAP_FUNC_RECORD start */
 /* Definition of member fields of the function record structure in coverage
 
 /* COVMAP_FUNC_RECORD start */
 /* Definition of member fields of the function record structure in coverage
index 334c41f3abc2287e59b3218c04e38cac0c24894a..a70bf27ed7b91dcc22dc90a087536717f5a77289 100644 (file)
@@ -173,13 +173,14 @@ bool InstrProfiling::runOnModule(Module &M) {
 }
 
 static Constant *getOrInsertValueProfilingCall(Module &M) {
 }
 
 static Constant *getOrInsertValueProfilingCall(Module &M) {
-  auto *VoidTy = Type::getVoidTy(M.getContext());
-  auto *VoidPtrTy = Type::getInt8PtrTy(M.getContext());
-  auto *Int32Ty = Type::getInt32Ty(M.getContext());
-  auto *Int64Ty = Type::getInt64Ty(M.getContext());
-  Type *ArgTypes[] = {Int64Ty, VoidPtrTy, Int32Ty};
+  LLVMContext &Ctx = M.getContext();
+  auto *ReturnTy = Type::getVoidTy(M.getContext());
+  Type *ParamTypes[] = {
+#define VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType) ParamLLVMType
+#include "llvm/ProfileData/InstrProfData.inc"
+  };
   auto *ValueProfilingCallTy =
   auto *ValueProfilingCallTy =
-      FunctionType::get(VoidTy, makeArrayRef(ArgTypes), false);
+      FunctionType::get(ReturnTy, makeArrayRef(ParamTypes), false);
   return M.getOrInsertFunction("__llvm_profile_instrument_target",
                                ValueProfilingCallTy);
 }
   return M.getOrInsertFunction("__llvm_profile_instrument_target",
                                ValueProfilingCallTy);
 }