MLIR 22.0.0git
LocationSnapshot.cpp File Reference
#include "mlir/Transforms/LocationSnapshot.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/OperationSupport.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.

Classes

class  mlir::impl::LocationSnapshotBase< DerivedT >

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::impl
 Attribute collections provide a dictionary-like interface.

Macros

#define GEN_PASS_DEF_LOCATIONSNAPSHOT

Functions

std::unique_ptr<::mlir::Passmlir::impl::createLocationSnapshot ()
std::unique_ptr<::mlir::Passmlir::impl::createLocationSnapshot (LocationSnapshotOptions options)
std::unique_ptr<::mlir::Passmlir::createLocationSnapshot ()
std::unique_ptr<::mlir::Passmlir::createLocationSnapshot (LocationSnapshotOptions options)
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.
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.

Macro Definition Documentation

◆ GEN_PASS_DEF_LOCATIONSNAPSHOT

#define GEN_PASS_DEF_LOCATIONSNAPSHOT

Definition at line 21 of file LocationSnapshot.cpp.

Function Documentation

◆ generateLocationsFromIR() [1/2]

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

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

◆ generateLocationsFromIR() [2/2]

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

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