MLIR  20.0.0git
Classes | Namespaces | Macros | Functions | Variables
PassRegistry.cpp File Reference
#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>

Go to the source code of this file.

Classes

struct  llvm::cl::OptionValue< PassArgData >
 Define a valid OptionValue for the command line pass argument. More...
 
struct  mlir::detail::PassPipelineCLParserImpl
 

Namespaces

 llvm
 The OpAsmOpInterface, see OpAsmInterface.td for more details.
 
 llvm::cl
 
 mlir
 Include the generated interface declarations.
 
 mlir::detail
 AttrTypeReplacer.
 

Macros

#define PASS_PIPELINE_ARG   "pass-pipeline"
 The name for the command line option used for parsing the textual pass pipeline. More...
 

Functions

static PassRegistryFunction buildDefaultRegistryFn (const PassAllocatorFunction &allocator)
 Utility to create a default registry function from a pass instance. More...
 
static void printOptionHelp (StringRef arg, StringRef desc, size_t indent, size_t descIndent, bool isTopLevel)
 Utility to print the help string for a specific option. More...
 
static size_t findChar (StringRef str, size_t index, char c)
 Attempt to find the next occurance of character 'c' in the string starting from the index-th position , omitting any occurances that appear within intervening ranges or literals. More...
 
static StringRef extractArgAndUpdateOptions (StringRef &options, size_t argSize)
 Extract an argument from 'options' and update it to point after the arg. More...
 
static std::tuple< StringRef, StringRef, StringRef > parseNextArg (StringRef options)
 Parse in the next argument from the given options string. More...
 

Variables

static llvm::ManagedStatic< llvm::StringMap< PassInfo > > passRegistry
 Static mapping of all of the registered passes. More...
 
static llvm::ManagedStatic< llvm::StringMap< TypeID > > passRegistryTypeIDs
 A mapping of the above pass registry entries to the corresponding TypeID of the pass that they generate. More...
 
static llvm::ManagedStatic< llvm::StringMap< PassPipelineInfo > > passPipelineRegistry
 Static mapping of all of the registered pass pipelines. More...
 

Macro Definition Documentation

◆ PASS_PIPELINE_ARG

#define PASS_PIPELINE_ARG   "pass-pipeline"

The name for the command line option used for parsing the textual pass pipeline.

Definition at line 846 of file PassRegistry.cpp.

Function Documentation

◆ buildDefaultRegistryFn()

static PassRegistryFunction buildDefaultRegistryFn ( const PassAllocatorFunction allocator)
static

Utility to create a default registry function from a pass instance.

Definition at line 40 of file PassRegistry.cpp.

References mlir::OpPassManager::addPass(), mlir::OpPassManager::Explicit, mlir::OpPassManager::getNesting(), mlir::OpPassManager::getOpAnchorName(), mlir::OpPassManager::getOpName(), and options.

◆ extractArgAndUpdateOptions()

static StringRef extractArgAndUpdateOptions ( StringRef &  options,
size_t  argSize 
)
static

Extract an argument from 'options' and update it to point after the arg.

Returns the cleaned argument string.

Definition at line 215 of file PassRegistry.cpp.

References findChar(), and options.

Referenced by mlir::detail::pass_options::parseCommaSeparatedList(), and parseNextArg().

◆ findChar()

static size_t findChar ( StringRef  str,
size_t  index,
char  c 
)
static

Attempt to find the next occurance of character 'c' in the string starting from the index-th position , omitting any occurances that appear within intervening ranges or literals.

Definition at line 192 of file PassRegistry.cpp.

Referenced by extractArgAndUpdateOptions(), and mlir::detail::pass_options::parseCommaSeparatedList().

◆ parseNextArg()

static std::tuple<StringRef, StringRef, StringRef> parseNextArg ( StringRef  options)
static

Parse in the next argument from the given options string.

Returns a tuple containing [the key of the option, the value of the option, updated options string pointing after the parsed option].

Definition at line 284 of file PassRegistry.cpp.

References extractArgAndUpdateOptions(), and options.

Referenced by mlir::detail::PassOptions::parseFromString().

◆ printOptionHelp()

static void printOptionHelp ( StringRef  arg,
StringRef  desc,
size_t  indent,
size_t  descIndent,
bool  isTopLevel 
)
static

Utility to print the help string for a specific option.

Definition at line 61 of file PassRegistry.cpp.

Referenced by mlir::PassRegistryEntry::printHelpStr().

Variable Documentation

◆ passPipelineRegistry

llvm::ManagedStatic<llvm::StringMap<PassPipelineInfo> > passPipelineRegistry
static

Static mapping of all of the registered pass pipelines.

Definition at line 36 of file PassRegistry.cpp.

Referenced by mlir::PassPipelineInfo::lookup().

◆ passRegistry

llvm::ManagedStatic<llvm::StringMap<PassInfo> > passRegistry
static

Static mapping of all of the registered passes.

Definition at line 28 of file PassRegistry.cpp.

Referenced by mlir::PassInfo::lookup(), mlir::printRegisteredPasses(), and mlir::registerPass().

◆ passRegistryTypeIDs

llvm::ManagedStatic<llvm::StringMap<TypeID> > passRegistryTypeIDs
static

A mapping of the above pass registry entries to the corresponding TypeID of the pass that they generate.

Definition at line 32 of file PassRegistry.cpp.

Referenced by mlir::registerPass().