MLIR  19.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 289 of file PassManager.h.

Member Typedef Documentation

◆ PrintCallbackFn

Definition at line 291 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 133 of file IRPrinting.cpp.

◆ ~IRPrinterConfig()

PassManager::IRPrinterConfig::~IRPrinterConfig ( )
virtualdefault

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 342 of file PassManager.h.

◆ 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 156 of file IRPrinting.cpp.

◆ 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 147 of file IRPrinting.cpp.

◆ 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 333 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 337 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 329 of file PassManager.h.


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