llvm/polly/lib/Analysis/ScopDetectionDiagnostic.cpp

//===- ScopDetectionDiagnostic.cpp - Error diagnostics --------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Small set of diagnostic helper classes to encapsulate any errors occurred
// during the detection of Scops.
//
// The ScopDetection defines a set of error classes (via Statistic variables)
// that groups a number of individual errors into a group, e.g. non-affinity
// related errors.
// On error we generate an object that carries enough additional information
// to diagnose the error and generate a helpful error message.
//
//===----------------------------------------------------------------------===//

#include "polly/ScopDetectionDiagnostic.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/AliasSetTracker.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <string>
#include <utility>

usingnamespacellvm;

#define DEBUG_TYPE

#define SCOP_STAT(NAME, DESC)

static Statistic RejectStatistics[] =;

namespace polly {

/// Small string conversion via raw_string_stream.
template <typename T> std::string operator+(Twine LHS, const T &RHS) {}
} // namespace polly

namespace llvm {

// Lexicographic order on (line, col) of our debug locations.
static bool operator<(const DebugLoc &LHS, const DebugLoc &RHS) {}
} // namespace llvm

namespace polly {

BBPair getBBPairForRegion(const Region *R) {}

void getDebugLocations(const BBPair &P, DebugLoc &Begin, DebugLoc &End) {}

void emitRejectionRemarks(const BBPair &P, const RejectLog &Log,
                          OptimizationRemarkEmitter &ORE) {}

//===----------------------------------------------------------------------===//
// RejectReason.

RejectReason::RejectReason(RejectReasonKind K) :{}

const DebugLoc RejectReason::Unknown =;

const DebugLoc &RejectReason::getDebugLoc() const {}

// RejectLog.
void RejectLog::print(raw_ostream &OS, int level) const {}

//===----------------------------------------------------------------------===//
// ReportCFG.

ReportCFG::ReportCFG(const RejectReasonKind K) :{}

bool ReportCFG::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportInvalidTerminator.

std::string ReportInvalidTerminator::getRemarkName() const {}

const Value *ReportInvalidTerminator::getRemarkBB() const {}

std::string ReportInvalidTerminator::getMessage() const {}

const DebugLoc &ReportInvalidTerminator::getDebugLoc() const {}

bool ReportInvalidTerminator::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// UnreachableInExit.

std::string ReportUnreachableInExit::getRemarkName() const {}

const Value *ReportUnreachableInExit::getRemarkBB() const {}

std::string ReportUnreachableInExit::getMessage() const {}

const DebugLoc &ReportUnreachableInExit::getDebugLoc() const {}

std::string ReportUnreachableInExit::getEndUserMessage() const {}

bool ReportUnreachableInExit::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// IndirectPredecessor.

std::string ReportIndirectPredecessor::getRemarkName() const {}

const Value *ReportIndirectPredecessor::getRemarkBB() const {}

std::string ReportIndirectPredecessor::getMessage() const {}

const DebugLoc &ReportIndirectPredecessor::getDebugLoc() const {}

std::string ReportIndirectPredecessor::getEndUserMessage() const {}

bool ReportIndirectPredecessor::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportIrreducibleRegion.

std::string ReportIrreducibleRegion::getRemarkName() const {}

const Value *ReportIrreducibleRegion::getRemarkBB() const {}

std::string ReportIrreducibleRegion::getMessage() const {}

const DebugLoc &ReportIrreducibleRegion::getDebugLoc() const {}

std::string ReportIrreducibleRegion::getEndUserMessage() const {}

bool ReportIrreducibleRegion::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportAffFunc.

ReportAffFunc::ReportAffFunc(const RejectReasonKind K, const Instruction *Inst)
    :{}

bool ReportAffFunc::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportUndefCond.

std::string ReportUndefCond::getRemarkName() const {}

const Value *ReportUndefCond::getRemarkBB() const {}

std::string ReportUndefCond::getMessage() const {}

bool ReportUndefCond::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportInvalidCond.

std::string ReportInvalidCond::getRemarkName() const {}

const Value *ReportInvalidCond::getRemarkBB() const {}

std::string ReportInvalidCond::getMessage() const {}

bool ReportInvalidCond::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportUndefOperand.

std::string ReportUndefOperand::getRemarkName() const {}

const Value *ReportUndefOperand::getRemarkBB() const {}

std::string ReportUndefOperand::getMessage() const {}

bool ReportUndefOperand::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportNonAffBranch.

std::string ReportNonAffBranch::getRemarkName() const {}

const Value *ReportNonAffBranch::getRemarkBB() const {}

std::string ReportNonAffBranch::getMessage() const {}

bool ReportNonAffBranch::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportNoBasePtr.

std::string ReportNoBasePtr::getRemarkName() const {}

const Value *ReportNoBasePtr::getRemarkBB() const {}

std::string ReportNoBasePtr::getMessage() const {}

bool ReportNoBasePtr::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportUndefBasePtr.

std::string ReportUndefBasePtr::getRemarkName() const {}

const Value *ReportUndefBasePtr::getRemarkBB() const {}

std::string ReportUndefBasePtr::getMessage() const {}

bool ReportUndefBasePtr::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportVariantBasePtr.

std::string ReportVariantBasePtr::getRemarkName() const {}

const Value *ReportVariantBasePtr::getRemarkBB() const {}

std::string ReportVariantBasePtr::getMessage() const {}

std::string ReportVariantBasePtr::getEndUserMessage() const {}

bool ReportVariantBasePtr::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportDifferentArrayElementSize

std::string ReportDifferentArrayElementSize::getRemarkName() const {}

const Value *ReportDifferentArrayElementSize::getRemarkBB() const {}

std::string ReportDifferentArrayElementSize::getMessage() const {}

bool ReportDifferentArrayElementSize::classof(const RejectReason *RR) {}

std::string ReportDifferentArrayElementSize::getEndUserMessage() const {}

//===----------------------------------------------------------------------===//
// ReportNonAffineAccess.

std::string ReportNonAffineAccess::getRemarkName() const {}

const Value *ReportNonAffineAccess::getRemarkBB() const {}

std::string ReportNonAffineAccess::getMessage() const {}

bool ReportNonAffineAccess::classof(const RejectReason *RR) {}

std::string ReportNonAffineAccess::getEndUserMessage() const {}

//===----------------------------------------------------------------------===//
// ReportLoopBound.

ReportLoopBound::ReportLoopBound(Loop *L, const SCEV *LoopCount)
    :{}

std::string ReportLoopBound::getRemarkName() const {}

const Value *ReportLoopBound::getRemarkBB() const {}

std::string ReportLoopBound::getMessage() const {}

const DebugLoc &ReportLoopBound::getDebugLoc() const {}

bool ReportLoopBound::classof(const RejectReason *RR) {}

std::string ReportLoopBound::getEndUserMessage() const {}

//===----------------------------------------------------------------------===//
// ReportLoopHasNoExit.

std::string ReportLoopHasNoExit::getRemarkName() const {}

const Value *ReportLoopHasNoExit::getRemarkBB() const {}

std::string ReportLoopHasNoExit::getMessage() const {}

bool ReportLoopHasNoExit::classof(const RejectReason *RR) {}

const DebugLoc &ReportLoopHasNoExit::getDebugLoc() const {}

std::string ReportLoopHasNoExit::getEndUserMessage() const {}

//===----------------------------------------------------------------------===//
// ReportLoopHasMultipleExits.

std::string ReportLoopHasMultipleExits::getRemarkName() const {}

const Value *ReportLoopHasMultipleExits::getRemarkBB() const {}

std::string ReportLoopHasMultipleExits::getMessage() const {}

bool ReportLoopHasMultipleExits::classof(const RejectReason *RR) {}

const DebugLoc &ReportLoopHasMultipleExits::getDebugLoc() const {}

std::string ReportLoopHasMultipleExits::getEndUserMessage() const {}

//===----------------------------------------------------------------------===//
// ReportLoopOnlySomeLatches

std::string ReportLoopOnlySomeLatches::getRemarkName() const {}

const Value *ReportLoopOnlySomeLatches::getRemarkBB() const {}

std::string ReportLoopOnlySomeLatches::getMessage() const {}

bool ReportLoopOnlySomeLatches::classof(const RejectReason *RR) {}

const DebugLoc &ReportLoopOnlySomeLatches::getDebugLoc() const {}

std::string ReportLoopOnlySomeLatches::getEndUserMessage() const {}

//===----------------------------------------------------------------------===//
// ReportFuncCall.

ReportFuncCall::ReportFuncCall(Instruction *Inst)
    :{}

std::string ReportFuncCall::getRemarkName() const {}

const Value *ReportFuncCall::getRemarkBB() const {}

std::string ReportFuncCall::getMessage() const {}

const DebugLoc &ReportFuncCall::getDebugLoc() const {}

std::string ReportFuncCall::getEndUserMessage() const {}

bool ReportFuncCall::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportNonSimpleMemoryAccess

ReportNonSimpleMemoryAccess::ReportNonSimpleMemoryAccess(Instruction *Inst)
    :{}

std::string ReportNonSimpleMemoryAccess::getRemarkName() const {}

const Value *ReportNonSimpleMemoryAccess::getRemarkBB() const {}

std::string ReportNonSimpleMemoryAccess::getMessage() const {}

const DebugLoc &ReportNonSimpleMemoryAccess::getDebugLoc() const {}

std::string ReportNonSimpleMemoryAccess::getEndUserMessage() const {}

bool ReportNonSimpleMemoryAccess::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportAlias.

ReportAlias::ReportAlias(Instruction *Inst, AliasSet &AS)
    :{}

std::string ReportAlias::formatInvalidAlias(std::string Prefix,
                                            std::string Suffix) const {}

std::string ReportAlias::getRemarkName() const {}

const Value *ReportAlias::getRemarkBB() const {}

std::string ReportAlias::getMessage() const {}

std::string ReportAlias::getEndUserMessage() const {}

const DebugLoc &ReportAlias::getDebugLoc() const {}

bool ReportAlias::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportOther.

std::string ReportOther::getRemarkName() const {}

std::string ReportOther::getMessage() const {}

ReportOther::ReportOther(const RejectReasonKind K) :{}

bool ReportOther::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportIntToPtr.
ReportIntToPtr::ReportIntToPtr(Instruction *BaseValue)
    :{}

std::string ReportIntToPtr::getRemarkName() const {}

const Value *ReportIntToPtr::getRemarkBB() const {}

std::string ReportIntToPtr::getMessage() const {}

const DebugLoc &ReportIntToPtr::getDebugLoc() const {}

bool ReportIntToPtr::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportAlloca.

ReportAlloca::ReportAlloca(Instruction *Inst)
    :{}

std::string ReportAlloca::getRemarkName() const {}

const Value *ReportAlloca::getRemarkBB() const {}

std::string ReportAlloca::getMessage() const {}

const DebugLoc &ReportAlloca::getDebugLoc() const {}

bool ReportAlloca::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportUnknownInst.

ReportUnknownInst::ReportUnknownInst(Instruction *Inst)
    :{}

std::string ReportUnknownInst::getRemarkName() const {}

const Value *ReportUnknownInst::getRemarkBB() const {}

std::string ReportUnknownInst::getMessage() const {}

const DebugLoc &ReportUnknownInst::getDebugLoc() const {}

bool ReportUnknownInst::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportEntry.

ReportEntry::ReportEntry(BasicBlock *BB)
    :{}

std::string ReportEntry::getRemarkName() const {}

const Value *ReportEntry::getRemarkBB() const {}

std::string ReportEntry::getMessage() const {}

std::string ReportEntry::getEndUserMessage() const {}

const DebugLoc &ReportEntry::getDebugLoc() const {}

bool ReportEntry::classof(const RejectReason *RR) {}

//===----------------------------------------------------------------------===//
// ReportUnprofitable.

ReportUnprofitable::ReportUnprofitable(Region *R)
    :{}

std::string ReportUnprofitable::getRemarkName() const {}

const Value *ReportUnprofitable::getRemarkBB() const {}

std::string ReportUnprofitable::getMessage() const {}

std::string ReportUnprofitable::getEndUserMessage() const {}

const DebugLoc &ReportUnprofitable::getDebugLoc() const {}

bool ReportUnprofitable::classof(const RejectReason *RR) {}
} // namespace polly