LLVM: include/llvm/Support/BinaryStreamRef.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_SUPPORT_BINARYSTREAMREF_H

10#define LLVM_SUPPORT_BINARYSTREAMREF_H

11

16#include

17#include

18#include

19

20namespace llvm {

21

22

24protected:

30 }

31

33 std::optional<uint64_t> Length)

37 std::optional<uint64_t> Length)

41

44

45public:

47

51

53 }

54

55

56

57

60 return RefType();

61

63 RefType Result(static_cast<const RefType &>(*this));

64 if (N == 0)

65 return Result;

66

67 Result.ViewOffset += N;

68 if (Result.Length)

69 *Result.Length -= N;

70 return Result;

71 }

72

73

74

75

78 return RefType();

79

80 RefType Result(static_cast<const RefType &>(*this));

82

83 if (N == 0)

84 return Result;

85

86

87

88 if (!Result.Length)

90

91 *Result.Length -= N;

92 return Result;

93 }

94

95

99 }

100

101

105 }

106

107

108

111 }

112

113

114

117 }

118

120

122 if (LHS.BorrowedImpl != RHS.BorrowedImpl)

123 return false;

124 if (LHS.ViewOffset != RHS.ViewOffset)

125 return false;

126 if (LHS.Length != RHS.Length)

127 return false;

128 return true;

129 }

130

131protected:

138 }

139

144};

145

146

147

148

149

150

151

152

158 std::optional<uint64_t> Length)

160

161public:

165 std::optional<uint64_t> Length);

168

173

174

177

178

179

180

181

182

183

186

187

188

189

190

191

194};

195

199

202 return {Off + Offset, SubSub};

203 }

206 }

208

209 std::pair<BinarySubstreamRef, BinarySubstreamRef> split(uint64_t Off) const {

211 }

212

215};

216

219 WritableBinaryStream> {

224

228

232 }

233

234public:

238 std::optional<uint64_t> Length);

244

247

248

251

252

253

254

255

256

257

259

260

262

263

265};

266

267}

268

269#endif

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Common stuff for mutable and immutable StreamRefs.

friend bool operator==(const RefType &LHS, const RefType &RHS)

std::optional< uint64_t > Length

RefType drop_back(uint64_t N) const

Return a new BinaryStreamRef with the last N elements removed.

BinaryStreamRefBase & operator=(const BinaryStreamRefBase &Other)=default

RefType drop_front(uint64_t N) const

Return a new BinaryStreamRef with the first N elements removed.

BinaryStreamRefBase()=default

BinaryStreamRefBase & operator=(BinaryStreamRefBase &&Other)=default

BinaryStreamRefBase(StreamType &BorrowedImpl, uint64_t Offset, std::optional< uint64_t > Length)

std::shared_ptr< StreamType > SharedImpl

StreamType * BorrowedImpl

Error checkOffsetForRead(uint64_t Offset, uint64_t DataSize) const

RefType drop_symmetric(uint64_t N) const

Return a new BinaryStreamRef with the first and last N elements removed.

BinaryStreamRefBase(std::shared_ptr< StreamType > SharedImpl, uint64_t Offset, std::optional< uint64_t > Length)

RefType slice(uint64_t Offset, uint64_t Len) const

Return a new BinaryStreamRef with the first Offset elements removed, and retaining exactly Len elemen...

BinaryStreamRefBase(StreamType &BorrowedImpl)

llvm::endianness getEndian() const

RefType keep_back(uint64_t N) const

Return a new BinaryStreamRef with only the last N elements remaining.

RefType keep_front(uint64_t N) const

Return a new BinaryStreamRef with only the first N elements remaining.

BinaryStreamRefBase(BinaryStreamRefBase &&Other)=default

uint64_t getLength() const

BinaryStreamRefBase(const BinaryStreamRefBase &Other)=default

BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.

BinaryStreamRef(BinaryStreamRef &&Other)=default

Error readLongestContiguousChunk(uint64_t Offset, ArrayRef< uint8_t > &Buffer) const

Given an Offset into this BinaryStreamRef, return a reference to the largest buffer the stream could ...

BinaryStreamRef(const BinaryStreamRef &Other)=default

BinaryStreamRef(BinaryStreamRef &S, uint64_t Offset, uint64_t Length)=delete

Error readBytes(uint64_t Offset, uint64_t Size, ArrayRef< uint8_t > &Buffer) const

Given an Offset into this StreamRef and a Size, return a reference to a buffer owned by the stream.

BinaryStreamRef()=default

BinaryStreamRef & operator=(BinaryStreamRef &&Other)=default

BinaryStreamRef & operator=(const BinaryStreamRef &Other)=default

An interface for accessing data in a stream-like format, but which discourages copying.

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...

StringRef - Represent a constant reference to a string, i.e.

WritableBinaryStreamRef & operator=(const WritableBinaryStreamRef &Other)=default

WritableBinaryStreamRef(const WritableBinaryStreamRef &Other)=default

WritableBinaryStreamRef()=default

WritableBinaryStreamRef(WritableBinaryStreamRef &&Other)=default

WritableBinaryStreamRef(WritableBinaryStreamRef &S, uint64_t Offset, uint64_t Length)=delete

Error writeBytes(uint64_t Offset, ArrayRef< uint8_t > Data) const

Given an Offset into this WritableBinaryStreamRef and some input data, writes the data to the underly...

WritableBinaryStreamRef & operator=(WritableBinaryStreamRef &&Other)=default

Error commit()

For buffered streams, commits changes to the backing store.

A BinaryStream which can be read from as well as written to.

BinaryStreamFlags getFlags() const override

Return the properties of this stream.

This is an optimization pass for GlobalISel generic memory operations.

decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)

std::pair< BinarySubstreamRef, BinarySubstreamRef > split(uint64_t Off) const

BinarySubstreamRef keep_front(uint64_t N) const

BinarySubstreamRef slice(uint64_t Off, uint64_t Size) const

BinaryStreamRef StreamData

BinarySubstreamRef drop_front(uint64_t N) const