LLVM  3.7.0
Public Member Functions | List of all members
llvm::StreamingMemoryObject Class Reference

Interface to data which is actually streamed from a DataStreamer. More...

#include <StreamingMemoryObject.h>

Inheritance diagram for llvm::StreamingMemoryObject:
[legend]
Collaboration diagram for llvm::StreamingMemoryObject:
[legend]

Public Member Functions

 StreamingMemoryObject (std::unique_ptr< DataStreamer > Streamer)
 
uint64_t getExtent () const override
 Returns the size of the region in bytes. More...
 
uint64_t readBytes (uint8_t *Buf, uint64_t Size, uint64_t Address) const override
 Tries to read a contiguous range of bytes from the region, up to the end of the region. More...
 
const uint8_t * getPointer (uint64_t address, uint64_t size) const override
 Ensures that the requested data is in memory, and returns a pointer to it. More...
 
bool isValidAddress (uint64_t address) const override
 Returns true if the address is within the object (i.e. More...
 
bool dropLeadingBytes (size_t s)
 Drop s bytes from the front of the stream, pushing the positions of the remaining bytes down by s. More...
 
void 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). More...
 
- Public Member Functions inherited from llvm::MemoryObject
virtual ~MemoryObject ()
 

Detailed Description

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 25 of file StreamingMemoryObject.h.

Constructor & Destructor Documentation

llvm::StreamingMemoryObject::StreamingMemoryObject ( std::unique_ptr< DataStreamer Streamer)

Definition at line 126 of file StreamingMemoryObject.cpp.

Member Function Documentation

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 107 of file StreamingMemoryObject.cpp.

uint64_t llvm::StreamingMemoryObject::getExtent ( ) const
overridevirtual

Returns the size of the region in bytes.

(The region is contiguous, so the highest valid address of the region is getExtent() - 1).

Returns
- The size of the region.

Implements llvm::MemoryObject.

Definition at line 79 of file StreamingMemoryObject.cpp.

const uint8_t* llvm::StreamingMemoryObject::getPointer ( uint64_t  address,
uint64_t  size 
) const
inlineoverridevirtual

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

Parameters
address- address of the byte, in the same space as getBase()
size- amount of data that must be available on return
Returns
- valid pointer to the requested data

Implements llvm::MemoryObject.

Definition at line 31 of file StreamingMemoryObject.h.

References llvm::report_fatal_error().

bool llvm::StreamingMemoryObject::isValidAddress ( uint64_t  address) const
overridevirtual

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

Parameters
address- address of the byte, in the same space as getBase()
Returns
- true if the address may be read with readByte()

Implements llvm::MemoryObject.

Definition at line 74 of file StreamingMemoryObject.cpp.

uint64_t llvm::StreamingMemoryObject::readBytes ( uint8_t *  Buf,
uint64_t  Size,
uint64_t  Address 
) const
overridevirtual

Tries to read a contiguous range of bytes from the region, up to the end of the region.

Parameters
Buf- A pointer to a buffer to be filled in. Must be non-NULL and large enough to hold size bytes.
Size- The number of bytes to copy.
Address- The address of the first byte, in the same space as getBase().
Returns
- The number of bytes read.

Implements llvm::MemoryObject.

Definition at line 87 of file StreamingMemoryObject.cpp.

References llvm::dwarf::syntax::Address.

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 114 of file StreamingMemoryObject.cpp.

References size.


The documentation for this class was generated from the following files: