Class Hierarchy Compound List File List Header Files Compound Members File Members
Module Class Reference
Defines the interface of a module, the basis of IR nodes or passes.
More...
#include <suifkernel/module.h>
Class diagram for Module:
List of all members.Public Members
- Module (SuifEnv* suif_env, const LString& moduleName = emptyLString )
- virtual ~Module ()
- virtual LString get_module_name () const
- Retrieves the name of a module. More...
- virtual Module* clone () const = 0
- generates a new copy of the current instance if necessary The implementor of a subclass is responsible for overriding this method if the implementation has a unique state the default implementation returns the current instance.
- virtual bool delete_me () const
- tells the system whether an instance of this Module should be deleted after it has been executed the default implementation returns false.
- virtual bool is_initialized () const
- returns true if the method initalize() was already executed on this instance.
- virtual void initialize ()
- initializes the modules. More...
- virtual bool parse_command_line ( TokenStream* command_line_stream )
- parses the input for this Module.
- virtual void execute ()
- executes the Module parse_command_line should be called before this method is invoked.
- virtual SuifEnv* get_suif_env () const
- virtual bool supports_interface ( const LString &interface_name ) const
- Interface required for the SUIF interface support mechanism. More...
- virtual Address get_interface ( const LString &interface_name ) const
- virtual void interface_registered (const LString &producer_module_name, const LString &interface_name)
- These are callbacks that the module system will give when a new module registers its support for an interface.
- virtual void interface_object_created (Module *producer_module, const LString &interface_name)
- virtual void interface_object_destructed (Module *producer_module, const LString &interface_name)
- void import_module (const char* module_name)
Protected Members
Detailed Description
Defines the interface of a module, the basis of IR nodes or passes.
-
From Loading A DLL to executing a module:
-
When a new DLL is loaded,
- 1) init_DLL(SuifEnv) is called. This should build a class for each module in the DLL. Each of these modules is placed into the ModuleSubSystem by name. During ModuleSubSystem::register_module() the Module::initialize() method will be called. Command line parsing should be built here.
- 2) When a pass is to be execute (because the execute Module wants to invoke it) The prototype module is retrieved by name (the string returned by Module::get_class_name()). from the module sub system. The prototype is then cloned (with Module::clone()). The clone is then initialized (with Module::initialize()) if its is_initialize() returns false. Then the clone's parse_command_line() method is called. Finally, the Module::execute() method is invoked.
- 3) The ModuleSubSystem also has a execute() which
- a) invokes parse_command_line_and_clone() which builds a returns a clone() of the Module invokes Module::parse_command_line on TokenStream command_line
- b) invokes module::execute() then deletes the module if delete_me()
Member Function Documentation
Module::Module (SuifEnv * suif_env, const LString & moduleName = emptyLString)
virtual Module::~Module () [virtual]
virtual LString Module::get_module_name () const [virtual]
Retrieves the name of a module.
This name must be unique for every kind of Module. (it may be called before calling the initialize method)
virtual Module * Module::clone (void) const [pure virtual]
generates a new copy of the current instance if necessary The implementor of a subclass is responsible for overriding this method if the implementation has a unique state the default implementation returns the current instance.
Reimplemented in XLoadModule, walker_pass, walker_based_module, UnownedPass, TypeCheckerPass, TypeBuilderModule, TimeModule, SuifPrinterModule, SuifModule, SuifClonerModule, StructPaddingPass, SimpleModule, SaveModule, S2CPass, RepeatValueBlockBuilderPass, RemoveTrashPass, RemoveIfAndLoopPass, PrintModule, PipelinerDispatchPass, Pipeliner, PipelinablePass, Pass, PaddingPass, One2MultiArrayExpressionPass, NonConstBoundDismantlerPass, NameAllSymbolsPass, MultiDimArrayDismantlerPass, iterator_pass, InlinePass, ImportModule, FlattenStatementListsPass, FieldBuilderPass, Driver, CreateSuifComplexInputPass, CountCallsWithWalkerPass, CountCallsWithIteratorPass, convertsuif2bto1_pass, convertsuif1to2b, CombinedPass, CFor2ForPass, CfeModule, CallExpressionDismantlerPass, BasicModule, AvoidLabelCollisions, AvoidFileScopeCollisions, AvoidExternCollisions and AddProcedureEndLabelsPass.
virtual bool Module::delete_me (void) const [virtual]
tells the system whether an instance of this Module should be deleted after it has been executed the default implementation returns false.
Reimplemented in TimeModule, SimpleModule, S2CPass and Driver.
virtual bool Module::is_initialized () const [virtual]
returns true if the method initalize() was already executed on this instance.
virtual void Module::initialize () [virtual]
initializes the modules.
This method must/will be called before a call to parse_command_line or execute
Reimplemented in XLoadModule, walker_based_module, TypeBuilderModule, SuifPrinterModule, SuifModule, SuifClonerModule, SaveModule, S2CPass, RepeatValueBlockBuilderPass, PrintModule, PaddingPass, ImportModule, Driver, convertsuif2bto1_pass, convertsuif1to2b, CFor2ForPass, CfeModule and BasicModule.
virtual bool Module::parse_command_line (TokenStream * command_line_stream) [virtual]
virtual void Module::execute (void) [virtual]
executes the Module parse_command_line should be called before this method is invoked.
Reimplemented in XLoadModule, TimeModule, SuifPrinterModule, SimpleModule, SaveModule, PrintModule, PipelinerDispatchPass, Pipeliner, PipelinablePass, Pass, ImportModule, FrontendPass and Driver.
virtual SuifEnv * Module::get_suif_env () const [virtual]
virtual bool Module::supports_interface (const LString & interface_name) const [virtual]
Interface required for the SUIF interface support mechanism.
This can return pointers to anything. Frequently it will be a pointer to a function to call
virtual Address Module::get_interface (const LString & interface_name) const [virtual]
virtual void Module::interface_registered (const LString & producer_module_name, const LString & interface_name) [virtual]
These are callbacks that the module system will give when a new module registers its support for an interface.
virtual void Module::interface_object_created (Module * producer_module, const LString & interface_name) [virtual]
virtual void Module::interface_object_destructed (Module * producer_module, const LString & interface_name) [virtual]
void Module::import_module (const char * module_name)
virtual void Module::set_interface (const LString & interface_name, Address interface) [protected, virtual]
Member Data Documentation
SuifEnv* Module::_suif_env [protected]
LString Module::_module_name [protected]
OptionLiteral* Module::_command_name [protected]
OptionList* Module::_command_line [protected]
suif_hash_map<LString, Address>* Module::_interfaces [protected]
The documentation for this class was generated from the following file:
Generated at Mon Nov 22 19:43:33 1999 for NCI SUIF by
written by Dimitri van Heesch, © 1997-1999