]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/lib/profile/InstrProfilingMergeFile.c
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 #include "InstrProfiling.h"
14 #include "InstrProfilingInternal.h"
15 #include "InstrProfilingUtil.h"
17 #define INSTR_PROF_VALUE_PROF_DATA
18 #include "InstrProfData.inc"
20 void (*VPMergeHook
)(ValueProfData
*,
21 __llvm_profile_data
*) = &lprofMergeValueProfData
;
23 /* Merge value profile data pointed to by SrcValueProfData into
24 * in-memory profile counters pointed by to DstData. */
25 void lprofMergeValueProfData(ValueProfData
*SrcValueProfData
,
26 __llvm_profile_data
*DstData
) {
28 InstrProfValueData
*VData
;
29 ValueProfRecord
*VR
= getFirstValueProfRecord(SrcValueProfData
);
30 for (I
= 0; I
< SrcValueProfData
->NumValueKinds
; I
++) {
31 VData
= getValueProfRecordValueData(VR
);
32 for (S
= 0; S
< VR
->NumValueSites
; S
++) {
33 uint8_t NV
= VR
->SiteCountArray
[S
];
34 for (V
= 0; V
< NV
; V
++) {
35 for (C
= 0; C
< VData
[V
].Count
; C
++)
36 __llvm_profile_instrument_target(VData
[V
].Value
, DstData
, S
);
39 VR
= getValueProfRecordNext(VR
);