From e8ec005f39d55b58da0148ac1f718c097433a7b2 Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Tue, 24 Nov 2015 19:21:15 +0000 Subject: [PATCH] [PGO] Introduce value profile data closure type. The closure is designed to abstact away two types of value profile data: - InstrProfRecord which is the primary data structure used to represent profile data in host tools (reader, writer, and profile-use) - value profile runtime data structure suitable to be used by C runtime library. Both sources of data need to serialize to disk/memory-buffer in common format: ValueProfData. The abstraction allows compiler-rt's raw profiler writer to share the same code with indexed profile writer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254008 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ProfileData/InstrProf.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/llvm/ProfileData/InstrProf.h b/include/llvm/ProfileData/InstrProf.h index 5ec7d65773c..20d1574b309 100644 --- a/include/llvm/ProfileData/InstrProf.h +++ b/include/llvm/ProfileData/InstrProf.h @@ -538,6 +538,18 @@ typedef struct ValueProfData { ValueProfRecord *getFirstValueProfRecord(); } ValueProfData; +typedef struct ValueProfRecordClosure { + void *Record; + uint32_t (*GetNumValueKinds)(void *Record); + uint32_t (*GetNumValueSites)(void *Record, uint32_t VKind); + uint32_t (*GetNumValueData)(void *Record, uint32_t VKind); + uint32_t (*GetNumValueDataForSite)(void *R, uint32_t VK, uint32_t S); + uint64_t (*RemapValueData)(uint64_t Value); + void (*GetValueForSite)(InstrProfValueData Dst[], void *R, uint32_t K, + uint32_t S); + ValueProfData *(*AllocateValueProfData)(size_t TotalSizeInBytes); +} ValueProfRecordClosure; + inline uint32_t getValueProfRecordHeaderSize(uint32_t NumValueSites) { uint32_t Size = offsetof(ValueProfRecord, SiteCountArray) + sizeof(uint8_t) * NumValueSites; -- 2.34.1