MLIR  19.0.0git
Classes | Public Types | Public Member Functions | List of all members
mlir::detail::PassOptions Class Reference

Base container class and manager for all pass options. More...

#include "mlir/Pass/PassOptions.h"

+ Inheritance diagram for mlir::detail::PassOptions:

Classes

class  ListOption
 This class represents a specific pass option that contains a list of values of the provided data type. More...
 
class  Option
 This class represents a specific pass option, with a provided data type. More...
 

Public Types

template<typename DataType >
using OptionParser = std::conditional_t< std::is_base_of< llvm::cl::generic_parser_base, llvm::cl::parser< DataType > >::value, GenericOptionParser< DataType >, llvm::cl::parser< DataType > >
 The specific parser to use depending on llvm::cl parser used. More...
 

Public Member Functions

 PassOptions ()=default
 
 PassOptions (const PassOptions &)=delete
 Delete the copy constructor to avoid copying the internal options map. More...
 
 PassOptions (PassOptions &&)=delete
 
void copyOptionValuesFrom (const PassOptions &other)
 Copy the option values from 'other' into 'this', where 'other' has the same options as 'this'. More...
 
LogicalResult parseFromString (StringRef options, raw_ostream &errorStream=llvm::errs())
 Parse options out as key=value pairs that can then be handed off to the llvm::cl command line passing infrastructure. More...
 
void print (raw_ostream &os)
 Print the options held by this struct in a form that can be parsed via 'parseFromString'. More...
 
void printHelp (size_t indent, size_t descIndent) const
 Print the help string for the options held by this struct. More...
 
size_t getOptionWidth () const
 Return the maximum width required when printing the help string. More...
 

Detailed Description

Base container class and manager for all pass options.

Definition at line 79 of file PassOptions.h.

Member Typedef Documentation

◆ OptionParser

template<typename DataType >
using mlir::detail::PassOptions::OptionParser = std::conditional_t<std::is_base_of<llvm::cl::generic_parser_base, llvm::cl::parser<DataType> >::value, GenericOptionParser<DataType>, llvm::cl::parser<DataType> >

The specific parser to use depending on llvm::cl parser used.

This is only necessary because we need to provide additional methods for certain data type parsers. TODO: We should upstream the methods in GenericOptionParser to avoid the need to do this.

Definition at line 150 of file PassOptions.h.

Constructor & Destructor Documentation

◆ PassOptions() [1/3]

mlir::detail::PassOptions::PassOptions ( )
default

◆ PassOptions() [2/3]

mlir::detail::PassOptions::PassOptions ( const PassOptions )
delete

Delete the copy constructor to avoid copying the internal options map.

◆ PassOptions() [3/3]

mlir::detail::PassOptions::PassOptions ( PassOptions &&  )
delete

Member Function Documentation

◆ copyOptionValuesFrom()

void detail::PassOptions::copyOptionValuesFrom ( const PassOptions other)

Copy the option values from 'other' into 'this', where 'other' has the same options as 'this'.

Copy the option values from 'other'.

Definition at line 203 of file PassRegistry.cpp.

Referenced by mlir::Pass::copyOptionValuesFrom().

◆ getOptionWidth()

size_t detail::PassOptions::getOptionWidth ( ) const

Return the maximum width required when printing the help string.

Definition at line 346 of file PassRegistry.cpp.

References max(), and options.

◆ parseFromString()

LogicalResult detail::PassOptions::parseFromString ( StringRef  options,
raw_ostream &  errorStream = llvm::errs() 
)

Parse options out as key=value pairs that can then be handed off to the llvm::cl command line passing infrastructure.

Everything is space separated.

Definition at line 283 of file PassRegistry.cpp.

References mlir::failure(), options, parseNextArg(), and mlir::success().

Referenced by mlir::Pass::initializeOptions().

◆ print()

void detail::PassOptions::print ( raw_ostream &  os)

Print the options held by this struct in a form that can be parsed via 'parseFromString'.

Definition at line 307 of file PassRegistry.cpp.

References options.

Referenced by mlir::Pass::printAsTextualPipeline().

◆ printHelp()

void detail::PassOptions::printHelp ( size_t  indent,
size_t  descIndent 
) const

Print the help string for the options held by this struct.

descIndent is the indent that the descriptions should be aligned.

descIndent is the indent within the stream that the descriptions should be aligned.

Definition at line 328 of file PassRegistry.cpp.

References options.


The documentation for this class was generated from the following files: