Coverage Report

Created: 2019-02-23 12:57

/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
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// Small set of diagnostic helper classes to encapsulate any errors occurred
10
// during the detection of Scops.
11
//
12
// The ScopDetection defines a set of error classes (via Statistic variables)
13
// that groups a number of individual errors into a group, e.g. non-affinity
14
// related errors.
15
// On error we generate an object that carries enough additional information
16
// to diagnose the error and generate a helpful error message.
17
//
18
//===----------------------------------------------------------------------===//
19
20
#ifndef POLLY_SCOPDETECTIONDIAGNOSTIC_H
21
#define POLLY_SCOPDETECTIONDIAGNOSTIC_H
22
23
#include "llvm/ADT/SmallVector.h"
24
#include "llvm/Analysis/LoopInfo.h"
25
#include "llvm/IR/DebugLoc.h"
26
#include "llvm/IR/Instruction.h"
27
#include <cstddef>
28
#include <memory>
29
#include <string>
30
#include <utility>
31
#include <vector>
32
33
using namespace llvm;
34
35
namespace llvm {
36
37
class AliasSet;
38
class BasicBlock;
39
class OptimizationRemarkEmitter;
40
class raw_ostream;
41
class Region;
42
class SCEV;
43
class Value;
44
} // namespace llvm
45
46
namespace polly {
47
48
/// Type to hold region delimiters (entry & exit block).
49
using BBPair = std::pair<BasicBlock *, BasicBlock *>;
50
51
/// Return the region delimiters (entry & exit block) of @p R.
52
BBPair getBBPairForRegion(const Region *R);
53
54
/// Set the begin and end source location for the region limited by @p P.
55
void getDebugLocations(const BBPair &P, DebugLoc &Begin, DebugLoc &End);
56
57
class RejectLog;
58
59
/// Emit optimization remarks about the rejected regions to the user.
60
///
61
/// This emits the content of the reject log as optimization remarks.
62
/// Remember to at least track failures (-polly-detect-track-failures).
63
/// @param P The region delimiters (entry & exit) we emit remarks for.
64
/// @param Log The error log containing all messages being emitted as remark.
65
void emitRejectionRemarks(const BBPair &P, const RejectLog &Log,
66
                          OptimizationRemarkEmitter &ORE);
67
68
// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
69
enum class RejectReasonKind {
70
  // CFG Category
71
  CFG,
72
  InvalidTerminator,
73
  IrreducibleRegion,
74
  UnreachableInExit,
75
  LastCFG,
76
77
  // Non-Affinity
78
  AffFunc,
79
  UndefCond,
80
  InvalidCond,
81
  UndefOperand,
82
  NonAffBranch,
83
  NoBasePtr,
84
  UndefBasePtr,
85
  VariantBasePtr,
86
  NonAffineAccess,
87
  DifferentElementSize,
88
  LastAffFunc,
89
90
  LoopBound,
91
  LoopHasNoExit,
92
  LoopHasMultipleExits,
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
602
  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
182
  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.15k
  explicit RejectLog(Region *R) : R(R) {}
170
171
  using iterator = SmallVector<RejectReasonPtr, 1>::const_iterator;
172
173
445
  iterator begin() const { return ErrorReports.begin(); }
174
445
  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.86k
  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
602
  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
216
  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
154
      : 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
5
        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
55
        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 a loop has multiple exists.
589
class ReportLoopHasMultipleExits : public RejectReason {
590
  /// The loop that has multiple exits.
591
  Loop *L;
592
593
  const DebugLoc Loc;
594
595
public:
596
  ReportLoopHasMultipleExits(Loop *L)
597
      : RejectReason(RejectReasonKind::LoopHasMultipleExits), L(L),
598
35
        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 when not all loop latches are part of the scop.
617
class ReportLoopOnlySomeLatches : public RejectReason {
618
  /// The loop for which not all loop latches are part of the scop.
619
  Loop *L;
620
621
  const DebugLoc Loc;
622
623
public:
624
  ReportLoopOnlySomeLatches(Loop *L)
625
      : RejectReason(RejectReasonKind::LoopOnlySomeLatches), L(L),
626
5
        Loc(L->getStartLoc()) {}
627
628
  /// @name LLVM-RTTI interface
629
  //@{
630
  static bool classof(const RejectReason *RR);
631
  //@}
632
633
  /// @name RejectReason interface
634
  //@{
635
  std::string getRemarkName() const override;
636
  const Value *getRemarkBB() const override;
637
  std::string getMessage() const override;
638
  const DebugLoc &getDebugLoc() const override;
639
  std::string getEndUserMessage() const override;
640
  //@}
641
};
642
643
//===----------------------------------------------------------------------===//
644
/// Captures errors with non-side-effect-known function calls.
645
class ReportFuncCall : public RejectReason {
646
  // The offending call instruction.
647
  Instruction *Inst;
648
649
public:
650
  ReportFuncCall(Instruction *Inst);
651
652
  /// @name LLVM-RTTI interface
653
  //@{
654
  static bool classof(const RejectReason *RR);
655
  //@}
656
657
  /// @name RejectReason interface
658
  //@{
659
  std::string getRemarkName() const override;
660
  const Value *getRemarkBB() const override;
661
  std::string getMessage() const override;
662
  const DebugLoc &getDebugLoc() const override;
663
  std::string getEndUserMessage() const override;
664
  //@}
665
};
666
667
//===----------------------------------------------------------------------===//
668
/// Captures errors with aliasing.
669
class ReportAlias : public RejectReason {
670
public:
671
  using PointerSnapshotTy = std::vector<const Value *>;
672
673
private:
674
  /// Format an invalid alias set.
675
  ///
676
  //  @param Prefix A prefix string to put before the list of aliasing pointers.
677
  //  @param Suffix A suffix string to put after the list of aliasing pointers.
678
  std::string formatInvalidAlias(std::string Prefix = "",
679
                                 std::string Suffix = "") const;
680
681
  Instruction *Inst;
682
683
  // A snapshot of the llvm values that took part in the aliasing error.
684
  mutable PointerSnapshotTy Pointers;
685
686
public:
687
  ReportAlias(Instruction *Inst, AliasSet &AS);
688
689
0
  const PointerSnapshotTy &getPointers() const { return Pointers; }
690
691
  /// @name LLVM-RTTI interface
692
  //@{
693
  static bool classof(const RejectReason *RR);
694
  //@}
695
696
  /// @name RejectReason interface
697
  //@{
698
  std::string getRemarkName() const override;
699
  const Value *getRemarkBB() const override;
700
  std::string getMessage() const override;
701
  const DebugLoc &getDebugLoc() const override;
702
  std::string getEndUserMessage() const override;
703
  //@}
704
};
705
706
//===----------------------------------------------------------------------===//
707
/// Base class for otherwise ungrouped reject reasons.
708
class ReportOther : public RejectReason {
709
public:
710
  ReportOther(const RejectReasonKind K);
711
712
  /// @name LLVM-RTTI interface
713
  //@{
714
  static bool classof(const RejectReason *RR);
715
  //@}
716
717
  /// @name RejectReason interface
718
  //@{
719
  std::string getRemarkName() const override;
720
  std::string getMessage() const override;
721
  //@}
722
};
723
724
//===----------------------------------------------------------------------===//
725
/// Captures errors with bad IntToPtr instructions.
726
class ReportIntToPtr : public ReportOther {
727
  // The offending base value.
728
  Instruction *BaseValue;
729
730
public:
731
  ReportIntToPtr(Instruction *BaseValue);
732
733
  /// @name LLVM-RTTI interface
734
  //@{
735
  static bool classof(const RejectReason *RR);
736
  //@}
737
738
  /// @name RejectReason interface
739
  //@{
740
  std::string getRemarkName() const override;
741
  const Value *getRemarkBB() const override;
742
  std::string getMessage() const override;
743
  const DebugLoc &getDebugLoc() const override;
744
  //@}
745
};
746
747
//===----------------------------------------------------------------------===//
748
/// Captures errors with alloca instructions.
749
class ReportAlloca : public ReportOther {
750
  Instruction *Inst;
751
752
public:
753
  ReportAlloca(Instruction *Inst);
754
755
  /// @name LLVM-RTTI interface
756
  //@{
757
  static bool classof(const RejectReason *RR);
758
  //@}
759
760
  /// @name RejectReason interface
761
  //@{
762
  std::string getRemarkName() const override;
763
  const Value *getRemarkBB() const override;
764
  std::string getMessage() const override;
765
  const DebugLoc &getDebugLoc() const override;
766
  //@}
767
};
768
769
//===----------------------------------------------------------------------===//
770
/// Captures errors with unknown instructions.
771
class ReportUnknownInst : public ReportOther {
772
  Instruction *Inst;
773
774
public:
775
  ReportUnknownInst(Instruction *Inst);
776
777
  /// @name LLVM-RTTI interface
778
  //@{
779
  static bool classof(const RejectReason *RR);
780
  //@}
781
782
  /// @name RejectReason interface
783
  //@{
784
  std::string getRemarkName() const override;
785
  const Value *getRemarkBB() const override;
786
  std::string getMessage() const override;
787
  const DebugLoc &getDebugLoc() const override;
788
  //@}
789
};
790
791
//===----------------------------------------------------------------------===//
792
/// Captures errors with regions containing the function entry block.
793
class ReportEntry : public ReportOther {
794
  BasicBlock *BB;
795
796
public:
797
  ReportEntry(BasicBlock *BB);
798
799
  /// @name LLVM-RTTI interface
800
  //@{
801
  static bool classof(const RejectReason *RR);
802
  //@}
803
804
  /// @name RejectReason interface
805
  //@{
806
  std::string getRemarkName() const override;
807
  const Value *getRemarkBB() const override;
808
  std::string getMessage() const override;
809
  std::string getEndUserMessage() const override;
810
  const DebugLoc &getDebugLoc() const override;
811
  //@}
812
};
813
814
//===----------------------------------------------------------------------===//
815
/// Report regions that seem not profitable to be optimized.
816
class ReportUnprofitable : public ReportOther {
817
  Region *R;
818
819
public:
820
  ReportUnprofitable(Region *R);
821
822
  /// @name LLVM-RTTI interface
823
  //@{
824
  static bool classof(const RejectReason *RR);
825
  //@}
826
827
  /// @name RejectReason interface
828
  //@{
829
  std::string getRemarkName() const override;
830
  const Value *getRemarkBB() const override;
831
  std::string getMessage() const override;
832
  std::string getEndUserMessage() const override;
833
  const DebugLoc &getDebugLoc() const override;
834
  //@}
835
};
836
837
//===----------------------------------------------------------------------===//
838
/// Captures errors with non-simple memory accesses.
839
class ReportNonSimpleMemoryAccess : public ReportOther {
840
  // The offending call instruction.
841
  Instruction *Inst;
842
843
public:
844
  ReportNonSimpleMemoryAccess(Instruction *Inst);
845
846
  /// @name LLVM-RTTI interface
847
  //@{
848
  static bool classof(const RejectReason *RR);
849
  //@}
850
851
  /// @name RejectReason interface
852
  //@{
853
  std::string getRemarkName() const override;
854
  const Value *getRemarkBB() const override;
855
  std::string getMessage() const override;
856
  const DebugLoc &getDebugLoc() const override;
857
  std::string getEndUserMessage() const override;
858
  //@}
859
};
860
} // namespace polly
861
862
#endif // POLLY_SCOPDETECTIONDIAGNOSTIC_H