Esempio n. 1
0
def work(args):  # main function
    gen_setup.msge("READING XED DB")

    xeddb = read_xed_db.xed_reader_t(args.state_bits_filename,
                                     args.instructions_filename,
                                     args.widths_filename,
                                     args.element_types_filename)

    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
    gen_setup.msge("READING XED DB")
    (chips, chip_db) = chipmodel.read_database(args.chip_filename)

    xeddb = read_xed_db.xed_reader_t(args.state_bits_filename,
                                     args.instructions_filename,
                                     args.widths_filename,
                                     args.element_types_filename)

    # 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