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