protected internal override int GetCondCode(MCInst i) { if (i.p == null || i.p.Length < 2 || i.p[1].t != Opcode.vl_cc) { return(Opcode.cc_always); } return((int)i.p[1].v); }
protected internal override bool IsCall(MCInst i) { if (i.p != null && i.p.Length > 0 && i.p[0].t == Opcode.vl_str && (i.p[0].v == x86_call_rel32)) { return(true); } return(false); }
protected internal override bool IsBranch(MCInst i) { if (i.p != null && i.p.Length > 0 && i.p[0].t == Opcode.vl_str && (i.p[0].v == x86_jmp_rel32 || i.p[0].v == x86_jcc_rel32)) { return(true); } return(false); }
protected internal override int GetBranchDest(MCInst i) { if (!IsBranch(i)) { throw new NotSupportedException(); } if (i.p[0].v == x86_jcc_rel32) { return((int)i.p[2].v); } else { return((int)i.p[1].v); } }
protected internal override string MCInstToDebug(MCInst i) { StringBuilder sb = new StringBuilder(); if (insts.TryGetValue((int)i.p[0].v, out string str)) { sb.Append(str); } else { sb.Append("<unknown>"); } return(sb.ToString()); }
protected internal override MCInst RestoreRegister(Reg r) { MCInst ret = new MCInst { p = new Param[] { new Param { t = Opcode.vl_str, str = "pop", v = x86_pop_r32 }, new Param { t = Opcode.vl_mreg, mreg = r } } }; return(ret); }
static MCInst inst(CilNode.IRNode parent, int inst, Param Rn = null, Param Rd = null, Param Rm = null, Param Rt = null, int imm = 0, int W = 0, int S = 0, Param[] register_list = null, string str_target = null, bool is_tls = false) { string str = null; insts.TryGetValue(inst, out str); MCInst ret = new MCInst { parent = parent, p = new Param[] { new Param { t = ir.Opcode.vl_str, v = inst, str = str, v2 = is_tls ? 1 : 0 }, Rn, Rd, Rm, Rt, imm, W, S, RegListToInt(register_list), str_target } }; return(ret); }
protected internal override void SetBranchDest(MCInst i, int d) { if (!IsBranch(i)) { throw new NotSupportedException(); } if (i.p[0].v == x86_jcc_rel32) { i.p[2] = new Param { t = Opcode.vl_br_target, v = d } } ; else { i.p[1] = new Param { t = Opcode.vl_br_target, v = d } }; }
protected internal override int GetCondCode(MCInst i) { throw new NotImplementedException(); }
private int Rm(MCInst i) { return(i.p[3].mreg.id); }
private int W(MCInst i) { return((int)i.p[6].v); }
private int Rt(MCInst i) { return(i.p[4].mreg.id); }
protected internal override Reg GetMoveSrc(MCInst i) { return(i.p[2].mreg); }
private int Imm(MCInst i) { return((int)i.p[5].v); }
protected internal override Reg GetMoveDest(MCInst i) { throw new NotImplementedException(); }
protected internal override Reg GetMoveDest(MCInst i) { return(i.p[1].mreg); }
private int Rd(MCInst i) { return(i.p[2].mreg.id); }
private int Rlist(MCInst i) { return((int)i.p[8].v); }
protected internal override void SetBranchDest(MCInst i, int d) { throw new NotImplementedException(); }
protected internal override int GetBranchDest(MCInst i) { throw new NotImplementedException(); }
private string Str(MCInst i) { return(i.p[9]?.str); }
protected internal override bool IsBranch(MCInst i) { throw new NotImplementedException(); }
private int Rn(MCInst i) { return(i.p[1].mreg.id); }