Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //===- OffloadYAML.h - Offload Binary YAMLIO implementation -----*- C++ -*-===//
  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. /// \file
  10. /// This file declares classes for handling the YAML representation of
  11. /// offloading binaries.
  12. ///
  13. //===----------------------------------------------------------------------===//
  14.  
  15. #ifndef LLVM_OBJECTYAML_OFFLOADYAML_H
  16. #define LLVM_OBJECTYAML_OFFLOADYAML_H
  17.  
  18. #include "llvm/ADT/MapVector.h"
  19. #include "llvm/Object/OffloadBinary.h"
  20. #include "llvm/ObjectYAML/YAML.h"
  21. #include "llvm/Support/YAMLTraits.h"
  22. #include <optional>
  23.  
  24. namespace llvm {
  25. namespace OffloadYAML {
  26.  
  27. struct Binary {
  28.   struct StringEntry {
  29.     StringRef Key;
  30.     StringRef Value;
  31.   };
  32.  
  33.   struct Member {
  34.     std::optional<object::ImageKind> ImageKind;
  35.     std::optional<object::OffloadKind> OffloadKind;
  36.     std::optional<uint32_t> Flags;
  37.     std::optional<std::vector<StringEntry>> StringEntries;
  38.     std::optional<yaml::BinaryRef> Content;
  39.   };
  40.  
  41.   std::optional<uint32_t> Version;
  42.   std::optional<uint64_t> Size;
  43.   std::optional<uint64_t> EntryOffset;
  44.   std::optional<uint64_t> EntrySize;
  45.   std::vector<Member> Members;
  46. };
  47.  
  48. } // end namespace OffloadYAML
  49. } // end namespace llvm
  50.  
  51. LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::OffloadYAML::Binary::Member)
  52. LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::OffloadYAML::Binary::StringEntry)
  53.  
  54. namespace llvm {
  55. namespace yaml {
  56.  
  57. template <> struct ScalarEnumerationTraits<object::ImageKind> {
  58.   static void enumeration(IO &IO, object::ImageKind &Value);
  59. };
  60.  
  61. template <> struct ScalarEnumerationTraits<object::OffloadKind> {
  62.   static void enumeration(IO &IO, object::OffloadKind &Value);
  63. };
  64.  
  65. template <> struct MappingTraits<OffloadYAML::Binary> {
  66.   static void mapping(IO &IO, OffloadYAML::Binary &O);
  67. };
  68.  
  69. template <> struct MappingTraits<OffloadYAML::Binary::StringEntry> {
  70.   static void mapping(IO &IO, OffloadYAML::Binary::StringEntry &M);
  71. };
  72.  
  73. template <> struct MappingTraits<OffloadYAML::Binary::Member> {
  74.   static void mapping(IO &IO, OffloadYAML::Binary::Member &M);
  75. };
  76.  
  77. } // end namespace yaml
  78. } // end namespace llvm
  79.  
  80. #endif // LLVM_OBJECTYAML_OFFLOADYAML_H
  81.