GPUOcelot
Public Types | Public Member Functions | Friends

ir::Module Class Reference

#include <Module.h>

List of all members.

Public Types

typedef std::map< std::string,
Texture
TextureMap
 Map from texture variable names to objects.
typedef std::vector< PTXStatementStatementVector
 Typedef for a vector of PTXStatements.
typedef std::unordered_map
< std::string, PTXKernel * > 
KernelMap
typedef std::vector< PTXKernel * > KernelVector
typedef std::unordered_map
< std::string, Global
GlobalMap
 Map from unique identifier to global variable.
typedef std::unordered_map
< std::string,
ir::PTXKernel::Prototype
FunctionPrototypeMap
 map from unique identifier to function prototype

Public Member Functions

 Module (const std::string &path, bool dontLoad=false)
 Module (std::istream &source, const std::string &path="::unknown path::")
 Module (const std::string &, const StatementVector &)
 Module ()
 ~Module ()
void write (std::ostream &stream) const
void writeIR (std::ostream &stream) const
 Write the module to an assembly file from the IR.
void unload ()
bool load (const std::string &path)
bool load (std::istream &source, const std::string &path="::unknown path::")
bool lazyLoad (std::string &source, const std::string &path="::unknown path::")
bool lazyLoad (const char *source, const std::string &path="::unknown path::")
void loadNow ()
 Load the module if it has not already been loaded.
bool loaded () const
 Is the module loaded?
PTXKernelgetKernel (const std::string &name)
 Gets a kernel instance by name.
void removeKernel (const std::string &name)
 Removes an existing kernel by name.
PTXKernelinsertKernel (PTXKernel *kernel)
 Adds a new kernel.
TexturegetTexture (const std::string &name)
 Gets a texture instance by name.
TextureinsertTexture (const Texture &texture)
 Insert a texture into the module.
GlobalgetGlobal (const std::string &name)
 Gets a global instance by name.
GlobalinsertGlobal (const Global &global)
 Insert a global into the module.
const std::string & path () const
 Gets the module path.
const KernelMapkernels () const
 Gets the kernel map.
const GlobalMapglobals () const
 Gets the global map.
const TextureMaptextures () const
 Gets the texture map.
const StatementVectorstatements () const
 Gets the statement vector.
const FunctionPrototypeMapprototypes () const
 gets all declared function prototypes
unsigned int addressSize () const
 get the address size
void addPrototype (const std::string &identifier, const ir::PTXKernel::Prototype &prototype)

Friends

class executive::Executive

Member Typedef Documentation

typedef std::unordered_map< std::string, ir::PTXKernel::Prototype > ir::Module::FunctionPrototypeMap

map from unique identifier to function prototype

typedef std::unordered_map< std::string, Global > ir::Module::GlobalMap

Map from unique identifier to global variable.

typedef std::unordered_map< std::string, PTXKernel* > ir::Module::KernelMap
typedef std::vector< PTXKernel* > ir::Module::KernelVector
typedef std::vector< PTXStatement > ir::Module::StatementVector

Typedef for a vector of PTXStatements.

typedef std::map< std::string, Texture > ir::Module::TextureMap

Map from texture variable names to objects.


Constructor & Destructor Documentation

ir::Module::Module ( const std::string &  path,
bool  dontLoad = false 
)

Given a path to a PTX source file, construct the Module, load and parse the PTX file, and extract kernels into Kernel objects

ir::Module::Module ( std::istream &  source,
const std::string &  path = "::unknown path::" 
)

Given a stream constaining a PTX file, parse the PTX file, and extract kernels into Kernel objects

ir::Module::Module ( const std::string &  name,
const StatementVector statements 
)

Construct a Module from a name and a vector of PTXStatements

ir::Module::Module ( )

Construct an empty module

ir::Module::~Module ( )

Deconstruct a module


Member Function Documentation

void ir::Module::addPrototype ( const std::string &  identifier,
const ir::PTXKernel::Prototype prototype 
)
unsigned int ir::Module::addressSize ( ) const

get the address size

ir::Global * ir::Module::getGlobal ( const std::string &  name)

Gets a global instance by name.

Parameters:
name[mangled] name of global
Returns:
pointer to global instance with (name) or 0 if it does not exist
ir::PTXKernel * ir::Module::getKernel ( const std::string &  name)

Gets a kernel instance by name.

Parameters:
name[mangled] name of kernel
Returns:
pointer to kernel instance with (name) or 0 if kernel does not exist
ir::Texture * ir::Module::getTexture ( const std::string &  name)

Gets a texture instance by name.

Parameters:
name[mangled] name of texture
Returns:
pointer to texture instance with (name) or 0 if it does not exist
const ir::Module::GlobalMap & ir::Module::globals ( ) const

Gets the global map.

ir::Global * ir::Module::insertGlobal ( const Global global)

Insert a global into the module.

Parameters:
globalthe global being inserted, it will be owned by the module.
Returns:
pointer to global instance being inserted
ir::PTXKernel * ir::Module::insertKernel ( PTXKernel kernel)

Adds a new kernel.

Parameters:
kernelThe kernel being inserted, it will be owned by the module.
Returns:
A pointer to the newly inserted kernel.
ir::Texture * ir::Module::insertTexture ( const Texture texture)

Insert a texture into the module.

Parameters:
texturethe texture being inserted, it will be owned by the module.
Returns:
pointer to texture instance being inserted
const ir::Module::KernelMap & ir::Module::kernels ( ) const

Gets the kernel map.

bool ir::Module::lazyLoad ( std::string &  source,
const std::string &  path = "::unknown path::" 
)

Unloads module and loads PTX source string via a destructive copy

bool ir::Module::lazyLoad ( const char *  source,
const std::string &  path = "::unknown path::" 
)

Unloads module and loads PTX source, this pointer must be valid until the module is loaded

bool ir::Module::load ( std::istream &  stream,
const std::string &  path = "::unknown path::" 
)

Unloads module and loads PTX source file in given stream

Unloads module and loads everything in path

bool ir::Module::load ( const std::string &  path)

Unloads module and loads PTX source file in given path

Unloads module and loads everything in path

bool ir::Module::loaded ( ) const

Is the module loaded?

void ir::Module::loadNow ( )

Load the module if it has not already been loaded.

const std::string & ir::Module::path ( ) const

Gets the module path.

const ir::Module::FunctionPrototypeMap & ir::Module::prototypes ( ) const

gets all declared function prototypes

void ir::Module::removeKernel ( const std::string &  name)

Removes an existing kernel by name.

Parameters:
name[mangled] name of kernel
const ir::Module::StatementVector & ir::Module::statements ( ) const

Gets the statement vector.

const ir::Module::TextureMap & ir::Module::textures ( ) const

Gets the texture map.

void ir::Module::unload ( )

Deletes everything associated with this particular module

void ir::Module::write ( std::ostream &  stream) const

Write the module to an assembly file using statements

void ir::Module::writeIR ( std::ostream &  stream) const

Write the module to an assembly file from the IR.


Friends And Related Function Documentation

friend class executive::Executive [friend]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines