LLVM: include/llvm/CGData/CodeGenDataReader.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CGDATA_CODEGENDATAREADER_H

14#define LLVM_CGDATA_CODEGENDATAREADER_H

15

22

23namespace llvm {

24

27 std::string LastErrorMsg;

28

29public:

32

33

35

37

39

41

43

50

51

52

55

56

57

59 create(std::unique_ptr Buffer);

60

61

62

63

64

65

71

72protected:

73

74

76

77

78

80

81

83 LastError = Err;

84 LastErrorMsg = ErrMsg;

88 }

89

92 LastError = IPE.get();

94 });

96 }

97

98

100};

101

103

104 std::unique_ptr DataBuffer;

105

107

108public:

110 : DataBuffer(std::move(DataBuffer)) {}

114

115

117

119

121

123 return static_cast<CGDataKind>(Header.DataKind);

124 }

125

126

128 return Header.DataKind &

130 }

131

133 return Header.DataKind &

135 }

136};

137

138

139

140

141

142

144

145 std::unique_ptr DataBuffer;

146

148

150

151public:

153 : DataBuffer(std::move(DataBuffer_)), Line(*DataBuffer, true, '#') {}

156

157

159

161

163

165

166

168 return static_cast<uint32_t>(DataKind) &

170 }

171

172

174 return static_cast<uint32_t>(DataKind) &

176 }

177};

178

179}

180

181#endif

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

Defines the virtual file system interface vfs::FileSystem.

const std::string & getMessage() const

virtual bool hasOutlinedHashTree() const =0

Return true if the data has an outlined hash tree.

Error success()

Clear the current error and return a successful one.

Definition CodeGenDataReader.h:99

virtual ~CodeGenDataReader()=default

virtual bool hasStableFunctionMap() const =0

Return true if the data has a stable function map.

virtual uint32_t getVersion() const =0

Return the codegen data version.

OutlinedHashTreeRecord HashTreeRecord

The outlined hash tree that has been read.

Definition CodeGenDataReader.h:75

CodeGenDataReader()=default

static LLVM_ABI Expected< std::unique_ptr< CodeGenDataReader > > create(const Twine &Path, vfs::FileSystem &FS)

Factory method to create an appropriately typed reader for the given codegen data file path and file ...

Error error(cgdata_error Err, const std::string &ErrMsg="")

Set the current error and return same.

Definition CodeGenDataReader.h:82

std::unique_ptr< StableFunctionMap > releaseStableFunctionMap()

Definition CodeGenDataReader.h:47

StableFunctionMapRecord FunctionMapRecord

The stable function map that has been read. When it's released by.

Definition CodeGenDataReader.h:79

virtual CGDataKind getDataKind() const =0

Return the codegen data kind.

virtual Error read()=0

Read the header. Required before reading first record.

Error error(Error &&E)

Definition CodeGenDataReader.h:90

static LLVM_ABI Error mergeFromObjectFile(const object::ObjectFile *Obj, OutlinedHashTreeRecord &GlobalOutlineRecord, StableFunctionMapRecord &GlobalFunctionMapRecord, stable_hash *CombinedHash=nullptr)

Extract the cgdata embedded in sections from the given object file and merge them into the GlobalOutl...

std::unique_ptr< OutlinedHashTree > releaseOutlinedHashTree()

Return the outlined hash tree that is released from the reader.

Definition CodeGenDataReader.h:44

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Tagged union holding either a T or a Error.

static bool hasFormat(const MemoryBuffer &Buffer)

Return true if the given buffer is in binary codegen data format.

Error read() override

Read the contents including the header.

bool hasStableFunctionMap() const override

Return true if the header indicates the data has a stable function map.

Definition CodeGenDataReader.h:132

IndexedCodeGenDataReader(const IndexedCodeGenDataReader &)=delete

bool hasOutlinedHashTree() const override

Return true if the header indicates the data has an outlined hash tree.

Definition CodeGenDataReader.h:127

IndexedCodeGenDataReader(std::unique_ptr< MemoryBuffer > DataBuffer)

Definition CodeGenDataReader.h:109

CGDataKind getDataKind() const override

Return the codegen data kind.

Definition CodeGenDataReader.h:122

IndexedCodeGenDataReader & operator=(const IndexedCodeGenDataReader &)=delete

uint32_t getVersion() const override

Return the codegen data version.

Definition CodeGenDataReader.h:120

This interface provides simple read-only access to a block of memory, and provides simple methods for...

static bool hasFormat(const MemoryBuffer &Buffer)

Return true if the given buffer is in text codegen data format.

bool hasStableFunctionMap() const override

Return true if the header indicates the data has a stable function map.

Definition CodeGenDataReader.h:173

bool hasOutlinedHashTree() const override

Return true if the header indicates the data has an outlined hash tree.

Definition CodeGenDataReader.h:167

Error read() override

Read the contents including the header.

TextCodeGenDataReader & operator=(const TextCodeGenDataReader &)=delete

uint32_t getVersion() const override

Text format does not have version, so return 0.

Definition CodeGenDataReader.h:162

TextCodeGenDataReader(const TextCodeGenDataReader &)=delete

TextCodeGenDataReader(std::unique_ptr< MemoryBuffer > DataBuffer_)

Definition CodeGenDataReader.h:152

CGDataKind getDataKind() const override

Return the codegen data kind.

Definition CodeGenDataReader.h:164

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

A forward iterator which reads text lines from a buffer.

This class is the base class for all object file types.

The virtual file system interface.

This is an optimization pass for GlobalISel generic memory operations.

@ StableFunctionMergingMap

@ FunctionOutlinedHashTree

void handleAllErrors(Error E, HandlerTs &&... Handlers)

Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...

uint64_t stable_hash

An opaque object representing a stable hash code.

Error make_error(ArgTs &&... Args)

Make a Error instance representing failure using the given error info type.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

Implement std::hash so that hash_code can be used in STL containers.

The structure of the serialized stable function map is as follows: