summaryrefslogtreecommitdiff
path: root/PCodeInfo.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--PCodeInfo.h462
1 files changed, 462 insertions, 0 deletions
diff --git a/PCodeInfo.h b/PCodeInfo.h
new file mode 100644
index 0000000..9e3b048
--- /dev/null
+++ b/PCodeInfo.h
@@ -0,0 +1,462 @@
+#pragma once
+
+#include "PCode.h"
+
+typedef struct _OpcodeInfo {
+ const char *name;
+ const char *format;
+ unsigned char x8;
+ unsigned char x9;
+ int xA;
+ unsigned int insn;
+} OpcodeInfo;
+
+enum {
+ PC_B = 0x0,
+ PC_BL = 0x1,
+ PC_BC = 0x2,
+ PC_BCLR = 0x3,
+ PC_BCCTR = 0x4,
+ PC_BT = 0x5,
+ PC_BTLR = 0x6,
+ PC_BTCTR = 0x7,
+ PC_BF = 0x8,
+ PC_BFLR = 0x9,
+ PC_BFCTR = 0xA,
+ PC_BDNZ = 0xB,
+ PC_BDNZT = 0xC,
+ PC_BDNZF = 0xD,
+ PC_BDZ = 0xE,
+ PC_BDZT = 0xF,
+ PC_BDZF = 0x10,
+ PC_BLR = 0x11,
+ PC_BCTR = 0x12,
+ PC_BCTRL = 0x13,
+ PC_BLRL = 0x14,
+ PC_LBZ = 0x15,
+ PC_LBZU = 0x16,
+ PC_LBZX = 0x17,
+ PC_LBZUX = 0x18,
+ PC_LHZ = 0x19,
+ PC_LHZU = 0x1A,
+ PC_LHZX = 0x1B,
+ PC_LHZUX = 0x1C,
+ PC_LHA = 0x1D,
+ PC_LHAU = 0x1E,
+ PC_LHAX = 0x1F,
+ PC_LHAUX = 0x20,
+ PC_LHBRX = 0x21,
+ PC_LWZ = 0x22,
+ PC_LWZU = 0x23,
+ PC_LWZX = 0x24,
+ PC_LWZUX = 0x25,
+ PC_LWBRX = 0x26,
+ PC_LMW = 0x27,
+ PC_STB = 0x28,
+ PC_STBU = 0x29,
+ PC_STBX = 0x2A,
+ PC_STBUX = 0x2B,
+ PC_STH = 0x2C,
+ PC_STHU = 0x2D,
+ PC_STHX = 0x2E,
+ PC_STHUX = 0x2F,
+ PC_STHBRX = 0x30,
+ PC_STW = 0x31,
+ PC_STWU = 0x32,
+ PC_STWX = 0x33,
+ PC_STWUX = 0x34,
+ PC_STWBRX = 0x35,
+ PC_STMW = 0x36,
+ PC_DCBF = 0x37,
+ PC_DCBST = 0x38,
+ PC_DCBT = 0x39,
+ PC_DCBTST = 0x3A,
+ PC_DCBZ = 0x3B,
+ PC_ADD = 0x3C,
+ PC_ADDC = 0x3D,
+ PC_ADDE = 0x3E,
+ PC_ADDI = 0x3F,
+ PC_ADDIC = 0x40,
+ PC_ADDICR = 0x41,
+ PC_ADDIS = 0x42,
+ PC_ADDME = 0x43,
+ PC_ADDZE = 0x44,
+ PC_DIVW = 0x45,
+ PC_DIVWU = 0x46,
+ PC_MULHW = 0x47,
+ PC_MULHWU = 0x48,
+ PC_MULLI = 0x49,
+ PC_MULLW = 0x4A,
+ PC_NEG = 0x4B,
+ PC_SUBF = 0x4C,
+ PC_SUBFC = 0x4D,
+ PC_SUBFE = 0x4E,
+ PC_SUBFIC = 0x4F,
+ PC_SUBFME = 0x50,
+ PC_SUBFZE = 0x51,
+ PC_CMPI = 0x52,
+ PC_CMP = 0x53,
+ PC_CMPLI = 0x54,
+ PC_CMPL = 0x55,
+ PC_ANDI = 0x56,
+ PC_ANDIS = 0x57,
+ PC_ORI = 0x58,
+ PC_ORIS = 0x59,
+ PC_XORI = 0x5A,
+ PC_XORIS = 0x5B,
+ PC_AND = 0x5C,
+ PC_OR = 0x5D,
+ PC_XOR = 0x5E,
+ PC_NAND = 0x5F,
+ PC_NOR = 0x60,
+ PC_EQV = 0x61,
+ PC_ANDC = 0x62,
+ PC_ORC = 0x63,
+ PC_EXTSB = 0x64,
+ PC_EXTSH = 0x65,
+ PC_CNTLZW = 0x66,
+ PC_RLWINM = 0x67,
+ PC_RLWNM = 0x68,
+ PC_RLWIMI = 0x69,
+ PC_SLW = 0x6A,
+ PC_SRW = 0x6B,
+ PC_SRAWI = 0x6C,
+ PC_SRAW = 0x6D,
+ PC_CRAND = 0x6E,
+ PC_CRANDC = 0x6F,
+ PC_CREQV = 0x70,
+ PC_CRNAND = 0x71,
+ PC_CRNOR = 0x72,
+ PC_CROR = 0x73,
+ PC_CRORC = 0x74,
+ PC_CRXOR = 0x75,
+ PC_MCRF = 0x76,
+ PC_MTXER = 0x77,
+ PC_MTCTR = 0x78,
+ PC_MTLR = 0x79,
+ PC_MTCRF = 0x7A,
+ PC_MTMSR = 0x7B,
+ PC_MTSPR = 0x7C,
+ PC_MFMSR = 0x7D,
+ PC_MFSPR = 0x7E,
+ PC_MFXER = 0x7F,
+ PC_MFCTR = 0x80,
+ PC_MFLR = 0x81,
+ PC_MFCR = 0x82,
+ PC_MFFS = 0x83,
+ PC_MTFSF = 0x84,
+ PC_EIEIO = 0x85,
+ PC_ISYNC = 0x86,
+ PC_SYNC = 0x87,
+ PC_RFI = 0x88,
+ PC_LI = 0x89,
+ PC_LIS = 0x8A,
+ PC_MR = 0x8B,
+ PC_NOP = 0x8C,
+ PC_NOT = 0x8D,
+ PC_LFS = 0x8E,
+ PC_LFSU = 0x8F,
+ PC_LFSX = 0x90,
+ PC_LFSUX = 0x91,
+ PC_LFD = 0x92,
+ PC_LFDU = 0x93,
+ PC_LFDX = 0x94,
+ PC_LFDUX = 0x95,
+ PC_STFS = 0x96,
+ PC_STFSU = 0x97,
+ PC_STFSX = 0x98,
+ PC_STFSUX = 0x99,
+ PC_STFD = 0x9A,
+ PC_STFDU = 0x9B,
+ PC_STFDX = 0x9C,
+ PC_STFDUX = 0x9D,
+ PC_FMR = 0x9E,
+ PC_FABS = 0x9F,
+ PC_FNEG = 0xA0,
+ PC_FNABS = 0xA1,
+ PC_FADD = 0xA2,
+ PC_FADDS = 0xA3,
+ PC_FSUB = 0xA4,
+ PC_FSUBS = 0xA5,
+ PC_FMUL = 0xA6,
+ PC_FMULS = 0xA7,
+ PC_FDIV = 0xA8,
+ PC_FDIV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 PC_RFCI = 0xE3,
+ PC_TLBRE = 0xE4,
+ PC_TLBSX = 0xE5,
+ PC_TLBWE = 0xE6,
+ PC_WRTEE = 0xE7,
+ PC_WRTEEI = 0xE8,
+ PC_MFDCR = 0xE9,
+ PC_MTDCR = 0xEA,
+ PC_DCBA = 0xEB,
+ PC_DSS = 0xEC,
+ PC_DSSALL = 0xED,
+ PC_DST = 0xEE,
+ PC_DSTT = 0xEF,
+ PC_DSTST = 0xF0,
+ PC_DSTSTT = 0xF1,
+ PC_LVEBX = 0xF2,
+ PC_LVEHX = 0xF3,
+ PC_LVEWX = 0xF4,
+ PC_LVSL = 0xF5,
+ PC_LVSR = 0xF6,
+ PC_LVX = 0xF7,
+ PC_LVXL = 0xF8,
+ PC_STVEBX = 0xF9,
+ PC_STVEHX = 0xFA,
+ PC_STVEWX = 0xFB,
+ PC_STVX = 0xFC,
+ PC_STVXL = 0xFD,
+ PC_MFVSCR = 0xFE,
+ PC_MTVSCR = 0xFF,
+ PC_VADDCUW = 0x100,
+ PC_VADDFP = 0x101,
+ PC_VADDSBS = 0x102,
+ PC_VADDSHS = 0x103,
+ PC_VADDSWS = 0x104,
+ PC_VADDUBM = 0x105,
+ PC_VADDUBS = 0x106,
+ PC_VADDUHM = 0x107,
+ PC_VADDUHS = 0x108,
+ PC_VADDUWM = 0x109,
+ PC_VADDUWS = 0x10A,
+ PC_VAND = 0x10B,
+ PC_VANDC = 0x10C,
+ PC_VAVGSB = 0x10D,
+ PC_VAVGSH = 0x10E,
+ PC_VAVGSW = 0x10F,
+ PC_VAVGUB = 0x110,
+ PC_VAVGUH = 0x111,
+ PC_VAVGUW = 0x112,
+ PC_VCFSX = 0x113,
+ PC_VCFUX = 0x114,
+ PC_VCMPBFP = 0x115,
+ PC_VCMPEQFP = 0x116,
+ PC_VCMPEQUB = 0x117,
+ PC_VCMPEQUH = 0x118,
+ PC_VCMPEQUW = 0x119,
+ PC_VCMPGEFP = 0x11A,
+ PC_VCMPGTFP = 0x11B,
+ PC_VCMPGTSB = 0x11C,
+ PC_VCMPGTSH = 0x11D,
+ PC_VCMPGTSW = 0x11E,
+ PC_VCMPGTUB = 0x11F,
+ PC_VCMPGTUH = 0x120,
+ PC_VCMPGTUW = 0x121,
+ PC_VCTSXS = 0x122,
+ PC_VCTUXS = 0x123,
+ PC_VEXPTEFP = 0x124,
+ PC_VLOGEFP = 0x125,
+ PC_VMAXFP = 0x126,
+ PC_VMAXSB = 0x127,
+ PC_VMAXSH = 0x128,
+ PC_VMAXSW = 0x129,
+ PC_VMAXUB = 0x12A,
+ PC_VMAXUH = 0x12B,
+ PC_VMAXUW = 0x12C,
+ PC_VMINFP = 0x12D,
+ PC_VMINSB = 0x12E,
+ PC_VMINSH = 0x12F,
+ PC_VMINSW = 0x130,
+ PC_VMINUB = 0x131,
+ PC_VMINUH = 0x132,
+ PC_VMINUW = 0x133,
+ PC_VMRGHB = 0x134,
+ PC_VMRGHH = 0x135,
+ PC_VMRGHW = 0x136,
+ PC_VMRGLB = 0x137,
+ PC_VMRGLH = 0x138,
+ PC_VMRGLW = 0x139,
+ PC_VMULESB = 0x13A,
+ PC_VMULESH = 0x13B,
+ PC_VMULEUB = 0x13C,
+ PC_VMULEUH = 0x13D,
+ PC_VMULOSB = 0x13E,
+ PC_VMULOSH = 0x13F,
+ PC_VMULOUB = 0x140,
+ PC_VMULOUH = 0x141,
+ PC_VNOR = 0x142,
+ PC_VOR = 0x143,
+ PC_VPKPX = 0x144,
+ PC_VPKSHSS = 0x145,
+ PC_VPKSHUS = 0x146,
+ PC_VPKSWSS = 0x147,
+ PC_VPKSWUS = 0x148,
+ PC_VPKUHUM = 0x149,
+ PC_VPKUHUS = 0x14A,
+ PC_VPKUWUM = 0x14B,
+ PC_VPKUWUS = 0x14C,
+ PC_VREFP = 0x14D,
+ PC_VRFIM = 0x14E,
+ PC_VRFIN = 0x14F,
+ PC_VRFIP = 0x150,
+ PC_VRFIZ = 0x151,
+ PC_VRLB = 0x152,
+ PC_VRLH = 0x153,
+ PC_VRLW = 0x154,
+ PC_VRSQRTEFP = 0x155,
+ PC_VSL = 0x156,
+ PC_VSLB = 0x157,
+ PC_VSLH = 0x158,
+ PC_VSLO = 0x159,
+ PC_VSLW = 0x15A,
+ PC_VSPLTB = 0x15B,
+ PC_VSPLTH = 0x15C,
+ PC_VSPLTW = 0x15D,
+ PC_VSPLTISB = 0x15E,
+ PC_VSPLTISH = 0x15F,
+ PC_VSPLTISW = 0x160,
+ PC_VSR = 0x161,
+ PC_VSRAB = 0x162,
+ PC_VSRAH = 0x163,
+ PC_VSRAW = 0x164,
+ PC_VSRB = 0x165,
+ PC_VSRH = 0x166,
+ PC_VSRO = 0x167,
+ PC_VSRW = 0x168,
+ PC_VSUBCUW = 0x169,
+ PC_VSUBFP = 0x16A,
+ PC_VSUBSBS = 0x16B,
+ PC_VSUBSHS = 0x16C,
+ PC_VSUBSWS = 0x16D,
+ PC_VSUBUBM = 0x16E,
+ PC_VSUBUBS = 0x16F,
+ PC_VSUBUHM = 0x170,
+ PC_VSUBUHS = 0x171,
+ PC_VSUBUWM = 0x172,
+ PC_VSUBUWS = 0x173,
+ PC_VSUMSWS = 0x174,
+ PC_VSUM2SWS = 0x175,
+ PC_VSUM4SBS = 0x176,
+ PC_VSUM4SHS = 0x177,
+ PC_VSUM4UBS = 0x178,
+ PC_VUPKHPX = 0x179,
+ PC_VUPKHSB = 0x17A,
+ PC_VUPKHSH = 0x17B,
+ PC_VUPKLPX = 0x17C,
+ PC_VUPKLSB = 0x17D,
+ PC_VUPKLSH = 0x17E,
+ PC_VXOR = 0x17F,
+ PC_VMADDFP = 0x180,
+ PC_VMHADDSHS = 0x181,
+ PC_VMHRADDSHS = 0x182,
+ PC_VMLADDUHM = 0x183,
+ PC_VMSUMMBM = 0x184,
+ PC_VMSUMSHM = 0x185,
+ PC_VMSUMSHS = 0x186,
+ PC_VMSUMUBM = 0x187,
+ PC_VMSUMUHM = 0x188,
+ PC_VMSUMUHS = 0x189,
+ PC_VNMSUBFP = 0x18A,
+ PC_VPERM = 0x18B,
+ PC_VSEL = 0x18C,
+ PC_VSLDOI = 0x18D,
+ PC_VMR = 0x18E,
+ PC_VMRP = 0x18F,
+ PC_SLE = 0x190,
+ PC_SLEQ = 0x191,
+ PC_SLIQ = 0x192,
+ PC_SLLIQ = 0x193,
+ PC_SLLQ = 0x194,
+ PC_SLQ = 0x195,
+ PC_SRAIQ = 0x196,
+ PC_SRAQ = 0x197,
+ PC_SRE = 0x198,
+ PC_SREA = 0x199,
+ PC_SREQ = 0x19A,
+ PC_SRIQ = 0x19B,
+ PC_SRLIQ = 0x19C,
+ PC_SRLQ = 0x19D,
+ PC_SRQ = 0x19E,
+ PC_MASKG = 0x19F,
+ PC_MASKIR = 0x1A0,
+ PC_LSCBX = 0x1A1,
+ PC_DIV = 0x1A2,
+ PC_DIVS = 0x1A3,
+ PC_DOZ = 0x1A4,
+ PC_MUL = 0x1A5,
+ PC_NABS = 0x1A6,
+ PC_ABS = 0x1A7,
+ PC_CLCS = 0x1A8,
+ PC_DOZI = 0x1A9,
+ PC_RLMI = 0x1AA,
+ PC_RRIB = 0x1AB,
+ PC_PENTRY = 0x1AC,
+ PC_PEXIT = 0x1AD,
+ OPCODE_MAX = 0x1AE
+};
+
+extern OpcodeInfo opcodeInfo[OPCODE_MAX];
+
+extern void pcode_get_hi_lo(int a1, char a2, int *pA, int *pB);
+extern int pcode_check_imm_bits(int a1, int a2, int a3);
+extern int pcode_const_from_format(char *buf, int *pResult);
+extern PCode *vformatpcode(short opcode, va_list argList);
+extern int expectandformatoperand(PCodeArg *operand, unsigned char expectedKind, char a3, int bitCount, char *buf);
+extern int formatoperand(PCodeArg *operand, char *buf);
+extern void formatoperands(PCode *pcode, char *buf, int showBasicBlocks);
+extern PCode *makecopyinstruction(PCodeArg *a, PCodeArg *b);
+extern int is_location_independent(PCode *pcode);
+extern int can_reuse_stored_value(PCode *a, PCode *b);
+extern int nbytes_loaded_or_stored_by(PCode *pcode);
+extern void change_num_operands(PCode *pcode, int newNum);
+extern void change_opcode(PCode *pcode, short opcode);