LLVM: lib/ObjectYAML/OffloadEmitter.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

13

14using namespace llvm;

16

17namespace llvm {

18namespace yaml {

19

21 for (const auto &Member : Doc.Members) {

23 if (Member.ImageKind)

24 Image.TheImageKind = *Member.ImageKind;

25 if (Member.OffloadKind)

26 Image.TheOffloadKind = *Member.OffloadKind;

27 if (Member.Flags)

28 Image.Flags = *Member.Flags;

29

30 if (Member.StringEntries)

31 for (const auto &Entry : *Member.StringEntries)

32 Image.StringData[Entry.Key] = Entry.Value;

33

36 if (Member.Content)

37 Member.Content->writeAsBinary(OS);

39

40

42 auto *TheHeader =

47 TheHeader->Size = *Doc.Size;

49 TheHeader->EntryOffset = *Doc.EntryOffset;

51 TheHeader->EntrySize = *Doc.EntrySize;

52

53 Out.write(Buffer.begin(), Buffer.size());

54 }

55

56 return true;

57}

58

59}

60}

This file declares classes for handling the YAML representation of offloading binaries.

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 is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

static LLVM_ABI SmallString< 0 > write(const OffloadingImage &)

Serialize the contents of File to a binary buffer to be read later.

This class implements an extremely fast bulk output stream that can only output to a stream.

raw_ostream & write(unsigned char C)

A raw_ostream that writes to an SmallVector or SmallString.

StringRef str() const

Return a StringRef for the vector contents.

llvm::function_ref< void(const Twine &Msg)> ErrorHandler

LLVM_ABI bool yaml2offload(OffloadYAML::Binary &Doc, raw_ostream &Out, ErrorHandler EH)

Definition OffloadEmitter.cpp:20

This is an optimization pass for GlobalISel generic memory operations.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

std::optional< uint32_t > Version

std::optional< uint64_t > EntryOffset

std::optional< uint64_t > Size

std::optional< uint64_t > EntrySize

std::vector< Member > Members

The offloading metadata that will be serialized to a memory buffer.

Common declarations for yaml2obj.