MLIR 22.0.0git
LocationSnapshot.h
Go to the documentation of this file.
1//===- LocationSnapshot.h - Location Snapshot Utilities ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This header file several utility methods for snapshotting the current IR to
10// produce new debug locations.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_TRANSFORMS_LOCATIONSNAPSHOT_H
15#define MLIR_TRANSFORMS_LOCATIONSNAPSHOT_H
16
17#include "mlir/Support/LLVM.h"
18#include "llvm/ADT/StringRef.h"
19
20#include <memory>
21
22namespace mlir {
23class Location;
24class Operation;
25class OpPrintingFlags;
26class Pass;
27
28#define GEN_PASS_DECL_LOCATIONSNAPSHOT
29#include "mlir/Transforms/Passes.h.inc"
30
31/// This function generates new locations from the given IR by snapshotting the
32/// IR to the given stream, and using the printed locations within that stream.
33/// The generated locations replace the current operation locations.
34void generateLocationsFromIR(raw_ostream &os, StringRef fileName, Operation *op,
35 OpPrintingFlags flags);
36/// This function generates new locations from the given IR by snapshotting the
37/// IR to the given file, and using the printed locations within that file. If
38/// `filename` is empty, a temporary file is generated instead.
39LogicalResult generateLocationsFromIR(StringRef fileName, Operation *op,
40 OpPrintingFlags flags);
41
42/// This function generates new locations from the given IR by snapshotting the
43/// IR to the given stream, and using the printed locations within that stream.
44/// The generated locations are represented as a NameLoc with the given tag as
45/// the name, and then fused with the existing locations.
46void generateLocationsFromIR(raw_ostream &os, StringRef fileName, StringRef tag,
47 Operation *op, OpPrintingFlags flags);
48/// This function generates new locations from the given IR by snapshotting the
49/// IR to the given file, and using the printed locations within that file. If
50/// `filename` is empty, a temporary file is generated instead.
51LogicalResult generateLocationsFromIR(StringRef fileName, StringRef tag,
52 Operation *op, OpPrintingFlags flags);
53
54} // namespace mlir
55
56#endif // MLIR_TRANSFORMS_LOCATIONSNAPSHOT_H
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition Location.h:76
Set of flags used to control the behavior of the various IR print methods (e.g.
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
The abstract base pass class.
Definition Pass.h:51
Include the generated interface declarations.
void generateLocationsFromIR(raw_ostream &os, StringRef fileName, Operation *op, OpPrintingFlags flags)
This function generates new locations from the given IR by snapshotting the IR to the given stream,...