From: Xinliang David Li Date: Sun, 22 Nov 2015 00:22:07 +0000 (+0000) Subject: [PGO] Define value profiling updater API signature in InstrProfData.inc (NFC) X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=9b627286bc1350e25f0ecdd8a76955e54d333ff6 [PGO] Define value profiling updater API signature in InstrProfData.inc (NFC) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253805 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ProfileData/InstrProfData.inc b/include/llvm/ProfileData/InstrProfData.inc index 9893c59b139..c422787859a 100644 --- a/include/llvm/ProfileData/InstrProfData.inc +++ b/include/llvm/ProfileData/InstrProfData.inc @@ -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 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 */ +/* 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 diff --git a/lib/Transforms/Instrumentation/InstrProfiling.cpp b/lib/Transforms/Instrumentation/InstrProfiling.cpp index 334c41f3abc..a70bf27ed7b 100644 --- a/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -173,13 +173,14 @@ bool InstrProfiling::runOnModule(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 = - FunctionType::get(VoidTy, makeArrayRef(ArgTypes), false); + FunctionType::get(ReturnTy, makeArrayRef(ParamTypes), false); return M.getOrInsertFunction("__llvm_profile_instrument_target", ValueProfilingCallTy); }