#include "PassDetail.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/IR/Verifier.h"
#include "mlir/Parser/Parser.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/FileUtilities.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/ToolOutputFile.h"
usingnamespacemlir;
usingnamespacemlir::detail;
namespace mlir {
namespace detail {
struct RecoveryReproducerContext { … };
}
}
llvm::ManagedStatic<llvm::sys::SmartMutex<true>>
RecoveryReproducerContext::reproducerMutex;
llvm::ManagedStatic<llvm::SmallSetVector<RecoveryReproducerContext *, 1>>
RecoveryReproducerContext::reproducerSet;
RecoveryReproducerContext::RecoveryReproducerContext(
std::string passPipelineStr, Operation *op,
ReproducerStreamFactory &streamFactory, bool verifyPasses)
: … { … }
RecoveryReproducerContext::~RecoveryReproducerContext() { … }
static void appendReproducer(std::string &description, Operation *op,
const ReproducerStreamFactory &factory,
const std::string &pipelineElements,
bool disableThreads, bool verifyPasses) { … }
void RecoveryReproducerContext::generate(std::string &description) { … }
void RecoveryReproducerContext::disable() { … }
void RecoveryReproducerContext::enable() { … }
void RecoveryReproducerContext::crashHandler(void *) { … }
void RecoveryReproducerContext::registerSignalHandler() { … }
struct PassCrashReproducerGenerator::Impl { … };
PassCrashReproducerGenerator::PassCrashReproducerGenerator(
ReproducerStreamFactory &streamFactory, bool localReproducer)
: … { … }
PassCrashReproducerGenerator::~PassCrashReproducerGenerator() = default;
void PassCrashReproducerGenerator::initialize(
iterator_range<PassManager::pass_iterator> passes, Operation *op,
bool pmFlagVerifyPasses) { … }
static void
formatPassOpReproducerMessage(Diagnostic &os,
std::pair<Pass *, Operation *> passOpPair) { … }
void PassCrashReproducerGenerator::finalize(Operation *rootOp,
LogicalResult executionResult) { … }
void PassCrashReproducerGenerator::prepareReproducerFor(Pass *pass,
Operation *op) { … }
void PassCrashReproducerGenerator::prepareReproducerFor(
iterator_range<PassManager::pass_iterator> passes, Operation *op) { … }
void PassCrashReproducerGenerator::removeLastReproducerFor(Pass *pass,
Operation *op) { … }
namespace {
struct CrashReproducerInstrumentation : public PassInstrumentation { … };
}
namespace {
struct FileReproducerStream : public mlir::ReproducerStream { … };
}
LogicalResult PassManager::runWithCrashRecovery(Operation *op,
AnalysisManager am) { … }
static ReproducerStreamFactory
makeReproducerStreamFactory(StringRef outputFile) { … }
void printAsTextualPipeline(
raw_ostream &os, StringRef anchorName,
const llvm::iterator_range<OpPassManager::pass_iterator> &passes);
std::string mlir::makeReproducer(
StringRef anchorName,
const llvm::iterator_range<OpPassManager::pass_iterator> &passes,
Operation *op, StringRef outputFile, bool disableThreads,
bool verifyPasses) { … }
void PassManager::enableCrashReproducerGeneration(StringRef outputFile,
bool genLocalReproducer) { … }
void PassManager::enableCrashReproducerGeneration(
ReproducerStreamFactory factory, bool genLocalReproducer) { … }
void PassReproducerOptions::attachResourceParser(ParserConfig &config) { … }
LogicalResult PassReproducerOptions::apply(PassManager &pm) const { … }