MLIR  16.0.0git
Namespaces | Macros | Functions
LocationSnapshot.cpp File Reference
#include "mlir/Transforms/LocationSnapshot.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Builders.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/FileUtilities.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ToolOutputFile.h"
#include "mlir/Transforms/Passes.h.inc"
+ Include dependency graph for LocationSnapshot.cpp:

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 

Macros

#define GEN_PASS_DEF_LOCATIONSNAPSHOT
 

Functions

static void generateLocationsFromIR (raw_ostream &os, StringRef fileName, Operation *op, const OpPrintingFlags &flags, StringRef tag)
 This function generates new locations from the given IR by snapshotting the IR to the given stream, and using the printed locations within that stream. More...
 
static LogicalResult generateLocationsFromIR (StringRef fileName, Operation *op, OpPrintingFlags flags, StringRef tag)
 This function generates new locations from the given IR by snapshotting the IR to the given file, and using the printed locations within that file. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_LOCATIONSNAPSHOT

#define GEN_PASS_DEF_LOCATIONSNAPSHOT

Definition at line 19 of file LocationSnapshot.cpp.

Function Documentation

◆ generateLocationsFromIR() [1/2]

static void generateLocationsFromIR ( raw_ostream &  os,
StringRef  fileName,
Operation op,
const OpPrintingFlags flags,
StringRef  tag 
)
static

This function generates new locations from the given IR by snapshotting the IR to the given stream, and using the printed locations within that stream.

If a 'tag' is non-empty, the generated locations are represented as a NameLoc with the given tag as the name, and then fused with the existing locations. Otherwise, the existing locations are replaced.

Definition at line 30 of file LocationSnapshot.cpp.

References mlir::Operation::getContext(), mlir::Builder::getFusedLoc(), mlir::Builder::getStringAttr(), mlir::Operation::print(), mlir::Operation::setLoc(), and mlir::Operation::walk().

Referenced by mlir::generateLocationsFromIR().

◆ generateLocationsFromIR() [2/2]

static LogicalResult generateLocationsFromIR ( StringRef  fileName,
Operation op,
OpPrintingFlags  flags,
StringRef  tag 
)
static

This function generates new locations from the given IR by snapshotting the IR to the given file, and using the printed locations within that file.

If filename is empty, a temporary file is generated instead.

Definition at line 70 of file LocationSnapshot.cpp.

References mlir::Operation::emitError(), mlir::generateLocationsFromIR(), mlir::openOutputFile(), and mlir::success().