8ed65c0dd39f685aa6d401882e46013e9e9a0ac5
[oota-llvm.git] / include / llvm / IR / DiagnosticInfo.h
1 //===- llvm/Support/DiagnosticInfo.h - Diagnostic Declaration ---*- 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 // This file declares the different classes involved in low level diagnostics.
11 //
12 // Diagnostics reporting is still done as part of the LLVMContext.
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_IR_DIAGNOSTICINFO_H
16 #define LLVM_IR_DIAGNOSTICINFO_H
17
18 #include "llvm-c/Core.h"
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/IR/DebugLoc.h"
21 #include "llvm/IR/Module.h"
22 #include "llvm/Support/Casting.h"
23 #include <functional>
24
25 namespace llvm {
26
27 // Forward declarations.
28 class DiagnosticPrinter;
29 class Function;
30 class Instruction;
31 class LLVMContextImpl;
32 class Twine;
33 class Value;
34 class DebugLoc;
35 class SMDiagnostic;
36
37 /// \brief Defines the different supported severity of a diagnostic.
38 enum DiagnosticSeverity {
39   DS_Error,
40   DS_Warning,
41   DS_Remark,
42   // A note attaches additional information to one of the previous diagnostic
43   // types.
44   DS_Note
45 };
46
47 /// \brief Defines the different supported kind of a diagnostic.
48 /// This enum should be extended with a new ID for each added concrete subclass.
49 enum DiagnosticKind {
50   DK_Bitcode,
51   DK_InlineAsm,
52   DK_StackSize,
53   DK_Linker,
54   DK_DebugMetadataVersion,
55   DK_SampleProfile,
56   DK_OptimizationRemark,
57   DK_OptimizationRemarkMissed,
58   DK_OptimizationRemarkAnalysis,
59   DK_OptimizationRemarkAnalysisFPCommute,
60   DK_OptimizationRemarkAnalysisAliasing,
61   DK_OptimizationFailure,
62   DK_MIRParser,
63   DK_FirstPluginKind
64 };
65
66 /// \brief Get the next available kind ID for a plugin diagnostic.
67 /// Each time this function is called, it returns a different number.
68 /// Therefore, a plugin that wants to "identify" its own classes
69 /// with a dynamic identifier, just have to use this method to get a new ID
70 /// and assign it to each of its classes.
71 /// The returned ID will be greater than or equal to DK_FirstPluginKind.
72 /// Thus, the plugin identifiers will not conflict with the
73 /// DiagnosticKind values.
74 int getNextAvailablePluginDiagnosticKind();
75
76 /// \brief This is the base abstract class for diagnostic reporting in
77 /// the backend.
78 /// The print method must be overloaded by the subclasses to print a
79 /// user-friendly message in the client of the backend (let us call it a
80 /// frontend).
81 class DiagnosticInfo {
82 private:
83   /// Kind defines the kind of report this is about.
84   const /* DiagnosticKind */ int Kind;
85   /// Severity gives the severity of the diagnostic.
86   const DiagnosticSeverity Severity;
87
88 public:
89   DiagnosticInfo(/* DiagnosticKind */ int Kind, DiagnosticSeverity Severity)
90       : Kind(Kind), Severity(Severity) {}
91
92   virtual ~DiagnosticInfo() {}
93
94   /* DiagnosticKind */ int getKind() const { return Kind; }
95   DiagnosticSeverity getSeverity() const { return Severity; }
96
97   /// Print using the given \p DP a user-friendly message.
98   /// This is the default message that will be printed to the user.
99   /// It is used when the frontend does not directly take advantage
100   /// of the information contained in fields of the subclasses.
101   /// The printed message must not end with '.' nor start with a severity
102   /// keyword.
103   virtual void print(DiagnosticPrinter &DP) const = 0;
104
105   static const char *AlwaysPrint;
106 };
107
108 typedef std::function<void(const DiagnosticInfo &)> DiagnosticHandlerFunction;
109
110 /// Diagnostic information for inline asm reporting.
111 /// This is basically a message and an optional location.
112 class DiagnosticInfoInlineAsm : public DiagnosticInfo {
113 private:
114   /// Optional line information. 0 if not set.
115   unsigned LocCookie;
116   /// Message to be reported.
117   const Twine &MsgStr;
118   /// Optional origin of the problem.
119   const Instruction *Instr;
120
121 public:
122   /// \p MsgStr is the message to be reported to the frontend.
123   /// This class does not copy \p MsgStr, therefore the reference must be valid
124   /// for the whole life time of the Diagnostic.
125   DiagnosticInfoInlineAsm(const Twine &MsgStr,
126                           DiagnosticSeverity Severity = DS_Error)
127       : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(0), MsgStr(MsgStr),
128         Instr(nullptr) {}
129
130   /// \p LocCookie if non-zero gives the line number for this report.
131   /// \p MsgStr gives the message.
132   /// This class does not copy \p MsgStr, therefore the reference must be valid
133   /// for the whole life time of the Diagnostic.
134   DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr,
135                           DiagnosticSeverity Severity = DS_Error)
136       : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(LocCookie),
137         MsgStr(MsgStr), Instr(nullptr) {}
138
139   /// \p Instr gives the original instruction that triggered the diagnostic.
140   /// \p MsgStr gives the message.
141   /// This class does not copy \p MsgStr, therefore the reference must be valid
142   /// for the whole life time of the Diagnostic.
143   /// Same for \p I.
144   DiagnosticInfoInlineAsm(const Instruction &I, const Twine &MsgStr,
145                           DiagnosticSeverity Severity = DS_Error);
146
147   unsigned getLocCookie() const { return LocCookie; }
148   const Twine &getMsgStr() const { return MsgStr; }
149   const Instruction *getInstruction() const { return Instr; }
150
151   /// \see DiagnosticInfo::print.
152   void print(DiagnosticPrinter &DP) const override;
153
154   static bool classof(const DiagnosticInfo *DI) {
155     return DI->getKind() == DK_InlineAsm;
156   }
157 };
158
159 /// Diagnostic information for stack size reporting.
160 /// This is basically a function and a size.
161 class DiagnosticInfoStackSize : public DiagnosticInfo {
162 private:
163   /// The function that is concerned by this stack size diagnostic.
164   const Function &Fn;
165   /// The computed stack size.
166   unsigned StackSize;
167
168 public:
169   /// \p The function that is concerned by this stack size diagnostic.
170   /// \p The computed stack size.
171   DiagnosticInfoStackSize(const Function &Fn, unsigned StackSize,
172                           DiagnosticSeverity Severity = DS_Warning)
173       : DiagnosticInfo(DK_StackSize, Severity), Fn(Fn), StackSize(StackSize) {}
174
175   const Function &getFunction() const { return Fn; }
176   unsigned getStackSize() const { return StackSize; }
177
178   /// \see DiagnosticInfo::print.
179   void print(DiagnosticPrinter &DP) const override;
180
181   static bool classof(const DiagnosticInfo *DI) {
182     return DI->getKind() == DK_StackSize;
183   }
184 };
185
186 /// Diagnostic information for debug metadata version reporting.
187 /// This is basically a module and a version.
188 class DiagnosticInfoDebugMetadataVersion : public DiagnosticInfo {
189 private:
190   /// The module that is concerned by this debug metadata version diagnostic.
191   const Module &M;
192   /// The actual metadata version.
193   unsigned MetadataVersion;
194
195 public:
196   /// \p The module that is concerned by this debug metadata version diagnostic.
197   /// \p The actual metadata version.
198   DiagnosticInfoDebugMetadataVersion(const Module &M, unsigned MetadataVersion,
199                           DiagnosticSeverity Severity = DS_Warning)
200       : DiagnosticInfo(DK_DebugMetadataVersion, Severity), M(M),
201         MetadataVersion(MetadataVersion) {}
202
203   const Module &getModule() const { return M; }
204   unsigned getMetadataVersion() const { return MetadataVersion; }
205
206   /// \see DiagnosticInfo::print.
207   void print(DiagnosticPrinter &DP) const override;
208
209   static bool classof(const DiagnosticInfo *DI) {
210     return DI->getKind() == DK_DebugMetadataVersion;
211   }
212 };
213
214 /// Diagnostic information for the sample profiler.
215 class DiagnosticInfoSampleProfile : public DiagnosticInfo {
216 public:
217   DiagnosticInfoSampleProfile(const char *FileName, unsigned LineNum,
218                               const Twine &Msg,
219                               DiagnosticSeverity Severity = DS_Error)
220       : DiagnosticInfo(DK_SampleProfile, Severity), FileName(FileName),
221         LineNum(LineNum), Msg(Msg) {}
222   DiagnosticInfoSampleProfile(const char *FileName, const Twine &Msg,
223                               DiagnosticSeverity Severity = DS_Error)
224       : DiagnosticInfo(DK_SampleProfile, Severity), FileName(FileName),
225         LineNum(0), Msg(Msg) {}
226   DiagnosticInfoSampleProfile(const Twine &Msg,
227                               DiagnosticSeverity Severity = DS_Error)
228       : DiagnosticInfo(DK_SampleProfile, Severity), FileName(nullptr),
229         LineNum(0), Msg(Msg) {}
230
231   /// \see DiagnosticInfo::print.
232   void print(DiagnosticPrinter &DP) const override;
233
234   static bool classof(const DiagnosticInfo *DI) {
235     return DI->getKind() == DK_SampleProfile;
236   }
237
238   const char *getFileName() const { return FileName; }
239   unsigned getLineNum() const { return LineNum; }
240   const Twine &getMsg() const { return Msg; }
241
242 private:
243   /// Name of the input file associated with this diagnostic.
244   const char *FileName;
245
246   /// Line number where the diagnostic occurred. If 0, no line number will
247   /// be emitted in the message.
248   unsigned LineNum;
249
250   /// Message to report.
251   const Twine &Msg;
252 };
253
254 /// Common features for diagnostics dealing with optimization remarks.
255 class DiagnosticInfoOptimizationBase : public DiagnosticInfo {
256 public:
257   /// \p PassName is the name of the pass emitting this diagnostic.
258   /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
259   /// the location information to use in the diagnostic. If line table
260   /// information is available, the diagnostic will include the source code
261   /// location. \p Msg is the message to show. Note that this class does not
262   /// copy this message, so this reference must be valid for the whole life time
263   /// of the diagnostic.
264   DiagnosticInfoOptimizationBase(enum DiagnosticKind Kind,
265                                  enum DiagnosticSeverity Severity,
266                                  const char *PassName, const Function &Fn,
267                                  const DebugLoc &DLoc, const Twine &Msg)
268       : DiagnosticInfo(Kind, Severity), PassName(PassName), Fn(Fn), DLoc(DLoc),
269         Msg(Msg) {}
270
271   /// \see DiagnosticInfo::print.
272   void print(DiagnosticPrinter &DP) const override;
273
274   /// Return true if this optimization remark is enabled by one of
275   /// of the LLVM command line flags (-pass-remarks, -pass-remarks-missed,
276   /// or -pass-remarks-analysis). Note that this only handles the LLVM
277   /// flags. We cannot access Clang flags from here (they are handled
278   /// in BackendConsumer::OptimizationRemarkHandler).
279   virtual bool isEnabled() const = 0;
280
281   /// Return true if location information is available for this diagnostic.
282   bool isLocationAvailable() const;
283
284   /// Return a string with the location information for this diagnostic
285   /// in the format "file:line:col". If location information is not available,
286   /// it returns "<unknown>:0:0".
287   const std::string getLocationStr() const;
288
289   /// Return location information for this diagnostic in three parts:
290   /// the source file name, line number and column.
291   void getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const;
292
293   const char *getPassName() const { return PassName; }
294   const Function &getFunction() const { return Fn; }
295   const DebugLoc &getDebugLoc() const { return DLoc; }
296   const Twine &getMsg() const { return Msg; }
297
298 private:
299   /// Name of the pass that triggers this report. If this matches the
300   /// regular expression given in -Rpass=regexp, then the remark will
301   /// be emitted.
302   const char *PassName;
303
304   /// Function where this diagnostic is triggered.
305   const Function &Fn;
306
307   /// Debug location where this diagnostic is triggered.
308   DebugLoc DLoc;
309
310   /// Message to report.
311   const Twine &Msg;
312 };
313
314 /// Diagnostic information for applied optimization remarks.
315 class DiagnosticInfoOptimizationRemark : public DiagnosticInfoOptimizationBase {
316 public:
317   /// \p PassName is the name of the pass emitting this diagnostic. If
318   /// this name matches the regular expression given in -Rpass=, then the
319   /// diagnostic will be emitted. \p Fn is the function where the diagnostic
320   /// is being emitted. \p DLoc is the location information to use in the
321   /// diagnostic. If line table information is available, the diagnostic
322   /// will include the source code location. \p Msg is the message to show.
323   /// Note that this class does not copy this message, so this reference
324   /// must be valid for the whole life time of the diagnostic.
325   DiagnosticInfoOptimizationRemark(const char *PassName, const Function &Fn,
326                                    const DebugLoc &DLoc, const Twine &Msg)
327       : DiagnosticInfoOptimizationBase(DK_OptimizationRemark, DS_Remark,
328                                        PassName, Fn, DLoc, Msg) {}
329
330   static bool classof(const DiagnosticInfo *DI) {
331     return DI->getKind() == DK_OptimizationRemark;
332   }
333
334   /// \see DiagnosticInfoOptimizationBase::isEnabled.
335   bool isEnabled() const override;
336 };
337
338 /// Diagnostic information for missed-optimization remarks.
339 class DiagnosticInfoOptimizationRemarkMissed
340     : public DiagnosticInfoOptimizationBase {
341 public:
342   /// \p PassName is the name of the pass emitting this diagnostic. If
343   /// this name matches the regular expression given in -Rpass-missed=, then the
344   /// diagnostic will be emitted. \p Fn is the function where the diagnostic
345   /// is being emitted. \p DLoc is the location information to use in the
346   /// diagnostic. If line table information is available, the diagnostic
347   /// will include the source code location. \p Msg is the message to show.
348   /// Note that this class does not copy this message, so this reference
349   /// must be valid for the whole life time of the diagnostic.
350   DiagnosticInfoOptimizationRemarkMissed(const char *PassName,
351                                          const Function &Fn,
352                                          const DebugLoc &DLoc, const Twine &Msg)
353       : DiagnosticInfoOptimizationBase(DK_OptimizationRemarkMissed, DS_Remark,
354                                        PassName, Fn, DLoc, Msg) {}
355
356   static bool classof(const DiagnosticInfo *DI) {
357     return DI->getKind() == DK_OptimizationRemarkMissed;
358   }
359
360   /// \see DiagnosticInfoOptimizationBase::isEnabled.
361   bool isEnabled() const override;
362 };
363
364 /// Diagnostic information for optimization analysis remarks.
365 class DiagnosticInfoOptimizationRemarkAnalysis
366     : public DiagnosticInfoOptimizationBase {
367 public:
368   /// \p PassName is the name of the pass emitting this diagnostic. If
369   /// this name matches the regular expression given in -Rpass-analysis=, then
370   /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
371   /// is being emitted. \p DLoc is the location information to use in the
372   /// diagnostic. If line table information is available, the diagnostic will
373   /// include the source code location. \p Msg is the message to show. Note that
374   /// this class does not copy this message, so this reference must be valid for
375   /// the whole life time of the diagnostic.
376   DiagnosticInfoOptimizationRemarkAnalysis(const char *PassName,
377                                            const Function &Fn,
378                                            const DebugLoc &DLoc,
379                                            const Twine &Msg)
380       : DiagnosticInfoOptimizationBase(DK_OptimizationRemarkAnalysis, DS_Remark,
381                                        PassName, Fn, DLoc, Msg) {}
382
383   static bool classof(const DiagnosticInfo *DI) {
384     return DI->getKind() == DK_OptimizationRemarkAnalysis;
385   }
386
387   /// \see DiagnosticInfoOptimizationBase::isEnabled.
388   bool isEnabled() const override;
389
390 protected:
391   DiagnosticInfoOptimizationRemarkAnalysis(enum DiagnosticKind Kind,
392                                            const char *PassName,
393                                            const Function &Fn,
394                                            const DebugLoc &DLoc,
395                                            const Twine &Msg)
396       : DiagnosticInfoOptimizationBase(Kind, DS_Remark, PassName, Fn, DLoc,
397                                        Msg) {}
398 };
399
400 /// Diagnostic information for optimization analysis remarks related to
401 /// floating-point non-commutativity.
402 class DiagnosticInfoOptimizationRemarkAnalysisFPCommute
403     : public DiagnosticInfoOptimizationRemarkAnalysis {
404 public:
405   /// \p PassName is the name of the pass emitting this diagnostic. If
406   /// this name matches the regular expression given in -Rpass-analysis=, then
407   /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
408   /// is being emitted. \p DLoc is the location information to use in the
409   /// diagnostic. If line table information is available, the diagnostic will
410   /// include the source code location. \p Msg is the message to show. The
411   /// front-end will append its own message related to options that address
412   /// floating-point non-commutativity. Note that this class does not copy this
413   /// message, so this reference must be valid for the whole life time of the
414   /// diagnostic.
415   DiagnosticInfoOptimizationRemarkAnalysisFPCommute(const char *PassName,
416                                                     const Function &Fn,
417                                                     const DebugLoc &DLoc,
418                                                     const Twine &Msg)
419       : DiagnosticInfoOptimizationRemarkAnalysis(
420             DK_OptimizationRemarkAnalysisFPCommute, PassName, Fn, DLoc, Msg) {}
421
422   static bool classof(const DiagnosticInfo *DI) {
423     return DI->getKind() == DK_OptimizationRemarkAnalysisFPCommute;
424   }
425 };
426
427 /// Diagnostic information for optimization analysis remarks related to
428 /// pointer aliasing.
429 class DiagnosticInfoOptimizationRemarkAnalysisAliasing
430     : public DiagnosticInfoOptimizationRemarkAnalysis {
431 public:
432   /// \p PassName is the name of the pass emitting this diagnostic. If
433   /// this name matches the regular expression given in -Rpass-analysis=, then
434   /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
435   /// is being emitted. \p DLoc is the location information to use in the
436   /// diagnostic. If line table information is available, the diagnostic will
437   /// include the source code location. \p Msg is the message to show. The
438   /// front-end will append its own message related to options that address
439   /// pointer aliasing legality. Note that this class does not copy this
440   /// message, so this reference must be valid for the whole life time of the
441   /// diagnostic.
442   DiagnosticInfoOptimizationRemarkAnalysisAliasing(const char *PassName,
443                                                    const Function &Fn,
444                                                    const DebugLoc &DLoc,
445                                                    const Twine &Msg)
446       : DiagnosticInfoOptimizationRemarkAnalysis(
447             DK_OptimizationRemarkAnalysisAliasing, PassName, Fn, DLoc, Msg) {}
448
449   static bool classof(const DiagnosticInfo *DI) {
450     return DI->getKind() == DK_OptimizationRemarkAnalysisAliasing;
451   }
452 };
453
454 /// Diagnostic information for machine IR parser.
455 class DiagnosticInfoMIRParser : public DiagnosticInfo {
456   const SMDiagnostic &Diagnostic;
457
458 public:
459   DiagnosticInfoMIRParser(DiagnosticSeverity Severity,
460                           const SMDiagnostic &Diagnostic)
461       : DiagnosticInfo(DK_MIRParser, Severity), Diagnostic(Diagnostic) {}
462
463   const SMDiagnostic &getDiagnostic() const { return Diagnostic; }
464
465   void print(DiagnosticPrinter &DP) const override;
466
467   static bool classof(const DiagnosticInfo *DI) {
468     return DI->getKind() == DK_MIRParser;
469   }
470 };
471
472 // Create wrappers for C Binding types (see CBindingWrapping.h).
473 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo, LLVMDiagnosticInfoRef)
474
475 /// Emit an optimization-applied message. \p PassName is the name of the pass
476 /// emitting the message. If -Rpass= is given and \p PassName matches the
477 /// regular expression in -Rpass, then the remark will be emitted. \p Fn is
478 /// the function triggering the remark, \p DLoc is the debug location where
479 /// the diagnostic is generated. \p Msg is the message string to use.
480 void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
481                             const Function &Fn, const DebugLoc &DLoc,
482                             const Twine &Msg);
483
484 /// Emit an optimization-missed message. \p PassName is the name of the
485 /// pass emitting the message. If -Rpass-missed= is given and \p PassName
486 /// matches the regular expression in -Rpass, then the remark will be
487 /// emitted. \p Fn is the function triggering the remark, \p DLoc is the
488 /// debug location where the diagnostic is generated. \p Msg is the
489 /// message string to use.
490 void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName,
491                                   const Function &Fn, const DebugLoc &DLoc,
492                                   const Twine &Msg);
493
494 /// Emit an optimization analysis remark message. \p PassName is the name of
495 /// the pass emitting the message. If -Rpass-analysis= is given and \p
496 /// PassName matches the regular expression in -Rpass, then the remark will be
497 /// emitted. \p Fn is the function triggering the remark, \p DLoc is the debug
498 /// location where the diagnostic is generated. \p Msg is the message string
499 /// to use.
500 void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName,
501                                     const Function &Fn, const DebugLoc &DLoc,
502                                     const Twine &Msg);
503
504 /// Emit an optimization analysis remark related to messages about
505 /// floating-point non-commutativity. \p PassName is the name of the pass
506 /// emitting the message. If -Rpass-analysis= is given and \p PassName matches
507 /// the regular expression in -Rpass, then the remark will be emitted. \p Fn is
508 /// the function triggering the remark, \p DLoc is the debug location where the
509 /// diagnostic is generated. \p Msg is the message string to use.
510 void emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx,
511                                              const char *PassName,
512                                              const Function &Fn,
513                                              const DebugLoc &DLoc,
514                                              const Twine &Msg);
515
516 /// Emit an optimization analysis remark related to messages about
517 /// pointer aliasing. \p PassName is the name of the pass emitting the message.
518 /// If -Rpass-analysis= is given and \p PassName matches the regular expression
519 /// in -Rpass, then the remark will be emitted. \p Fn is the function triggering
520 /// the remark, \p DLoc is the debug location where the diagnostic is generated.
521 /// \p Msg is the message string to use.
522 void emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
523                                             const char *PassName,
524                                             const Function &Fn,
525                                             const DebugLoc &DLoc,
526                                             const Twine &Msg);
527
528 /// Diagnostic information for optimization failures.
529 class DiagnosticInfoOptimizationFailure
530     : public DiagnosticInfoOptimizationBase {
531 public:
532   /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
533   /// the location information to use in the diagnostic. If line table
534   /// information is available, the diagnostic will include the source code
535   /// location. \p Msg is the message to show. Note that this class does not
536   /// copy this message, so this reference must be valid for the whole life time
537   /// of the diagnostic.
538   DiagnosticInfoOptimizationFailure(const Function &Fn, const DebugLoc &DLoc,
539                                     const Twine &Msg)
540       : DiagnosticInfoOptimizationBase(DK_OptimizationFailure, DS_Warning,
541                                        nullptr, Fn, DLoc, Msg) {}
542
543   static bool classof(const DiagnosticInfo *DI) {
544     return DI->getKind() == DK_OptimizationFailure;
545   }
546
547   /// \see DiagnosticInfoOptimizationBase::isEnabled.
548   bool isEnabled() const override;
549 };
550
551 /// Emit a warning when loop vectorization is specified but fails. \p Fn is the
552 /// function triggering the warning, \p DLoc is the debug location where the
553 /// diagnostic is generated. \p Msg is the message string to use.
554 void emitLoopVectorizeWarning(LLVMContext &Ctx, const Function &Fn,
555                               const DebugLoc &DLoc, const Twine &Msg);
556
557 /// Emit a warning when loop interleaving is specified but fails. \p Fn is the
558 /// function triggering the warning, \p DLoc is the debug location where the
559 /// diagnostic is generated. \p Msg is the message string to use.
560 void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn,
561                                const DebugLoc &DLoc, const Twine &Msg);
562
563 } // End namespace llvm
564
565 #endif