xref: /freebsd/contrib/llvm-project/compiler-rt/lib/profile/InstrProfiling.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric /*===- InstrProfiling.h- Support library for PGO instrumentation ----------===*\
20b57cec5SDimitry Andric |*
30b57cec5SDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric |* See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric |*
70b57cec5SDimitry Andric \*===----------------------------------------------------------------------===*/
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef PROFILE_INSTRPROFILING_H_
100b57cec5SDimitry Andric #define PROFILE_INSTRPROFILING_H_
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "InstrProfilingPort.h"
130b57cec5SDimitry Andric #include <stdio.h>
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #define INSTR_PROF_VISIBILITY COMPILER_RT_VISIBILITY
16480093f4SDimitry Andric #include "profile/InstrProfData.inc"
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric enum ValueKind {
190b57cec5SDimitry Andric #define VALUE_PROF_KIND(Enumerator, Value, Descr) Enumerator = Value,
20480093f4SDimitry Andric #include "profile/InstrProfData.inc"
210b57cec5SDimitry Andric };
220b57cec5SDimitry Andric 
230b57cec5SDimitry Andric typedef void *IntPtrT;
240b57cec5SDimitry Andric typedef struct COMPILER_RT_ALIGNAS(INSTR_PROF_DATA_ALIGNMENT)
250b57cec5SDimitry Andric     __llvm_profile_data {
260b57cec5SDimitry Andric #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) Type Name;
27480093f4SDimitry Andric #include "profile/InstrProfData.inc"
280b57cec5SDimitry Andric } __llvm_profile_data;
290b57cec5SDimitry Andric 
300b57cec5SDimitry Andric typedef struct __llvm_profile_header {
310b57cec5SDimitry Andric #define INSTR_PROF_RAW_HEADER(Type, Name, Initializer) Type Name;
32480093f4SDimitry Andric #include "profile/InstrProfData.inc"
330b57cec5SDimitry Andric } __llvm_profile_header;
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric typedef struct ValueProfNode * PtrToNodeT;
360b57cec5SDimitry Andric typedef struct ValueProfNode {
370b57cec5SDimitry Andric #define INSTR_PROF_VALUE_NODE(Type, LLVMType, Name, Initializer) Type Name;
38480093f4SDimitry Andric #include "profile/InstrProfData.inc"
390b57cec5SDimitry Andric } ValueProfNode;
400b57cec5SDimitry Andric 
410b57cec5SDimitry Andric /*!
42480093f4SDimitry Andric  * \brief Return 1 if profile counters are continuously synced to the raw
43480093f4SDimitry Andric  * profile via an mmap(). This is in contrast to the default mode, in which
44480093f4SDimitry Andric  * the raw profile is written out at program exit time.
45480093f4SDimitry Andric  */
46480093f4SDimitry Andric int __llvm_profile_is_continuous_mode_enabled(void);
47480093f4SDimitry Andric 
48480093f4SDimitry Andric /*!
49480093f4SDimitry Andric  * \brief Enable continuous mode.
50480093f4SDimitry Andric  *
51480093f4SDimitry Andric  * See \ref __llvm_profile_is_continuous_mode_enabled. The behavior is undefined
52480093f4SDimitry Andric  * if continuous mode is already enabled, or if it cannot be enable due to
53480093f4SDimitry Andric  * conflicting options.
54480093f4SDimitry Andric  */
55480093f4SDimitry Andric void __llvm_profile_enable_continuous_mode(void);
56480093f4SDimitry Andric 
57480093f4SDimitry Andric /*!
58*5f757f3fSDimitry Andric  * \brief Disable continuous mode.
59*5f757f3fSDimitry Andric  *
60*5f757f3fSDimitry Andric  */
61*5f757f3fSDimitry Andric void __llvm_profile_disable_continuous_mode(void);
62*5f757f3fSDimitry Andric 
63*5f757f3fSDimitry Andric /*!
64e8d8bef9SDimitry Andric  * \brief Set the page size.
65e8d8bef9SDimitry Andric  *
66e8d8bef9SDimitry Andric  * This is a pre-requisite for enabling continuous mode. The buffer size
67e8d8bef9SDimitry Andric  * calculation code inside of libprofile cannot simply call getpagesize(), as
68e8d8bef9SDimitry Andric  * it is not allowed to depend on libc.
69e8d8bef9SDimitry Andric  */
70e8d8bef9SDimitry Andric void __llvm_profile_set_page_size(unsigned PageSize);
71e8d8bef9SDimitry Andric 
72e8d8bef9SDimitry Andric /*!
730b57cec5SDimitry Andric  * \brief Get number of bytes necessary to pad the argument to eight
740b57cec5SDimitry Andric  * byte boundary.
750b57cec5SDimitry Andric  */
760b57cec5SDimitry Andric uint8_t __llvm_profile_get_num_padding_bytes(uint64_t SizeInBytes);
770b57cec5SDimitry Andric 
780b57cec5SDimitry Andric /*!
790b57cec5SDimitry Andric  * \brief Get required size for profile buffer.
800b57cec5SDimitry Andric  */
810b57cec5SDimitry Andric uint64_t __llvm_profile_get_size_for_buffer(void);
820b57cec5SDimitry Andric 
830b57cec5SDimitry Andric /*!
840b57cec5SDimitry Andric  * \brief Write instrumentation data to the given buffer.
850b57cec5SDimitry Andric  *
860b57cec5SDimitry Andric  * \pre \c Buffer is the start of a buffer at least as big as \a
870b57cec5SDimitry Andric  * __llvm_profile_get_size_for_buffer().
880b57cec5SDimitry Andric  */
890b57cec5SDimitry Andric int __llvm_profile_write_buffer(char *Buffer);
900b57cec5SDimitry Andric 
910b57cec5SDimitry Andric const __llvm_profile_data *__llvm_profile_begin_data(void);
920b57cec5SDimitry Andric const __llvm_profile_data *__llvm_profile_end_data(void);
930b57cec5SDimitry Andric const char *__llvm_profile_begin_names(void);
940b57cec5SDimitry Andric const char *__llvm_profile_end_names(void);
9504eeddc0SDimitry Andric char *__llvm_profile_begin_counters(void);
9604eeddc0SDimitry Andric char *__llvm_profile_end_counters(void);
97*5f757f3fSDimitry Andric char *__llvm_profile_begin_bitmap(void);
98*5f757f3fSDimitry Andric char *__llvm_profile_end_bitmap(void);
990b57cec5SDimitry Andric ValueProfNode *__llvm_profile_begin_vnodes();
1000b57cec5SDimitry Andric ValueProfNode *__llvm_profile_end_vnodes();
1010b57cec5SDimitry Andric uint32_t *__llvm_profile_begin_orderfile();
1020b57cec5SDimitry Andric 
1030b57cec5SDimitry Andric /*!
1040b57cec5SDimitry Andric  * \brief Clear profile counters to zero.
1050b57cec5SDimitry Andric  *
1060b57cec5SDimitry Andric  */
1070b57cec5SDimitry Andric void __llvm_profile_reset_counters(void);
1080b57cec5SDimitry Andric 
1090b57cec5SDimitry Andric /*!
1100b57cec5SDimitry Andric  * \brief Merge profile data from buffer.
1110b57cec5SDimitry Andric  *
112*5f757f3fSDimitry Andric  * Read profile data from buffer \p Profile and merge with in-process profile
113*5f757f3fSDimitry Andric  * counters and bitmaps. The client is expected to have checked or already
114*5f757f3fSDimitry Andric  * know the profile data in the buffer matches the in-process counter
115*5f757f3fSDimitry Andric  * structure before calling it. Returns 0 (success) if the profile data is
116*5f757f3fSDimitry Andric  * valid. Upon reading invalid/corrupted profile data, returns 1 (failure).
1170b57cec5SDimitry Andric  */
118fe6060f1SDimitry Andric int __llvm_profile_merge_from_buffer(const char *Profile, uint64_t Size);
1190b57cec5SDimitry Andric 
1200b57cec5SDimitry Andric /*! \brief Check if profile in buffer matches the current binary.
1210b57cec5SDimitry Andric  *
1220b57cec5SDimitry Andric  *  Returns 0 (success) if the profile data in buffer \p Profile with size
1230b57cec5SDimitry Andric  *  \p Size was generated by the same binary and therefore matches
124*5f757f3fSDimitry Andric  *  structurally the in-process counters and bitmaps. If the profile data in
125*5f757f3fSDimitry Andric  *  buffer is not compatible, the interface returns 1 (failure).
1260b57cec5SDimitry Andric  */
1270b57cec5SDimitry Andric int __llvm_profile_check_compatibility(const char *Profile,
1280b57cec5SDimitry Andric                                        uint64_t Size);
1290b57cec5SDimitry Andric 
1300b57cec5SDimitry Andric /*!
1310b57cec5SDimitry Andric  * \brief Counts the number of times a target value is seen.
1320b57cec5SDimitry Andric  *
1330b57cec5SDimitry Andric  * Records the target value for the CounterIndex if not seen before. Otherwise,
1340b57cec5SDimitry Andric  * increments the counter associated w/ the target value.
1350b57cec5SDimitry Andric  * void __llvm_profile_instrument_target(uint64_t TargetValue, void *Data,
1360b57cec5SDimitry Andric  *                                       uint32_t CounterIndex);
1370b57cec5SDimitry Andric  */
1380b57cec5SDimitry Andric void INSTR_PROF_VALUE_PROF_FUNC(
1390b57cec5SDimitry Andric #define VALUE_PROF_FUNC_PARAM(ArgType, ArgName, ArgLLVMType) ArgType ArgName
140480093f4SDimitry Andric #include "profile/InstrProfData.inc"
1410b57cec5SDimitry Andric     );
1420b57cec5SDimitry Andric 
1430b57cec5SDimitry Andric void __llvm_profile_instrument_target_value(uint64_t TargetValue, void *Data,
1440b57cec5SDimitry Andric                                             uint32_t CounterIndex,
1450b57cec5SDimitry Andric                                             uint64_t CounterValue);
1460b57cec5SDimitry Andric 
1470b57cec5SDimitry Andric /*!
1480b57cec5SDimitry Andric  * \brief Write instrumentation data to the current file.
1490b57cec5SDimitry Andric  *
1500b57cec5SDimitry Andric  * Writes to the file with the last name given to \a *
1510b57cec5SDimitry Andric  * __llvm_profile_set_filename(),
1520b57cec5SDimitry Andric  * or if it hasn't been called, the \c LLVM_PROFILE_FILE environment variable,
1530b57cec5SDimitry Andric  * or if that's not set, the last name set to INSTR_PROF_PROFILE_NAME_VAR,
1540b57cec5SDimitry Andric  * or if that's not set,  \c "default.profraw".
1550b57cec5SDimitry Andric  */
1560b57cec5SDimitry Andric int __llvm_profile_write_file(void);
1570b57cec5SDimitry Andric 
1580b57cec5SDimitry Andric int __llvm_orderfile_write_file(void);
1590b57cec5SDimitry Andric /*!
1600b57cec5SDimitry Andric  * \brief this is a wrapper interface to \c __llvm_profile_write_file.
161349cc55cSDimitry Andric  * After this interface is invoked, an already dumped flag will be set
1620b57cec5SDimitry Andric  * so that profile won't be dumped again during program exit.
1630b57cec5SDimitry Andric  * Invocation of interface __llvm_profile_reset_counters will clear
1640b57cec5SDimitry Andric  * the flag. This interface is designed to be used to collect profile
1650b57cec5SDimitry Andric  * data from user selected hot regions. The use model is
1660b57cec5SDimitry Andric  *      __llvm_profile_reset_counters();
1670b57cec5SDimitry Andric  *      ... hot region 1
1680b57cec5SDimitry Andric  *      __llvm_profile_dump();
1690b57cec5SDimitry Andric  *      .. some other code
1700b57cec5SDimitry Andric  *      __llvm_profile_reset_counters();
1710b57cec5SDimitry Andric  *       ... hot region 2
1720b57cec5SDimitry Andric  *      __llvm_profile_dump();
1730b57cec5SDimitry Andric  *
1740b57cec5SDimitry Andric  *  It is expected that on-line profile merging is on with \c %m specifier
1750b57cec5SDimitry Andric  *  used in profile filename . If merging is  not turned on, user is expected
1760b57cec5SDimitry Andric  *  to invoke __llvm_profile_set_filename  to specify different profile names
1770b57cec5SDimitry Andric  *  for different regions before dumping to avoid profile write clobbering.
1780b57cec5SDimitry Andric  */
1790b57cec5SDimitry Andric int __llvm_profile_dump(void);
1800b57cec5SDimitry Andric 
1810b57cec5SDimitry Andric int __llvm_orderfile_dump(void);
1820b57cec5SDimitry Andric 
1830b57cec5SDimitry Andric /*!
1840b57cec5SDimitry Andric  * \brief Set the filename for writing instrumentation data.
1850b57cec5SDimitry Andric  *
1860b57cec5SDimitry Andric  * Sets the filename to be used for subsequent calls to
1870b57cec5SDimitry Andric  * \a __llvm_profile_write_file().
1880b57cec5SDimitry Andric  *
1890b57cec5SDimitry Andric  * \c Name is not copied, so it must remain valid.  Passing NULL resets the
1900b57cec5SDimitry Andric  * filename logic to the default behaviour.
19168d75effSDimitry Andric  *
19268d75effSDimitry Andric  * Note: There may be multiple copies of the profile runtime (one for each
19368d75effSDimitry Andric  * instrumented image/DSO). This API only modifies the filename within the
19468d75effSDimitry Andric  * copy of the runtime available to the calling image.
195480093f4SDimitry Andric  *
196480093f4SDimitry Andric  * Warning: This is a no-op if continuous mode (\ref
197480093f4SDimitry Andric  * __llvm_profile_is_continuous_mode_enabled) is on. The reason for this is
198480093f4SDimitry Andric  * that in continuous mode, profile counters are mmap()'d to the profile at
199480093f4SDimitry Andric  * program initialization time. Support for transferring the mmap'd profile
200480093f4SDimitry Andric  * counts to a new file has not been implemented.
2010b57cec5SDimitry Andric  */
2020b57cec5SDimitry Andric void __llvm_profile_set_filename(const char *Name);
2030b57cec5SDimitry Andric 
2040b57cec5SDimitry Andric /*!
205349cc55cSDimitry Andric  * \brief Set the FILE object for writing instrumentation data. Return 0 if set
206349cc55cSDimitry Andric  * successfully or return 1 if failed.
2070b57cec5SDimitry Andric  *
2080b57cec5SDimitry Andric  * Sets the FILE object to be used for subsequent calls to
2090b57cec5SDimitry Andric  * \a __llvm_profile_write_file(). The profile file name set by environment
2100b57cec5SDimitry Andric  * variable, command-line option, or calls to \a  __llvm_profile_set_filename
2110b57cec5SDimitry Andric  * will be ignored.
2120b57cec5SDimitry Andric  *
2130b57cec5SDimitry Andric  * \c File will not be closed after a call to \a __llvm_profile_write_file() but
2140b57cec5SDimitry Andric  * it may be flushed. Passing NULL restores default behavior.
2150b57cec5SDimitry Andric  *
2160b57cec5SDimitry Andric  * If \c EnableMerge is nonzero, the runtime will always merge profiling data
2170b57cec5SDimitry Andric  * with the contents of the profiling file. If EnableMerge is zero, the runtime
2180b57cec5SDimitry Andric  * may still merge the data if it would have merged for another reason (for
2190b57cec5SDimitry Andric  * example, because of a %m specifier in the file name).
22068d75effSDimitry Andric  *
22168d75effSDimitry Andric  * Note: There may be multiple copies of the profile runtime (one for each
22268d75effSDimitry Andric  * instrumented image/DSO). This API only modifies the file object within the
22368d75effSDimitry Andric  * copy of the runtime available to the calling image.
224480093f4SDimitry Andric  *
225349cc55cSDimitry Andric  * Warning: This is a no-op if EnableMerge is 0 in continuous mode (\ref
226349cc55cSDimitry Andric  * __llvm_profile_is_continuous_mode_enabled), because disable merging requires
227349cc55cSDimitry Andric  * copying the old profile file to new profile file and this function is usually
228349cc55cSDimitry Andric  * used when the proess doesn't have permission to open file.
2290b57cec5SDimitry Andric  */
230349cc55cSDimitry Andric int __llvm_profile_set_file_object(FILE *File, int EnableMerge);
2310b57cec5SDimitry Andric 
2320b57cec5SDimitry Andric /*! \brief Register to write instrumentation data to file at exit. */
2330b57cec5SDimitry Andric int __llvm_profile_register_write_file_atexit(void);
2340b57cec5SDimitry Andric 
2350b57cec5SDimitry Andric /*! \brief Initialize file handling. */
2360b57cec5SDimitry Andric void __llvm_profile_initialize_file(void);
2370b57cec5SDimitry Andric 
2385ffd83dbSDimitry Andric /*! \brief Initialize the profile runtime. */
2395ffd83dbSDimitry Andric void __llvm_profile_initialize(void);
2405ffd83dbSDimitry Andric 
2410b57cec5SDimitry Andric /*!
2420b57cec5SDimitry Andric  * \brief Return path prefix (excluding the base filename) of the profile data.
2430b57cec5SDimitry Andric  * This is useful for users using \c -fprofile-generate=./path_prefix who do
2440b57cec5SDimitry Andric  * not care about the default raw profile name. It is also useful to collect
2450b57cec5SDimitry Andric  * more than more profile data files dumped in the same directory (Online
2460b57cec5SDimitry Andric  * merge mode is turned on for instrumented programs with shared libs).
2470b57cec5SDimitry Andric  * Side-effect: this API call will invoke malloc with dynamic memory allocation.
2480b57cec5SDimitry Andric  */
2490b57cec5SDimitry Andric const char *__llvm_profile_get_path_prefix();
2500b57cec5SDimitry Andric 
2510b57cec5SDimitry Andric /*!
2520b57cec5SDimitry Andric  * \brief Return filename (including path) of the profile data. Note that if the
2530b57cec5SDimitry Andric  * user calls __llvm_profile_set_filename later after invoking this interface,
2540b57cec5SDimitry Andric  * the actual file name may differ from what is returned here.
25568d75effSDimitry Andric  * Side-effect: this API call will invoke malloc with dynamic memory allocation
25668d75effSDimitry Andric  * (the returned pointer must be passed to `free` to avoid a leak).
25768d75effSDimitry Andric  *
25868d75effSDimitry Andric  * Note: There may be multiple copies of the profile runtime (one for each
25968d75effSDimitry Andric  * instrumented image/DSO). This API only retrieves the filename from the copy
26068d75effSDimitry Andric  * of the runtime available to the calling image.
2610b57cec5SDimitry Andric  */
2620b57cec5SDimitry Andric const char *__llvm_profile_get_filename();
2630b57cec5SDimitry Andric 
2640b57cec5SDimitry Andric /*! \brief Get the magic token for the file format. */
2650b57cec5SDimitry Andric uint64_t __llvm_profile_get_magic(void);
2660b57cec5SDimitry Andric 
2670b57cec5SDimitry Andric /*! \brief Get the version of the file format. */
2680b57cec5SDimitry Andric uint64_t __llvm_profile_get_version(void);
2690b57cec5SDimitry Andric 
2700b57cec5SDimitry Andric /*! \brief Get the number of entries in the profile data section. */
27104eeddc0SDimitry Andric uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin,
27204eeddc0SDimitry Andric                                      const __llvm_profile_data *End);
27304eeddc0SDimitry Andric 
27404eeddc0SDimitry Andric /*! \brief Get the size of the profile data section in bytes. */
2750b57cec5SDimitry Andric uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin,
2760b57cec5SDimitry Andric                                       const __llvm_profile_data *End);
2770b57cec5SDimitry Andric 
27804eeddc0SDimitry Andric /*! \brief Get the size in bytes of a single counter entry. */
27904eeddc0SDimitry Andric size_t __llvm_profile_counter_entry_size(void);
28004eeddc0SDimitry Andric 
28104eeddc0SDimitry Andric /*! \brief Get the number of entries in the profile counters section. */
28204eeddc0SDimitry Andric uint64_t __llvm_profile_get_num_counters(const char *Begin, const char *End);
28304eeddc0SDimitry Andric 
28404eeddc0SDimitry Andric /*! \brief Get the size of the profile counters section in bytes. */
28504eeddc0SDimitry Andric uint64_t __llvm_profile_get_counters_size(const char *Begin, const char *End);
28604eeddc0SDimitry Andric 
287*5f757f3fSDimitry Andric /*! \brief Get the number of bytes in the profile bitmap section. */
288*5f757f3fSDimitry Andric uint64_t __llvm_profile_get_num_bitmap_bytes(const char *Begin,
289*5f757f3fSDimitry Andric                                              const char *End);
290*5f757f3fSDimitry Andric 
291*5f757f3fSDimitry Andric /*! \brief Get the size of the profile name section in bytes. */
292*5f757f3fSDimitry Andric uint64_t __llvm_profile_get_name_size(const char *Begin, const char *End);
293*5f757f3fSDimitry Andric 
294480093f4SDimitry Andric /* ! \brief Given the sizes of the data and counter information, return the
295480093f4SDimitry Andric  * number of padding bytes before and after the counters, and after the names,
296480093f4SDimitry Andric  * in the raw profile.
297480093f4SDimitry Andric  *
298480093f4SDimitry Andric  * Note: When mmap() mode is disabled, no padding bytes before/after counters
299480093f4SDimitry Andric  * are needed. However, in mmap() mode, the counter section in the raw profile
300480093f4SDimitry Andric  * must be page-aligned: this API computes the number of padding bytes
301480093f4SDimitry Andric  * needed to achieve that.
302480093f4SDimitry Andric  */
303480093f4SDimitry Andric void __llvm_profile_get_padding_sizes_for_counters(
304*5f757f3fSDimitry Andric     uint64_t DataSize, uint64_t CountersSize, uint64_t NumBitmapBytes,
305*5f757f3fSDimitry Andric     uint64_t NamesSize, uint64_t *PaddingBytesBeforeCounters,
306*5f757f3fSDimitry Andric     uint64_t *PaddingBytesAfterCounters, uint64_t *PaddingBytesAfterBitmap,
307480093f4SDimitry Andric     uint64_t *PaddingBytesAfterNames);
308480093f4SDimitry Andric 
3090b57cec5SDimitry Andric /*!
3100b57cec5SDimitry Andric  * \brief Set the flag that profile data has been dumped to the file.
3110b57cec5SDimitry Andric  * This is useful for users to disable dumping profile data to the file for
3120b57cec5SDimitry Andric  * certain processes in case the processes don't have permission to write to
3130b57cec5SDimitry Andric  * the disks, and trying to do so would result in side effects such as crashes.
3140b57cec5SDimitry Andric  */
3150b57cec5SDimitry Andric void __llvm_profile_set_dumped();
3160b57cec5SDimitry Andric 
3170b57cec5SDimitry Andric /*!
31868d75effSDimitry Andric  * This variable is defined in InstrProfilingRuntime.cpp as a hidden
3190b57cec5SDimitry Andric  * symbol. Its main purpose is to enable profile runtime user to
3200b57cec5SDimitry Andric  * bypass runtime initialization code -- if the client code explicitly
3210b57cec5SDimitry Andric  * define this variable, then InstProfileRuntime.o won't be linked in.
3220b57cec5SDimitry Andric  * Note that this variable's visibility needs to be hidden so that the
3230b57cec5SDimitry Andric  * definition of this variable in an instrumented shared library won't
3240b57cec5SDimitry Andric  * affect runtime initialization decision of the main program.
3250b57cec5SDimitry Andric  *  __llvm_profile_profile_runtime. */
3260b57cec5SDimitry Andric COMPILER_RT_VISIBILITY extern int INSTR_PROF_PROFILE_RUNTIME_VAR;
3270b57cec5SDimitry Andric 
3280b57cec5SDimitry Andric /*!
329349cc55cSDimitry Andric  * This variable is defined in InstrProfilingVersionVar.c as a hidden symbol
330349cc55cSDimitry Andric  * (except on Apple platforms where this symbol is checked by TAPI).  Its main
331349cc55cSDimitry Andric  * purpose is to encode the raw profile version value and other format related
332349cc55cSDimitry Andric  * information such as whether the profile is from IR based instrumentation. The
333349cc55cSDimitry Andric  * variable is defined as weak so that compiler can emit an overriding
334349cc55cSDimitry Andric  * definition depending on user option.
3350b57cec5SDimitry Andric  */
3360b57cec5SDimitry Andric extern uint64_t INSTR_PROF_RAW_VERSION_VAR; /* __llvm_profile_raw_version */
3370b57cec5SDimitry Andric 
3380b57cec5SDimitry Andric /*!
3390b57cec5SDimitry Andric  * This variable is a weak symbol defined in InstrProfiling.c. It allows
3400b57cec5SDimitry Andric  * compiler instrumentation to provide overriding definition with value
3410b57cec5SDimitry Andric  * from compiler command line. This variable has default visibility.
3420b57cec5SDimitry Andric  */
3430b57cec5SDimitry Andric extern char INSTR_PROF_PROFILE_NAME_VAR[1]; /* __llvm_profile_filename. */
3440b57cec5SDimitry Andric 
3450b57cec5SDimitry Andric #endif /* PROFILE_INSTRPROFILING_H_ */
346