Coverage Report

Created: 2018-04-23 18:20

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/include/polly/ScopDetectionDiagnostic.h
Line
Count
Source (jump to first uncovered line)
1
//===- ScopDetectionDiagnostic.h - Diagnostic for ScopDetection -*- 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
// Small set of diagnostic helper classes to encapsulate any errors occurred
11
// during the detection of Scops.
12
//
13
// The ScopDetection defines a set of error classes (via Statistic variables)
14
// that groups a number of individual errors into a group, e.g. non-affinity
15
// related errors.
16
// On error we generate an object that carries enough additional information
17
// to diagnose the error and generate a helpful error message.
18
//
19
//===----------------------------------------------------------------------===//
20
21
#ifndef POLLY_SCOPDETECTIONDIAGNOSTIC_H
22
#define POLLY_SCOPDETECTIONDIAGNOSTIC_H
23
24
#include "llvm/ADT/SmallVector.h"
25
#include "llvm/Analysis/LoopInfo.h"
26
#include "llvm/IR/DebugLoc.h"
27
#include "llvm/IR/Instruction.h"
28
#include <cstddef>
29
#include <memory>
30
#include <string>
31
#include <utility>
32
#include <vector>
33
34
using namespace llvm;
35
36
namespace llvm {
37
38
class AliasSet;
39
class BasicBlock;
40
class OptimizationRemarkEmitter;
41
class raw_ostream;
42
class Region;
43
class SCEV;
44
class Value;
45
} // namespace llvm
46
47
namespace polly {
48
49
/// Type to hold region delimiters (entry & exit block).
50
using BBPair = std::pair<BasicBlock *, BasicBlock *>;
51
52
/// Return the region delimiters (entry & exit block) of @p R.
53
BBPair getBBPairForRegion(const Region *R);
54
55
/// Set the begin and end source location for the region limited by @p P.
56
void getDebugLocations(const BBPair &P, DebugLoc &Begin, DebugLoc &End);
57
58
class RejectLog;
59
60
/// Emit optimization remarks about the rejected regions to the user.
61
///
62
/// This emits the content of the reject log as optimization remarks.
63
/// Remember to at least track failures (-polly-detect-track-failures).
64
/// @param P The region delimiters (entry & exit) we emit remarks for.
65
/// @param Log The error log containing all messages being emitted as remark.
66
void emitRejectionRemarks(const BBPair &P, const RejectLog &Log,
67
                          OptimizationRemarkEmitter &ORE);
68
69
// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
70
enum class RejectReasonKind {
71
  // CFG Category
72
  CFG,
73
  InvalidTerminator,
74
  IrreducibleRegion,
75
  UnreachableInExit,
76
  LastCFG,
77
78
  // Non-Affinity
79
  AffFunc,
80
  UndefCond,
81
  InvalidCond,
82
  UndefOperand,
83
  NonAffBranch,
84
  NoBasePtr,
85
  UndefBasePtr,
86
  VariantBasePtr,
87
  NonAffineAccess,
88
  DifferentElementSize,
89
  LastAffFunc,
90
91
  LoopBound,
92
  LoopHasNoExit,
93
  LoopOnlySomeLatches,
94
95
  FuncCall,
96
  NonSimpleMemoryAccess,
97
98
  Alias,
99
100
  // Other
101
  Other,
102
  IntToPtr,
103
  Alloca,
104
  UnknownInst,
105
  Entry,
106
  Unprofitable,
107
  LastOther
108
};
109
110
//===----------------------------------------------------------------------===//
111
/// Base class of all reject reasons found during Scop detection.
112
///
113
/// Subclasses of RejectReason should provide means to capture enough
114
/// diagnostic information to help clients figure out what and where something
115
/// went wrong in the Scop detection.
116
class RejectReason {
117
private:
118
  const RejectReasonKind Kind;
119
120
protected:
121
  static const DebugLoc Unknown;
122
123
public:
124
  RejectReason(RejectReasonKind K);
125
126
595
  virtual ~RejectReason() = default;
127
128
0
  RejectReasonKind getKind() const { return Kind; }
129
130
  /// Generate the remark name to identify this remark.
131
  ///
132
  /// @return A short string that identifies the error.
133
  virtual std::string getRemarkName() const = 0;
134
135
  /// Get the Basic Block containing this remark.
136
  ///
137
  /// @return The Basic Block containing this remark.
138
  virtual const Value *getRemarkBB() const = 0;
139
140
  /// Generate a reasonable diagnostic message describing this error.
141
  ///
142
  /// @return A debug message representing this error.
143
  virtual std::string getMessage() const = 0;
144
145
  /// Generate a message for the end-user describing this error.
146
  ///
147
  /// The message provided has to be suitable for the end-user. So it should
148
  /// not reference any LLVM internal data structures or terminology.
149
  /// Ideally, the message helps the end-user to increase the size of the
150
  /// regions amenable to Polly.
151
  ///
152
  /// @return A short message representing this error.
153
188
  virtual std::string getEndUserMessage() const { return "Unspecified error."; }
154
155
  /// Get the source location of this error.
156
  ///
157
  /// @return The debug location for this error.
158
  virtual const DebugLoc &getDebugLoc() const;
159
};
160
161
using RejectReasonPtr = std::shared_ptr<RejectReason>;
162
163
/// Stores all errors that occurred during the detection.
164
class RejectLog {
165
  Region *R;
166
  SmallVector<RejectReasonPtr, 1> ErrorReports;
167
168
public:
169
5.13k
  explicit RejectLog(Region *R) : R(R) {}
170
171
  using iterator = SmallVector<RejectReasonPtr, 1>::const_iterator;
172
173
433
  iterator begin() const { return ErrorReports.begin(); }
174
433
  iterator end() const { return ErrorReports.end(); }
175
11.3k
  size_t size() const { return ErrorReports.size(); }
176
177
  /// Returns true, if we store at least one error.
178
  ///
179
  /// @return true, if we store at least one error.
180
9.80k
  bool hasErrors() const { return size() > 0; }
181
182
  void print(raw_ostream &OS, int level = 0) const;
183
184
0
  const Region *region() const { return R; }
185
595
  void report(RejectReasonPtr Reject) { ErrorReports.push_back(Reject); }
186
};
187
188
//===----------------------------------------------------------------------===//
189
/// Base class for CFG related reject reasons.
190
///
191
/// Scop candidates that violate structural restrictions can be grouped under
192
/// this reject reason class.
193
class ReportCFG : public RejectReason {
194
public:
195
  ReportCFG(const RejectReasonKind K);
196
197
  /// @name LLVM-RTTI interface
198
  //@{
199
  static bool classof(const RejectReason *RR);
200
  //@}
201
};
202
203
//===----------------------------------------------------------------------===//
204
/// Captures bad terminator within a Scop candidate.
205
class ReportInvalidTerminator : public ReportCFG {
206
  BasicBlock *BB;
207
208
public:
209
  ReportInvalidTerminator(BasicBlock *BB)
210
0
      : ReportCFG(RejectReasonKind::InvalidTerminator), BB(BB) {}
211
212
  /// @name LLVM-RTTI interface
213
  //@{
214
  static bool classof(const RejectReason *RR);
215
  //@}
216
217
  /// @name RejectReason interface
218
  //@{
219
  std::string getRemarkName() const override;
220
  const Value *getRemarkBB() const override;
221
  std::string getMessage() const override;
222
  const DebugLoc &getDebugLoc() const override;
223
  //@}
224
};
225
226
//===----------------------------------------------------------------------===//
227
/// Captures irreducible regions in CFG.
228
class ReportIrreducibleRegion : public ReportCFG {
229
  Region *R;
230
  DebugLoc DbgLoc;
231
232
public:
233
  ReportIrreducibleRegion(Region *R, DebugLoc DbgLoc)
234
3
      : ReportCFG(RejectReasonKind::IrreducibleRegion), R(R), DbgLoc(DbgLoc) {}
235
236
  /// @name LLVM-RTTI interface
237
  //@{
238
  static bool classof(const RejectReason *RR);
239
  //@}
240
241
  /// @name RejectReason interface
242
  //@{
243
  std::string getRemarkName() const override;
244
  const Value *getRemarkBB() const override;
245
  std::string getMessage() const override;
246
  std::string getEndUserMessage() const override;
247
  const DebugLoc &getDebugLoc() const override;
248
  //@}
249
};
250
251
//===----------------------------------------------------------------------===//
252
/// Captures regions with an unreachable in the exit block.
253
class ReportUnreachableInExit : public ReportCFG {
254
  BasicBlock *BB;
255
  DebugLoc DbgLoc;
256
257
public:
258
  ReportUnreachableInExit(BasicBlock *BB, DebugLoc DbgLoc)
259
25
      : ReportCFG(RejectReasonKind::UnreachableInExit), BB(BB), DbgLoc(DbgLoc) {
260
25
  }
261
262
  /// @name LLVM-RTTI interface
263
  //@{
264
  static bool classof(const RejectReason *RR);
265
  //@}
266
267
  /// @name RejectReason interface
268
  //@{
269
  std::string getRemarkName() const override;
270
  const Value *getRemarkBB() const override;
271
  std::string getMessage() const override;
272
  std::string getEndUserMessage() const override;
273
  const DebugLoc &getDebugLoc() const override;
274
  //@}
275
};
276
277
//===----------------------------------------------------------------------===//
278
/// Base class for non-affine reject reasons.
279
///
280
/// Scop candidates that violate restrictions to affinity are reported under
281
/// this class.
282
class ReportAffFunc : public RejectReason {
283
protected:
284
  // The instruction that caused non-affinity to occur.
285
  const Instruction *Inst;
286
287
public:
288
  ReportAffFunc(const RejectReasonKind K, const Instruction *Inst);
289
290
  /// @name LLVM-RTTI interface
291
  //@{
292
  static bool classof(const RejectReason *RR);
293
  //@}
294
295
  /// @name RejectReason interface
296
  //@{
297
225
  const DebugLoc &getDebugLoc() const override { return Inst->getDebugLoc(); }
298
  //@}
299
};
300
301
//===----------------------------------------------------------------------===//
302
/// Captures a condition that is based on an 'undef' value.
303
class ReportUndefCond : public ReportAffFunc {
304
  // The BasicBlock we found the broken condition in.
305
  BasicBlock *BB;
306
307
public:
308
  ReportUndefCond(const Instruction *Inst, BasicBlock *BB)
309
159
      : ReportAffFunc(RejectReasonKind::UndefCond, Inst), BB(BB) {}
310
311
  /// @name LLVM-RTTI interface
312
  //@{
313
  static bool classof(const RejectReason *RR);
314
  //@}
315
316
  /// @name RejectReason interface
317
  //@{
318
  std::string getRemarkName() const override;
319
  const Value *getRemarkBB() const override;
320
  std::string getMessage() const override;
321
  //@}
322
};
323
324
//===----------------------------------------------------------------------===//
325
/// Captures an invalid condition
326
///
327
/// Conditions have to be either constants or icmp instructions.
328
class ReportInvalidCond : public ReportAffFunc {
329
  // The BasicBlock we found the broken condition in.
330
  BasicBlock *BB;
331
332
public:
333
  ReportInvalidCond(const Instruction *Inst, BasicBlock *BB)
334
1
      : ReportAffFunc(RejectReasonKind::InvalidCond, Inst), BB(BB) {}
335
336
  /// @name LLVM-RTTI interface
337
  //@{
338
  static bool classof(const RejectReason *RR);
339
  //@}
340
341
  /// @name RejectReason interface
342
  //@{
343
  std::string getRemarkName() const override;
344
  const Value *getRemarkBB() const override;
345
  std::string getMessage() const override;
346
  //@}
347
};
348
349
//===----------------------------------------------------------------------===//
350
/// Captures an undefined operand.
351
class ReportUndefOperand : public ReportAffFunc {
352
  // The BasicBlock we found the undefined operand in.
353
  BasicBlock *BB;
354
355
public:
356
  ReportUndefOperand(BasicBlock *BB, const Instruction *Inst)
357
5
      : ReportAffFunc(RejectReasonKind::UndefOperand, Inst), BB(BB) {}
358
359
  /// @name LLVM-RTTI interface
360
  //@{
361
  static bool classof(const RejectReason *RR);
362
  //@}
363
364
  /// @name RejectReason interface
365
  //@{
366
  std::string getRemarkName() const override;
367
  const Value *getRemarkBB() const override;
368
  std::string getMessage() const override;
369
  //@}
370
};
371
372
//===----------------------------------------------------------------------===//
373
/// Captures a non-affine branch.
374
class ReportNonAffBranch : public ReportAffFunc {
375
  // The BasicBlock we found the non-affine branch in.
376
  BasicBlock *BB;
377
378
  /// LHS & RHS of the failed condition.
379
  //@{
380
  const SCEV *LHS;
381
  const SCEV *RHS;
382
  //@}
383
384
public:
385
  ReportNonAffBranch(BasicBlock *BB, const SCEV *LHS, const SCEV *RHS,
386
                     const Instruction *Inst)
387
      : ReportAffFunc(RejectReasonKind::NonAffBranch, Inst), BB(BB), LHS(LHS),
388
6
        RHS(RHS) {}
389
390
0
  const SCEV *lhs() { return LHS; }
391
0
  const SCEV *rhs() { return RHS; }
392
393
  /// @name LLVM-RTTI interface
394
  //@{
395
  static bool classof(const RejectReason *RR);
396
  //@}
397
398
  /// @name RejectReason interface
399
  //@{
400
  std::string getRemarkName() const override;
401
  const Value *getRemarkBB() const override;
402
  std::string getMessage() const override;
403
  //@}
404
};
405
406
//===----------------------------------------------------------------------===//
407
/// Captures a missing base pointer.
408
class ReportNoBasePtr : public ReportAffFunc {
409
public:
410
  ReportNoBasePtr(const Instruction *Inst)
411
0
      : ReportAffFunc(RejectReasonKind::NoBasePtr, Inst) {}
412
413
  /// @name LLVM-RTTI interface
414
  //@{
415
  static bool classof(const RejectReason *RR);
416
  //@}
417
418
  /// @name RejectReason interface
419
  //@{
420
  std::string getRemarkName() const override;
421
  const Value *getRemarkBB() const override;
422
  std::string getMessage() const override;
423
  //@}
424
};
425
426
//===----------------------------------------------------------------------===//
427
/// Captures an undefined base pointer.
428
class ReportUndefBasePtr : public ReportAffFunc {
429
public:
430
  ReportUndefBasePtr(const Instruction *Inst)
431
6
      : ReportAffFunc(RejectReasonKind::UndefBasePtr, Inst) {}
432
433
  /// @name LLVM-RTTI interface
434
  //@{
435
  static bool classof(const RejectReason *RR);
436
  //@}
437
438
  /// @name RejectReason interface
439
  //@{
440
  std::string getRemarkName() const override;
441
  const Value *getRemarkBB() const override;
442
  std::string getMessage() const override;
443
  //@}
444
};
445
446
//===----------------------------------------------------------------------===//
447
/// Captures a base pointer that is not invariant in the region.
448
class ReportVariantBasePtr : public ReportAffFunc {
449
  // The variant base pointer.
450
  Value *BaseValue;
451
452
public:
453
  ReportVariantBasePtr(Value *BaseValue, const Instruction *Inst)
454
      : ReportAffFunc(RejectReasonKind::VariantBasePtr, Inst),
455
10
        BaseValue(BaseValue) {}
456
457
  /// @name LLVM-RTTI interface
458
  //@{
459
  static bool classof(const RejectReason *RR);
460
  //@}
461
462
  /// @name RejectReason interface
463
  //@{
464
  std::string getRemarkName() const override;
465
  const Value *getRemarkBB() const override;
466
  std::string getMessage() const override;
467
  std::string getEndUserMessage() const override;
468
  //@}
469
};
470
471
//===----------------------------------------------------------------------===//
472
/// Captures a non-affine access function.
473
class ReportNonAffineAccess : public ReportAffFunc {
474
  // The non-affine access function.
475
  const SCEV *AccessFunction;
476
477
  // The base pointer of the memory access.
478
  const Value *BaseValue;
479
480
public:
481
  ReportNonAffineAccess(const SCEV *AccessFunction, const Instruction *Inst,
482
                        const Value *V)
483
      : ReportAffFunc(RejectReasonKind::NonAffineAccess, Inst),
484
58
        AccessFunction(AccessFunction), BaseValue(V) {}
485
486
0
  const SCEV *get() { return AccessFunction; }
487
488
  /// @name LLVM-RTTI interface
489
  //@{
490
  static bool classof(const RejectReason *RR);
491
  //@}
492
493
  /// @name RejectReason interface
494
  //@{
495
  std::string getRemarkName() const override;
496
  const Value *getRemarkBB() const override;
497
  std::string getMessage() const override;
498
  std::string getEndUserMessage() const override;
499
  //@}
500
};
501
502
//===----------------------------------------------------------------------===//
503
/// Report array accesses with differing element size.
504
class ReportDifferentArrayElementSize : public ReportAffFunc {
505
  // The base pointer of the memory access.
506
  const Value *BaseValue;
507
508
public:
509
  ReportDifferentArrayElementSize(const Instruction *Inst, const Value *V)
510
      : ReportAffFunc(RejectReasonKind::DifferentElementSize, Inst),
511
0
        BaseValue(V) {}
512
513
  /// @name LLVM-RTTI interface
514
  //@{
515
  static bool classof(const RejectReason *RR);
516
  //@}
517
518
  /// @name RejectReason interface
519
  //@{
520
  std::string getRemarkName() const override;
521
  const Value *getRemarkBB() const override;
522
  std::string getMessage() const override;
523
  std::string getEndUserMessage() const override;
524
  //@}
525
};
526
527
//===----------------------------------------------------------------------===//
528
/// Captures errors with non affine loop bounds.
529
class ReportLoopBound : public RejectReason {
530
  // The offending loop.
531
  Loop *L;
532
533
  // The non-affine loop bound.
534
  const SCEV *LoopCount;
535
536
  // A copy of the offending loop's debug location.
537
  const DebugLoc Loc;
538
539
public:
540
  ReportLoopBound(Loop *L, const SCEV *LoopCount);
541
542
0
  const SCEV *loopCount() { return LoopCount; }
543
544
  /// @name LLVM-RTTI interface
545
  //@{
546
  static bool classof(const RejectReason *RR);
547
  //@}
548
549
  /// @name RejectReason interface
550
  //@{
551
  std::string getRemarkName() const override;
552
  const Value *getRemarkBB() const override;
553
  std::string getMessage() const override;
554
  const DebugLoc &getDebugLoc() const override;
555
  std::string getEndUserMessage() const override;
556
  //@}
557
};
558
559
//===----------------------------------------------------------------------===//
560
/// Captures errors when loop has no exit.
561
class ReportLoopHasNoExit : public RejectReason {
562
  /// The loop that has no exit.
563
  Loop *L;
564
565
  const DebugLoc Loc;
566
567
public:
568
  ReportLoopHasNoExit(Loop *L)
569
      : RejectReason(RejectReasonKind::LoopHasNoExit), L(L),
570
0
        Loc(L->getStartLoc()) {}
571
572
  /// @name LLVM-RTTI interface
573
  //@{
574
  static bool classof(const RejectReason *RR);
575
  //@}
576
577
  /// @name RejectReason interface
578
  //@{
579
  std::string getRemarkName() const override;
580
  const Value *getRemarkBB() const override;
581
  std::string getMessage() const override;
582
  const DebugLoc &getDebugLoc() const override;
583
  std::string getEndUserMessage() const override;
584
  //@}
585
};
586
587
//===----------------------------------------------------------------------===//
588
/// Captures errors when not all loop latches are part of the scop.
589
class ReportLoopOnlySomeLatches : public RejectReason {
590
  /// The loop for which not all loop latches are part of the scop.
591
  Loop *L;
592
593
  const DebugLoc Loc;
594
595
public:
596
  ReportLoopOnlySomeLatches(Loop *L)
597
      : RejectReason(RejectReasonKind::LoopOnlySomeLatches), L(L),
598
5
        Loc(L->getStartLoc()) {}
599
600
  /// @name LLVM-RTTI interface
601
  //@{
602
  static bool classof(const RejectReason *RR);
603
  //@}
604
605
  /// @name RejectReason interface
606
  //@{
607
  std::string getRemarkName() const override;
608
  const Value *getRemarkBB() const override;
609
  std::string getMessage() const override;
610
  const DebugLoc &getDebugLoc() const override;
611
  std::string getEndUserMessage() const override;
612
  //@}
613
};
614
615
//===----------------------------------------------------------------------===//
616
/// Captures errors with non-side-effect-known function calls.
617
class ReportFuncCall : public RejectReason {
618
  // The offending call instruction.
619
  Instruction *Inst;
620
621
public:
622
  ReportFuncCall(Instruction *Inst);
623
624
  /// @name LLVM-RTTI interface
625
  //@{
626
  static bool classof(const RejectReason *RR);
627
  //@}
628
629
  /// @name RejectReason interface
630
  //@{
631
  std::string getRemarkName() const override;
632
  const Value *getRemarkBB() const override;
633
  std::string getMessage() const override;
634
  const DebugLoc &getDebugLoc() const override;
635
  std::string getEndUserMessage() const override;
636
  //@}
637
};
638
639
//===----------------------------------------------------------------------===//
640
/// Captures errors with aliasing.
641
class ReportAlias : public RejectReason {
642
public:
643
  using PointerSnapshotTy = std::vector<const Value *>;
644
645
private:
646
  /// Format an invalid alias set.
647
  ///
648
  //  @param Prefix A prefix string to put before the list of aliasing pointers.
649
  //  @param Suffix A suffix string to put after the list of aliasing pointers.
650
  std::string formatInvalidAlias(std::string Prefix = "",
651
                                 std::string Suffix = "") const;
652
653
  Instruction *Inst;
654
655
  // A snapshot of the llvm values that took part in the aliasing error.
656
  mutable PointerSnapshotTy Pointers;
657
658
public:
659
  ReportAlias(Instruction *Inst, AliasSet &AS);
660
661
0
  const PointerSnapshotTy &getPointers() const { return Pointers; }
662
663
  /// @name LLVM-RTTI interface
664
  //@{
665
  static bool classof(const RejectReason *RR);
666
  //@}
667
668
  /// @name RejectReason interface
669
  //@{
670
  std::string getRemarkName() const override;
671
  const Value *getRemarkBB() const override;
672
  std::string getMessage() const override;
673
  const DebugLoc &getDebugLoc() const override;
674
  std::string getEndUserMessage() const override;
675
  //@}
676
};
677
678
//===----------------------------------------------------------------------===//
679
/// Base class for otherwise ungrouped reject reasons.
680
class ReportOther : public RejectReason {
681
public:
682
  ReportOther(const RejectReasonKind K);
683
684
  /// @name LLVM-RTTI interface
685
  //@{
686
  static bool classof(const RejectReason *RR);
687
  //@}
688
689
  /// @name RejectReason interface
690
  //@{
691
  std::string getRemarkName() const override;
692
  std::string getMessage() const override;
693
  //@}
694
};
695
696
//===----------------------------------------------------------------------===//
697
/// Captures errors with bad IntToPtr instructions.
698
class ReportIntToPtr : public ReportOther {
699
  // The offending base value.
700
  Instruction *BaseValue;
701
702
public:
703
  ReportIntToPtr(Instruction *BaseValue);
704
705
  /// @name LLVM-RTTI interface
706
  //@{
707
  static bool classof(const RejectReason *RR);
708
  //@}
709
710
  /// @name RejectReason interface
711
  //@{
712
  std::string getRemarkName() const override;
713
  const Value *getRemarkBB() const override;
714
  std::string getMessage() const override;
715
  const DebugLoc &getDebugLoc() const override;
716
  //@}
717
};
718
719
//===----------------------------------------------------------------------===//
720
/// Captures errors with alloca instructions.
721
class ReportAlloca : public ReportOther {
722
  Instruction *Inst;
723
724
public:
725
  ReportAlloca(Instruction *Inst);
726
727
  /// @name LLVM-RTTI interface
728
  //@{
729
  static bool classof(const RejectReason *RR);
730
  //@}
731
732
  /// @name RejectReason interface
733
  //@{
734
  std::string getRemarkName() const override;
735
  const Value *getRemarkBB() const override;
736
  std::string getMessage() const override;
737
  const DebugLoc &getDebugLoc() const override;
738
  //@}
739
};
740
741
//===----------------------------------------------------------------------===//
742
/// Captures errors with unknown instructions.
743
class ReportUnknownInst : public ReportOther {
744
  Instruction *Inst;
745
746
public:
747
  ReportUnknownInst(Instruction *Inst);
748
749
  /// @name LLVM-RTTI interface
750
  //@{
751
  static bool classof(const RejectReason *RR);
752
  //@}
753
754
  /// @name RejectReason interface
755
  //@{
756
  std::string getRemarkName() const override;
757
  const Value *getRemarkBB() const override;
758
  std::string getMessage() const override;
759
  const DebugLoc &getDebugLoc() const override;
760
  //@}
761
};
762
763
//===----------------------------------------------------------------------===//
764
/// Captures errors with regions containing the function entry block.
765
class ReportEntry : public ReportOther {
766
  BasicBlock *BB;
767
768
public:
769
  ReportEntry(BasicBlock *BB);
770
771
  /// @name LLVM-RTTI interface
772
  //@{
773
  static bool classof(const RejectReason *RR);
774
  //@}
775
776
  /// @name RejectReason interface
777
  //@{
778
  std::string getRemarkName() const override;
779
  const Value *getRemarkBB() const override;
780
  std::string getMessage() const override;
781
  std::string getEndUserMessage() const override;
782
  const DebugLoc &getDebugLoc() const override;
783
  //@}
784
};
785
786
//===----------------------------------------------------------------------===//
787
/// Report regions that seem not profitable to be optimized.
788
class ReportUnprofitable : public ReportOther {
789
  Region *R;
790
791
public:
792
  ReportUnprofitable(Region *R);
793
794
  /// @name LLVM-RTTI interface
795
  //@{
796
  static bool classof(const RejectReason *RR);
797
  //@}
798
799
  /// @name RejectReason interface
800
  //@{
801
  std::string getRemarkName() const override;
802
  const Value *getRemarkBB() const override;
803
  std::string getMessage() const override;
804
  std::string getEndUserMessage() const override;
805
  const DebugLoc &getDebugLoc() const override;
806
  //@}
807
};
808
809
//===----------------------------------------------------------------------===//
810
/// Captures errors with non-simple memory accesses.
811
class ReportNonSimpleMemoryAccess : public ReportOther {
812
  // The offending call instruction.
813
  Instruction *Inst;
814
815
public:
816
  ReportNonSimpleMemoryAccess(Instruction *Inst);
817
818
  /// @name LLVM-RTTI interface
819
  //@{
820
  static bool classof(const RejectReason *RR);
821
  //@}
822
823
  /// @name RejectReason interface
824
  //@{
825
  std::string getRemarkName() const override;
826
  const Value *getRemarkBB() const override;
827
  std::string getMessage() const override;
828
  const DebugLoc &getDebugLoc() const override;
829
  std::string getEndUserMessage() const override;
830
  //@}
831
};
832
} // namespace polly
833
834
#endif // POLLY_SCOPDETECTIONDIAGNOSTIC_H