LLVM 17.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
18#include "llvm/ADT/MapVector.h"
22#include <optional>
23
24namespace llvm {
25namespace OffloadYAML {
26
27struct Binary {
28 struct StringEntry {
31 };
32
33 struct Member {
34 std::optional<object::ImageKind> ImageKind;
35 std::optional<object::OffloadKind> OffloadKind;
36 std::optional<uint32_t> Flags;
37 std::optional<std::vector<StringEntry>> StringEntries;
38 std::optional<yaml::BinaryRef> Content;
39 };
40
41 std::optional<uint32_t> Version;
42 std::optional<uint64_t> Size;
43 std::optional<uint64_t> EntryOffset;
44 std::optional<uint64_t> EntrySize;
45 std::vector<Member> Members;
46};
47
48} // end namespace OffloadYAML
49} // end namespace llvm
50
53
54namespace llvm {
55namespace yaml {
56
57template <> struct ScalarEnumerationTraits<object::ImageKind> {
58 static void enumeration(IO &IO, object::ImageKind &Value);
59};
60
61template <> struct ScalarEnumerationTraits<object::OffloadKind> {
62 static void enumeration(IO &IO, object::OffloadKind &Value);
63};
64
65template <> struct MappingTraits<OffloadYAML::Binary> {
66 static void mapping(IO &IO, OffloadYAML::Binary &O);
67};
68
69template <> struct MappingTraits<OffloadYAML::Binary::StringEntry> {
70 static void mapping(IO &IO, OffloadYAML::Binary::StringEntry &M);
71};
72
73template <> struct MappingTraits<OffloadYAML::Binary::Member> {
74 static void mapping(IO &IO, OffloadYAML::Binary::Member &M);
75};
76
77} // end namespace yaml
78} // end namespace llvm
79
80#endif // LLVM_OBJECTYAML_OFFLOADYAML_H
This file implements a map that provides insertion order iteration.
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
LLVM Value Representation.
Definition: Value.h:74
OffloadKind
The producer of the associated offloading image.
Definition: OffloadBinary.h:32
ImageKind
The type of contents the offloading image contains.
Definition: OffloadBinary.h:41
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
std::optional< uint32_t > Flags
Definition: OffloadYAML.h:36
std::optional< object::OffloadKind > OffloadKind
Definition: OffloadYAML.h:35
std::optional< std::vector< StringEntry > > StringEntries
Definition: OffloadYAML.h:37
std::optional< yaml::BinaryRef > Content
Definition: OffloadYAML.h:38
std::optional< object::ImageKind > ImageKind
Definition: OffloadYAML.h:34
std::optional< uint32_t > Version
Definition: OffloadYAML.h:41
std::optional< uint64_t > EntryOffset
Definition: OffloadYAML.h:43
std::optional< uint64_t > Size
Definition: OffloadYAML.h:42
std::optional< uint64_t > EntrySize
Definition: OffloadYAML.h:44
std::vector< Member > Members
Definition: OffloadYAML.h:45