2016-03-04 02:54:46 +08:00
|
|
|
/*===- InstrProfilingMergeFile.c - Profile in-process Merging ------------===*\
|
|
|
|
|*
|
|
|
|
|* The LLVM Compiler Infrastructure
|
|
|
|
|*
|
|
|
|
|* This file is distributed under the University of Illinois Open Source
|
|
|
|
|* License. See LICENSE.TXT for details.
|
|
|
|
|*
|
|
|
|
|*===----------------------------------------------------------------------===
|
|
|
|
|* This file defines APIs needed to support in-process merging for profile data
|
|
|
|
|* stored in files.
|
|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
|
|
|
|
#include "InstrProfiling.h"
|
|
|
|
#include "InstrProfilingInternal.h"
|
|
|
|
#include "InstrProfilingUtil.h"
|
|
|
|
|
|
|
|
#define INSTR_PROF_VALUE_PROF_DATA
|
|
|
|
#include "InstrProfData.inc"
|
|
|
|
|
|
|
|
void (*VPMergeHook)(ValueProfData *,
|
2016-03-06 12:18:13 +08:00
|
|
|
__llvm_profile_data *) = &lprofMergeValueProfData;
|
2016-03-04 02:54:46 +08:00
|
|
|
|
|
|
|
/* Merge value profile data pointed to by SrcValueProfData into
|
|
|
|
* in-memory profile counters pointed by to DstData. */
|
2016-03-06 12:18:13 +08:00
|
|
|
void lprofMergeValueProfData(ValueProfData *SrcValueProfData,
|
|
|
|
__llvm_profile_data *DstData) {
|
2016-03-04 02:54:46 +08:00
|
|
|
unsigned I, S, V, C;
|
|
|
|
InstrProfValueData *VData;
|
|
|
|
ValueProfRecord *VR = getFirstValueProfRecord(SrcValueProfData);
|
|
|
|
for (I = 0; I < SrcValueProfData->NumValueKinds; I++) {
|
|
|
|
VData = getValueProfRecordValueData(VR);
|
|
|
|
for (S = 0; S < VR->NumValueSites; S++) {
|
|
|
|
uint8_t NV = VR->SiteCountArray[S];
|
|
|
|
for (V = 0; V < NV; V++) {
|
|
|
|
for (C = 0; C < VData[V].Count; C++)
|
|
|
|
__llvm_profile_instrument_target(VData[V].Value, DstData, S);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
VR = getValueProfRecordNext(VR);
|
|
|
|
}
|
|
|
|
}
|