for fname in os.listdir(insns_dir):
if not fname.endswith(".h"):
continue
- res.append(os.path.join(insns_dir, fname))
+ insn = fname[:-2]
+ res.append((os.path.join(insns_dir, fname), insn))
return res
patterns = ['WRITE_RD', 'RS1', 'RS2', 'RS3',
# botch-job/hack: RS1 also matches against FRS1 (etc.)
# check letter before match: if "F", skip it.
continue
- res.append('REG_%s' % pattern)
+ p = pattern
+ if p.startswith('WRITE_'):
+ p = p[6:]
+ res.append('REG_%s' % p)
+ if len(res) == 0:
+ return "0"
return ' | '.join(res)
if __name__ == '__main__':
+ template = "#define REGS_%-12s %s"
files = list_insns()
- for fname in files:
- print fname, find_registers(fname)
+ for (fname, insn) in files:
+ print template % (insn, find_registers(fname))