Path: blob/main/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingMergeFile.c
35233 views
/*===- InstrProfilingMergeFile.c - Profile in-process Merging ------------===*\1|*2|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3|* See https://llvm.org/LICENSE.txt for license information.4|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5|*6|*===----------------------------------------------------------------------===7|* This file defines APIs needed to support in-process merging for profile data8|* stored in files.9\*===----------------------------------------------------------------------===*/1011#if !defined(__Fuchsia__)1213#include "InstrProfiling.h"14#include "InstrProfilingInternal.h"15#include "InstrProfilingUtil.h"1617#define INSTR_PROF_VALUE_PROF_DATA18#include "profile/InstrProfData.inc"1920/* Merge value profile data pointed to by SrcValueProfData into21* in-memory profile counters pointed by to DstData. */22COMPILER_RT_VISIBILITY23void lprofMergeValueProfData(ValueProfData *SrcValueProfData,24__llvm_profile_data *DstData) {25unsigned I, S, V, DstIndex = 0;26InstrProfValueData *VData;27ValueProfRecord *VR = getFirstValueProfRecord(SrcValueProfData);28for (I = 0; I < SrcValueProfData->NumValueKinds; I++) {29VData = getValueProfRecordValueData(VR);30unsigned SrcIndex = 0;31for (S = 0; S < VR->NumValueSites; S++) {32uint8_t NV = VR->SiteCountArray[S];33for (V = 0; V < NV; V++) {34__llvm_profile_instrument_target_value(VData[SrcIndex].Value, DstData,35DstIndex, VData[SrcIndex].Count);36++SrcIndex;37}38++DstIndex;39}40VR = getValueProfRecordNext(VR);41}42}4344#endif454647