MLIR  19.0.0git
Functions | Variables
MlirOptMain.cpp File Reference
#include "mlir/Tools/mlir-opt/MlirOptMain.h"
#include "mlir/Bytecode/BytecodeWriter.h"
#include "mlir/Debug/CLOptionsSetup.h"
#include "mlir/Debug/Counter.h"
#include "mlir/Debug/DebuggerExecutionContextHook.h"
#include "mlir/Debug/ExecutionContext.h"
#include "mlir/Debug/Observers/ActionLogging.h"
#include "mlir/Dialect/IRDL/IR/IRDL.h"
#include "mlir/Dialect/IRDL/IRDLLoading.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Parser/Parser.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/FileUtilities.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/Timing.h"
#include "mlir/Support/ToolUtilities.h"
#include "mlir/Tools/ParseUtilities.h"
#include "mlir/Tools/Plugins/DialectPlugin.h"
#include "mlir/Tools/Plugins/PassPlugin.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/ToolOutputFile.h"

Go to the source code of this file.

Functions

LogicalResult loadIRDLDialects (StringRef irdlFile, MLIRContext &ctx)
 
static LogicalResult doVerifyRoundTrip (Operation *op, const MlirOptMainConfig &config, bool useBytecode)
 
static LogicalResult doVerifyRoundTrip (Operation *op, const MlirOptMainConfig &config)
 
static LogicalResult performActions (raw_ostream &os, const std::shared_ptr< llvm::SourceMgr > &sourceMgr, MLIRContext *context, const MlirOptMainConfig &config)
 Perform the actions on the input file indicated by the command line flags within the specified context. More...
 
static LogicalResult processBuffer (raw_ostream &os, std::unique_ptr< MemoryBuffer > ownedBuffer, const MlirOptMainConfig &config, DialectRegistry &registry, llvm::ThreadPoolInterface *threadPool)
 Parses the memory buffer. More...
 
static LogicalResult printRegisteredDialects (DialectRegistry &registry)
 

Variables

ManagedStatic< MlirOptMainConfigCLOptions > clOptionsConfig
 

Function Documentation

◆ doVerifyRoundTrip() [1/2]

static LogicalResult doVerifyRoundTrip ( Operation op,
const MlirOptMainConfig config 
)
static

Definition at line 343 of file MlirOptMain.cpp.

◆ doVerifyRoundTrip() [2/2]

static LogicalResult doVerifyRoundTrip ( Operation op,
const MlirOptMainConfig config,
bool  useBytecode 
)
static

Definition at line 276 of file MlirOptMain.cpp.

◆ loadIRDLDialects()

LogicalResult loadIRDLDialects ( StringRef  irdlFile,
MLIRContext ctx 
)

◆ performActions()

static LogicalResult performActions ( raw_ostream &  os,
const std::shared_ptr< llvm::SourceMgr > &  sourceMgr,
MLIRContext context,
const MlirOptMainConfig config 
)
static

Perform the actions on the input file indicated by the command line flags within the specified context.

This typically parses the main source file, runs zero or more optimization passes, then prints the output.

Definition at line 357 of file MlirOptMain.cpp.

References mlir::applyDefaultTimingManagerCLOptions(), mlir::PassReproducerOptions::attachResourceParser(), mlir::MLIRContext::disableMultithreading(), mlir::TimingManager::getRootScope(), mlir::MLIRContext::isMultithreadingEnabled(), mlir::TimingScope::nest(), and mlir::MlirOptMainConfig::shouldRunReproducer().

◆ printRegisteredDialects()

static LogicalResult printRegisteredDialects ( DialectRegistry registry)
static

Definition at line 517 of file MlirOptMain.cpp.

References mlir::DialectRegistry::getDialectNames(), and mlir::success().

Referenced by mlir::MlirOptMain().

◆ processBuffer()

static LogicalResult processBuffer ( raw_ostream &  os,
std::unique_ptr< MemoryBuffer >  ownedBuffer,
const MlirOptMainConfig config,
DialectRegistry registry,
llvm::ThreadPoolInterface *  threadPool 
)
static

Parses the memory buffer.

If successfully, run a series of passes against it and print the result.

Definition at line 441 of file MlirOptMain.cpp.

Variable Documentation

◆ clOptionsConfig

ManagedStatic<MlirOptMainConfigCLOptions> clOptionsConfig