Otawa  0.10
otawa::MemArea Class Reference

Utility class representing an area in the memory defined by a base address and a size. More...

#include <otawa/base.h>

Public Member Functions

 MemArea (void)
 Build a null mem area. More...
 
 MemArea (const MemArea &a)
 
 MemArea (const Address &base, ot::size size)
 
 MemArea (const Address &base, const Address &top)
 MemArea::MemArea(const MemArea& a); Copy an existing mem area. More...
 
Address address (void) const
 Get the base address of the area. More...
 
ot::size size (void) const
 Get the size of the area. More...
 
Address topAddress (void) const
 Get the top address of the area, that is, the address of the first byte after the area. More...
 
Address lastAddress (void) const
 Get the last address of the area, that is, the address of the last byte in the area. More...
 
bool isNull (void) const
 Test if the area is null. More...
 
bool isEmpty (void) const
 Test whether the area is empty, that is, whether the size is null. More...
 
bool contains (const Address &addr) const
 Test whether the area contains the given address. More...
 
bool equals (const MemArea &a) const
 Test wether the current area and the given one are equal. More...
 
bool includes (const MemArea &a) const
 Test if the current mem area includes (not strictly) the given one. More...
 
bool meets (const MemArea &a) const
 Test if the current memory area meets at least one byte of the given one. More...
 
MemArea meet (const MemArea &a) const
 Build the intersection of both memory areas. More...
 
MemArea join (const MemArea &a) const
 Build a memory area that is the inclusive join of both memory areas. More...
 
void set (const MemArea &a)
 
void move (const Address &base)
 
void moveTop (const Address &top)
 
void resize (const ot::size size)
 
 operator bool (void) const
 
bool operator== (const MemArea &a) const
 
bool operator!= (const MemArea &a) const
 
bool operator>= (const MemArea &a) const
 
bool operator> (const MemArea &a) const
 
bool operator< (const MemArea &a) const
 
bool operator<= (const MemArea &a) const
 
MemArea operator& (const MemArea &a) const
 
MemArea operator+ (const MemArea &a) const
 
MemArea operator= (const MemArea &a)
 
void operator&= (const MemArea &a)
 
void operator+= (const MemArea &a)
 

Static Public Attributes

static MemArea null
 Null memory area. More...
 

Private Attributes

Address _base
 
ot::size _size
 

Detailed Description

Utility class representing an area in the memory defined by a base address and a size.

Constructor & Destructor Documentation

otawa::MemArea::MemArea ( void  )
inline

Build a null mem area.

Referenced by join(), and meet().

otawa::MemArea::MemArea ( const MemArea a)
inline
otawa::MemArea::MemArea ( const Address base,
ot::size  size 
)
inline
otawa::MemArea::MemArea ( const Address base,
const Address top 
)
inline

MemArea::MemArea(const MemArea& a); Copy an existing mem area.

Parameters
aArea to copy. MemArea::MemArea(const Address& base, ot::size size); Build a memory area.
baseBase address of the area.
sizeSize of the area (in bytes).

Build a memory area.

Parameters
baseBase address of the area.
topTop address, that is, address of the first byte past the area.

Member Function Documentation

bool otawa::MemArea::contains ( const Address addr) const
inline

Test whether the area contains the given address.

Parameters
addrAddress to test.
Returns
True if the address is in the area, false else.
bool otawa::MemArea::equals ( const MemArea a) const
inline

Test wether the current area and the given one are equal.

Parameters
aArea to test equality for.
Returns
True if both areas are equal, false else.

References _base, and _size.

bool otawa::MemArea::includes ( const MemArea a) const

Test if the current mem area includes (not strictly) the given one.

Parameters
aMemory area tested for inclusion.
Returns
True if the current memory area contains the a memory area.

References address(), and lastAddress().

Referenced by operator<(), and operator<=().

bool otawa::MemArea::isEmpty ( void  ) const
inline

Test whether the area is empty, that is, whether the size is null.

Returns
True if the size is null, false else.
MemArea otawa::MemArea::join ( const MemArea a) const

Build a memory area that is the inclusive join of both memory areas.

Parameters
aMemory area to join with.
Returns
Result of inclusive join.

References address(), lastAddress(), otawa::clp::max(), MemArea(), and otawa::clp::min().

Referenced by otawa::FlowFactLoader::addressOf(), and otawa::FlowFactLoader::scanMemAccess().

Address otawa::MemArea::lastAddress ( void  ) const
inline
MemArea otawa::MemArea::meet ( const MemArea a) const

Build the intersection of both memory areas.

Parameters
aMemory area to meet with.
Returns
Result of meet.

References address(), lastAddress(), otawa::clp::max(), MemArea(), otawa::clp::min(), and null.

bool otawa::MemArea::meets ( const MemArea a) const

Test if the current memory area meets at least one byte of the given one.

Parameters
aMemory area to test.
Returns
True if there is, at least, one byte in common between both memory areas.

References address(), and lastAddress().

void otawa::MemArea::move ( const Address base)
inline
void otawa::MemArea::moveTop ( const Address top)
inline
otawa::MemArea::operator bool ( void  ) const
inline
bool otawa::MemArea::operator!= ( const MemArea a) const
inline
MemArea otawa::MemArea::operator& ( const MemArea a) const
inline
void otawa::MemArea::operator&= ( const MemArea a)
inline
MemArea otawa::MemArea::operator+ ( const MemArea a) const
inline
void otawa::MemArea::operator+= ( const MemArea a)
inline
bool otawa::MemArea::operator< ( const MemArea a) const
inline

References includes().

bool otawa::MemArea::operator<= ( const MemArea a) const
inline

References includes().

MemArea otawa::MemArea::operator= ( const MemArea a)
inline
bool otawa::MemArea::operator== ( const MemArea a) const
inline
bool otawa::MemArea::operator> ( const MemArea a) const
inline
bool otawa::MemArea::operator>= ( const MemArea a) const
inline
void otawa::MemArea::resize ( const ot::size  size)
inline
void otawa::MemArea::set ( const MemArea a)
inline

References _base, and _size.

ot::size otawa::MemArea::size ( void  ) const
inline

Get the size of the area.

Returns
Area size (in bytes).
Address otawa::MemArea::topAddress ( void  ) const
inline

Get the top address of the area, that is, the address of the first byte after the area.

Returns
Area top address.

Referenced by otawa::operator<<(), and otawa::FlowFactLoader::scanMemAccess().

Member Data Documentation

Address otawa::MemArea::_base
private

Referenced by equals(), and set().

ot::size otawa::MemArea::_size
private

Referenced by equals(), and set().

MemArea otawa::MemArea::null
static

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