Coverage Report

Created: 2018-06-24 14:39

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