607f29de8a23f8523397146de9f3ac3c9c21637b
[oota-llvm.git] / include / llvm / ProfileData / InstrProf.h
1 //=-- InstrProf.h - Instrumented profiling format support ---------*- C++ -*-=//
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 // Instrumentation-based profiling data is generated by instrumented
11 // binaries through library functions in compiler-rt, and read by the clang
12 // frontend to feed PGO.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_PROFILEDATA_INSTRPROF_H_
17 #define LLVM_PROFILEDATA_INSTRPROF_H_
18
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/ADT/StringSet.h"
21 #include "llvm/IR/GlobalValue.h"
22 #include "llvm/Support/Endian.h"
23 #include "llvm/Support/ErrorHandling.h"
24 #include "llvm/Support/ErrorOr.h"
25 #include "llvm/Support/MD5.h"
26 #include <cstdint>
27 #include <list>
28 #include <system_error>
29 #include <vector>
30
31 namespace llvm {
32
33 class Function;
34 class GlobalVariable;
35 class Module;
36
37 /// Return the name of data section containing profile counter variables.
38 inline StringRef getInstrProfCountersSectionName(bool AddSegment) {
39   return AddSegment ? "__DATA,__llvm_prf_cnts" : "__llvm_prf_cnts";
40 }
41
42 /// Return the name of data section containing names of instrumented
43 /// functions.
44 inline StringRef getInstrProfNameSectionName(bool AddSegment) {
45   return AddSegment ? "__DATA,__llvm_prf_names" : "__llvm_prf_names";
46 }
47
48 /// Return the name of the data section containing per-function control
49 /// data.
50 inline StringRef getInstrProfDataSectionName(bool AddSegment) {
51   return AddSegment ? "__DATA,__llvm_prf_data" : "__llvm_prf_data";
52 }
53
54 /// Return the name of the section containing function coverage mapping
55 /// data.
56 inline StringRef getInstrProfCoverageSectionName(bool AddSegment) {
57   return AddSegment ? "__DATA,__llvm_covmap" : "__llvm_covmap";
58 }
59
60 /// Return the name prefix of variables containing instrumented function names.
61 inline StringRef getInstrProfNameVarPrefix() { return "__llvm_profile_name_"; }
62
63 /// Return the name prefix of variables containing per-function control data.
64 inline StringRef getInstrProfDataVarPrefix() { return "__llvm_profile_data_"; }
65
66 /// Return the name prefix of profile counter variables.
67 inline StringRef getInstrProfCountersVarPrefix() {
68   return "__llvm_profile_counters_";
69 }
70
71 /// Return the name prefix of the COMDAT group for instrumentation variables
72 /// associated with a COMDAT function.
73 inline StringRef getInstrProfComdatPrefix() { return "__llvm_profile_vars_"; }
74
75 /// Return the name of a covarage mapping variable (internal linkage) 
76 /// for each instrumented source module. Such variables are allocated
77 /// in the __llvm_covmap section.
78 inline StringRef getCoverageMappingVarName() {
79   return "__llvm_coverage_mapping";
80 }
81
82 /// Return the name of function that registers all the per-function control
83 /// data at program startup time by calling __llvm_register_function. This
84 /// function has internal linkage and is called by  __llvm_profile_init
85 /// runtime method. This function is not generated for these platforms:
86 /// Darwin, Linux, and FreeBSD.
87 inline StringRef getInstrProfRegFuncsName() {
88   return "__llvm_profile_register_functions";
89 }
90
91 /// Return the name of the runtime interface that registers per-function control
92 /// data for one instrumented function.
93 inline StringRef getInstrProfRegFuncName() {
94   return "__llvm_profile_register_function";
95 }
96
97 /// Return the name of the runtime initialization method that is generated by
98 /// the compiler. The function calls __llvm_profile_register_functions and
99 /// __llvm_profile_override_default_filename functions if needed. This function
100 /// has internal linkage and invoked at startup time via init_array.
101 inline StringRef getInstrProfInitFuncName() { return "__llvm_profile_init"; }
102
103 /// Return the name of the hook variable defined in profile runtime library.
104 /// A reference to the variable causes the linker to link in the runtime
105 /// initialization module (which defines the hook variable).
106 inline StringRef getInstrProfRuntimeHookVarName() {
107   return "__llvm_profile_runtime";
108 }
109
110 /// Return the name of the compiler generated function that references the
111 /// runtime hook variable. The function is a weak global.
112 inline StringRef getInstrProfRuntimeHookVarUseFuncName() {
113   return "__llvm_profile_runtime_user";
114 }
115
116 /// Return the name of the profile runtime interface that overrides the default
117 /// profile data file name.
118 inline StringRef getInstrProfFileOverriderFuncName() {
119   return "__llvm_profile_override_default_filename";
120 }
121
122 /// Return the modified name for function \c F suitable to be
123 /// used the key for profile lookup.
124 std::string getPGOFuncName(const Function &F);
125
126 /// Return the modified name for a function suitable to be
127 /// used the key for profile lookup. The function's original
128 /// name is \c RawFuncName and has linkage of type \c Linkage.
129 /// The function is defined in module \c FileName.
130 std::string getPGOFuncName(StringRef RawFuncName,
131                            GlobalValue::LinkageTypes Linkage,
132                            StringRef FileName);
133
134 /// Create and return the global variable for function name used in PGO
135 /// instrumentation. \c FuncName is the name of the function returned
136 /// by \c getPGOFuncName call.
137 GlobalVariable *createPGOFuncNameVar(Function &F, StringRef FuncName);
138
139 /// Create and return the global variable for function name used in PGO
140 /// instrumentation.  /// \c FuncName is the name of the function
141 /// returned by \c getPGOFuncName call, \c M is the owning module,
142 /// and \c Linkage is the linkage of the instrumented function.
143 GlobalVariable *createPGOFuncNameVar(Module &M,
144                                      GlobalValue::LinkageTypes Linkage,
145                                      StringRef FuncName);
146
147 const std::error_category &instrprof_category();
148
149 enum class instrprof_error {
150   success = 0,
151   eof,
152   bad_magic,
153   bad_header,
154   unsupported_version,
155   unsupported_hash_type,
156   too_large,
157   truncated,
158   malformed,
159   unknown_function,
160   hash_mismatch,
161   count_mismatch,
162   counter_overflow,
163   value_site_count_mismatch
164 };
165
166 inline std::error_code make_error_code(instrprof_error E) {
167   return std::error_code(static_cast<int>(E), instrprof_category());
168 }
169
170 enum InstrProfValueKind : uint32_t {
171   IPVK_IndirectCallTarget = 0,
172
173   IPVK_First = IPVK_IndirectCallTarget,
174   IPVK_Last = IPVK_IndirectCallTarget
175 };
176
177 struct InstrProfStringTable {
178   // Set of string values in profiling data.
179   StringSet<> StringValueSet;
180   InstrProfStringTable() { StringValueSet.clear(); }
181   // Get a pointer to internal storage of a string in set
182   const char *getStringData(StringRef Str) {
183     auto Result = StringValueSet.find(Str);
184     return (Result == StringValueSet.end()) ? nullptr : Result->first().data();
185   }
186   // Insert a string to StringTable
187   const char *insertString(StringRef Str) {
188     auto Result = StringValueSet.insert(Str);
189     return Result.first->first().data();
190   }
191 };
192
193 struct InstrProfValueData {
194   // Profiled value.
195   uint64_t Value;
196   // Number of times the value appears in the training run.
197   uint64_t Count;
198 };
199
200 struct InstrProfValueSiteRecord {
201   /// Value profiling data pairs at a given value site.
202   std::list<InstrProfValueData> ValueData;
203
204   InstrProfValueSiteRecord() { ValueData.clear(); }
205   template <class InputIterator>
206   InstrProfValueSiteRecord(InputIterator F, InputIterator L)
207       : ValueData(F, L) {}
208
209   /// Sort ValueData ascending by Value
210   void sortByTargetValues() {
211     ValueData.sort(
212         [](const InstrProfValueData &left, const InstrProfValueData &right) {
213           return left.Value < right.Value;
214         });
215   }
216
217   /// Merge data from another InstrProfValueSiteRecord
218   void mergeValueData(InstrProfValueSiteRecord &Input) {
219     this->sortByTargetValues();
220     Input.sortByTargetValues();
221     auto I = ValueData.begin();
222     auto IE = ValueData.end();
223     for (auto J = Input.ValueData.begin(), JE = Input.ValueData.end(); J != JE;
224          ++J) {
225       while (I != IE && I->Value < J->Value)
226         ++I;
227       if (I != IE && I->Value == J->Value) {
228         I->Count += J->Count;
229         ++I;
230         continue;
231       }
232       ValueData.insert(I, *J);
233     }
234   }
235 };
236
237 /// Profiling information for a single function.
238 struct InstrProfRecord {
239   InstrProfRecord() {}
240   InstrProfRecord(StringRef Name, uint64_t Hash, std::vector<uint64_t> Counts)
241       : Name(Name), Hash(Hash), Counts(std::move(Counts)) {}
242   StringRef Name;
243   uint64_t Hash;
244   std::vector<uint64_t> Counts;
245
246   typedef std::vector<std::pair<uint64_t, const char *>> ValueMapType;
247
248   /// Return the number of value profile kinds with non-zero number
249   /// of profile sites.
250   inline uint32_t getNumValueKinds() const;
251   /// Return the number of instrumented sites for ValueKind.
252   inline uint32_t getNumValueSites(uint32_t ValueKind) const;
253   /// Return the total number of ValueData for ValueKind.
254   inline uint32_t getNumValueData(uint32_t ValueKind) const;
255   /// Return the number of value data collected for ValueKind at profiling
256   /// site: Site.
257   inline uint32_t getNumValueDataForSite(uint32_t ValueKind,
258                                          uint32_t Site) const;
259   inline std::unique_ptr<InstrProfValueData[]>
260   getValueForSite(uint32_t ValueKind, uint32_t Site) const;
261   /// Reserve space for NumValueSites sites.
262   inline void reserveSites(uint32_t ValueKind, uint32_t NumValueSites);
263   /// Add ValueData for ValueKind at value Site.
264   inline void addValueData(uint32_t ValueKind, uint32_t Site,
265                            InstrProfValueData *VData, uint32_t N,
266                            ValueMapType *HashKeys);
267   /// Merge Value Profile ddata from Src record to this record for ValueKind.
268   inline instrprof_error mergeValueProfData(uint32_t ValueKind,
269                                             InstrProfRecord &Src);
270
271   /// Used by InstrProfWriter: update the value strings to commoned strings in
272   /// the writer instance.
273   inline void updateStrings(InstrProfStringTable *StrTab);
274
275 private:
276   std::vector<InstrProfValueSiteRecord> IndirectCallSites;
277   const std::vector<InstrProfValueSiteRecord> &
278   getValueSitesForKind(uint32_t ValueKind) const {
279     switch (ValueKind) {
280     case IPVK_IndirectCallTarget:
281       return IndirectCallSites;
282     default:
283       llvm_unreachable("Unknown value kind!");
284     }
285     return IndirectCallSites;
286   }
287
288   std::vector<InstrProfValueSiteRecord> &
289   getValueSitesForKind(uint32_t ValueKind) {
290     return const_cast<std::vector<InstrProfValueSiteRecord> &>(
291         const_cast<const InstrProfRecord *>(this)
292             ->getValueSitesForKind(ValueKind));
293   }
294   // Map indirect call target name hash to name string.
295   uint64_t remapValue(uint64_t Value, uint32_t ValueKind,
296                       ValueMapType *HashKeys) {
297     if (!HashKeys)
298       return Value;
299     switch (ValueKind) {
300     case IPVK_IndirectCallTarget: {
301       auto Result =
302           std::lower_bound(HashKeys->begin(), HashKeys->end(), Value,
303                            [](const std::pair<uint64_t, const char *> &LHS,
304                               uint64_t RHS) { return LHS.first < RHS; });
305       assert(Result != HashKeys->end() &&
306              "Hash does not match any known keys\n");
307       Value = (uint64_t)Result->second;
308       break;
309     }
310     }
311     return Value;
312   }
313 };
314
315 uint32_t InstrProfRecord::getNumValueKinds() const {
316   uint32_t NumValueKinds = 0;
317   for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)
318     NumValueKinds += !(getValueSitesForKind(Kind).empty());
319   return NumValueKinds;
320 }
321
322 uint32_t InstrProfRecord::getNumValueData(uint32_t ValueKind) const {
323   uint32_t N = 0;
324   const std::vector<InstrProfValueSiteRecord> &SiteRecords =
325       getValueSitesForKind(ValueKind);
326   for (auto &SR : SiteRecords) {
327     N += SR.ValueData.size();
328   }
329   return N;
330 }
331
332 uint32_t InstrProfRecord::getNumValueSites(uint32_t ValueKind) const {
333   return getValueSitesForKind(ValueKind).size();
334 }
335
336 uint32_t InstrProfRecord::getNumValueDataForSite(uint32_t ValueKind,
337                                                  uint32_t Site) const {
338   return getValueSitesForKind(ValueKind)[Site].ValueData.size();
339 }
340
341 std::unique_ptr<InstrProfValueData[]>
342 InstrProfRecord::getValueForSite(uint32_t ValueKind, uint32_t Site) const {
343   uint32_t N = getNumValueDataForSite(ValueKind, Site);
344   if (N == 0)
345     return std::unique_ptr<InstrProfValueData[]>(nullptr);
346
347   std::unique_ptr<InstrProfValueData[]> VD(new InstrProfValueData[N]);
348   uint32_t I = 0;
349   for (auto V : getValueSitesForKind(ValueKind)[Site].ValueData) {
350     VD[I] = V;
351     I++;
352   }
353   assert(I == N);
354
355   return VD;
356 }
357
358 void InstrProfRecord::addValueData(uint32_t ValueKind, uint32_t Site,
359                                    InstrProfValueData *VData, uint32_t N,
360                                    ValueMapType *HashKeys) {
361   for (uint32_t I = 0; I < N; I++) {
362     VData[I].Value = remapValue(VData[I].Value, ValueKind, HashKeys);
363   }
364   std::vector<InstrProfValueSiteRecord> &ValueSites =
365       getValueSitesForKind(ValueKind);
366   if (N == 0)
367     ValueSites.push_back(InstrProfValueSiteRecord());
368   else
369     ValueSites.emplace_back(VData, VData + N);
370 }
371
372 void InstrProfRecord::reserveSites(uint32_t ValueKind, uint32_t NumValueSites) {
373   std::vector<InstrProfValueSiteRecord> &ValueSites =
374       getValueSitesForKind(ValueKind);
375   ValueSites.reserve(NumValueSites);
376 }
377
378 instrprof_error InstrProfRecord::mergeValueProfData(uint32_t ValueKind,
379                                                     InstrProfRecord &Src) {
380   uint32_t ThisNumValueSites = getNumValueSites(ValueKind);
381   uint32_t OtherNumValueSites = Src.getNumValueSites(ValueKind);
382   if (ThisNumValueSites != OtherNumValueSites)
383     return instrprof_error::value_site_count_mismatch;
384   std::vector<InstrProfValueSiteRecord> &ThisSiteRecords =
385       getValueSitesForKind(ValueKind);
386   std::vector<InstrProfValueSiteRecord> &OtherSiteRecords =
387       Src.getValueSitesForKind(ValueKind);
388   for (uint32_t I = 0; I < ThisNumValueSites; I++)
389     ThisSiteRecords[I].mergeValueData(OtherSiteRecords[I]);
390   return instrprof_error::success;
391 }
392
393 void InstrProfRecord::updateStrings(InstrProfStringTable *StrTab) {
394   if (!StrTab)
395     return;
396
397   Name = StrTab->insertString(Name);
398   for (auto &VSite : IndirectCallSites)
399     for (auto &VData : VSite.ValueData)
400       VData.Value = (uint64_t)StrTab->insertString((const char *)VData.Value);
401 }
402
403 namespace IndexedInstrProf {
404 enum class HashT : uint32_t {
405   MD5,
406
407   Last = MD5
408 };
409
410 static inline uint64_t MD5Hash(StringRef Str) {
411   MD5 Hash;
412   Hash.update(Str);
413   llvm::MD5::MD5Result Result;
414   Hash.final(Result);
415   // Return the least significant 8 bytes. Our MD5 implementation returns the
416   // result in little endian, so we may need to swap bytes.
417   using namespace llvm::support;
418   return endian::read<uint64_t, little, unaligned>(Result);
419 }
420
421 static inline uint64_t ComputeHash(HashT Type, StringRef K) {
422   switch (Type) {
423     case HashT::MD5:
424       return IndexedInstrProf::MD5Hash(K);
425   }
426   llvm_unreachable("Unhandled hash type");
427 }
428
429 const uint64_t Magic = 0x8169666f72706cff;  // "\xfflprofi\x81"
430 const uint64_t Version = 3;
431 const HashT HashType = HashT::MD5;
432
433 // This structure defines the file header of the LLVM profile
434 // data file in indexed-format.
435 struct Header {
436   uint64_t Magic;
437   uint64_t Version;
438   uint64_t MaxFunctionCount;
439   uint64_t HashType;
440   uint64_t HashOffset;
441 };
442
443 inline support::endianness getHostEndianness() {
444   return sys::IsLittleEndianHost ? support::little : support::big;
445 }
446
447 /// This is the header of the data structure that defines the on-disk
448 /// layout of the value profile data of a particular kind for one function.
449 struct ValueProfRecord {
450   // The kind of the value profile record.
451   uint32_t Kind;
452   // The number of value profile sites. It is guaranteed to be non-zero;
453   // otherwise the record for this kind won't be emitted.
454   uint32_t NumValueSites;
455   // The first element of the array that stores the number of profiled
456   // values for each value site. The size of the array is NumValueSites.
457   // Since NumValueSites is greater than zero, there is at least one
458   // element in the array.
459   uint8_t SiteCountArray[1];
460
461   // The fake declaration is for documentation purpose only.
462   // Align the start of next field to be on 8 byte boundaries.
463   // uint8_t Padding[X];
464
465   // The array of value profile data. The size of the array is the sum
466   // of all elements in SiteCountArray[].
467   // InstrProfValueData ValueData[];
468
469   /// Return the \c ValueProfRecord header size including the padding bytes.
470   static uint32_t getHeaderSize(uint32_t NumValueSites);
471   /// Return the total size of the value profile record including the
472   /// header and the value data.
473   static uint32_t getSize(uint32_t NumValueSites, uint32_t NumValueData);
474   /// Return the total size of the value profile record including the
475   /// header and the value data.
476   uint32_t getSize() const { return getSize(NumValueSites, getNumValueData()); }
477   /// Use this method to advance to the next \c ValueProfRecord.
478   ValueProfRecord *getNext();
479   /// Return the pointer to the first value profile data.
480   InstrProfValueData *getValueData();
481   /// Return the number of value sites.
482   uint32_t getNumValueSites() const { return NumValueSites; }
483   /// Return the number of value data.
484   uint32_t getNumValueData() const;
485   /// Read data from this record and save it to Record.
486   void deserializeTo(InstrProfRecord &Record,
487                      InstrProfRecord::ValueMapType *VMap);
488   /// Extract data from \c Record and serialize into this instance.
489   void serializeFrom(const InstrProfRecord &Record, uint32_t ValueKind,
490                      uint32_t NumValueSites);
491   /// In-place byte swap:
492   /// Do byte swap for this instance. \c Old is the original order before
493   /// the swap, and \c New is the New byte order.
494   void swapBytes(support::endianness Old, support::endianness New);
495 };
496
497 /// Per-function header/control data structure for value profiling
498 /// data in indexed format.
499 struct ValueProfData {
500   // Total size in bytes including this field. It must be a multiple
501   // of sizeof(uint64_t).
502   uint32_t TotalSize;
503   // The number of value profile kinds that has value profile data.
504   // In this implementation, a value profile kind is considered to
505   // have profile data if the number of value profile sites for the
506   // kind is not zero. More aggressively, the implemnetation can
507   // choose to check the actual data value: if none of the value sites
508   // has any profiled values, the kind can be skipped.
509   uint32_t NumValueKinds;
510
511   // Following are a sequence of variable length records. The prefix/header
512   // of each record is defined by ValueProfRecord type. The number of
513   // records is NumValueKinds.
514   // ValueProfRecord Record_1;
515   // ValueProfRecord Record_N;
516
517   /// Return the total size in bytes of the on-disk value profile data
518   /// given the data stored in Record.
519   static uint32_t getSize(const InstrProfRecord &Record);
520   /// Return a pointer to \c ValueProfData instance ready to be streamed.
521   static std::unique_ptr<ValueProfData>
522   serializeFrom(const InstrProfRecord &Record);
523   /// Return a pointer to \c ValueProfileData instance ready to be read.
524   /// All data in the instance are properly byte swapped. The input
525   /// data is assumed to be in little endian order.
526   static ErrorOr<std::unique_ptr<ValueProfData>>
527   getValueProfData(const unsigned char *D, const unsigned char *const BufferEnd,
528                    support::endianness SrcDataEndianness);
529   /// Swap byte order from \c Endianness order to host byte order.
530   void swapBytesToHost(support::endianness Endianness);
531   /// Swap byte order from host byte order to \c Endianness order.
532   void swapBytesFromHost(support::endianness Endianness);
533   /// Return the total size of \c ValueProfileData.
534   uint32_t getSize() const { return TotalSize; }
535   /// Read data from this data and save it to \c Record.
536   void deserializeTo(InstrProfRecord &Record,
537                      InstrProfRecord::ValueMapType *VMap);
538   /// Return the first \c ValueProfRecord instance.
539   ValueProfRecord *getFirstValueProfRecord();
540 };
541
542 }  // end namespace IndexedInstrProf
543
544 namespace RawInstrProf {
545
546 const uint64_t Version = 1;
547
548 // Magic number to detect file format and endianness.
549 // Use 255 at one end, since no UTF-8 file can use that character.  Avoid 0,
550 // so that utilities, like strings, don't grab it as a string.  129 is also
551 // invalid UTF-8, and high enough to be interesting.
552 // Use "lprofr" in the centre to stand for "LLVM Profile Raw", or "lprofR"
553 // for 32-bit platforms.
554 // The magic and version need to be kept in sync with
555 // projects/compiler-rt/lib/profile/InstrProfiling.c
556
557 template <class IntPtrT>
558 inline uint64_t getMagic();
559 template <>
560 inline uint64_t getMagic<uint64_t>() {
561   return uint64_t(255) << 56 | uint64_t('l') << 48 | uint64_t('p') << 40 |
562          uint64_t('r') << 32 | uint64_t('o') << 24 | uint64_t('f') << 16 |
563          uint64_t('r') << 8 | uint64_t(129);
564 }
565
566 template <>
567 inline uint64_t getMagic<uint32_t>() {
568   return uint64_t(255) << 56 | uint64_t('l') << 48 | uint64_t('p') << 40 |
569          uint64_t('r') << 32 | uint64_t('o') << 24 | uint64_t('f') << 16 |
570          uint64_t('R') << 8 | uint64_t(129);
571 }
572
573 // Per-function profile data header/control structure.
574 // The definition should match the structure defined in
575 // compiler-rt/lib/profile/InstrProfiling.h.
576 // It should also match the synthesized type in
577 // Transforms/Instrumentation/InstrProfiling.cpp:getOrCreateRegionCounters.
578 template <class IntPtrT> struct ProfileData {
579   #define INSTR_PROF_DATA(Type, LLVMType, Name, Init) Type Name;
580   #include "llvm/ProfileData/InstrProfData.inc"
581 };
582
583 // File header structure of the LLVM profile data in raw format.
584 // The definition should match the header referenced in
585 // compiler-rt/lib/profile/InstrProfilingFile.c  and
586 // InstrProfilingBuffer.c.
587 struct Header {
588   const uint64_t Magic;
589   const uint64_t Version;
590   const uint64_t DataSize;
591   const uint64_t CountersSize;
592   const uint64_t NamesSize;
593   const uint64_t CountersDelta;
594   const uint64_t NamesDelta;
595 };
596
597 }  // end namespace RawInstrProf
598
599 namespace coverage {
600
601 // Profile coverage map has the following layout:
602 // [CoverageMapFileHeader]
603 // [ArrayStart]
604 //  [CovMapFunctionRecord]
605 //  [CovMapFunctionRecord]
606 //  ...
607 // [ArrayEnd]
608 // [Encoded Region Mapping Data]
609 LLVM_PACKED_START
610 template <class IntPtrT> struct CovMapFunctionRecord {
611   #define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Type Name;
612   #include "llvm/ProfileData/InstrProfData.inc"
613 };
614 LLVM_PACKED_END
615
616 }
617
618 } // end namespace llvm
619
620 namespace std {
621 template <>
622 struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
623 }
624
625 #endif // LLVM_PROFILEDATA_INSTRPROF_H_