LLVM 22.0.0git
OffloadYAML.h
Go to the documentation of this file.
1//===- OffloadYAML.h - Offload Binary YAMLIO implementation -----*- 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/// \file
10/// This file declares classes for handling the YAML representation of
11/// offloading binaries.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_OBJECTYAML_OFFLOADYAML_H
16#define LLVM_OBJECTYAML_OFFLOADYAML_H
17
21#include <optional>
22
23namespace llvm {
24namespace OffloadYAML {
25
26struct Binary {
31
32 struct Member {
33 std::optional<object::ImageKind> ImageKind;
34 std::optional<object::OffloadKind> OffloadKind;
35 std::optional<uint32_t> Flags;
36 std::optional<std::vector<StringEntry>> StringEntries;
37 std::optional<yaml::BinaryRef> Content;
38 };
39
40 std::optional<uint32_t> Version;
41 std::optional<uint64_t> Size;
42 std::optional<uint64_t> EntryOffset;
43 std::optional<uint64_t> EntrySize;
44 std::vector<Member> Members;
45};
46
47} // end namespace OffloadYAML
48} // end namespace llvm
49
52
53namespace llvm {
54namespace yaml {
55
56template <> struct ScalarEnumerationTraits<object::ImageKind> {
57 static void enumeration(IO &IO, object::ImageKind &Value);
58};
59
60template <> struct ScalarEnumerationTraits<object::OffloadKind> {
62};
63
64template <> struct MappingTraits<OffloadYAML::Binary> {
65 static void mapping(IO &IO, OffloadYAML::Binary &O);
66};
67
68template <> struct MappingTraits<OffloadYAML::Binary::StringEntry> {
70};
71
72template <> struct MappingTraits<OffloadYAML::Binary::Member> {
73 static void mapping(IO &IO, OffloadYAML::Binary::Member &M);
74};
75
76} // end namespace yaml
77} // end namespace llvm
78
79#endif // LLVM_OBJECTYAML_OFFLOADYAML_H
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML sequence.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
LLVM Value Representation.
Definition Value.h:75
OffloadKind
The producer of the associated offloading image.
ImageKind
The type of contents the offloading image contains.
This is an optimization pass for GlobalISel generic memory operations.
std::optional< uint32_t > Flags
Definition OffloadYAML.h:35
std::optional< object::OffloadKind > OffloadKind
Definition OffloadYAML.h:34
std::optional< std::vector< StringEntry > > StringEntries
Definition OffloadYAML.h:36
std::optional< yaml::BinaryRef > Content
Definition OffloadYAML.h:37
std::optional< object::ImageKind > ImageKind
Definition OffloadYAML.h:33
std::optional< uint32_t > Version
Definition OffloadYAML.h:40
std::optional< uint64_t > EntryOffset
Definition OffloadYAML.h:42
std::optional< uint64_t > Size
Definition OffloadYAML.h:41
std::optional< uint64_t > EntrySize
Definition OffloadYAML.h:43
std::vector< Member > Members
Definition OffloadYAML.h:44
static void mapping(IO &IO, OffloadYAML::Binary &O)
static void mapping(IO &IO, OffloadYAML::Binary::Member &M)
static void mapping(IO &IO, OffloadYAML::Binary::StringEntry &M)
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
Definition YAMLTraits.h:62
static void enumeration(IO &IO, object::ImageKind &Value)
static void enumeration(IO &IO, object::OffloadKind &Value)
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
Definition YAMLTraits.h:107