]>
Commit | Line | Data |
---|---|---|
92a42be0 SL |
1 | /*===- InstrProfilingPlatformLinux.c - Profile data Linux platform ------===*\ |
2 | |* | |
3 | |* The LLVM Compiler Infrastructure | |
4 | |* | |
5 | |* This file is distributed under the University of Illinois Open Source | |
6 | |* License. See LICENSE.TXT for details. | |
7 | |* | |
8 | \*===----------------------------------------------------------------------===*/ | |
9 | ||
10 | #include "InstrProfiling.h" | |
11 | ||
12 | #if defined(__linux__) || defined(__FreeBSD__) | |
13 | #include <stdlib.h> | |
14 | ||
3157f602 XL |
15 | #define PROF_DATA_START INSTR_PROF_SECT_START(INSTR_PROF_DATA_SECT_NAME) |
16 | #define PROF_DATA_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_DATA_SECT_NAME) | |
17 | #define PROF_NAME_START INSTR_PROF_SECT_START(INSTR_PROF_NAME_SECT_NAME) | |
18 | #define PROF_NAME_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_NAME_SECT_NAME) | |
19 | #define PROF_CNTS_START INSTR_PROF_SECT_START(INSTR_PROF_CNTS_SECT_NAME) | |
20 | #define PROF_CNTS_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_CNTS_SECT_NAME) | |
5bcae85e SL |
21 | #define PROF_VNODES_START INSTR_PROF_SECT_START(INSTR_PROF_VNODES_SECT_NAME) |
22 | #define PROF_VNODES_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_VNODES_SECT_NAME) | |
92a42be0 | 23 | |
3157f602 XL |
24 | /* Declare section start and stop symbols for various sections |
25 | * generated by compiler instrumentation. | |
26 | */ | |
27 | extern __llvm_profile_data PROF_DATA_START COMPILER_RT_VISIBILITY; | |
28 | extern __llvm_profile_data PROF_DATA_STOP COMPILER_RT_VISIBILITY; | |
29 | extern uint64_t PROF_CNTS_START COMPILER_RT_VISIBILITY; | |
30 | extern uint64_t PROF_CNTS_STOP COMPILER_RT_VISIBILITY; | |
31 | extern char PROF_NAME_START COMPILER_RT_VISIBILITY; | |
32 | extern char PROF_NAME_STOP COMPILER_RT_VISIBILITY; | |
5bcae85e SL |
33 | extern ValueProfNode PROF_VNODES_START COMPILER_RT_VISIBILITY; |
34 | extern ValueProfNode PROF_VNODES_STOP COMPILER_RT_VISIBILITY; | |
3157f602 XL |
35 | |
36 | /* Add dummy data to ensure the section is always created. */ | |
37 | __llvm_profile_data | |
38 | __prof_data_sect_data[0] COMPILER_RT_SECTION(INSTR_PROF_DATA_SECT_NAME_STR); | |
39 | uint64_t | |
40 | __prof_cnts_sect_data[0] COMPILER_RT_SECTION(INSTR_PROF_CNTS_SECT_NAME_STR); | |
41 | char __prof_nms_sect_data[0] COMPILER_RT_SECTION(INSTR_PROF_NAME_SECT_NAME_STR); | |
5bcae85e | 42 | ValueProfNode __prof_vnodes_sect_data[0] COMPILER_RT_SECTION(INSTR_PROF_VNODES_SECT_NAME_STR); |
3157f602 XL |
43 | |
44 | COMPILER_RT_VISIBILITY const __llvm_profile_data * | |
92a42be0 | 45 | __llvm_profile_begin_data(void) { |
3157f602 | 46 | return &PROF_DATA_START; |
92a42be0 | 47 | } |
3157f602 | 48 | COMPILER_RT_VISIBILITY const __llvm_profile_data * |
92a42be0 | 49 | __llvm_profile_end_data(void) { |
3157f602 | 50 | return &PROF_DATA_STOP; |
92a42be0 | 51 | } |
3157f602 XL |
52 | COMPILER_RT_VISIBILITY const char *__llvm_profile_begin_names(void) { |
53 | return &PROF_NAME_START; | |
92a42be0 | 54 | } |
3157f602 XL |
55 | COMPILER_RT_VISIBILITY const char *__llvm_profile_end_names(void) { |
56 | return &PROF_NAME_STOP; | |
92a42be0 | 57 | } |
3157f602 XL |
58 | COMPILER_RT_VISIBILITY uint64_t *__llvm_profile_begin_counters(void) { |
59 | return &PROF_CNTS_START; | |
92a42be0 | 60 | } |
3157f602 XL |
61 | COMPILER_RT_VISIBILITY uint64_t *__llvm_profile_end_counters(void) { |
62 | return &PROF_CNTS_STOP; | |
92a42be0 | 63 | } |
5bcae85e SL |
64 | |
65 | COMPILER_RT_VISIBILITY ValueProfNode * | |
66 | __llvm_profile_begin_vnodes(void) { | |
67 | return &PROF_VNODES_START; | |
68 | } | |
69 | COMPILER_RT_VISIBILITY ValueProfNode *__llvm_profile_end_vnodes(void) { | |
70 | return &PROF_VNODES_STOP; | |
71 | } | |
72 | COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = &PROF_VNODES_START; | |
73 | COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = &PROF_VNODES_STOP; | |
74 | ||
92a42be0 | 75 | #endif |