MLIR
22.0.0git
include
mlir
Remark
RemarkStreamer.h
Go to the documentation of this file.
1
//===- RemarkStreamer.h - MLIR Optimization Remark ---------------*-===//
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 file defines LLVMRemarkStreamer plugging class that uses LLVM's
10
// streamer.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "
mlir/IR/Remarks.h
"
15
16
#include "llvm/Remarks/RemarkStreamer.h"
17
#include "llvm/Support/ToolOutputFile.h"
18
19
namespace
mlir::remark::detail
{
20
21
/// Concrete streamer that writes LLVM optimization remarks to a file
22
/// (YAML or Bitstream). Lives outside core.
23
class
LLVMRemarkStreamer
final :
public
MLIRRemarkStreamerBase
{
24
public
:
25
static
FailureOr<std::unique_ptr<MLIRRemarkStreamerBase>>
26
createToFile
(llvm::StringRef path, llvm::remarks::Format fmt);
27
28
void
streamOptimizationRemark
(
const
Remark
&remark)
override
;
29
void
finalize
()
override
;
30
~LLVMRemarkStreamer
()
override
;
31
32
private
:
33
LLVMRemarkStreamer
() =
default
;
34
35
std::unique_ptr<class llvm::ToolOutputFile> file;
36
// RemarkStreamer must be destructed before file is destroyed!
37
std::unique_ptr<class llvm::remarks::RemarkStreamer> remarkStreamer;
38
};
39
}
// namespace mlir::remark::detail
40
41
namespace
mlir::remark
{
42
/// Enable optimization remarks to a file with the given path and format.
43
/// The remark categories are used to filter the remarks that are emitted.
44
/// If the printAsEmitRemarks flag is set, remarks will also be printed using
45
/// mlir::emitRemarks.
46
LogicalResult
enableOptimizationRemarksWithLLVMStreamer
(
47
MLIRContext
&ctx, StringRef filePath, llvm::remarks::Format fmt,
48
const
RemarkCategories
&cat,
bool
printAsEmitRemarks =
false
);
49
50
}
// namespace mlir::remark
Remarks.h
mlir::MLIRContext
MLIRContext is the top-level object for a collection of MLIR operations.
Definition:
MLIRContext.h:63
mlir::remark::detail::LLVMRemarkStreamer
Concrete streamer that writes LLVM optimization remarks to a file (YAML or Bitstream).
Definition:
RemarkStreamer.h:23
mlir::remark::detail::LLVMRemarkStreamer::createToFile
static FailureOr< std::unique_ptr< MLIRRemarkStreamerBase > > createToFile(llvm::StringRef path, llvm::remarks::Format fmt)
Definition:
RemarkStreamer.cpp:14
mlir::remark::detail::LLVMRemarkStreamer::streamOptimizationRemark
void streamOptimizationRemark(const Remark &remark) override
Stream an optimization remark to the underlying remark streamer.
Definition:
RemarkStreamer.cpp:38
mlir::remark::detail::LLVMRemarkStreamer::~LLVMRemarkStreamer
~LLVMRemarkStreamer() override
Definition:
RemarkStreamer.cpp:48
mlir::remark::detail::LLVMRemarkStreamer::finalize
void finalize() override
Definition:
RemarkStreamer.cpp:53
mlir::remark::detail::MLIRRemarkStreamerBase
Base class for MLIR remark streamers that is used to stream optimization remarks to the underlying re...
Definition:
Remarks.h:328
mlir::remark::detail::Remark
Definition:
Remarks.h:88
mlir::remark::detail
Definition:
MLIRContext.h:37
mlir::remark
Definition:
MLIRContext.h:37
mlir::remark::enableOptimizationRemarksWithLLVMStreamer
LogicalResult enableOptimizationRemarksWithLLVMStreamer(MLIRContext &ctx, StringRef filePath, llvm::remarks::Format fmt, const RemarkCategories &cat, bool printAsEmitRemarks=false)
Enable optimization remarks to a file with the given path and format.
Definition:
RemarkStreamer.cpp:61
mlir::remark::RemarkCategories
Define an the set of categories to accept.
Definition:
Remarks.h:31
Generated on Sun Oct 5 2025 16:32:04 for MLIR by
1.9.1