def work(agi, united_lookup, eosz_nts, ild_gendir, debug): #dump lookup tables for each NT #just for debugging nt_arrays = [] for nt_name in eosz_nts: array = ild_nt.gen_nt_lookup(agi, nt_name, 'EOSZ') if not array: return None nt_arrays.append(array) ild_nt.dump_lu_arrays(agi, nt_arrays, 'ild_eosz_debug.txt', 'ild_eosz_debug_header.txt') #get all sequences of NTs that set EOSZ #we will use these sequences to create EOSZ-computing functions all_eosz_seq = get_all_eosz_seq(united_lookup) debug.write('EOSZ SEQS: %s\n' % all_eosz_seq) #for each EOSZ sequence create a lookup array nt_seq_arrays = {} for nt_seq in all_eosz_seq: array = ild_nt.gen_nt_seq_lookup(agi, nt_seq, _eosz_token) if not array: return None nt_seq_arrays[tuple(nt_seq)] = array #init function calls all single init functions for the created tables init_f = ild_nt.gen_init_function(list(nt_seq_arrays.values()), 'xed_ild_eosz_init') #dump init and lookup functions for EOSZ sequences ild_nt.dump_lu_arrays(agi, list(nt_seq_arrays.values()), _eosz_c_fn, mbuild.join('include-private', _eosz_header_fn), init_f) #generate EOSZ getter functions - they get xed_decoded_inst_t* #and return EOSZ value (corresponding to EOSZ NT sequence #that they represent) getter_fos = [] for names in nt_seq_arrays.keys(): arr = nt_seq_arrays[names] getter_fo = ild_codegen.gen_derived_operand_getter( agi, _eosz_token, arr, list(names)) getter_fos.append(getter_fo) ild_codegen.dump_flist_2_header(agi, 'xed-ild-eosz-getters.h', [ ildutil.ild_private_header, _eosz_header_fn, operand_storage.get_operand_accessors_fn() ], getter_fos) #getter_lookup = gen_getter_fn_lookup(agi, united_lookup, nt_seq_arrays) return nt_seq_arrays
def work(agi, united_lookup, easz_nts, ild_gendir, debug): #dump lookup tables for each NT #just for debugging nt_arrays = [] for nt_name in easz_nts: array = ild_nt.gen_nt_lookup(agi, nt_name, 'EASZ') if not array: return nt_arrays.append(array) ild_nt.dump_lu_arrays(agi, nt_arrays, 'ild_easz_debug.txt', 'ild_easz_debug_header.txt') all_easz_seq = get_all_easz_seq(united_lookup) debug.write('EASZ SEQS: %s\n' % all_easz_seq) nt_seq_arrays = {} for nt_seq in all_easz_seq: array = ild_nt.gen_nt_seq_lookup(agi, nt_seq, _easz_token) if not array: return nt_seq_arrays[tuple(nt_seq)] = array #init function calls all single init functions for the created tables nt_seq_values = [v for (k,v) in sorted(nt_seq_arrays.items())] init_f = ild_nt.gen_init_function(nt_seq_values, 'xed_ild_easz_init') ild_nt.dump_lu_arrays(agi, nt_seq_values, _easz_c_fn, mbuild.join('include-private', _easz_header_fn), init_f) getter_fos = [] for names in nt_seq_arrays.keys(): arr = nt_seq_arrays[names] getter_fo = ild_codegen.gen_derived_operand_getter(agi, _easz_token, arr, list(names)) getter_fos.append(getter_fo) headers = [ildutil.ild_private_header, _easz_header_fn, operand_storage.get_operand_accessors_fn()] ild_codegen.dump_flist_2_header(agi, 'xed-ild-easz-getters.h', headers, getter_fos) #getter_lookup = gen_getter_fn_lookup(agi, united_lookup, nt_seq_arrays) return nt_seq_arrays