[Clang][SME2] Enable multi-vector loads & stores for SME2 (#75821)
[llvm-project.git] / compiler-rt / lib / profile / InstrProfilingMergeFile.c
blob8923ba21cc58082cc4c0da49ed72d5315e017f04
1 /*===- InstrProfilingMergeFile.c - Profile in-process Merging ------------===*\
2 |*
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 |* See https://llvm.org/LICENSE.txt for license information.
5 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 |*
7 |*===----------------------------------------------------------------------===
8 |* This file defines APIs needed to support in-process merging for profile data
9 |* stored in files.
10 \*===----------------------------------------------------------------------===*/
12 #if !defined(__Fuchsia__)
14 #include "InstrProfiling.h"
15 #include "InstrProfilingInternal.h"
16 #include "InstrProfilingUtil.h"
18 #define INSTR_PROF_VALUE_PROF_DATA
19 #include "profile/InstrProfData.inc"
21 /* Merge value profile data pointed to by SrcValueProfData into
22 * in-memory profile counters pointed by to DstData. */
23 COMPILER_RT_VISIBILITY
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);
37 ++SrcIndex;
39 ++DstIndex;
41 VR = getValueProfRecordNext(VR);
45 #endif