[NFC] Refactor DXContainer to support more parts
authorChris Bieneman <chris.bieneman@me.com>
Wed, 28 Sep 2022 18:30:44 +0000 (13:30 -0500)
committerChris Bieneman <chris.bieneman@me.com>
Thu, 29 Sep 2022 16:59:52 +0000 (11:59 -0500)
commit63accaf46f09485447a3e2f529eebf2c795a8693
tree0afe6403dba107a0a7efbd507aa1fdb49661edb6
parent5d4dd5357076de54d70f8621a39626b393a6e110
[NFC] Refactor DXContainer to support more parts

This patch refactors some of the DXContainer Object and YAML code to
make it easier to add more part parsing.

DXContainer has a whole bunch of constant values, so I've added a
DXContainerConstants.def file which will grow with constant
definitions, but starts with just part identifiers. I've also added a
utility to parse the part magic string into an enum, and converted the
code to use that utility and the enum instead of the part literal
string.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D133980
llvm/include/llvm/BinaryFormat/DXContainer.h
llvm/include/llvm/BinaryFormat/DXContainerConstants.def [new file with mode: 0644]
llvm/include/llvm/ObjectYAML/DXContainerYAML.h
llvm/lib/BinaryFormat/CMakeLists.txt
llvm/lib/BinaryFormat/DXContainer.cpp [new file with mode: 0644]
llvm/lib/Object/DXContainer.cpp
llvm/tools/obj2yaml/dxcontainer2yaml.cpp