LLVM API Documentation
#include <StreamableMemoryObject.h>
Public Member Functions | |
StreamingMemoryObject (DataStreamer *streamer) | |
uint64_t | getBase () const override |
uint64_t | getExtent () const override |
int | readByte (uint64_t address, uint8_t *ptr) const override |
int | readBytes (uint64_t address, uint64_t size, uint8_t *buf) const override |
const uint8_t * | getPointer (uint64_t address, uint64_t size) const override |
bool | isValidAddress (uint64_t address) const override |
bool | isObjectEnd (uint64_t address) const override |
bool | dropLeadingBytes (size_t s) |
void | setKnownObjectSize (size_t size) |
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 106 of file StreamableMemoryObject.h.
Definition at line 135 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 116 of file StreamableMemoryObject.cpp.
uint64_t llvm::StreamingMemoryObject::getBase | ( | ) | const [inline, override, virtual] |
getBase - Returns the lowest valid address in the region.
Implements llvm::StreamableMemoryObject.
Definition at line 109 of file StreamableMemoryObject.h.
uint64_t llvm::StreamingMemoryObject::getExtent | ( | ) | const [override, 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 94 of file StreamableMemoryObject.cpp.
const uint8_t* llvm::StreamingMemoryObject::getPointer | ( | uint64_t | address, |
uint64_t | size | ||
) | const [inline, override, virtual] |
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.
References llvm_unreachable.
bool llvm::StreamingMemoryObject::isObjectEnd | ( | uint64_t | address | ) | const [override, 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 88 of file StreamableMemoryObject.cpp.
bool llvm::StreamingMemoryObject::isValidAddress | ( | uint64_t | address | ) | const [override, 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 83 of file StreamableMemoryObject.cpp.
int llvm::StreamingMemoryObject::readByte | ( | uint64_t | address, |
uint8_t * | ptr | ||
) | const [override, 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 102 of file StreamableMemoryObject.cpp.
int llvm::StreamingMemoryObject::readBytes | ( | uint64_t | address, |
uint64_t | size, | ||
uint8_t * | buf | ||
) | const [override, 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 108 of file StreamableMemoryObject.cpp.
References llvm::LibFunc::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 123 of file StreamableMemoryObject.cpp.