with open(regsname, "w") as f:
txt = find_registers(fname)
txt += "\n#define INSN_%s\n" % insn.upper()
+ # help identify type of register
+ if insn in ['beq', 'bne', 'blt', 'bltu', 'bge', 'bgeu']:
+ txt += "#define INSN_TYPE_BRANCH\n"
+ elif insn in ['c_ld', 'c_bnez']:
+ txt += "\n#define INSN_TYPE_C_BRANCH\n"
+ elif insn in ['c_lwsp', 'c_ldsp', 'c_lqsp', 'c_flwsp', 'c_fldsp']:
+ txt += "\n#define INSN_TYPE_C_STACK_LD\n"
+ elif insn in ['c_swsp', 'c_sdsp', 'c_sqsp', 'c_fswsp', 'c_fsdsp']:
+ txt += "\n#define INSN_TYPE_C_STACK_ST\n"
+ elif insn in ['c_lw', 'c_ld', 'c_lq', 'c_flw', 'c_fld']:
+ txt += "\n#define INSN_TYPE_C_LD\n"
+ elif insn in ['c_sw', 'c_sd', 'c_sq', 'c_fsw', 'c_fsd']:
+ txt += "\n#define INSN_TYPE_C_ST\n"
+ elif insn in ['c_beqz', 'c_bnez']:
+ txt += "\n#define INSN_TYPE_C_BRANCH\n"
+ elif insn.startswith("c_"):
+ txt += "#define INSN_TYPE_C\n"
+ elif insn.startswith("fmv") or \
+ insn.startswith("fcvt") or \
+ insn.startswith("fsgn"):
+ txt += "#define INSN_TYPE_FP_DUALOP\n"
+ elif insn.startswith("feq") or \
+ insn.startswith("flt") or \
+ insn.startswith("fle"):
+ txt += "#define INSN_TYPE_FP_BRANCH\n"
f.write(txt)