[llvm] r253805 - [PGO] Define value profiling updater API signature in InstrProfData.inc (NFC)

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 21 16:22:08 PST 2015


Author: davidxl
Date: Sat Nov 21 18:22:07 2015
New Revision: 253805

URL: http://llvm.org/viewvc/llvm-project?rev=253805&view=rev
Log:
[PGO] Define value profiling updater API signature in InstrProfData.inc (NFC)




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

Modified: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=253805&r1=253804&r2=253805&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc Sat Nov 21 18:22:07 2015
@@ -66,7 +66,6 @@ INSTR_PROF_DATA(IntPtrT, llvm::Type::get
 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 */
@@ -89,6 +88,24 @@ INSTR_PROF_RAW_HEADER(const uint64_t, Va
 #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

Modified: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=253805&r1=253804&r2=253805&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp Sat Nov 21 18:22:07 2015
@@ -173,13 +173,14 @@ bool InstrProfiling::runOnModule(Module
 }
 
 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 =
-      FunctionType::get(VoidTy, makeArrayRef(ArgTypes), false);
+      FunctionType::get(ReturnTy, makeArrayRef(ParamTypes), false);
   return M.getOrInsertFunction("__llvm_profile_instrument_target",
                                ValueProfilingCallTy);
 }




More information about the llvm-commits mailing list