blob: d247ca437729367c3f386f28f3066e0ab467604e [file] [log] [blame]
Stephen Hines86277eb2015-03-23 12:06:32 -07001/*===- InstrProfiling.h- Support library for PGO instrumentation ----------===*\
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#ifndef PROFILE_INSTRPROFILING_INTERNALH_
11#define PROFILE_INSTRPROFILING_INTERNALH_
12
13#include "InstrProfiling.h"
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080014#include "stddef.h"
Stephen Hines86277eb2015-03-23 12:06:32 -070015
16/*!
17 * \brief Write instrumentation data to the given buffer, given explicit
18 * pointers to the live data in memory. This function is probably not what you
19 * want. Use __llvm_profile_get_size_for_buffer instead. Use this function if
20 * your program has a custom memory layout.
21 */
22uint64_t __llvm_profile_get_size_for_buffer_internal(
23 const __llvm_profile_data *DataBegin, const __llvm_profile_data *DataEnd,
24 const uint64_t *CountersBegin, const uint64_t *CountersEnd,
25 const char *NamesBegin, const char *NamesEnd);
26
27/*!
28 * \brief Write instrumentation data to the given buffer, given explicit
29 * pointers to the live data in memory. This function is probably not what you
30 * want. Use __llvm_profile_write_buffer instead. Use this function if your
31 * program has a custom memory layout.
32 *
33 * \pre \c Buffer is the start of a buffer at least as big as \a
34 * __llvm_profile_get_size_for_buffer_internal().
35 */
36int __llvm_profile_write_buffer_internal(
37 char *Buffer, const __llvm_profile_data *DataBegin,
38 const __llvm_profile_data *DataEnd, const uint64_t *CountersBegin,
39 const uint64_t *CountersEnd, const char *NamesBegin, const char *NamesEnd);
40
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080041/*!
42 * This is an internal function not intended to be used externally.
43 */
44typedef struct ProfDataIOVec {
45 const void *Data;
46 size_t ElmSize;
47 size_t NumElm;
48} ProfDataIOVec;
49
50typedef uint32_t (*WriterCallback)(ProfDataIOVec *, uint32_t NumIOVecs,
51 void **WriterCtx);
52int llvmWriteProfData(WriterCallback Writer, void *WriterCtx,
53 const uint8_t *ValueDataBegin,
54 const uint64_t ValueDataSize);
55int llvmWriteProfDataImpl(WriterCallback Writer, void *WriterCtx,
56 const __llvm_profile_data *DataBegin,
57 const __llvm_profile_data *DataEnd,
58 const uint64_t *CountersBegin,
59 const uint64_t *CountersEnd,
60 const uint8_t *ValueDataBegin,
61 const uint64_t ValueDataSize, const char *NamesBegin,
62 const char *NamesEnd);
63
64extern char *(*GetEnvHook)(const char *);
65
Stephen Hines86277eb2015-03-23 12:06:32 -070066#endif