LLVM: include/llvm/Object/OffloadBundle.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17#ifndef LLVM_OBJECT_OFFLOADBUNDLE_H

18#define LLVM_OBJECT_OFFLOADBUNDLE_H

19

29#include

30

31namespace llvm {

32

34

35

36

37

38

39

40

41

42

43

44

45

46

48private:

50

51public:

61

63

70};

71

72

77 std::string ID;

81 OS << "Offset = " << Offset << ", Size = " << Size

82 << ", ID Length = " << IDLength << ", ID = " << ID << "\n";

83 }

85 OS << ID.data() << "\tfile://" << FilePath << "#offset=" << Offset

86 << "&size=" << Size << "\n";

87 }

88};

89

90

92

96 bool Decompressed;

98

99public:

101

107

110 bool Decompress = false);

112

114

118 Entry.dumpInfo(outs());

119 }

120

123 Entry.dumpURI(outs(), FileName);

124 }

125

127 bool Decompress = false)

128 : FileName(File), NumberOfEntries(0), Decompressed(Decompress),

130 if (Decompress)

133 }

134};

135

137

144

145

146

150

151public:

154 switch (Type) {

157 break;

160 break;

161 }

163 }

164

167 int64_t O = 0;

168 int64_t S = 0;

169

170 if (!Str.consume_front("file://"))

172 "Reading type of URI");

173

175 Str.take_until([](char C) { return (C == '#') || (C == '?'); });

177

178 if (!Str.consume_front("#offset="))

180 "Reading 'offset' in URI");

181

184 Str = Str.drop_front(OffsetStr.size());

185

186 if (!Str.consume_front("&size="))

188 "Reading 'size' in URI");

189

190 Str.getAsInteger(10, S);

191 std::unique_ptr OffloadingURI(

193 return std::move(OffloadingURI);

194 }

195

198

200 "Memory Type URI is not currently supported.");

201 }

202

204};

205

206

207

210

211

212

215

216

217

220

222

223}

224

225}

226#endif

This file implements a map that provides insertion order iteration.

This file defines the SmallString class.

The Input class is used to parse a yaml document into in-memory structs and vectors.

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.

Definition OffloadBundle.h:47

static llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > decompress(const llvm::MemoryBuffer &Input, raw_ostream *VerboseStream=nullptr)

static const uint16_t DefaultVersion

Definition OffloadBundle.h:62

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

Definition OffloadBundle.h:105

bool isDecompressed() const

Definition OffloadBundle.h:106

void printEntriesAsURI()

Definition OffloadBundle.h:121

uint64_t getSize() const

Definition OffloadBundle.h:103

std::unique_ptr< MemoryBuffer > DecompressedBuffer

Definition OffloadBundle.h:100

LLVM_ABI Error dumpEntryToCodeObject()

LLVM_ABI Error readEntries(StringRef Section, uint64_t SectionOffset)

OffloadBundleFatBin(MemoryBufferRef Source, StringRef File, bool Decompress=false)

Definition OffloadBundle.h:126

SmallVector< OffloadBundleEntry > getEntries()

Definition OffloadBundle.h:102

void dumpEntries()

Definition OffloadBundle.h:116

LLVM_ABI Error extractBundle(const ObjectFile &Source)

StringRef getFileName() const

Definition OffloadBundle.h:104

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.

UriTypeT

Definition OffloadBundle.h:136

@ FILE_URI

Definition OffloadBundle.h:136

@ MEMORY_URI

Definition OffloadBundle.h:136

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.

Definition OffloadBundle.h:73

uint64_t IDLength

Definition OffloadBundle.h:76

uint64_t Size

Definition OffloadBundle.h:75

uint64_t Offset

Definition OffloadBundle.h:74

void dumpInfo(raw_ostream &OS)

Definition OffloadBundle.h:80

std::string ID

Definition OffloadBundle.h:77

OffloadBundleEntry(uint64_t O, uint64_t S, uint64_t I, StringRef T)

Definition OffloadBundle.h:78

void dumpURI(raw_ostream &OS, StringRef FilePath)

Definition OffloadBundle.h:84

UriTypeT URIType

Definition OffloadBundle.h:143

int64_t Size

Definition OffloadBundle.h:140

static Expected< std::unique_ptr< OffloadBundleURI > > createOffloadBundleURI(StringRef Str, UriTypeT Type)

Definition OffloadBundle.h:153

StringRef FileName

Definition OffloadBundle.h:142

int64_t Offset

Definition OffloadBundle.h:139

static Expected< std::unique_ptr< OffloadBundleURI > > createFileURI(StringRef Str)

Definition OffloadBundle.h:166

uint64_t ProcessID

Definition OffloadBundle.h:141

StringRef getFileName() const

Definition OffloadBundle.h:203

static Expected< std::unique_ptr< OffloadBundleURI > > createMemoryURI(StringRef Str)

Definition OffloadBundle.h:197

OffloadBundleURI(StringRef File, int64_t Off, int64_t Size)

Definition OffloadBundle.h:147