#include "mlir/Pass/PassRegistry.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include <optional>
#include <utility>
usingnamespacemlir;
usingnamespacedetail;
static llvm::ManagedStatic<llvm::StringMap<PassInfo>> passRegistry;
static llvm::ManagedStatic<llvm::StringMap<TypeID>> passRegistryTypeIDs;
static llvm::ManagedStatic<llvm::StringMap<PassPipelineInfo>>
passPipelineRegistry;
static PassRegistryFunction
buildDefaultRegistryFn(const PassAllocatorFunction &allocator) { … }
static void printOptionHelp(StringRef arg, StringRef desc, size_t indent,
size_t descIndent, bool isTopLevel) { … }
void mlir::printRegisteredPasses() { … }
void PassRegistryEntry::printHelpStr(size_t indent, size_t descIndent) const { … }
size_t PassRegistryEntry::getOptionWidth() const { … }
void mlir::registerPassPipeline(
StringRef arg, StringRef description, const PassRegistryFunction &function,
std::function<void(function_ref<void(const PassOptions &)>)> optHandler) { … }
PassInfo::PassInfo(StringRef arg, StringRef description,
const PassAllocatorFunction &allocator)
: … { … }
void mlir::registerPass(const PassAllocatorFunction &function) { … }
const PassInfo *mlir::PassInfo::lookup(StringRef passArg) { … }
const PassPipelineInfo *mlir::PassPipelineInfo::lookup(StringRef pipelineArg) { … }
static StringRef extractArgAndUpdateOptions(StringRef &options,
size_t argSize) { … }
LogicalResult detail::pass_options::parseCommaSeparatedList(
llvm::cl::Option &opt, StringRef argName, StringRef optionStr,
function_ref<LogicalResult(StringRef)> elementParseFn) { … }
void detail::PassOptions::OptionBase::anchor() { … }
void detail::PassOptions::copyOptionValuesFrom(const PassOptions &other) { … }
static std::tuple<StringRef, StringRef, StringRef>
parseNextArg(StringRef options) { … }
LogicalResult detail::PassOptions::parseFromString(StringRef options,
raw_ostream &errorStream) { … }
void detail::PassOptions::print(raw_ostream &os) const { … }
void detail::PassOptions::printHelp(size_t indent, size_t descIndent) const { … }
size_t detail::PassOptions::getOptionWidth() const { … }
llvm::cl::OptionValue<OpPassManager>::OptionValue() = default;
llvm::cl::OptionValue<OpPassManager>::OptionValue(
const mlir::OpPassManager &value) { … }
llvm::cl::OptionValue<OpPassManager>::OptionValue(
const llvm::cl::OptionValue<mlir::OpPassManager> &rhs) { … }
llvm::cl::OptionValue<OpPassManager> &
llvm::cl::OptionValue<OpPassManager>::operator=(
const mlir::OpPassManager &rhs) { … }
llvm::cl::OptionValue<OpPassManager>::~OptionValue<OpPassManager>() = default;
void llvm::cl::OptionValue<OpPassManager>::setValue(
const OpPassManager &newValue) { … }
void llvm::cl::OptionValue<OpPassManager>::setValue(StringRef pipelineStr) { … }
bool llvm::cl::OptionValue<OpPassManager>::compare(
const mlir::OpPassManager &rhs) const { … }
void llvm::cl::OptionValue<OpPassManager>::anchor() { … }
namespace llvm {
namespace cl {
template class basic_parser<OpPassManager>;
}
}
bool llvm::cl::parser<OpPassManager>::parse(Option &, StringRef, StringRef arg,
ParsedPassManager &value) { … }
void llvm::cl::parser<OpPassManager>::print(raw_ostream &os,
const OpPassManager &value) { … }
void llvm::cl::parser<OpPassManager>::printOptionDiff(
const Option &opt, OpPassManager &pm, const OptVal &defaultValue,
size_t globalWidth) const { … }
void llvm::cl::parser<OpPassManager>::anchor() { … }
llvm::cl::parser<OpPassManager>::ParsedPassManager::ParsedPassManager() =
default;
llvm::cl::parser<OpPassManager>::ParsedPassManager::ParsedPassManager(
ParsedPassManager &&) = default;
llvm::cl::parser<OpPassManager>::ParsedPassManager::~ParsedPassManager() =
default;
namespace {
class TextualPipeline { … };
}
LogicalResult TextualPipeline::initialize(StringRef text,
raw_ostream &errorStream) { … }
LogicalResult TextualPipeline::addToPipeline(
OpPassManager &pm,
function_ref<LogicalResult(const Twine &)> errorHandler) const { … }
LogicalResult TextualPipeline::parsePipelineText(StringRef text,
ErrorHandlerT errorHandler) { … }
LogicalResult TextualPipeline::resolvePipelineElements(
MutableArrayRef<PipelineElement> elements, ErrorHandlerT errorHandler) { … }
LogicalResult
TextualPipeline::resolvePipelineElement(PipelineElement &element,
ErrorHandlerT errorHandler) { … }
LogicalResult TextualPipeline::addToPipeline(
ArrayRef<PipelineElement> elements, OpPassManager &pm,
function_ref<LogicalResult(const Twine &)> errorHandler) const { … }
LogicalResult mlir::parsePassPipeline(StringRef pipeline, OpPassManager &pm,
raw_ostream &errorStream) { … }
FailureOr<OpPassManager> mlir::parsePassPipeline(StringRef pipeline,
raw_ostream &errorStream) { … }
namespace {
struct PassArgData { … };
}
namespace llvm {
namespace cl {
template <>
struct OptionValue<PassArgData> final
: OptionValueBase<PassArgData, true> { … };
}
}
namespace {
#define PASS_PIPELINE_ARG …
struct PassNameParser : public llvm::cl::parser<PassArgData> { … };
}
void PassNameParser::initialize() { … }
void PassNameParser::printOptionInfo(const llvm::cl::Option &opt,
size_t globalWidth) const { … }
size_t PassNameParser::getOptionWidth(const llvm::cl::Option &opt) const { … }
bool PassNameParser::parse(llvm::cl::Option &opt, StringRef argName,
StringRef arg, PassArgData &value) { … }
namespace mlir {
namespace detail {
struct PassPipelineCLParserImpl { … };
}
}
PassPipelineCLParser::PassPipelineCLParser(StringRef arg, StringRef description)
: … { … }
PassPipelineCLParser::PassPipelineCLParser(StringRef arg, StringRef description,
StringRef alias)
: … { … }
PassPipelineCLParser::~PassPipelineCLParser() = default;
bool PassPipelineCLParser::hasAnyOccurrences() const { … }
bool PassPipelineCLParser::contains(const PassRegistryEntry *entry) const { … }
LogicalResult PassPipelineCLParser::addToPipeline(
OpPassManager &pm,
function_ref<LogicalResult(const Twine &)> errorHandler) const { … }
PassNameCLParser::PassNameCLParser(StringRef arg, StringRef description)
: … { … }
PassNameCLParser::~PassNameCLParser() = default;
bool PassNameCLParser::hasAnyOccurrences() const { … }
bool PassNameCLParser::contains(const PassRegistryEntry *entry) const { … }