LLVM: lib/ObjCopy/DXContainer/DXContainerWriter.cpp Source File (original) (raw)

Go to the documentation of this file.

1

2

3

4

5

6

7

8

10

11namespace llvm {

13namespace dxbc {

14

15using namespace object;

16

17size_t DXContainerWriter::finalize() {

18 assert(Offsets.empty() &&

19 "Attempted to finalize writer with already computed offsets");

20 Offsets.reserve(Obj.Parts.size());

21 size_t Offset = Obj.headerSize();

22 for (const Part &P : Obj.Parts) {

23 Offsets.push_back(Offset);

25 }

26 return Obj.Header.FileSize;

27}

28

30 size_t TotalSize = finalize();

31 Out.reserveExtraSpace(TotalSize);

32

36 Out.write(reinterpret_cast<const char *>(&Header),

39 for (auto &O : Offsets)

41 Out.write(reinterpret_cast<const char *>(Offsets.data()),

42 Offsets.size() * sizeof(uint32_t));

43

44 for (const Part &P : Obj.Parts) {

45 Out.write(reinterpret_cast<const char *>(P.Name.data()), 4);

49 Out.write(reinterpret_cast<const char *>(&Size), sizeof(uint32_t));

50 Out.write(reinterpret_cast<const char *>(P.Data.data()), P.Data.size());

51 }

52

54}

55

56}

57}

58}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Error write()

Definition DXContainerWriter.cpp:29

constexpr bool IsBigEndianHost

void swapByteOrder(T &Value)

This is an optimization pass for GlobalISel generic memory operations.