17#ifndef LLVM_CLANG_DRIVER_OFFLOADBUNDLER_H
18#define LLVM_CLANG_DRIVER_OFFLOADBUNDLER_H
20#include "llvm/Support/Compression.h"
21#include "llvm/Support/Error.h"
22#include "llvm/TargetParser/Triple.h"
23#include <llvm/Support/MemoryBuffer.h>
93 std::string
str()
const;
110 static inline const size_t MagicSize = 4;
111 static inline const size_t VersionFieldSize =
sizeof(uint16_t);
112 static inline const size_t MethodFieldSize =
sizeof(uint16_t);
114 static inline const size_t FileSizeFieldSizeV2 =
sizeof(uint32_t);
115 static inline const size_t UncompressedSizeFieldSizeV2 =
sizeof(uint32_t);
117 static inline const size_t FileSizeFieldSizeV3 =
sizeof(uint64_t);
118 static inline const size_t UncompressedSizeFieldSizeV3 =
sizeof(uint64_t);
119 static inline const size_t HashFieldSize =
sizeof(uint64_t);
122 static inline const size_t V1HeaderSize =
123 MagicSize + VersionFieldSize + MethodFieldSize +
124 UncompressedSizeFieldSizeV2 + HashFieldSize;
127 static inline const size_t V2HeaderSize =
128 MagicSize + VersionFieldSize + FileSizeFieldSizeV2 + MethodFieldSize +
129 UncompressedSizeFieldSizeV2 + HashFieldSize;
132 static inline const size_t V3HeaderSize =
133 MagicSize + VersionFieldSize + FileSizeFieldSizeV3 + MethodFieldSize +
134 UncompressedSizeFieldSizeV3 + HashFieldSize;
136 static inline const llvm::StringRef MagicNumber =
"CCOB";
151 llvm_unreachable(
"Unsupported version");
156 compress(llvm::compression::Params
P,
const llvm::MemoryBuffer &Input,
157 uint16_t Version,
bool Verbose =
false);
159 decompress(
const llvm::MemoryBuffer &Input,
bool Verbose =
false);
llvm::MachO::Target Target
static size_t getHeaderSize(uint16_t Version)
static llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > decompress(const llvm::MemoryBuffer &Input, bool Verbose=false)
static const uint16_t DefaultVersion
static llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > compress(llvm::compression::Params P, const llvm::MemoryBuffer &Input, uint16_t Version, bool Verbose=false)
llvm::compression::Format CompressionFormat
std::vector< std::string > OutputFileNames
std::vector< std::string > TargetNames
uint16_t CompressedBundleVersion
std::vector< std::string > InputFileNames
bool PrintExternalCommands
llvm::Error BundleFiles()
Bundle the files. Return true if an error was found.
OffloadBundler(const OffloadBundlerConfig &BC)
llvm::Error UnbundleFiles()
llvm::Error UnbundleArchive()
UnbundleArchive takes an archive file (".a") as input containing bundled code object files,...
static llvm::Error ListBundleIDsInFile(llvm::StringRef InputFileName, const OffloadBundlerConfig &BundlerConfig)
const OffloadBundlerConfig & BundlerConfig
The JSON file list parser is used to communicate input to InstallAPI.
Obtain the offload kind, real machine triple, and an optional TargetID out of the target information ...
bool operator==(const OffloadTargetInfo &Target) const
bool isOffloadKindCompatible(const llvm::StringRef TargetOffloadKind) const
bool isTripleValid() const
llvm::StringRef OffloadKind
bool isOffloadKindValid() const
const OffloadBundlerConfig & BundlerConfig