LLVM 22.0.0git
YAMLRemarkSerializer.h
Go to the documentation of this file.
1//===-- YAMLRemarkSerializer.h - YAML Remark serialization ---*- 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 file provides an interface for serializing remarks to YAML.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_REMARKS_YAMLREMARKSERIALIZER_H
14#define LLVM_REMARKS_YAMLREMARKSERIALIZER_H
15
19#include <optional>
20
21namespace llvm {
22namespace remarks {
23
24/// Serialize the remarks to YAML. One remark entry looks like this:
25/// --- !<TYPE>
26/// Pass: <PASSNAME>
27/// Name: <REMARKNAME>
28/// DebugLoc: { File: <SOURCEFILENAME>, Line: <SOURCELINE>,
29/// Column: <SOURCECOLUMN> }
30/// Function: <FUNCTIONNAME>
31/// Args:
32/// - <KEY>: <VALUE>
33/// DebugLoc: { File: <FILE>, Line: <LINE>, Column: <COL> }
34/// ...
36 /// The YAML streamer.
37 yaml::Output YAMLOutput;
38
40 std::optional<StringTable> StrTab = std::nullopt);
41
42 void emit(const Remark &Remark) override;
43 std::unique_ptr<MetaSerializer> metaSerializer(
45 std::optional<StringRef> ExternalFilename = std::nullopt) override;
46
47 static bool classof(const RemarkSerializer *S) {
48 return S->SerializerFormat == Format::YAML;
49 }
50
51protected:
54 std::optional<StringTable> StrTab = std::nullopt);
55};
56
58 std::optional<StringRef> ExternalFilename;
59
60 YAMLMetaSerializer(raw_ostream &OS, std::optional<StringRef> ExternalFilename)
61 : MetaSerializer(OS), ExternalFilename(ExternalFilename) {}
62
63 void emit() override;
64};
65
66} // end namespace remarks
67} // end namespace llvm
68
69#endif // LLVM_REMARKS_YAMLREMARKSERIALIZER_H
#define LLVM_ABI
Definition: Compiler.h:213
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
raw_pwrite_stream & OS
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
Format
The format used for serializing/deserializing remarks.
Definition: RemarkFormat.h:26
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
This is the base class for a remark metadata serializer.
This is the base class for a remark serializer.
Format SerializerFormat
The format of the serializer.
A remark type used for both emission and parsing.
Definition: Remark.h:98
std::optional< StringRef > ExternalFilename
YAMLMetaSerializer(raw_ostream &OS, std::optional< StringRef > ExternalFilename)
Serialize the remarks to YAML.
static bool classof(const RemarkSerializer *S)
YAMLRemarkSerializer(Format SerializerFormat, raw_ostream &OS, SerializerMode Mode, std::optional< StringTable > StrTab=std::nullopt)
yaml::Output YAMLOutput
The YAML streamer.