1 /*===- InstrProfilingMergeFile.c - Profile in-process Merging ------------===*\ 2 |* 3 |* The LLVM Compiler Infrastructure 4 |* 5 |* This file is distributed under the University of Illinois Open Source 6 |* License. See LICENSE.TXT for details. 7 |* 8 |*===----------------------------------------------------------------------=== 9 |* This file defines APIs needed to support in-process merging for profile data 10 |* stored in files. 11 \*===----------------------------------------------------------------------===*/ 12 13 #if !defined(__Fuchsia__) 14 15 #include "InstrProfiling.h" 16 #include "InstrProfilingInternal.h" 17 #include "InstrProfilingUtil.h" 18 19 #define INSTR_PROF_VALUE_PROF_DATA 20 #include "InstrProfData.inc" 21 22 /* Merge value profile data pointed to by SrcValueProfData into 23 * in-memory profile counters pointed by to DstData. */ lprofMergeValueProfData(ValueProfData * SrcValueProfData,__llvm_profile_data * DstData)24void lprofMergeValueProfData(ValueProfData *SrcValueProfData, 25 __llvm_profile_data *DstData) { 26 unsigned I, S, V, DstIndex = 0; 27 InstrProfValueData *VData; 28 ValueProfRecord *VR = getFirstValueProfRecord(SrcValueProfData); 29 for (I = 0; I < SrcValueProfData->NumValueKinds; I++) { 30 VData = getValueProfRecordValueData(VR); 31 unsigned SrcIndex = 0; 32 for (S = 0; S < VR->NumValueSites; S++) { 33 uint8_t NV = VR->SiteCountArray[S]; 34 for (V = 0; V < NV; V++) { 35 __llvm_profile_instrument_target_value(VData[SrcIndex].Value, DstData, 36 DstIndex, VData[SrcIndex].Count); 37 ++SrcIndex; 38 } 39 ++DstIndex; 40 } 41 VR = getValueProfRecordNext(VR); 42 } 43 } 44 45 #endif 46