LLVM 20.0.0git
OffloadYAML.cpp
Go to the documentation of this file.
1//===- OffloadYAML.cpp - Offload Binary YAMLIO implementation -------------===//
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 classes for handling the YAML representation of offload
10// binaries.
11//
12//===----------------------------------------------------------------------===//
13
15
16namespace llvm {
17
18namespace yaml {
19
20void ScalarEnumerationTraits<object::ImageKind>::enumeration(
21 IO &IO, object::ImageKind &Value) {
22#define ECase(X) IO.enumCase(Value, #X, object::X)
23 ECase(IMG_None);
24 ECase(IMG_Object);
25 ECase(IMG_Bitcode);
26 ECase(IMG_Cubin);
27 ECase(IMG_Fatbinary);
28 ECase(IMG_PTX);
29 ECase(IMG_LAST);
30#undef ECase
31 IO.enumFallback<Hex16>(Value);
32}
33
34void ScalarEnumerationTraits<object::OffloadKind>::enumeration(
35 IO &IO, object::OffloadKind &Value) {
36#define ECase(X) IO.enumCase(Value, #X, object::X)
37 ECase(OFK_None);
38 ECase(OFK_OpenMP);
39 ECase(OFK_Cuda);
40 ECase(OFK_HIP);
41 ECase(OFK_LAST);
42#undef ECase
43 IO.enumFallback<Hex16>(Value);
44}
45
48 assert(!IO.getContext() && "The IO context is initialized already");
49 IO.setContext(&O);
50 IO.mapTag("!Offload", true);
51 IO.mapOptional("Version", O.Version);
52 IO.mapOptional("Size", O.Size);
53 IO.mapOptional("EntryOffset", O.EntryOffset);
54 IO.mapOptional("EntrySize", O.EntrySize);
55 IO.mapRequired("Members", O.Members);
56 IO.setContext(nullptr);
57}
58
61 assert(IO.getContext() && "The IO context is not initialized");
62 IO.mapRequired("Key", SE.Key);
63 IO.mapRequired("Value", SE.Value);
64}
65
67 IO &IO, OffloadYAML::Binary::Member &M) {
68 assert(IO.getContext() && "The IO context is not initialized");
69 IO.mapOptional("ImageKind", M.ImageKind);
70 IO.mapOptional("OffloadKind", M.OffloadKind);
71 IO.mapOptional("Flags", M.Flags);
72 IO.mapOptional("String", M.StringEntries);
73 IO.mapOptional("Content", M.Content);
74}
75
76} // namespace yaml
77
78} // namespace llvm
This file declares classes for handling the YAML representation of offloading binaries.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
#define ECase(X)
LLVM Value Representation.
Definition: Value.h:74
OffloadKind
The producer of the associated offloading image.
Definition: OffloadBinary.h:33
ImageKind
The type of contents the offloading image contains.
Definition: OffloadBinary.h:42
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18