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 14 #include "llvm/ObjectYAML/DXContainerYAML.h" 15 16 namespace llvm { 17 namespace yaml { 18 19 void MappingTraits<DXContainerYAML::VersionTuple>::mapping( 20 IO &IO, DXContainerYAML::VersionTuple &Version) { 21 IO.mapRequired("Major", Version.Major); 22 IO.mapRequired("Minor", Version.Minor); 23 } 24 25 void MappingTraits<DXContainerYAML::FileHeader>::mapping( 26 IO &IO, DXContainerYAML::FileHeader &Header) { 27 IO.mapRequired("Hash", Header.Hash); 28 IO.mapRequired("Version", Header.Version); 29 IO.mapOptional("FileSize", Header.FileSize); 30 IO.mapRequired("PartCount", Header.PartCount); 31 IO.mapOptional("PartOffsets", Header.PartOffsets); 32 } 33 34 void MappingTraits<DXContainerYAML::DXILProgram>::mapping( 35 IO &IO, DXContainerYAML::DXILProgram &Program) { 36 IO.mapRequired("MajorVersion", Program.MajorVersion); 37 IO.mapRequired("MinorVersion", Program.MinorVersion); 38 IO.mapRequired("ShaderKind", Program.ShaderKind); 39 IO.mapOptional("Size", Program.Size); 40 IO.mapRequired("DXILMajorVersion", Program.DXILMajorVersion); 41 IO.mapRequired("DXILMinorVersion", Program.DXILMinorVersion); 42 IO.mapOptional("DXILSize", Program.DXILSize); 43 IO.mapOptional("DXIL", Program.DXIL); 44 } 45 46 void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO, 47 DXContainerYAML::Part &P) { 48 IO.mapRequired("Name", P.Name); 49 IO.mapRequired("Size", P.Size); 50 IO.mapOptional("Program", P.Program); 51 } 52 53 void MappingTraits<DXContainerYAML::Object>::mapping( 54 IO &IO, DXContainerYAML::Object &Obj) { 55 IO.mapTag("!dxcontainer", true); 56 IO.mapRequired("Header", Obj.Header); 57 IO.mapRequired("Parts", Obj.Parts); 58 } 59 60 } // namespace yaml 61 } // namespace llvm 62