MLIR 22.0.0git
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/STLExtras.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, std::string > >, 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.
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.

Function Documentation

◆ createDirectoryOrPrintErr()

LogicalResult createDirectoryOrPrintErr ( llvm::StringRef dirPath)
static

Definition at line 247 of file IRPrinting.cpp.

References success().

Referenced by createTreePrinterOutputPath().

◆ createTreePrinterOutputPath()

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

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

◆ getOpAndSymbolNames()

std::pair< SmallVector< std::pair< std::string, std::string > >, 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 215 of file IRPrinting.cpp.

References mlir::SymbolTable::getSymbolAttrName().

Referenced by createTreePrinterOutputPath().

◆ printIR()