153b715b5SDimitry Andric /*===- InstrProfilingMergeFile.c - Profile in-process Merging ------------===*\ 253b715b5SDimitry Andric |* 353b715b5SDimitry Andric |* The LLVM Compiler Infrastructure 453b715b5SDimitry Andric |* 553b715b5SDimitry Andric |* This file is distributed under the University of Illinois Open Source 653b715b5SDimitry Andric |* License. See LICENSE.TXT for details. 753b715b5SDimitry Andric |* 853b715b5SDimitry Andric |*===----------------------------------------------------------------------=== 953b715b5SDimitry Andric |* This file defines APIs needed to support in-process merging for profile data 1053b715b5SDimitry Andric |* stored in files. 1153b715b5SDimitry Andric \*===----------------------------------------------------------------------===*/ 1253b715b5SDimitry Andric 13*4ba319b5SDimitry Andric #if !defined(__Fuchsia__) 14*4ba319b5SDimitry Andric 1553b715b5SDimitry Andric #include "InstrProfiling.h" 1653b715b5SDimitry Andric #include "InstrProfilingInternal.h" 1753b715b5SDimitry Andric #include "InstrProfilingUtil.h" 1853b715b5SDimitry Andric 1953b715b5SDimitry Andric #define INSTR_PROF_VALUE_PROF_DATA 2053b715b5SDimitry Andric #include "InstrProfData.inc" 2153b715b5SDimitry Andric 2253b715b5SDimitry Andric /* Merge value profile data pointed to by SrcValueProfData into 2353b715b5SDimitry Andric * in-memory profile counters pointed by to DstData. */ lprofMergeValueProfData(ValueProfData * SrcValueProfData,__llvm_profile_data * DstData)2453b715b5SDimitry Andricvoid lprofMergeValueProfData(ValueProfData *SrcValueProfData, 2553b715b5SDimitry Andric __llvm_profile_data *DstData) { 26*4ba319b5SDimitry Andric unsigned I, S, V, DstIndex = 0; 2753b715b5SDimitry Andric InstrProfValueData *VData; 2853b715b5SDimitry Andric ValueProfRecord *VR = getFirstValueProfRecord(SrcValueProfData); 2953b715b5SDimitry Andric for (I = 0; I < SrcValueProfData->NumValueKinds; I++) { 3053b715b5SDimitry Andric VData = getValueProfRecordValueData(VR); 31*4ba319b5SDimitry Andric unsigned SrcIndex = 0; 3253b715b5SDimitry Andric for (S = 0; S < VR->NumValueSites; S++) { 3353b715b5SDimitry Andric uint8_t NV = VR->SiteCountArray[S]; 3453b715b5SDimitry Andric for (V = 0; V < NV; V++) { 35*4ba319b5SDimitry Andric __llvm_profile_instrument_target_value(VData[SrcIndex].Value, DstData, 36*4ba319b5SDimitry Andric DstIndex, VData[SrcIndex].Count); 37*4ba319b5SDimitry Andric ++SrcIndex; 3853b715b5SDimitry Andric } 39*4ba319b5SDimitry Andric ++DstIndex; 4053b715b5SDimitry Andric } 4153b715b5SDimitry Andric VR = getValueProfRecordNext(VR); 4253b715b5SDimitry Andric } 4353b715b5SDimitry Andric } 44*4ba319b5SDimitry Andric 45*4ba319b5SDimitry Andric #endif 46