18 lines
692 B
Python
18 lines
692 B
Python
import logging
|
|
|
|
def get_register_allocator(config):
|
|
"""
|
|
Function that dynamically loads the requested register allocation module and returns its main function,
|
|
to be used to perform it.
|
|
"""
|
|
logging.debug('[RegisterAllocation] from {}.{} import {}'.format(config.module_location, config.module_name, config.allocation_function_name))
|
|
|
|
# set absolute module name
|
|
module_name = '{}.{}'.format(config.module_location, config.module_name)
|
|
|
|
# import the corresponding module
|
|
module = __import__(module_name, fromlist=[config.allocation_function_name])
|
|
|
|
# return requested function
|
|
return getattr(module, config.allocation_function_name)
|