📄 hdefs.c
字号:
i->tag = Pin_Unary; i->Pin.Unary.op = op; i->Pin.Unary.dst = dst; i->Pin.Unary.src = src; return i;}PPCInstr* PPCInstr_MulL ( Bool syned, Bool hi, Bool sz32, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_MulL; i->Pin.MulL.syned = syned; i->Pin.MulL.hi = hi; i->Pin.MulL.sz32 = sz32; i->Pin.MulL.dst = dst; i->Pin.MulL.srcL = srcL; i->Pin.MulL.srcR = srcR; /* if doing the low word, the signedness is irrelevant, but tie it down anyway. */ if (!hi) vassert(!syned); return i;}PPCInstr* PPCInstr_Div ( Bool syned, Bool sz32, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_Div; i->Pin.Div.syned = syned; i->Pin.Div.sz32 = sz32; i->Pin.Div.dst = dst; i->Pin.Div.srcL = srcL; i->Pin.Div.srcR = srcR; return i;}PPCInstr* PPCInstr_Call ( PPCCondCode cond, Addr64 target, UInt argiregs ) { UInt mask; PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_Call; i->Pin.Call.cond = cond; i->Pin.Call.target = target; i->Pin.Call.argiregs = argiregs; /* Only r3 .. r10 inclusive may be used as arg regs. Hence: */ mask = (1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)|(1<<10); vassert(0 == (argiregs & ~mask)); return i;}PPCInstr* PPCInstr_Goto ( IRJumpKind jk, PPCCondCode cond, PPCRI* dst ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_Goto; i->Pin.Goto.cond = cond; i->Pin.Goto.dst = dst; i->Pin.Goto.jk = jk; return i;}PPCInstr* PPCInstr_CMov ( PPCCondCode cond, HReg dst, PPCRI* src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_CMov; i->Pin.CMov.cond = cond; i->Pin.CMov.src = src; i->Pin.CMov.dst = dst; vassert(cond.test != Pct_ALWAYS); return i;}PPCInstr* PPCInstr_Load ( UChar sz, HReg dst, PPCAMode* src, Bool mode64 ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_Load; i->Pin.Load.sz = sz; i->Pin.Load.src = src; i->Pin.Load.dst = dst; vassert(sz == 1 || sz == 2 || sz == 4 || sz == 8); if (sz == 8) vassert(mode64); return i;}PPCInstr* PPCInstr_Store ( UChar sz, PPCAMode* dst, HReg src, Bool mode64 ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_Store; i->Pin.Store.sz = sz; i->Pin.Store.src = src; i->Pin.Store.dst = dst; vassert(sz == 1 || sz == 2 || sz == 4 || sz == 8); if (sz == 8) vassert(mode64); return i;}PPCInstr* PPCInstr_Set ( PPCCondCode cond, HReg dst ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_Set; i->Pin.Set.cond = cond; i->Pin.Set.dst = dst; return i;}PPCInstr* PPCInstr_MfCR ( HReg dst ){ PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_MfCR; i->Pin.MfCR.dst = dst; return i;}PPCInstr* PPCInstr_MFence ( void ){ PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_MFence; return i;}PPCInstr* PPCInstr_FpUnary ( PPCFpOp op, HReg dst, HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpUnary; i->Pin.FpUnary.op = op; i->Pin.FpUnary.dst = dst; i->Pin.FpUnary.src = src; return i;}PPCInstr* PPCInstr_FpBinary ( PPCFpOp op, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpBinary; i->Pin.FpBinary.op = op; i->Pin.FpBinary.dst = dst; i->Pin.FpBinary.srcL = srcL; i->Pin.FpBinary.srcR = srcR; return i;}PPCInstr* PPCInstr_FpMulAcc ( PPCFpOp op, HReg dst, HReg srcML, HReg srcMR, HReg srcAcc ){ PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpMulAcc; i->Pin.FpMulAcc.op = op; i->Pin.FpMulAcc.dst = dst; i->Pin.FpMulAcc.srcML = srcML; i->Pin.FpMulAcc.srcMR = srcMR; i->Pin.FpMulAcc.srcAcc = srcAcc; return i;}PPCInstr* PPCInstr_FpLdSt ( Bool isLoad, UChar sz, HReg reg, PPCAMode* addr ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpLdSt; i->Pin.FpLdSt.isLoad = isLoad; i->Pin.FpLdSt.sz = sz; i->Pin.FpLdSt.reg = reg; i->Pin.FpLdSt.addr = addr; vassert(sz == 4 || sz == 8); return i;}PPCInstr* PPCInstr_FpSTFIW ( HReg addr, HReg data ){ PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpSTFIW; i->Pin.FpSTFIW.addr = addr; i->Pin.FpSTFIW.data = data; return i;}PPCInstr* PPCInstr_FpRSP ( HReg dst, HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpRSP; i->Pin.FpRSP.dst = dst; i->Pin.FpRSP.src = src; return i;}PPCInstr* PPCInstr_FpCftI ( Bool fromI, Bool int32, HReg dst, HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpCftI; i->Pin.FpCftI.fromI = fromI; i->Pin.FpCftI.int32 = int32; i->Pin.FpCftI.dst = dst; i->Pin.FpCftI.src = src; vassert(!(int32 && fromI)); /* no such insn ("fcfiw"). */ return i;}PPCInstr* PPCInstr_FpCMov ( PPCCondCode cond, HReg dst, HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpCMov; i->Pin.FpCMov.cond = cond; i->Pin.FpCMov.dst = dst; i->Pin.FpCMov.src = src; vassert(cond.test != Pct_ALWAYS); return i;}PPCInstr* PPCInstr_FpLdFPSCR ( HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpLdFPSCR; i->Pin.FpLdFPSCR.src = src; return i;}PPCInstr* PPCInstr_FpCmp ( HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_FpCmp; i->Pin.FpCmp.dst = dst; i->Pin.FpCmp.srcL = srcL; i->Pin.FpCmp.srcR = srcR; return i;}/* Read/Write Link Register */PPCInstr* PPCInstr_RdWrLR ( Bool wrLR, HReg gpr ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_RdWrLR; i->Pin.RdWrLR.wrLR = wrLR; i->Pin.RdWrLR.gpr = gpr; return i;}/* AltiVec */PPCInstr* PPCInstr_AvLdSt ( Bool isLoad, UChar sz, HReg reg, PPCAMode* addr ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvLdSt; i->Pin.AvLdSt.isLoad = isLoad; i->Pin.AvLdSt.sz = sz; i->Pin.AvLdSt.reg = reg; i->Pin.AvLdSt.addr = addr; return i;}PPCInstr* PPCInstr_AvUnary ( PPCAvOp op, HReg dst, HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvUnary; i->Pin.AvUnary.op = op; i->Pin.AvUnary.dst = dst; i->Pin.AvUnary.src = src; return i;}PPCInstr* PPCInstr_AvBinary ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvBinary; i->Pin.AvBinary.op = op; i->Pin.AvBinary.dst = dst; i->Pin.AvBinary.srcL = srcL; i->Pin.AvBinary.srcR = srcR; return i;}PPCInstr* PPCInstr_AvBin8x16 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvBin8x16; i->Pin.AvBin8x16.op = op; i->Pin.AvBin8x16.dst = dst; i->Pin.AvBin8x16.srcL = srcL; i->Pin.AvBin8x16.srcR = srcR; return i;}PPCInstr* PPCInstr_AvBin16x8 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvBin16x8; i->Pin.AvBin16x8.op = op; i->Pin.AvBin16x8.dst = dst; i->Pin.AvBin16x8.srcL = srcL; i->Pin.AvBin16x8.srcR = srcR; return i;}PPCInstr* PPCInstr_AvBin32x4 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvBin32x4; i->Pin.AvBin32x4.op = op; i->Pin.AvBin32x4.dst = dst; i->Pin.AvBin32x4.srcL = srcL; i->Pin.AvBin32x4.srcR = srcR; return i;}PPCInstr* PPCInstr_AvBin32Fx4 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvBin32Fx4; i->Pin.AvBin32Fx4.op = op; i->Pin.AvBin32Fx4.dst = dst; i->Pin.AvBin32Fx4.srcL = srcL; i->Pin.AvBin32Fx4.srcR = srcR; return i;}PPCInstr* PPCInstr_AvUn32Fx4 ( PPCAvOp op, HReg dst, HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvUn32Fx4; i->Pin.AvUn32Fx4.op = op; i->Pin.AvUn32Fx4.dst = dst; i->Pin.AvUn32Fx4.src = src; return i;}PPCInstr* PPCInstr_AvPerm ( HReg dst, HReg srcL, HReg srcR, HReg ctl ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvPerm; i->Pin.AvPerm.dst = dst; i->Pin.AvPerm.srcL = srcL; i->Pin.AvPerm.srcR = srcR; i->Pin.AvPerm.ctl = ctl; return i;}PPCInstr* PPCInstr_AvSel ( HReg ctl, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvSel; i->Pin.AvSel.ctl = ctl; i->Pin.AvSel.dst = dst; i->Pin.AvSel.srcL = srcL; i->Pin.AvSel.srcR = srcR; return i;}PPCInstr* PPCInstr_AvShlDbl ( UChar shift, HReg dst, HReg srcL, HReg srcR ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvShlDbl; i->Pin.AvShlDbl.shift = shift; i->Pin.AvShlDbl.dst = dst; i->Pin.AvShlDbl.srcL = srcL; i->Pin.AvShlDbl.srcR = srcR; return i;}PPCInstr* PPCInstr_AvSplat ( UChar sz, HReg dst, PPCVI5s* src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvSplat; i->Pin.AvSplat.sz = sz; i->Pin.AvSplat.dst = dst; i->Pin.AvSplat.src = src; return i;}PPCInstr* PPCInstr_AvCMov ( PPCCondCode cond, HReg dst, HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvCMov; i->Pin.AvCMov.cond = cond; i->Pin.AvCMov.dst = dst; i->Pin.AvCMov.src = src; vassert(cond.test != Pct_ALWAYS); return i;}PPCInstr* PPCInstr_AvLdVSCR ( HReg src ) { PPCInstr* i = LibVEX_Alloc(sizeof(PPCInstr)); i->tag = Pin_AvLdVSCR; i->Pin.AvLdVSCR.src = src; return i;}/* Pretty Print instructions */static void ppLoadImm ( HReg dst, ULong imm, Bool mode64 ) {#if 1 vex_printf("li_word "); ppHRegPPC(dst); if (!mode64) { vassert(imm == (ULong)(Long)(Int)(UInt)imm); vex_printf(",0x%08x", (UInt)imm); } else { vex_printf(",0x%016llx", imm); }#else if (imm >= 0xFFFFFFFFFFFF8000ULL || imm < 0x8000) { // sign-extendable from 16 bits vex_printf("li "); ppHRegPPC(dst); vex_printf(",0x%x", (UInt)imm); } else { if (imm >= 0xFFFFFFFF80000000ULL || imm < 0x80000000ULL) { // sign-extendable from 32 bits vex_printf("lis "); ppHRegPPC(dst); vex_printf(",0x%x ; ", (UInt)(imm >> 16)); vex_printf("ori "); ppHRegPPC(dst); vex_printf(","); ppHRegPPC(dst); vex_printf(",0x%x", (UInt)(imm & 0xFFFF)); } else { // full 64bit immediate load: 5 (five!) insns. vassert(mode64); // load high word vex_printf("lis "); ppHRegPPC(dst); vex_printf(",0x%x ; ", (UInt)(imm >> 48) & 0xFFFF); vex_printf("ori "); ppHRegPPC(dst); vex_printf(","); ppHRegPPC(dst); vex_printf(",0x%x ; ", (UInt)(imm >> 32) & 0xFFFF); // shift r_dst low word to high word => rldicr vex_printf("rldicr "); ppHRegPPC(dst); vex_printf(","); ppHRegPPC(dst); vex_printf(",32,31 ; "); // load low word vex_printf("oris "); ppHRegPPC(dst); vex_printf(","); ppHRegPPC(dst); vex_printf(",0x%x ; ", (UInt)(imm >> 16) & 0xFFFF); vex_printf("ori ");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -