MLIR  16.0.0git
Public Types | Public Member Functions | List of all members
mlir::PassManager::IRPrinterConfig Class Reference

A configuration struct provided to the IR printer instrumentation. More...

#include "mlir/Pass/PassManager.h"

Public Types

using PrintCallbackFn = function_ref< void(raw_ostream &)>
 

Public Member Functions

 IRPrinterConfig (bool printModuleScope=false, bool printAfterOnlyOnChange=false, bool printAfterOnlyOnFailure=false, OpPrintingFlags opPrintingFlags=OpPrintingFlags())
 Initialize the configuration. More...
 
virtual ~IRPrinterConfig ()
 
virtual void printBeforeIfEnabled (Pass *pass, Operation *operation, PrintCallbackFn printCallback)
 A hook that may be overridden by a derived config that checks if the IR of 'operation' should be dumped before the pass 'pass' has been executed. More...
 
virtual void printAfterIfEnabled (Pass *pass, Operation *operation, PrintCallbackFn printCallback)
 A hook that may be overridden by a derived config that checks if the IR of 'operation' should be dumped after the pass 'pass' has been executed. More...
 
bool shouldPrintAtModuleScope () const
 Returns true if the IR should always be printed at the top-level scope. More...
 
bool shouldPrintAfterOnlyOnChange () const
 Returns true if the IR should only printed after a pass if the IR "changed". More...
 
bool shouldPrintAfterOnlyOnFailure () const
 Returns true if the IR should only printed after a pass if the pass "failed". More...
 
OpPrintingFlags getOpPrintingFlags () const
 Returns the printing flags to be used to print the IR. More...
 

Detailed Description

A configuration struct provided to the IR printer instrumentation.

Definition at line 276 of file PassManager.h.

Member Typedef Documentation

◆ PrintCallbackFn

Definition at line 278 of file PassManager.h.

Constructor & Destructor Documentation

◆ IRPrinterConfig()

PassManager::IRPrinterConfig::IRPrinterConfig ( bool  printModuleScope = false,
bool  printAfterOnlyOnChange = false,
bool  printAfterOnlyOnFailure = false,
OpPrintingFlags  opPrintingFlags = OpPrintingFlags() 
)
explicit

Initialize the configuration.

  • 'printModuleScope' signals if the top-level module IR should always be printed. This should only be set to true when multi-threading is disabled, otherwise we may try to print IR that is being modified asynchronously.
  • 'printAfterOnlyOnChange' signals that when printing the IR after a pass, in the case of a non-failure, we should first check if any potential mutations were made. This allows for reducing the number of logs that don't contain meaningful changes.
  • 'printAfterOnlyOnFailure' signals that when printing the IR after a pass, we only print in the case of a failure.
    • This option should not be used with the other printAfter flags above.
  • 'opPrintingFlags' sets up the printing flags to use when printing the IR.

Definition at line 187 of file IRPrinting.cpp.

References ~IRPrinterConfig().

Referenced by printAfterIfEnabled().

◆ ~IRPrinterConfig()

PassManager::IRPrinterConfig::~IRPrinterConfig ( )
virtualdefault

Referenced by IRPrinterConfig().

Member Function Documentation

◆ getOpPrintingFlags()

OpPrintingFlags mlir::PassManager::IRPrinterConfig::getOpPrintingFlags ( ) const
inline

Returns the printing flags to be used to print the IR.

Definition at line 329 of file PassManager.h.

References mlir::applyDefaultTimingPassManagerCLOptions(), mlir::applyPassManagerCLOptions(), and mlir::registerPassManagerCLOptions().

◆ printAfterIfEnabled()

void PassManager::IRPrinterConfig::printAfterIfEnabled ( Pass pass,
Operation operation,
PrintCallbackFn  printCallback 
)
virtual

A hook that may be overridden by a derived config that checks if the IR of 'operation' should be dumped after the pass 'pass' has been executed.

If the IR should be dumped, 'printCallback' should be invoked with the stream to dump into.

Definition at line 210 of file IRPrinting.cpp.

References IRPrinterConfig(), and printBeforeIfEnabled().

◆ printBeforeIfEnabled()

void PassManager::IRPrinterConfig::printBeforeIfEnabled ( Pass pass,
Operation operation,
PrintCallbackFn  printCallback 
)
virtual

A hook that may be overridden by a derived config that checks if the IR of 'operation' should be dumped before the pass 'pass' has been executed.

If the IR should be dumped, 'printCallback' should be invoked with the stream to dump into.

Definition at line 201 of file IRPrinting.cpp.

Referenced by printAfterIfEnabled().

◆ shouldPrintAfterOnlyOnChange()

bool mlir::PassManager::IRPrinterConfig::shouldPrintAfterOnlyOnChange ( ) const
inline

Returns true if the IR should only printed after a pass if the IR "changed".

Definition at line 320 of file PassManager.h.

◆ shouldPrintAfterOnlyOnFailure()

bool mlir::PassManager::IRPrinterConfig::shouldPrintAfterOnlyOnFailure ( ) const
inline

Returns true if the IR should only printed after a pass if the pass "failed".

Definition at line 324 of file PassManager.h.

◆ shouldPrintAtModuleScope()

bool mlir::PassManager::IRPrinterConfig::shouldPrintAtModuleScope ( ) const
inline

Returns true if the IR should always be printed at the top-level scope.

Definition at line 316 of file PassManager.h.


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