Otawa  0.10
otawa::hard::Platform Class Reference

This class records information about the architecture where the processed program will run. More...

#include <otawa/hard/Platform.h>

Classes

class  Identification
 

Public Types

typedef elm::genstruct::Table
< const hard::RegBank * > 
banks_t
 

Public Member Functions

 Platform (const Identification &id, const PropList &props=PropList::EMPTY)
 Build a platform from the given description. More...
 
 Platform (const Platform &platform, const PropList &props=PropList::EMPTY)
 Build a platform by cloning and reconfiguring the new platform. More...
 
const Identificationidentification (void) const
 Get identification of the current platform. More...
 
virtual bool accept (const Identification &id)
 Check if the platform handle the given platform description. More...
 
bool accept (elm::CString name)
 Check if the platform accepts the given kind of architecture. More...
 
bool accept (const elm::String &name)
 Check if the platform accepts the given kind of architecture. More...
 
const banks_tbanks (void) const
 
int regCount (void) const
 Get the count of registers in the current platform. More...
 
RegisterfindReg (int uniq) const
 Find the register matching the given unique identifier. More...
 
const RegisterfindReg (const string &name) const
 Find a register by its name. More...
 
virtual const RegistergetSP (void) const
 Get the register, usually (depending on the ABI), devoted to contain the stack pointer. More...
 
virtual const RegistergetPC (void) const
 Get the register containing the Program Counter. More...
 
const CacheConfigurationcache (void) const
 Get the cache configuration. More...
 
void loadCacheConfig (const elm::system::Path &path)
 Load a cache configuration from the given path. More...
 
void loadCacheConfig (elm::xom::Element *element)
 Load a cache configuration from an XML element. More...
 
const Memorymemory (void) const
 
void loadMemory (const elm::system::Path &path) throw (otawa::LoadException)
 Load a memory configuration from the given path. More...
 
void loadMemory (elm::xom::Element *element) throw (otawa::LoadException)
 Load a memory configuration from an XML element. More...
 
void loadProcessor (const elm::system::Path &path)
 Load the processor configuration. More...
 
void loadProcessor (elm::xom::Element *element)
 Load the processor configuration from the given element. More...
 
const Processorprocessor (void) const
 Get the current processor (possibly derivated from the current configuration). More...
 
const int pipelineDepth (void) const
 Get the depth of the pipeline of the platform processor. More...
 

Static Public Attributes

static const elm::String ANY
 Represents any architecture, platform, machine. More...
 
static const elm::String POWERPC
 Represents the PowerPC architecture. More...
 
static const elm::String ELF
 Represents the ELF ABI. More...
 
static const elm::String EABI
 Represents the EABI ABI. More...
 
static const elm::String LINUX
 Represents the Linux ABI. More...
 
static const elm::String LINUX_2_4
 Represents the Linux 2.4 ABI. More...
 
static const elm::String LINUX_2_6
 Represents the Linux 2.6 ABI. More...
 
static const elm::String MAC
 Represents a Macintosh machine (seems to be too wide, must be refined). More...
 
static const elm::String SIM
 Represents a simulator machine. More...
 
static const Identification ANY_PLATFORM
 Represents any platform. More...
 

Protected Member Functions

virtual ~Platform (void)
 
void setBanks (const banks_t &banks)
 Set the list of banks for an actual platform. More...
 

Static Protected Attributes

static const banks_t null_banks
 Empty register bank table. More...
 

Private Member Functions

void configure (const PropList &props)
 

Private Attributes

unsigned long flags
 
Identification id
 
const CacheConfiguration_cache
 
Processor_processor
 
const Memory_memory
 
int depth
 
int rcnt
 
const banks_t_banks
 

Static Private Attributes

static const unsigned long HAS_PROCESSOR = 0x00000001
 
static const unsigned long HAS_CACHE = 0x00000002
 
static const unsigned long HAS_MEMORY = 0x00000004
 

Friends

class otawa::Manager
 

Detailed Description

This class records information about the architecture where the processed program will run.

Member Typedef Documentation

Constructor & Destructor Documentation

otawa::hard::Platform::Platform ( const Identification id,
const PropList props = PropList::EMPTY 
)

Build a platform from the given description.

Parameters
_idPlatform identification.
propsProperties describing the platform.

References configure().

otawa::hard::Platform::Platform ( const Platform platform,
const PropList props = PropList::EMPTY 
)

Build a platform by cloning and reconfiguring the new platform.

Parameters
platformPlatform to clone.
propsDescription properties.

References configure().

otawa::hard::Platform::~Platform ( void  )
protectedvirtual

Member Function Documentation

bool otawa::hard::Platform::accept ( const Identification _id)
virtual

Check if the platform handle the given platform description.

Parameters
_idPlatform identifier to check.
Returns
True if the platform accepts this kind of architecture.

References otawa::hard::Platform::Identification::abi(), otawa::hard::Platform::Identification::architecture(), and otawa::hard::Platform::Identification::machine().

Referenced by accept().

bool otawa::hard::Platform::accept ( elm::CString  name)
inline

Check if the platform accepts the given kind of architecture.

Parameters
nameof the acrhitecture.
Returns
True if the platform accepts the given architecture.

References accept().

bool otawa::hard::Platform::accept ( const elm::String name)
inline

Check if the platform accepts the given kind of architecture.

Parameters
nameof the acrhitecture.
Returns
True if the platform accepts the given architecture.

References accept().

const elm::genstruct::Table< const hard::RegBank * > & otawa::hard::Platform::banks ( void  ) const
inline
const CacheConfiguration & otawa::hard::Platform::cache ( void  ) const
inline
Register * otawa::hard::Platform::findReg ( int  uniq) const

Find the register matching the given unique identifier.

Parameters
uniqUnique identifier of the register.
Returns
Found register or null.

References _banks.

Referenced by otawa::se::SEReg::asString(), otawa::RegIter::item(), otawa::FlowFactLoader::onRegSet(), and otawa::clp::State::print().

const Register * otawa::hard::Platform::findReg ( const string name) const

Find a register by its name.

Parameters
nameName of the register to find.
Returns
Found register or null.

References _banks, and name.

const Register * otawa::hard::Platform::getPC ( void  ) const
virtual

Get the register containing the Program Counter.

Returns
PC register or null.
const Register * otawa::hard::Platform::getSP ( void  ) const
virtual

Get the register, usually (depending on the ABI), devoted to contain the stack pointer.

Returns
SP register or null if none is defined.

Referenced by otawa::StackAnalysis::processWorkSpace(), and otawa::clp::Analysis::processWorkSpace().

const Identification & otawa::hard::Platform::identification ( void  ) const
inline

Get identification of the current platform.

Returns
Platform identification.

References id.

void otawa::hard::Platform::loadCacheConfig ( const elm::system::Path &  path)

Load a cache configuration from the given path.

Parameters
pathPath to the cache configuration.
Exceptions
LoadExceptionThrows if there is an error.

References _cache, flags, HAS_CACHE, otawa::hard::CacheConfiguration::load(), and elm::Exception::message().

Referenced by configure().

void otawa::hard::Platform::loadCacheConfig ( elm::xom::Element element)

Load a cache configuration from an XML element.

Parameters
elementElement to read from.
Exceptions
LoadExceptionThrown if there is an error.

References _cache, flags, HAS_CACHE, otawa::hard::CacheConfiguration::load(), and elm::Exception::message().

void otawa::hard::Platform::loadMemory ( const elm::system::Path &  path)
throw (otawa::LoadException
)

Load a memory configuration from the given path.

Parameters
pathPath to the memory configuration.
Exceptions
LoadExceptionThrows if there is an error.

References _memory, flags, HAS_MEMORY, and otawa::hard::Memory::load().

Referenced by configure().

void otawa::hard::Platform::loadMemory ( elm::xom::Element element)
throw (otawa::LoadException
)

Load a memory configuration from an XML element.

Parameters
elementElement to read from.
Exceptions
LoadExceptionThrown if there is an error.

References _memory, flags, HAS_MEMORY, and otawa::hard::Memory::load().

void otawa::hard::Platform::loadProcessor ( const elm::system::Path &  path)

Load the processor configuration.

Parameters
pathPath to the file.
Exceptions
elm::io::IOExceptionIf a configuration file cannot be loaded.

References _processor, flags, HAS_PROCESSOR, and otawa::hard::Processor::load().

Referenced by configure().

void otawa::hard::Platform::loadProcessor ( elm::xom::Element element)

Load the processor configuration from the given element.

Parameters
elementElement to use.
Exceptions
LoadExceptionIf the XML element is mal-formed.

References _processor, flags, HAS_PROCESSOR, and otawa::hard::Processor::load().

const Memory& otawa::hard::Platform::memory ( void  ) const
inline
const int otawa::hard::Platform::pipelineDepth ( void  ) const
inline

Get the depth of the pipeline of the platform processor.

Returns
Pipeline depth.

References depth.

Processor * otawa::hard::Platform::processor ( void  ) const
inline

Get the current processor (possibly derivated from the current configuration).

Returns
Current processor.

References _processor.

int otawa::hard::Platform::regCount ( void  ) const
inline

Get the count of registers in the current platform.

Returns
Count of registers.

References rcnt.

Referenced by otawa::ParExeGraph::createSequenceResources().

void otawa::hard::Platform::setBanks ( const banks_t banks)
protected

Set the list of banks for an actual platform.

Parameters
banksTable of register banks.
Note
This method is only accessible from derived class implementing an actual platform.

References _banks, banks(), and rcnt.

Friends And Related Function Documentation

friend class otawa::Manager
friend

Member Data Documentation

const banks_t* otawa::hard::Platform::_banks
private

Referenced by banks(), findReg(), and setBanks().

const CacheConfiguration* otawa::hard::Platform::_cache
private
const Memory* otawa::hard::Platform::_memory
private
Processor* otawa::hard::Platform::_processor
private
const elm::String otawa::hard::Platform::ANY
static

Represents any architecture, platform, machine.

Referenced by otawa::hard::Platform::Identification::matches(), and otawa::hard::Platform::Identification::split().

const Platform::Identification otawa::hard::Platform::ANY_PLATFORM
static

Represents any platform.

int otawa::hard::Platform::depth
private

Referenced by configure(), and pipelineDepth().

const elm::String otawa::hard::Platform::EABI
static

Represents the EABI ABI.

const elm::String otawa::hard::Platform::ELF
static

Represents the ELF ABI.

unsigned long otawa::hard::Platform::flags
private
const unsigned long otawa::hard::Platform::HAS_CACHE = 0x00000002
staticprivate
const unsigned long otawa::hard::Platform::HAS_MEMORY = 0x00000004
staticprivate

Referenced by configure(), loadMemory(), and ~Platform().

const unsigned long otawa::hard::Platform::HAS_PROCESSOR = 0x00000001
staticprivate

Referenced by configure(), loadProcessor(), and ~Platform().

Identification otawa::hard::Platform::id
private

Referenced by identification().

const elm::String otawa::hard::Platform::LINUX
static

Represents the Linux ABI.

const elm::String otawa::hard::Platform::LINUX_2_4
static

Represents the Linux 2.4 ABI.

const elm::String otawa::hard::Platform::LINUX_2_6
static

Represents the Linux 2.6 ABI.

const elm::String otawa::hard::Platform::MAC
static

Represents a Macintosh machine (seems to be too wide, must be refined).

const elm::genstruct::Table< const hard::RegBank * > otawa::hard::Platform::null_banks
staticprotected

Empty register bank table.

const elm::String otawa::hard::Platform::POWERPC
static

Represents the PowerPC architecture.

int otawa::hard::Platform::rcnt
private

Referenced by regCount(), and setBanks().

const elm::String otawa::hard::Platform::SIM
static

Represents a simulator machine.


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