📄 hdefs.h
字号:
/* --------- */typedef enum { Pavfp_INVALID, /* Floating point binary */ Pavfp_ADDF, Pavfp_SUBF, Pavfp_MULF, Pavfp_MAXF, Pavfp_MINF, Pavfp_CMPEQF, Pavfp_CMPGTF, Pavfp_CMPGEF, /* Floating point unary */ Pavfp_RCPF, Pavfp_RSQRTF, Pavfp_CVTU2F, Pavfp_CVTS2F, Pavfp_QCVTF2U, Pavfp_QCVTF2S, Pavfp_ROUNDM, Pavfp_ROUNDP, Pavfp_ROUNDN, Pavfp_ROUNDZ, } PPCAvFpOp;extern HChar* showPPCAvFpOp ( PPCAvFpOp );/* --------- */typedef enum { Pin_LI, /* load word (32/64-bit) immediate (fake insn) */ Pin_Alu, /* word add/sub/and/or/xor */ Pin_Shft, /* word shl/shr/sar */ Pin_AddSubC, /* add/sub with read/write carry */ Pin_Cmp, /* word compare */ Pin_Unary, /* not, neg, clz */ Pin_MulL, /* widening multiply */ Pin_Div, /* div */ Pin_Call, /* call to address in register */ Pin_Goto, /* conditional/unconditional jmp to dst */ Pin_CMov, /* conditional move */ Pin_Load, /* zero-extending load a 8|16|32|64 bit value from mem */ Pin_Store, /* store a 8|16|32|64 bit value to mem */ Pin_Set, /* convert condition code to value 0 or 1 */ Pin_MfCR, /* move from condition register to GPR */ Pin_MFence, /* mem fence */ Pin_FpUnary, /* FP unary op */ Pin_FpBinary, /* FP binary op */ Pin_FpMulAcc, /* FP multipy-accumulate style op */ Pin_FpLdSt, /* FP load/store */ Pin_FpSTFIW, /* stfiwx */ Pin_FpRSP, /* FP round IEEE754 double to IEEE754 single */ Pin_FpCftI, /* fcfid/fctid/fctiw */ Pin_FpCMov, /* FP floating point conditional move */ Pin_FpLdFPSCR, /* mtfsf */ Pin_FpCmp, /* FP compare, generating value into int reg */ Pin_RdWrLR, /* Read/Write Link Register */ Pin_AvLdSt, /* AV load/store (kludging for AMode_IR) */ Pin_AvUnary, /* AV unary general reg=>reg */ Pin_AvBinary, /* AV binary general reg,reg=>reg */ Pin_AvBin8x16, /* AV binary, 8x4 */ Pin_AvBin16x8, /* AV binary, 16x4 */ Pin_AvBin32x4, /* AV binary, 32x4 */ Pin_AvBin32Fx4, /* AV FP binary, 32Fx4 */ Pin_AvUn32Fx4, /* AV FP unary, 32Fx4 */ Pin_AvPerm, /* AV permute (shuffle) */ Pin_AvSel, /* AV select */ Pin_AvShlDbl, /* AV shift-left double by imm */ Pin_AvSplat, /* One elem repeated throughout dst */ Pin_AvLdVSCR, /* mtvscr */ Pin_AvCMov /* AV conditional move */ } PPCInstrTag;/* Destinations are on the LEFT (first operand) */typedef struct { PPCInstrTag tag; union { /* Get a 32/64-bit literal into a register. May turn into a number of real insns. */ struct { HReg dst; ULong imm64; } LI; /* Integer add/sub/and/or/xor. Limitations: - For add, the immediate, if it exists, is a signed 16. - For sub, the immediate, if it exists, is a signed 16 which may not be -32768, since no such instruction exists, and so we have to emit addi with +32768, but that is not possible. - For and/or/xor, the immediate, if it exists, is an unsigned 16. */ struct { PPCAluOp op; HReg dst; HReg srcL; PPCRH* srcR; } Alu; /* Integer shl/shr/sar. Limitations: the immediate, if it exists, is a signed 5-bit value between 1 and 31 inclusive. */ struct { PPCShftOp op; Bool sz32; /* mode64 has both 32 and 64bit shft */ HReg dst; HReg srcL; PPCRH* srcR; } Shft; /* */ struct { Bool isAdd; /* else sub */ Bool setC; /* else read carry */ HReg dst; HReg srcL; HReg srcR; } AddSubC; /* If signed, the immediate, if it exists, is a signed 16, else it is an unsigned 16. */ struct { Bool syned; Bool sz32; /* mode64 has both 32 and 64bit cmp */ UInt crfD; HReg srcL; PPCRH* srcR; } Cmp; /* Not, Neg, Clz32/64, Extsw */ struct { PPCUnaryOp op; HReg dst; HReg src; } Unary; struct { Bool syned; /* meaningless if hi32==False */ Bool hi; /* False=>low, True=>high */ Bool sz32; /* mode64 has both 32 & 64bit mull */ HReg dst; HReg srcL; HReg srcR; } MulL; /* ppc32 div/divu instruction. */ struct { Bool syned; Bool sz32; /* mode64 has both 32 & 64bit div */ HReg dst; HReg srcL; HReg srcR; } Div; /* Pseudo-insn. Call target (an absolute address), on given condition (which could be Pct_ALWAYS). argiregs indicates which of r3 .. r10 carries argument values for this call, using a bit mask (1<<N is set if rN holds an arg, for N in 3 .. 10 inclusive). */ struct { PPCCondCode cond; Addr64 target; UInt argiregs; } Call; /* Pseudo-insn. Goto dst, on given condition (which could be Pct_ALWAYS). */ struct { IRJumpKind jk; PPCCondCode cond; PPCRI* dst; } Goto; /* Mov src to dst on the given condition, which may not be the bogus Pct_ALWAYS. */ struct { PPCCondCode cond; HReg dst; PPCRI* src; } CMov; /* Zero extending loads. Dst size is host word size */ struct { UChar sz; /* 1|2|4|8 */ HReg dst; PPCAMode* src; } Load; /* 64/32/16/8 bit stores */ struct { UChar sz; /* 1|2|4|8 */ PPCAMode* dst; HReg src; } Store; /* Convert a ppc condition code to value 0 or 1. */ struct { PPCCondCode cond; HReg dst; } Set; /* Move the entire CR to a GPR */ struct { HReg dst; } MfCR; /* Mem fence. In short, an insn which flushes all preceding loads and stores as much as possible before continuing. On PPC we emit a "sync". */ struct { } MFence; /* PPC Floating point */ struct { PPCFpOp op; HReg dst; HReg src; } FpUnary; struct { PPCFpOp op; HReg dst; HReg srcL; HReg srcR; } FpBinary; struct { PPCFpOp op; HReg dst; HReg srcML; HReg srcMR; HReg srcAcc; } FpMulAcc; struct { Bool isLoad; UChar sz; /* only 4 (IEEE single) or 8 (IEEE double) */ HReg reg; PPCAMode* addr; } FpLdSt; struct { HReg addr; /* int reg */ HReg data; /* float reg */ } FpSTFIW; /* Round 64-bit FP value to 32-bit FP value in an FP reg. */ struct { HReg src; HReg dst; } FpRSP; /* fcfid/fctid/fctiw. Note there's no fcfiw so fromI==True && int32==True is not allowed. */ struct { Bool fromI; /* False==F->I, True==I->F */ Bool int32; /* True== I is 32, False==I is 64 */ HReg src; HReg dst; } FpCftI; /* FP mov src to dst on the given condition. */ struct { PPCCondCode cond; HReg dst; HReg src; } FpCMov; /* Load FP Status & Control Register */ struct { HReg src; } FpLdFPSCR; /* Do a compare, generating result into an int register. */ struct { UChar crfD; HReg dst; HReg srcL; HReg srcR; } FpCmp; /* Read/Write Link Register */ struct { Bool wrLR; HReg gpr; } RdWrLR; /* Simplistic AltiVec */ struct { Bool isLoad; UChar sz; /* 8|16|32|128 */ HReg reg; PPCAMode* addr; } AvLdSt; struct { PPCAvOp op; HReg dst; HReg src; } AvUnary; struct { PPCAvOp op; HReg dst; HReg srcL; HReg srcR; } AvBinary; struct { PPCAvOp op; HReg dst; HReg srcL; HReg srcR; } AvBin8x16; struct { PPCAvOp op; HReg dst; HReg srcL; HReg srcR; } AvBin16x8; struct { PPCAvOp op; HReg dst; HReg srcL; HReg srcR; } AvBin32x4; struct { PPCAvFpOp op; HReg dst; HReg srcL; HReg srcR; } AvBin32Fx4; struct { PPCAvFpOp op; HReg dst; HReg src; } AvUn32Fx4; /* Perm,Sel,SlDbl,Splat are all weird AV permutations */ struct { HReg dst; HReg srcL; HReg srcR; HReg ctl; } AvPerm; struct { HReg dst; HReg srcL; HReg srcR; HReg ctl; } AvSel; struct { UChar shift; HReg dst; HReg srcL; HReg srcR; } AvShlDbl; struct { UChar sz; /* 8,16,32 */ HReg dst; PPCVI5s* src; } AvSplat; /* Mov src to dst on the given condition, which may not be the bogus Xcc_ALWAYS. */ struct { PPCCondCode cond; HReg dst; HReg src; } AvCMov; /* Load AltiVec Status & Control Register */ struct { HReg src; } AvLdVSCR; } Pin; } PPCInstr;extern PPCInstr* PPCInstr_LI ( HReg, ULong, Bool );extern PPCInstr* PPCInstr_Alu ( PPCAluOp, HReg, HReg, PPCRH* );extern PPCInstr* PPCInstr_Shft ( PPCShftOp, Bool sz32, HReg, HReg, PPCRH* );extern PPCInstr* PPCInstr_AddSubC ( Bool, Bool, HReg, HReg, HReg );extern PPCInstr* PPCInstr_Cmp ( Bool, Bool, UInt, HReg, PPCRH* );extern PPCInstr* PPCInstr_Unary ( PPCUnaryOp op, HReg dst, HReg src );extern PPCInstr* PPCInstr_MulL ( Bool syned, Bool hi32, Bool sz32, HReg, HReg, HReg );extern PPCInstr* PPCInstr_Div ( Bool syned, Bool sz32, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_Call ( PPCCondCode, Addr64, UInt );extern PPCInstr* PPCInstr_Goto ( IRJumpKind, PPCCondCode cond, PPCRI* dst );extern PPCInstr* PPCInstr_CMov ( PPCCondCode, HReg dst, PPCRI* src );extern PPCInstr* PPCInstr_Load ( UChar sz, HReg dst, PPCAMode* src, Bool mode64 );extern PPCInstr* PPCInstr_Store ( UChar sz, PPCAMode* dst, HReg src, Bool mode64 );extern PPCInstr* PPCInstr_Set ( PPCCondCode cond, HReg dst );extern PPCInstr* PPCInstr_MfCR ( HReg dst );extern PPCInstr* PPCInstr_MFence ( void );extern PPCInstr* PPCInstr_FpUnary ( PPCFpOp op, HReg dst, HReg src );extern PPCInstr* PPCInstr_FpBinary ( PPCFpOp op, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_FpMulAcc ( PPCFpOp op, HReg dst, HReg srcML, HReg srcMR, HReg srcAcc );extern PPCInstr* PPCInstr_FpLdSt ( Bool isLoad, UChar sz, HReg, PPCAMode* );extern PPCInstr* PPCInstr_FpSTFIW ( HReg addr, HReg data );extern PPCInstr* PPCInstr_FpRSP ( HReg dst, HReg src );extern PPCInstr* PPCInstr_FpCftI ( Bool fromI, Bool int32, HReg dst, HReg src );extern PPCInstr* PPCInstr_FpCMov ( PPCCondCode, HReg dst, HReg src );extern PPCInstr* PPCInstr_FpLdFPSCR ( HReg src );extern PPCInstr* PPCInstr_FpCmp ( HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_RdWrLR ( Bool wrLR, HReg gpr );extern PPCInstr* PPCInstr_AvLdSt ( Bool isLoad, UChar sz, HReg, PPCAMode* );extern PPCInstr* PPCInstr_AvUnary ( PPCAvOp op, HReg dst, HReg src );extern PPCInstr* PPCInstr_AvBinary ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_AvBin8x16 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_AvBin16x8 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_AvBin32x4 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_AvBin32Fx4 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_AvUn32Fx4 ( PPCAvOp op, HReg dst, HReg src );extern PPCInstr* PPCInstr_AvPerm ( HReg dst, HReg srcL, HReg srcR, HReg ctl );extern PPCInstr* PPCInstr_AvSel ( HReg ctl, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_AvShlDbl ( UChar shift, HReg dst, HReg srcL, HReg srcR );extern PPCInstr* PPCInstr_AvSplat ( UChar sz, HReg dst, PPCVI5s* src );extern PPCInstr* PPCInstr_AvCMov ( PPCCondCode, HReg dst, HReg src );extern PPCInstr* PPCInstr_AvLdVSCR ( HReg src );extern void ppPPCInstr ( PPCInstr*, Bool mode64 );/* Some functions that insulate the register allocator from details of the underlying instruction set. */extern void getRegUsage_PPCInstr ( HRegUsage*, PPCInstr*, Bool mode64 );extern void mapRegs_PPCInstr ( HRegRemap*, PPCInstr* , Bool mode64);extern Bool isMove_PPCInstr ( PPCInstr*, HReg*, HReg* );extern Int emit_PPCInstr ( UChar* buf, Int nbuf, PPCInstr*, Bool mode64, void* dispatch );extern PPCInstr* genSpill_PPC ( HReg rreg, UShort offsetB, Bool mode64 );extern PPCInstr* genReload_PPC ( HReg rreg, UShort offsetB, Bool mode64 );extern void getAllocableRegs_PPC ( Int*, HReg**, Bool mode64 );extern HInstrArray* iselBB_PPC ( IRBB*, VexArch, VexArchInfo* );#endif /* ndef __LIBVEX_HOST_PPC_HDEFS_H *//*---------------------------------------------------------------*//*--- end host-ppc/hdefs.h ---*//*---------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -