def main(): hex_common.read_semantics_file(sys.argv[1]) hex_common.read_attribs_file(sys.argv[2]) hex_common.read_overrides_file(sys.argv[3]) hex_common.calculate_attribs() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() with open(sys.argv[4], 'w') as f: f.write("#ifndef HEXAGON_TCG_FUNCS_H\n") f.write("#define HEXAGON_TCG_FUNCS_H\n\n") for tag in hex_common.tags: ## Skip the priv instructions if ("A_PRIV" in hex_common.attribdict[tag]): continue ## Skip the guest instructions if ("A_GUEST" in hex_common.attribdict[tag]): continue ## Skip the diag instructions if (tag == "Y6_diag"): continue if (tag == "Y6_diag0"): continue if (tag == "Y6_diag1"): continue gen_def_tcg_func(f, tag, tagregs, tagimms) f.write("#endif /* HEXAGON_TCG_FUNCS_H */\n")
def main(): hex_common.read_semantics_file(sys.argv[1]) hex_common.read_attribs_file(sys.argv[2]) hex_common.read_overrides_file(sys.argv[3]) hex_common.read_overrides_file(sys.argv[4]) hex_common.calculate_attribs() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() with open(sys.argv[5], 'w') as f: for tag in hex_common.tags: ## Skip the priv instructions if ("A_PRIV" in hex_common.attribdict[tag]): continue ## Skip the guest instructions if ("A_GUEST" in hex_common.attribdict[tag]): continue ## Skip the diag instructions if (tag == "Y6_diag"): continue if (tag == "Y6_diag0"): continue if (tag == "Y6_diag1"): continue if (hex_common.skip_qemu_helper(tag)): continue gen_helper_function(f, tag, tagregs, tagimms)
def main(): hex_common.read_semantics_file(sys.argv[1]) hex_common.read_attribs_file(sys.argv[2]) hex_common.calculate_attribs() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() with open(sys.argv[3], 'w') as f: f.write("#ifndef HEXAGON_FUNC_TABLE_H\n") f.write("#define HEXAGON_FUNC_TABLE_H\n\n") f.write("const SemanticInsn opcode_genptr[XX_LAST_OPCODE] = {\n") for tag in hex_common.tags: ## Skip the priv instructions if ("A_PRIV" in hex_common.attribdict[tag]): continue ## Skip the guest instructions if ("A_GUEST" in hex_common.attribdict[tag]): continue ## Skip the diag instructions if (tag == "Y6_diag"): continue if (tag == "Y6_diag0"): continue if (tag == "Y6_diag1"): continue f.write(" [%s] = generate_%s,\n" % (tag, tag)) f.write("};\n\n") f.write("#endif /* HEXAGON_FUNC_TABLE_H */\n")
def main(): hex_common.read_semantics_file(sys.argv[1]) hex_common.read_attribs_file(sys.argv[2]) hex_common.calculate_attribs() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() with open(sys.argv[3], 'w') as f: f.write("#ifndef DEF_SHORTCODE\n") f.write("#define DEF_SHORTCODE(TAG,SHORTCODE) /* Nothing */\n") f.write("#endif\n") for tag in hex_common.tags: ## Skip the priv instructions if ("A_PRIV" in hex_common.attribdict[tag]): continue ## Skip the guest instructions if ("A_GUEST" in hex_common.attribdict[tag]): continue ## Skip the diag instructions if (tag == "Y6_diag"): continue if (tag == "Y6_diag0"): continue if (tag == "Y6_diag1"): continue gen_shortcode(f, tag) f.write("#undef DEF_SHORTCODE\n")
def main(): hex_common.read_semantics_file(sys.argv[1]) hex_common.read_attribs_file(sys.argv[2]) tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() with open(sys.argv[3], 'w') as f: for tag in hex_common.tags: regs = tagregs[tag] rregs = [] wregs = [] regids = "" for regtype, regid, toss, numregs in regs: if hex_common.is_read(regid): if regid[0] not in regids: regids += regid[0] rregs.append(regtype + regid + numregs) if hex_common.is_written(regid): wregs.append(regtype + regid + numregs) if regid[0] not in regids: regids += regid[0] for attrib in hex_common.attribdict[tag]: if hex_common.attribinfo[attrib]['rreg']: rregs.append(strip_reg_prefix(attribinfo[attrib]['rreg'])) if hex_common.attribinfo[attrib]['wreg']: wregs.append(strip_reg_prefix(attribinfo[attrib]['wreg'])) regids += calculate_regid_letters(tag) f.write('REGINFO(%s,"%s",\t/*RD:*/\t"%s",\t/*WR:*/\t"%s")\n' % \ (tag,regids,",".join(rregs),",".join(wregs))) for tag in hex_common.tags: imms = tagimms[tag] f.write('IMMINFO(%s' % tag) if not imms: f.write(''','u',0,0,'U',0,0''') for sign, size, shamt in imms: if sign == 'r': sign = 's' if not shamt: shamt = "0" f.write(''','%s',%s,%s''' % (sign, size, shamt)) if len(imms) == 1: if sign.isupper(): myu = 'u' else: myu = 'U' f.write(''','%s',0,0''' % myu) f.write(')\n')