17#ifndef LLVM_OBJECT_OFFLOADBUNDLE_H
18#define LLVM_OBJECT_OFFLOADBUNDLE_H
81 OS <<
"Offset = " <<
Offset <<
", Size = " <<
Size
82 <<
", ID Length = " <<
IDLength <<
", ID = " <<
ID <<
"\n";
85 OS <<
ID.data() <<
"\tfile://" << FilePath <<
"#offset=" <<
Offset
86 <<
"&size=" <<
Size <<
"\n";
110 bool Decompress =
false);
118 Entry.dumpInfo(
outs());
123 Entry.dumpURI(
outs(), FileName);
127 bool Decompress =
false)
128 : FileName(File), NumberOfEntries(0), Decompressed(Decompress),
170 if (!Str.consume_front(
"file://"))
172 "Reading type of URI");
175 Str.
take_until([](
char C) {
return (
C ==
'#') || (
C ==
'?'); });
178 if (!Str.consume_front(
"#offset="))
180 "Reading 'offset' in URI");
184 Str = Str.drop_front(OffsetStr.
size());
186 if (!Str.consume_front(
"&size="))
188 "Reading 'size' in URI");
190 Str.getAsInteger(10, S);
191 std::unique_ptr<OffloadBundleURI> OffloadingURI(
193 return std::move(OffloadingURI);
200 "Memory Type URI is not currently supported.");
This file implements a map that provides insertion order iteration.
This file defines the SmallString class.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
constexpr size_t size() const
size - Get the string size.
StringRef take_until(function_ref< bool(char)> F) const
Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicat...
The instances of the Type class are immutable: once they are created, they are never changed.
static llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > decompress(const llvm::MemoryBuffer &Input, raw_ostream *VerboseStream=nullptr)
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, raw_ostream *VerboseStream=nullptr)
This class is the base class for all object file types.
uint64_t getNumEntries() const
bool isDecompressed() const
std::unique_ptr< MemoryBuffer > DecompressedBuffer
LLVM_ABI Error dumpEntryToCodeObject()
LLVM_ABI Error readEntries(StringRef Section, uint64_t SectionOffset)
OffloadBundleFatBin(MemoryBufferRef Source, StringRef File, bool Decompress=false)
SmallVector< OffloadBundleEntry > getEntries()
LLVM_ABI Error extractBundle(const ObjectFile &Source)
StringRef getFileName() const
static LLVM_ABI Expected< std::unique_ptr< OffloadBundleFatBin > > create(MemoryBufferRef, uint64_t SectionOffset, StringRef FileName, bool Decompress=false)
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
LLVM_ABI Error extractCodeObject(const ObjectFile &Source, int64_t Offset, int64_t Size, StringRef OutputFileName)
Extract code object memory from the given Source object file at Offset and of Size,...
LLVM_ABI Error extractOffloadBundleByURI(StringRef URIstr)
Extracts an Offload Bundle Entry given by URI.
LLVM_ABI Error extractOffloadBundleFatBinary(const ObjectFile &Obj, SmallVectorImpl< OffloadBundleFatBin > &Bundles)
Extracts fat binary in binary clang-offload-bundler format from object Obj and return it in Bundles.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_fd_ostream & outs()
This returns a reference to a raw_fd_ostream for standard output.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
Bundle entry in binary clang-offload-bundler format.
void dumpInfo(raw_ostream &OS)
OffloadBundleEntry(uint64_t O, uint64_t S, uint64_t I, StringRef T)
void dumpURI(raw_ostream &OS, StringRef FilePath)
static Expected< std::unique_ptr< OffloadBundleURI > > createOffloadBundleURI(StringRef Str, UriTypeT Type)
static Expected< std::unique_ptr< OffloadBundleURI > > createFileURI(StringRef Str)
StringRef getFileName() const
static Expected< std::unique_ptr< OffloadBundleURI > > createMemoryURI(StringRef Str)
OffloadBundleURI(StringRef File, int64_t Off, int64_t Size)