1 /*===- InstrProfilingMergeFile.c - Profile in-process Merging ------------===*\
3 |* The LLVM Compiler Infrastructure
5 |* This file is distributed under the University of Illinois Open Source
6 |* License. See LICENSE.TXT for details.
8 |*===----------------------------------------------------------------------===
9 |* This file defines APIs needed to support in-process merging for profile data
11 \*===----------------------------------------------------------------------===*/
13 #if !defined(__Fuchsia__)
15 #include "InstrProfiling.h"
16 #include "InstrProfilingInternal.h"
17 #include "InstrProfilingUtil.h"
19 #define INSTR_PROF_VALUE_PROF_DATA
20 #include "InstrProfData.inc"
22 /* Merge value profile data pointed to by SrcValueProfData into
23 * in-memory profile counters pointed by to DstData. */
24 void 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);
41 VR = getValueProfRecordNext(VR);