memory_allocators_instances.cc

Go to the documentation of this file.
00001 /*!
00002         \file
00003         \brief Implementation of memory allocators for i686 architecture.
00004         \author jaz
00005 */
00006 
00007 #include <lestes/md/mem/memory_allocators.g.hh>
00008 #include <lestes/lang/cplus/sem/ss_declaration.g.hh>
00009 #include <lestes/lang/cplus/sem/visitor.v.g.hh>
00010 #include <lestes/backend_v2/intercode/pi.g.hh>
00011 
00012 package(lestes);
00013 package(md);
00014 package(mem);
00015 
00016 using ::lestes::backend_v2::intercode::pi_abstract_function_call;
00017 using ::lestes::backend_v2::intercode::pi_mem_decl;
00018 using ::lestes::lang::cplus::sem::ss_function_declaration;
00019 
00020 
00021 ptr< local_variable_allocator > local_variable_allocator::instance(ptr<ss_function_declaration> function)
00022 {
00023         map< srp< ss_function_declaration >, srp< local_variable_allocator > >::iterator it;
00024         it = singleton_instances_get()->find(function);
00025         
00026         if ( it!=singleton_instances_get()->end() ) {
00027                 return it->second;
00028         } else {
00029                 ptr< local_variable_allocator > new_instance = local_variable_allocator::create(function);
00030                 singleton_instances_get()->insert(::std::pair<srp< ss_function_declaration >, srp< local_variable_allocator> >(function,new_instance));
00031                 return new_instance;
00032         }
00033         
00034         return NULL;    
00035 }
00036 
00037 ptr< global_variable_allocator > global_variable_allocator::instance() {
00038         if ( !singleton_instance ) {
00039                 //A singleton instance has not been created yet. Create it!
00040                 singleton_instance = global_variable_allocator::create();
00041         }
00042         //Return instance
00043         return singleton_instance;
00044 }
00045 
00046 end_package(mem);
00047 end_package(md);
00048 end_package(lestes);
00049 

Generated on Mon Feb 12 18:22:41 2007 for lestes by doxygen 1.5.1-20070107