2016-03-04 02:54:46 +08:00
|
|
|
/*===- InstrProfilingMergeFile.c - Profile in-process Merging ------------===*\
|
|
|
|
|*
|
2019-01-19 16:50:56 +08:00
|
|
|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|* See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-03-04 02:54:46 +08:00
|
|
|
|*
|
|
|
|
|*===----------------------------------------------------------------------===
|
|
|
|
|* This file defines APIs needed to support in-process merging for profile data
|
|
|
|
|* stored in files.
|
|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
|
2018-07-25 11:01:35 +08:00
|
|
|
#if !defined(__Fuchsia__)
|
|
|
|
|
2016-03-04 02:54:46 +08:00
|
|
|
#include "InstrProfiling.h"
|
|
|
|
#include "InstrProfilingInternal.h"
|
|
|
|
#include "InstrProfilingUtil.h"
|
|
|
|
|
|
|
|
#define INSTR_PROF_VALUE_PROF_DATA
|
|
|
|
#include "InstrProfData.inc"
|
|
|
|
|
|
|
|
/* Merge value profile data pointed to by SrcValueProfData into
|
|
|
|
* in-memory profile counters pointed by to DstData. */
|
2019-02-15 05:38:40 +08:00
|
|
|
COMPILER_RT_VISIBILITY
|
2016-03-06 12:18:13 +08:00
|
|
|
void lprofMergeValueProfData(ValueProfData *SrcValueProfData,
|
|
|
|
__llvm_profile_data *DstData) {
|
2018-04-03 00:57:00 +08:00
|
|
|
unsigned I, S, V, DstIndex = 0;
|
2016-03-04 02:54:46 +08:00
|
|
|
InstrProfValueData *VData;
|
|
|
|
ValueProfRecord *VR = getFirstValueProfRecord(SrcValueProfData);
|
|
|
|
for (I = 0; I < SrcValueProfData->NumValueKinds; I++) {
|
|
|
|
VData = getValueProfRecordValueData(VR);
|
2018-04-03 00:57:00 +08:00
|
|
|
unsigned SrcIndex = 0;
|
2016-03-04 02:54:46 +08:00
|
|
|
for (S = 0; S < VR->NumValueSites; S++) {
|
|
|
|
uint8_t NV = VR->SiteCountArray[S];
|
|
|
|
for (V = 0; V < NV; V++) {
|
2018-04-03 00:57:00 +08:00
|
|
|
__llvm_profile_instrument_target_value(VData[SrcIndex].Value, DstData,
|
|
|
|
DstIndex, VData[SrcIndex].Count);
|
|
|
|
++SrcIndex;
|
2016-03-04 02:54:46 +08:00
|
|
|
}
|
2018-04-03 00:57:00 +08:00
|
|
|
++DstIndex;
|
2016-03-04 02:54:46 +08:00
|
|
|
}
|
|
|
|
VR = getValueProfRecordNext(VR);
|
|
|
|
}
|
|
|
|
}
|
2018-07-25 11:01:35 +08:00
|
|
|
|
|
|
|
#endif
|