LLVM API Documentation
#include <StreamableMemoryObject.h>
Public Member Functions | |
StreamingMemoryObject (DataStreamer *streamer) | |
virtual uint64_t | getBase () const LLVM_OVERRIDE |
virtual uint64_t | getExtent () const LLVM_OVERRIDE |
virtual int | readByte (uint64_t address, uint8_t *ptr) const LLVM_OVERRIDE |
virtual int | readBytes (uint64_t address, uint64_t size, uint8_t *buf) const LLVM_OVERRIDE |
virtual const uint8_t * | getPointer (uint64_t address, uint64_t size) const LLVM_OVERRIDE |
virtual bool | isValidAddress (uint64_t address) const LLVM_OVERRIDE |
virtual bool | isObjectEnd (uint64_t address) const LLVM_OVERRIDE |
bool | dropLeadingBytes (size_t s) |
void | setKnownObjectSize (size_t size) |
![]() | |
virtual | ~StreamableMemoryObject () |
Destructor - Override as necessary. More... | |
![]() | |
virtual | ~MemoryObject () |
Destructor - Override as necessary. More... | |
StreamingMemoryObject - interface to data which is actually streamed from a DataStreamer. In addition to inherited members, it has the dropLeadingBytes and setKnownObjectSize methods which are not applicable to non-streamed objects.
Definition at line 105 of file StreamableMemoryObject.h.
llvm::StreamingMemoryObject::StreamingMemoryObject | ( | DataStreamer * | streamer | ) |
Definition at line 136 of file StreamableMemoryObject.cpp.
References llvm::DataStreamer::GetBytes().
bool llvm::StreamingMemoryObject::dropLeadingBytes | ( | size_t | s | ) |
Drop s bytes from the front of the stream, pushing the positions of the remaining bytes down by s. This is used to skip past the bitcode header, since we don't know a priori if it's present, and we can't put bytes back into the stream once we've read them.
Definition at line 117 of file StreamableMemoryObject.cpp.
|
inlinevirtual |
getBase - Returns the lowest valid address in the region.
Implements llvm::StreamableMemoryObject.
Definition at line 108 of file StreamableMemoryObject.h.
|
virtual |
getExtent - Returns the size of the region in bytes. (The region is contiguous, so the highest valid address of the region is getBase() + getExtent() - 1). May block until all bytes in the stream have been read
Implements llvm::StreamableMemoryObject.
Definition at line 95 of file StreamableMemoryObject.cpp.
|
inlinevirtual |
getPointer - Ensures that the requested data is in memory, and returns A pointer to it. More efficient than using readBytes if the data is already in memory. May block until (address - base + size) bytes have been read
address | - address of the byte, in the same space as getBase() |
size | - amount of data that must be available on return |
Implements llvm::StreamableMemoryObject.
Definition at line 114 of file StreamableMemoryObject.h.
|
virtual |
isObjectEnd - Returns true if the address is one past the end of the object (i.e. if it is equal to base + extent) May block until (address - base) bytes have been read
address | - address of the byte, in the same space as getBase() |
Implements llvm::StreamableMemoryObject.
Definition at line 89 of file StreamableMemoryObject.cpp.
|
virtual |
isValidAddress - Returns true if the address is within the object (i.e. between base and base + extent - 1 inclusive) May block until (address - base) bytes have been read
address | - address of the byte, in the same space as getBase() |
Implements llvm::StreamableMemoryObject.
Definition at line 84 of file StreamableMemoryObject.cpp.
|
virtual |
readByte - Tries to read a single byte from the region. May block until (address - base) bytes have been read
address | - The address of the byte, in the same space as getBase(). |
ptr | - A pointer to a byte to be filled in. Must be non-NULL. |
Implements llvm::StreamableMemoryObject.
Definition at line 103 of file StreamableMemoryObject.cpp.
|
virtual |
readBytes - Tries to read a contiguous range of bytes from the region, up to the end of the region. May block until (address - base + size) bytes have been read. Additionally, StreamableMemoryObjects will not do partial reads - if size bytes cannot be read, readBytes will fail.
address | - The address of the first byte, in the same space as getBase(). |
size | - The number of bytes to copy. |
buf | - A pointer to a buffer to be filled in. Must be non-NULL and large enough to hold size bytes. |
Implements llvm::StreamableMemoryObject.
Definition at line 109 of file StreamableMemoryObject.cpp.
References llvm::Intrinsic::memcpy.
void llvm::StreamingMemoryObject::setKnownObjectSize | ( | size_t | size | ) |
If the data object size is known in advance, many of the operations can be made more efficient, so this method should be called before reading starts (although it can be called anytime).
Definition at line 124 of file StreamableMemoryObject.cpp.