20#ifndef POLLY_SCOPDETECTIONDIAGNOSTIC_H
21#define POLLY_SCOPDETECTIONDIAGNOSTIC_H
23#include "llvm/Analysis/LoopInfo.h"
24#include "llvm/IR/DebugLoc.h"
25#include "llvm/IR/Instruction.h"
31class OptimizationRemarkEmitter;
38using llvm::BasicBlock;
40using llvm::Instruction;
42using llvm::OptimizationRemarkEmitter;
43using llvm::raw_ostream;
46using llvm::SmallVector;
50using BBPair = std::pair<BasicBlock *, BasicBlock *>;
67 OptimizationRemarkEmitter &ORE);
173 using iterator = SmallVector<RejectReasonPtr, 1>::const_iterator;
184 void print(raw_ostream &OS,
int level = 0)
const;
414 const Instruction *
Inst)
598 Loc(
L->getStartLoc()) {}
626 Loc(
L->getStartLoc()) {}
654 Loc(
L->getStartLoc()) {}
707 std::string Suffix =
"")
const;
Stores all errors that occurred during the detection.
void report(RejectReasonPtr Reject)
void print(raw_ostream &OS, int level=0) const
const Region * region() const
bool hasErrors() const
Returns true, if we store at least one error.
SmallVector< RejectReasonPtr, 1 >::const_iterator iterator
SmallVector< RejectReasonPtr, 1 > ErrorReports
Base class of all reject reasons found during Scop detection.
virtual std::string getRemarkName() const =0
Generate the remark name to identify this remark.
virtual std::string getMessage() const =0
Generate a reasonable diagnostic message describing this error.
const RejectReasonKind Kind
static const DebugLoc Unknown
virtual const BasicBlock * getRemarkBB() const =0
Get the Basic Block containing this remark.
virtual ~RejectReason()=default
RejectReason(RejectReasonKind K)
virtual std::string getEndUserMessage() const
Generate a message for the end-user describing this error.
RejectReasonKind getKind() const
virtual const DebugLoc & getDebugLoc() const
Get the source location of this error.
static bool classof(const RejectReason *RR)
ReportAffFunc(const RejectReasonKind K, const Instruction *Inst)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
const PointerSnapshotTy & getPointers() const
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::vector< const Value * > PointerSnapshotTy
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string formatInvalidAlias(std::string Prefix="", std::string Suffix="") const
Format an invalid alias set.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportAlias(Instruction *Inst, AliasSet &AS)
PointerSnapshotTy Pointers
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
ReportAlloca(Instruction *Inst)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
ReportCFG(const RejectReasonKind K)
static bool classof(const RejectReason *RR)
ReportDifferentArrayElementSize(const Instruction *Inst, const Value *V)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
ReportEntry(BasicBlock *BB)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
static bool classof(const RejectReason *RR)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
ReportFuncCall(Instruction *Inst)
static bool classof(const RejectReason *RR)
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportIndirectPredecessor(Instruction *Inst, DebugLoc DbgLoc)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportIntToPtr(Instruction *BaseValue)
ReportInvalidCond(const Instruction *Inst, BasicBlock *BB)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
ReportInvalidTerminator(BasicBlock *BB)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
ReportIrreducibleRegion(Region *R, DebugLoc DbgLoc)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
ReportLoopBound(Loop *L, const SCEV *LoopCount)
static bool classof(const RejectReason *RR)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
ReportLoopHasMultipleExits(Loop *L)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
Loop * L
The loop that has multiple exits.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
Loop * L
The loop that has no exit.
static bool classof(const RejectReason *RR)
ReportLoopHasNoExit(Loop *L)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
Loop * L
The loop for which not all loop latches are part of the scop.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
ReportLoopOnlySomeLatches(Loop *L)
static bool classof(const RejectReason *RR)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
static bool classof(const RejectReason *RR)
ReportNoBasePtr(const Instruction *Inst)
ReportNonAffBranch(BasicBlock *BB, const SCEV *LHS, const SCEV *RHS, const Instruction *Inst)
const SCEV * LHS
LHS & RHS of the failed condition.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const SCEV * AccessFunction
static bool classof(const RejectReason *RR)
ReportNonAffineAccess(const SCEV *AccessFunction, const Instruction *Inst, const Value *V)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
ReportNonSimpleMemoryAccess(Instruction *Inst)
static bool classof(const RejectReason *RR)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
static bool classof(const RejectReason *RR)
ReportOther(const RejectReasonKind K)
ReportUndefBasePtr(const Instruction *Inst)
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportUndefCond(const Instruction *Inst, BasicBlock *BB)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
ReportUndefOperand(BasicBlock *BB, const Instruction *Inst)
static bool classof(const RejectReason *RR)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
ReportUnknownInst(Instruction *Inst)
static bool classof(const RejectReason *RR)
static bool classof(const RejectReason *RR)
ReportUnprofitable(Region *R)
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getRemarkName() const override
Generate the remark name to identify this remark.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
ReportUnreachableInExit(BasicBlock *BB, DebugLoc DbgLoc)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
const DebugLoc & getDebugLoc() const override
Get the source location of this error.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
std::string getEndUserMessage() const override
Generate a message for the end-user describing this error.
ReportVariantBasePtr(Value *BaseValue, const Instruction *Inst)
const BasicBlock * getRemarkBB() const override
Get the Basic Block containing this remark.
static bool classof(const RejectReason *RR)
std::string getRemarkName() const override
Generate the remark name to identify this remark.
std::string getMessage() const override
Generate a reasonable diagnostic message describing this error.
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
std::shared_ptr< RejectReason > RejectReasonPtr
void getDebugLocations(const BBPair &P, DebugLoc &Begin, DebugLoc &End)
Set the begin and end source location for the region limited by P.
@ Value
MemoryKind::Value: Models an llvm::Value.
void emitRejectionRemarks(const BBPair &P, const RejectLog &Log, OptimizationRemarkEmitter &ORE)
Emit optimization remarks about the rejected regions to the user.
BBPair getBBPairForRegion(const Region *R)
Return the region delimiters (entry & exit block) of R.
std::pair< llvm::BasicBlock *, llvm::BasicBlock * > BBPair
Type to hold region delimiters (entry & exit block).