MLIR  20.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 <optional>
#include "mlir/Transforms/Passes.h.inc"

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 20 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 31 of file LocationSnapshot.cpp.

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 71 of file LocationSnapshot.cpp.

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