LLVM  17.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 
16 namespace llvm {
17 
18 namespace yaml {
19 
21  IO &IO, object::ImageKind &Value) {
22 #define ECase(X) IO.enumCase(Value, #X, object::X)
23  ECase(IMG_None);
28  ECase(IMG_PTX);
29  ECase(IMG_LAST);
30 #undef ECase
31  IO.enumFallback<Hex16>(Value);
32 }
33 
35  IO &IO, object::OffloadKind &Value) {
36 #define ECase(X) IO.enumCase(Value, #X, object::X)
37  ECase(OFK_None);
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
llvm::object::OFK_None
@ OFK_None
Definition: OffloadBinary.h:33
llvm::OffloadYAML::Binary::StringEntry
Definition: OffloadYAML.h:28
llvm::object::IMG_Fatbinary
@ IMG_Fatbinary
Definition: OffloadBinary.h:46
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
OffloadYAML.h
llvm::object::IMG_Bitcode
@ IMG_Bitcode
Definition: OffloadBinary.h:44
llvm::yaml::MappingTraits
Definition: ModuleSummaryIndex.h:53
llvm::OffloadYAML::Binary::StringEntry::Value
StringRef Value
Definition: OffloadYAML.h:30
llvm::yaml::ScalarEnumerationTraits< object::OffloadKind >::enumeration
static void enumeration(IO &IO, object::OffloadKind &Value)
Definition: OffloadYAML.cpp:34
ECase
#define ECase(X)
llvm::object::IMG_PTX
@ IMG_PTX
Definition: OffloadBinary.h:47
llvm::object::OFK_OpenMP
@ OFK_OpenMP
Definition: OffloadBinary.h:34
llvm::OffloadYAML::Binary::StringEntry::Key
StringRef Key
Definition: OffloadYAML.h:29
llvm::object::OffloadKind
OffloadKind
The producer of the associated offloading image.
Definition: OffloadBinary.h:32
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:274
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::object::OFK_Cuda
@ OFK_Cuda
Definition: OffloadBinary.h:35
llvm::object::IMG_Cubin
@ IMG_Cubin
Definition: OffloadBinary.h:45
llvm::object::OFK_LAST
@ OFK_LAST
Definition: OffloadBinary.h:37
llvm::OffloadYAML::Binary::Member
Definition: OffloadYAML.h:33
llvm::object::IMG_Object
@ IMG_Object
Definition: OffloadBinary.h:43
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::yaml::ScalarEnumerationTraits< object::ImageKind >::enumeration
static void enumeration(IO &IO, object::ImageKind &Value)
Definition: OffloadYAML.cpp:20
llvm::object::IMG_None
@ IMG_None
Definition: OffloadBinary.h:42
llvm::object::OFK_HIP
@ OFK_HIP
Definition: OffloadBinary.h:36
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::object::IMG_LAST
@ IMG_LAST
Definition: OffloadBinary.h:48
llvm::OffloadYAML::Binary
Definition: OffloadYAML.h:27
llvm::object::ImageKind
ImageKind
The type of contents the offloading image contains.
Definition: OffloadBinary.h:41