LLVM: lib/CodeGen/AsmPrinter/ByteStreamer.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_BYTESTREAMER_H

15#define LLVM_LIB_CODEGEN_ASMPRINTER_BYTESTREAMER_H

16

21#include

22

23namespace llvm {

25 protected:

29

30 public:

31

35 unsigned PadTo = 0) = 0;

37};

38

40private:

42

43public:

46 AP.OutStreamer->AddComment(Comment);

47 AP.emitInt8(Byte);

48 }

50 AP.OutStreamer->AddComment(Comment);

51 AP.emitSLEB128(DWord);

52 }

54 unsigned PadTo) override {

55 AP.OutStreamer->AddComment(Comment);

56 AP.emitULEB128(DWord, nullptr, PadTo);

57 }

67};

68

70 private:

72 public:

75 Hash.update(Byte);

76 }

78 Hash.addSLEB128(DWord);

79 }

81 unsigned PadTo) override {

82 Hash.addULEB128(DWord);

83 }

85 Hash.hashRawTypeReference(D);

86 return 0;

87 }

88};

89

91private:

93 std::vectorstd::string &Comments;

94

95public:

96

97

98

100

106 Buffer.push_back(Byte);

108 Comments.push_back(Comment.str());

109 }

114 Comments.push_back(Comment.str());

115

116

117 for (size_t i = 1; i < Length; ++i)

118 Comments.push_back("");

119

120 }

121 }

123 unsigned PadTo) override {

127 Comments.push_back(Comment.str());

128

129

130 for (size_t i = 1; i < Length; ++i)

131 Comments.push_back("");

132 }

133 }

141};

142

143}

144

145#endif

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

static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")

static constexpr unsigned ULEB128PadSize

unsigned emitDIERef(const DIE &D) override

Definition ByteStreamer.h:58

APByteStreamer(AsmPrinter &Asm)

Definition ByteStreamer.h:44

void emitULEB128(uint64_t DWord, const Twine &Comment, unsigned PadTo) override

Definition ByteStreamer.h:53

void emitSLEB128(uint64_t DWord, const Twine &Comment) override

Definition ByteStreamer.h:49

void emitInt8(uint8_t Byte, const Twine &Comment) override

Definition ByteStreamer.h:45

This class is intended to be used as a driving class for all asm writers.

void emitInt8(uint8_t Byte, const Twine &Comment) override

Definition ByteStreamer.h:105

unsigned emitDIERef(const DIE &D) override

Definition ByteStreamer.h:134

void emitULEB128(uint64_t DWord, const Twine &Comment, unsigned PadTo) override

Definition ByteStreamer.h:122

void emitSLEB128(uint64_t DWord, const Twine &Comment) override

Definition ByteStreamer.h:110

const bool GenerateComments

Only verbose textual output needs comments.

Definition ByteStreamer.h:99

BufferByteStreamer(SmallVectorImpl< char > &Buffer, std::vector< std::string > &Comments, bool GenerateComments)

Definition ByteStreamer.h:101

virtual void emitULEB128(uint64_t DWord, const Twine &Comment="", unsigned PadTo=0)=0

virtual void emitSLEB128(uint64_t DWord, const Twine &Comment="")=0

virtual void emitInt8(uint8_t Byte, const Twine &Comment="")=0

virtual unsigned emitDIERef(const DIE &D)=0

ByteStreamer(const ByteStreamer &)=default

An object containing the capability of hashing and adding hash attributes onto a DIE.

A structured debug information entry.

HashingByteStreamer(DIEHash &H)

Definition ByteStreamer.h:73

void emitULEB128(uint64_t DWord, const Twine &Comment, unsigned PadTo) override

Definition ByteStreamer.h:80

void emitSLEB128(uint64_t DWord, const Twine &Comment) override

Definition ByteStreamer.h:77

void emitInt8(uint8_t Byte, const Twine &Comment) override

Definition ByteStreamer.h:74

unsigned emitDIERef(const DIE &D) override

Definition ByteStreamer.h:84

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

A raw_ostream that writes to an SmallVector or SmallString.

This is an optimization pass for GlobalISel generic memory operations.

unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)

Utility function to encode a SLEB128 value to an output stream.

unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)

Utility function to encode a ULEB128 value to an output stream.