MLIR  20.0.0git
Functions
IRPrinting.cpp File Reference
#include "PassDetail.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/FileUtilities.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ToolOutputFile.h"

Go to the source code of this file.

Functions

static void printIR (Operation *op, bool printModuleScope, raw_ostream &out, OpPrintingFlags flags)
 
static std::pair< SmallVector< std::pair< std::string, StringRef > >, std::string > getOpAndSymbolNames (Operation *op, StringRef passName, llvm::DenseMap< Operation *, unsigned > &counters)
 Return pairs of (sanitized op name, symbol name) for op and all parent operations. More...
 
static LogicalResult createDirectoryOrPrintErr (llvm::StringRef dirPath)
 
static std::unique_ptr< llvm::ToolOutputFile > createTreePrinterOutputPath (Operation *op, llvm::StringRef passArgument, llvm::StringRef rootDir, llvm::DenseMap< Operation *, unsigned > &counters)
 Creates directories (if required) and opens an output file for the FileTreeIRPrinterConfig. More...
 

Function Documentation

◆ createDirectoryOrPrintErr()

static LogicalResult createDirectoryOrPrintErr ( llvm::StringRef  dirPath)
static

Definition at line 242 of file IRPrinting.cpp.

Referenced by createTreePrinterOutputPath().

◆ createTreePrinterOutputPath()

static std::unique_ptr<llvm::ToolOutputFile> createTreePrinterOutputPath ( Operation op,
llvm::StringRef  passArgument,
llvm::StringRef  rootDir,
llvm::DenseMap< Operation *, unsigned > &  counters 
)
static

Creates directories (if required) and opens an output file for the FileTreeIRPrinterConfig.

Definition at line 255 of file IRPrinting.cpp.

References createDirectoryOrPrintErr(), getOpAndSymbolNames(), and mlir::openOutputFile().

◆ getOpAndSymbolNames()

static std::pair<SmallVector<std::pair<std::string, StringRef> >, std::string> getOpAndSymbolNames ( Operation op,
StringRef  passName,
llvm::DenseMap< Operation *, unsigned > &  counters 
)
static

Return pairs of (sanitized op name, symbol name) for op and all parent operations.

Op names are sanitized by replacing periods with underscores. The pairs are returned in order of outer-most to inner-most (ancestors of op first, op last). This information is used to construct the directory tree for the FileTreeIRPrinterConfig below. The counter for op will be incremented by this call.

Definition at line 214 of file IRPrinting.cpp.

References mlir::SymbolTable::getSymbolAttrName().

Referenced by createTreePrinterOutputPath().

◆ printIR()

static void printIR ( Operation op,
bool  printModuleScope,
raw_ostream &  out,
OpPrintingFlags  flags 
)
static