def work(args): # main function gen_setup.msge("READING XED DB") xeddb = gen_setup.read_db(args) histo = collections.defaultdict(int) for r in xeddb.recs: if hasattr(r,'operands'): s = re.sub(r'[ ]+',' ',r.operands) if 0: histo[s] = histo[s] + 1 if 1: for t in s.split(): if t.startswith('REG'): t = 'REG' + t[4:] if t.startswith('MEM'): t = 'MEM' + t[4:] histo[t] = histo[t] + 1 for k,v in sorted( list(histo.items()), key=lambda t: t[1] ): print("{0:4d} {1}".format(v,k)) print("TOTAL: ", len(histo)) return 0
def work(args): # main function msge("READING XED DB") xeddb = gen_setup.read_db(args) xeddb.recs.sort(key=lambda x: x.iclass) for r in xeddb.recs: for fld in sorted(r.__dict__.keys()): print("{}: {}".format(fld, getattr(r, fld))) print("EOSZ_LIST: {}".format(r.get_eosz_list())) print("\n\n") return 0
def work(args): # main function msgb("READING XED DB") xeddb = gen_setup.read_db(args) xeddb.recs.sort(key=lambda x: x.iclass) for r in xeddb.recs: if r.space in ['vex', 'evex']: print("{}: {}/{}: {}".format(r.iclass, r.space, r.vl, " ".join(r.cpuid))) else: print("{}: {}: {}".format(r.iclass, r.space, " ".join(r.cpuid))) return 0
def work(args): # main function msgb("READING XED DB") (chips, chip_db) = chipmodel.read_database(args.chip_filename) xeddb = gen_setup.read_db(args) (insts, undoc) = check(args.chip, xeddb, chip_db) ilist = list(set([x.iclass for x in insts])) ilist.sort() ulist = list(set([x.iclass for x in undoc])) ulist.sort() if args.otherchip: (insts2, undoc2) = check(args.otherchip, xeddb, chip_db) ilist2 = list(set([x.iclass for x in insts2])) ulist2 = list(set([x.iclass for x in undoc2])) s1 = set(ilist + ulist) s2 = set(ilist2 + ulist2) d12 = list(s1 - s2) d21 = list(s2 - s1) d12.sort() d21.sort() both = list(s1 & s2) both.sort() for i in d12: print("{:20s} IN: {} NOT IN: {}".format(i, args.chip, args.otherchip)) for i in d21: print("{:20s} IN: {} NOT IN: {}".format(i, args.otherchip, args.chip)) for i in both: print("{:20s} BOTH IN: {} IN: {}".format(i, args.chip, args.otherchip)) else: insts.sort(key=lambda x: (x.space, x.iclass, x.isa_set, x.vl)) undoc.sort(key=lambda x: (x.space, x.iclass, x.isa_set, x.vl)) print_header() for i in insts: public = 'PUBLIC' if hasattr(i, 'real_opcode') and i.real_opcode == 'N': public = 'PRIVATE' print_rec(i, public) for i in undoc: print_rec(i, "UNDOC") return 0
def work(args): # main function msgb("READING XED DB") xeddb = gen_setup.read_db(args) chips, chipdb = gen_setup.read_chips(args) xeddb.recs.sort(key=lambda x: x.iclass) for chip in chips: cpuids = set() for r in xeddb.recs: if r.isa_set in chipdb[chip]: for cpuid in r.cpuid: if cpuid != 'N/A': cpuids.add(cpuid) print("CHIP {}".format(chip)) print("\t{}".format(" ".join(cpuids))) return 0
def work(args): # main function msgb("READING XED DB") xeddb = gen_setup.read_db(args) d = {} for r in xeddb.recs: if hasattr(r, 'flags'): if hasattr(r, 'isa_set'): isa_set = r.isa_set else: isa_set = r.extension s = "{:<20} {:<20} {}".format(r.iclass, isa_set, r.flags) d[s] = True k = d.keys() k.sort() for a in k: msg(a) return 0
def work(args): # main function gen_setup.msge("READING XED DB") (chips, chip_db) = chipmodel.read_database(args.chip_filename) xeddb = gen_setup.read_db(args) # base chip instr bi = chip_list(args.basechip, xeddb, chip_db) # newer chip instr ni = chip_list(args.newchip, xeddb, chip_db) missing_new = [] for b in bi: found = False for n in ni: if b.iclass == n.iclass: found = True break if not found: missing_new.append(b) missing_old = [] for n in ni: found = False for b in bi: if n.iclass == b.iclass: found = True break if not found: missing_old.append(n) missing_old.sort(key=lambda x: x.iclass) missing_new.sort(key=lambda x: x.iclass) for i in missing_old: print("+{} {} {} {}".format(i.iclass, i.isa_set, i.space, i.vl)) for i in missing_new: print("-{} {} {} {}".format(i.iclass, i.isa_set, i.space, i.vl)) return 0
def work(args): # main function msgb("READING XED DB") (chips, chip_db) = chipmodel.read_database(args.chip_filename) xeddb = gen_setup.read_db(args) isasets = set() for r in xeddb.recs: isasets.add(r.isa_set) classes = {} for i in isasets: c = 'general' if 'XOP' in i: c = 'xop' elif 'SSE' in i: c = 'sse' elif 'AVX512' in i: c = 'avx512' elif 'ICL' in i: c = 'avx512' elif 'AVX' in i: c = 'avx' elif 'FMA' in i: c = 'avx' elif 'F16C' in i: c = 'avx' elif 'MMX' in i: c = 'mmx' classes[i] = c chip_icount_histo_tup = [] for c in chips: r = check(c, xeddb, chip_db, classes) chip_icount_histo_tup.append(r) groups = ['general', 'mmx', 'sse', 'avx', 'avx512'] for inst in xeddb.recs: if classes[inst.isa_set] == 'general' and inst.scalar: print("GPR SCALAR", inst.iclass) tlist = [] for s in chip_icount_histo_tup: t = [] (chip, icount, histo) = s t.append("{0:20s} {1:4d}".format(chip, icount)) for scalar in ['.sc', '']: for x in groups: k = x + scalar t.append("{0:7s}:{1:4d}".format(k, histo[k])) tlist.append((icount, " ".join(t))) def keyfn(x): return x[0] tlist.sort(key=keyfn) for x, y in tlist: print(y) return 0