def copy_module(module, temper=None): raise NotImplementedError("not finished, needs to insert all functions" "in valuemap first") new_module = Module(temper=temper) valuemap = {} ### Copy Globals for name, gv in module.globals.iteritems(): name = new_module.temp(name) new_global = GlobalValue(name, gv.type, gv.external, gv.address, gv.value) new_module.add_global(new_global) valuemap[gv] = new_global ### Copy Functions for name, func in module.functions.iteritems(): new_func, _ = copy_function(func, module=new_module) new_func.name = new_module.temp(name) new_module.add_function(new_func) valuemap[func] = new_func return new_module