LLVM  17.0.0git
DXContainerYAML.cpp
Go to the documentation of this file.
1 //===- DXContainerYAML.cpp - DXContainer 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
10 // DXContainerYAML.
11 //
12 //===----------------------------------------------------------------------===//
13 
16 
17 namespace llvm {
18 
19 // This assert is duplicated here to leave a breadcrumb of the places that need
20 // to be updated if flags grow past 64-bits.
21 static_assert((uint64_t)dxbc::FeatureFlags::NextUnusedBit <= 1ull << 63,
22  "Shader flag bits exceed enum size.");
23 
25 #define SHADER_FLAG(Num, Val, Str) \
26  Val = (FlagData & (uint64_t)dxbc::FeatureFlags::Val) > 0;
27 #include "llvm/BinaryFormat/DXContainerConstants.def"
28 }
29 
31  uint64_t Flag = 0;
32 #define SHADER_FLAG(Num, Val, Str) \
33  if (Val) \
34  Flag |= (uint64_t)dxbc::FeatureFlags::Val;
35 #include "llvm/BinaryFormat/DXContainerConstants.def"
36  return Flag;
37 }
38 
40  : IncludesSource((Data.Flags & static_cast<uint32_t>(
41  dxbc::HashFlags::IncludesSource)) != 0),
42  Digest(16, 0) {
43  memcpy(Digest.data(), &Data.Digest[0], 16);
44 }
45 
46 namespace yaml {
47 
50  IO.mapRequired("Major", Version.Major);
51  IO.mapRequired("Minor", Version.Minor);
52 }
53 
55  IO &IO, DXContainerYAML::FileHeader &Header) {
56  IO.mapRequired("Hash", Header.Hash);
57  IO.mapRequired("Version", Header.Version);
58  IO.mapOptional("FileSize", Header.FileSize);
59  IO.mapRequired("PartCount", Header.PartCount);
60  IO.mapOptional("PartOffsets", Header.PartOffsets);
61 }
62 
64  IO &IO, DXContainerYAML::DXILProgram &Program) {
65  IO.mapRequired("MajorVersion", Program.MajorVersion);
66  IO.mapRequired("MinorVersion", Program.MinorVersion);
67  IO.mapRequired("ShaderKind", Program.ShaderKind);
68  IO.mapOptional("Size", Program.Size);
69  IO.mapRequired("DXILMajorVersion", Program.DXILMajorVersion);
70  IO.mapRequired("DXILMinorVersion", Program.DXILMinorVersion);
71  IO.mapOptional("DXILSize", Program.DXILSize);
72  IO.mapOptional("DXIL", Program.DXIL);
73 }
74 
76  IO &IO, DXContainerYAML::ShaderFlags &Flags) {
77 #define SHADER_FLAG(Num, Val, Str) IO.mapRequired(#Val, Flags.Val);
78 #include "llvm/BinaryFormat/DXContainerConstants.def"
79 }
80 
82  IO &IO, DXContainerYAML::ShaderHash &Hash) {
83  IO.mapRequired("IncludesSource", Hash.IncludesSource);
84  IO.mapRequired("Digest", Hash.Digest);
85 }
86 
89  IO.mapRequired("Name", P.Name);
90  IO.mapRequired("Size", P.Size);
91  IO.mapOptional("Program", P.Program);
92  IO.mapOptional("Flags", P.Flags);
93  IO.mapOptional("Hash", P.Hash);
94 }
95 
97  IO &IO, DXContainerYAML::Object &Obj) {
98  IO.mapTag("!dxcontainer", true);
99  IO.mapRequired("Header", Obj.Header);
100  IO.mapRequired("Parts", Obj.Parts);
101 }
102 
103 } // namespace yaml
104 } // namespace llvm
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::DXContainerYAML::ShaderHash
Definition: DXContainerYAML.h:66
llvm::dxbc::HashFlags
HashFlags
Definition: DXContainer.h:43
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::DXContainerYAML::Object::Parts
std::vector< Part > Parts
Definition: DXContainerYAML.h:86
llvm::DXContainerYAML::ShaderHash::ShaderHash
ShaderHash()=default
llvm::yaml::MappingTraits
Definition: ModuleSummaryIndex.h:53
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::DXContainerYAML::DXILProgram::DXILSize
std::optional< uint32_t > DXILSize
Definition: DXContainerYAML.h:54
llvm::DXContainerYAML::DXILProgram::MinorVersion
uint8_t MinorVersion
Definition: DXContainerYAML.h:48
llvm::DXContainerYAML::VersionTuple
Definition: DXContainerYAML.h:30
llvm::DXContainerYAML::Object::Header
FileHeader Header
Definition: DXContainerYAML.h:85
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:148
llvm::IndexedInstrProf::Version
const uint64_t Version
Definition: InstrProf.h:1058
uint64_t
llvm::DXContainerYAML::ShaderFlags::ShaderFlags
ShaderFlags()=default
llvm::DXContainerYAML::DXILProgram::MajorVersion
uint8_t MajorVersion
Definition: DXContainerYAML.h:47
DXContainerYAML.h
llvm::DXContainerYAML::DXILProgram::DXIL
std::optional< std::vector< llvm::yaml::Hex8 > > DXIL
Definition: DXContainerYAML.h:55
llvm::DXContainerYAML::DXILProgram::DXILMinorVersion
uint16_t DXILMinorVersion
Definition: DXContainerYAML.h:52
llvm::DXContainerYAML::ShaderFlags::getEncodedFlags
uint64_t getEncodedFlags()
Definition: DXContainerYAML.cpp:30
memcpy
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
DXContainer.h
llvm::DXContainerYAML::DXILProgram::ShaderKind
uint16_t ShaderKind
Definition: DXContainerYAML.h:49
llvm::DXContainerYAML::FileHeader
Definition: DXContainerYAML.h:38
uint32_t
llvm::DXContainerYAML::DXILProgram::Size
std::optional< uint32_t > Size
Definition: DXContainerYAML.h:50
llvm::DXContainerYAML::DXILProgram
Definition: DXContainerYAML.h:46
llvm::DXContainerYAML::ShaderFlags
Definition: DXContainerYAML.h:59
llvm::DXContainerYAML::Object
Definition: DXContainerYAML.h:84
llvm::DXContainerYAML::ShaderHash::IncludesSource
bool IncludesSource
Definition: DXContainerYAML.h:70
llvm::DXContainerYAML::ShaderHash::Digest
std::vector< llvm::yaml::Hex8 > Digest
Definition: DXContainerYAML.h:71
llvm::DXContainerYAML::DXILProgram::DXILMajorVersion
uint16_t DXILMajorVersion
Definition: DXContainerYAML.h:51
llvm::dxbc::ShaderHash
Definition: DXContainer.h:49
llvm::DXContainerYAML::Part
Definition: DXContainerYAML.h:74