⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hdefs.c

📁 The Valgrind distribution has multiple tools. The most popular is the memory checking tool (called M
💻 C
📖 第 1 页 / 共 5 页
字号:
      vex_printf("%s(w) ", showPPCAvOp(i->Pin.AvBin32x4.op));      ppHRegPPC(i->Pin.AvBin32x4.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvBin32x4.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AvBin32x4.srcR);      return;   case Pin_AvBin32Fx4:      vex_printf("%s ", showPPCAvFpOp(i->Pin.AvBin32Fx4.op));      ppHRegPPC(i->Pin.AvBin32Fx4.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvBin32Fx4.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AvBin32Fx4.srcR);      return;   case Pin_AvUn32Fx4:      vex_printf("%s ", showPPCAvFpOp(i->Pin.AvUn32Fx4.op));      ppHRegPPC(i->Pin.AvUn32Fx4.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvUn32Fx4.src);      return;   case Pin_AvPerm:      vex_printf("vperm ");      ppHRegPPC(i->Pin.AvPerm.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvPerm.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AvPerm.srcR);      vex_printf(",");      ppHRegPPC(i->Pin.AvPerm.ctl);      return;   case Pin_AvSel:      vex_printf("vsel ");      ppHRegPPC(i->Pin.AvSel.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvSel.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AvSel.srcR);      vex_printf(",");      ppHRegPPC(i->Pin.AvSel.ctl);      return;   case Pin_AvShlDbl:      vex_printf("vsldoi ");      ppHRegPPC(i->Pin.AvShlDbl.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvShlDbl.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AvShlDbl.srcR);      vex_printf(",%d", i->Pin.AvShlDbl.shift);      return;   case Pin_AvSplat: {      UChar sz = i->Pin.AvSplat.sz;      UChar ch_sz = toUChar( (sz == 8) ? 'b' : (sz == 16) ? 'h' : 'w' );      vex_printf("vsplt%s%c ",                 i->Pin.AvSplat.src->tag == Pvi_Imm ? "is" : "", ch_sz);      ppHRegPPC(i->Pin.AvSplat.dst);      vex_printf(",");      ppPPCVI5s(i->Pin.AvSplat.src);      if (i->Pin.AvSplat.src->tag == Pvi_Reg)         vex_printf(", %d", (128/sz)-1);   /* louis lane */      return;   }   case Pin_AvCMov:      vex_printf("avcmov (%s) ", showPPCCondCode(i->Pin.AvCMov.cond));      ppHRegPPC(i->Pin.AvCMov.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvCMov.src);      vex_printf(": ");      vex_printf("if (v_dst != v_src) { ");      if (i->Pin.AvCMov.cond.test != Pct_ALWAYS) {         vex_printf("if (%s) { ", showPPCCondCode(i->Pin.AvCMov.cond));      }      vex_printf("vmr ");      ppHRegPPC(i->Pin.AvCMov.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvCMov.src);      if (i->Pin.FpCMov.cond.test != Pct_ALWAYS)         vex_printf(" }");      vex_printf(" }");      return;   case Pin_AvLdVSCR:      vex_printf("mtvscr ");      ppHRegPPC(i->Pin.AvLdVSCR.src);      return;   default:      vex_printf("\nppPPCInstr: No such tag(%d)\n", (Int)i->tag);      vpanic("ppPPCInstr");   }}/* --------- Helpers for register allocation. --------- */void getRegUsage_PPCInstr ( HRegUsage* u, PPCInstr* i, Bool mode64 ){   initHRegUsage(u);   switch (i->tag) {   case Pin_LI:      addHRegUse(u, HRmWrite, i->Pin.LI.dst);      break;   case Pin_Alu:      addHRegUse(u, HRmRead,  i->Pin.Alu.srcL);      addRegUsage_PPCRH(u,    i->Pin.Alu.srcR);      addHRegUse(u, HRmWrite, i->Pin.Alu.dst);      return;   case Pin_Shft:      addHRegUse(u, HRmRead,  i->Pin.Shft.srcL);      addRegUsage_PPCRH(u,    i->Pin.Shft.srcR);      addHRegUse(u, HRmWrite, i->Pin.Shft.dst);      return;   case Pin_AddSubC:      addHRegUse(u, HRmWrite, i->Pin.AddSubC.dst);      addHRegUse(u, HRmRead,  i->Pin.AddSubC.srcL);      addHRegUse(u, HRmRead,  i->Pin.AddSubC.srcR);      return;   case Pin_Cmp:      addHRegUse(u, HRmRead, i->Pin.Cmp.srcL);      addRegUsage_PPCRH(u,   i->Pin.Cmp.srcR);      return;   case Pin_Unary:      addHRegUse(u, HRmWrite, i->Pin.Unary.dst);      addHRegUse(u, HRmRead,  i->Pin.Unary.src);      return;   case Pin_MulL:      addHRegUse(u, HRmWrite, i->Pin.MulL.dst);      addHRegUse(u, HRmRead,  i->Pin.MulL.srcL);      addHRegUse(u, HRmRead,  i->Pin.MulL.srcR);      return;   case Pin_Div:      addHRegUse(u, HRmWrite, i->Pin.Div.dst);      addHRegUse(u, HRmRead,  i->Pin.Div.srcL);      addHRegUse(u, HRmRead,  i->Pin.Div.srcR);      return;   case Pin_Call: {      UInt argir;      /* This is a bit subtle. */      /* First off, claim it trashes all the caller-saved regs         which fall within the register allocator's jurisdiction.         These I believe to be:         mode32: r3 to r12         mode64: r3 to r10      */      /* XXXXXXXXXXXXXXXXX BUG! This doesn't say anything about the FP         or Altivec registers.  We get away with this ONLY because         getAllocatableRegs_PPC gives the allocator callee-saved fp         and Altivec regs, and no caller-save ones. */      addHRegUse(u, HRmWrite, hregPPC_GPR3(mode64));      addHRegUse(u, HRmWrite, hregPPC_GPR4(mode64));      addHRegUse(u, HRmWrite, hregPPC_GPR5(mode64));      addHRegUse(u, HRmWrite, hregPPC_GPR6(mode64));      addHRegUse(u, HRmWrite, hregPPC_GPR7(mode64));      addHRegUse(u, HRmWrite, hregPPC_GPR8(mode64));      addHRegUse(u, HRmWrite, hregPPC_GPR9(mode64));      addHRegUse(u, HRmWrite, hregPPC_GPR10(mode64));      if (!mode64) {         addHRegUse(u, HRmWrite, hregPPC_GPR11(mode64));         addHRegUse(u, HRmWrite, hregPPC_GPR12(mode64));      }      /* Now we have to state any parameter-carrying registers         which might be read.  This depends on the argiregs field. */      argir = i->Pin.Call.argiregs;      if (argir &(1<<10)) addHRegUse(u, HRmRead, hregPPC_GPR10(mode64));      if (argir & (1<<9)) addHRegUse(u, HRmRead, hregPPC_GPR9(mode64));      if (argir & (1<<8)) addHRegUse(u, HRmRead, hregPPC_GPR8(mode64));      if (argir & (1<<7)) addHRegUse(u, HRmRead, hregPPC_GPR7(mode64));      if (argir & (1<<6)) addHRegUse(u, HRmRead, hregPPC_GPR6(mode64));      if (argir & (1<<5)) addHRegUse(u, HRmRead, hregPPC_GPR5(mode64));      if (argir & (1<<4)) addHRegUse(u, HRmRead, hregPPC_GPR4(mode64));      if (argir & (1<<3)) addHRegUse(u, HRmRead, hregPPC_GPR3(mode64));      vassert(0 == (argir & ~((1<<3)|(1<<4)|(1<<5)|(1<<6)                              |(1<<7)|(1<<8)|(1<<9)|(1<<10))));      /* Finally, there is the issue that the insn trashes a         register because the literal target address has to be         loaded into a register.  %r10 seems a suitable victim.         (Can't use %r0, as use ops that interpret it as value zero). */      addHRegUse(u, HRmWrite, hregPPC_GPR10(mode64));      /* Upshot of this is that the assembler really must use %r10,         and no other, as a destination temporary. */      return;   }   case Pin_Goto:      addRegUsage_PPCRI(u, i->Pin.Goto.dst);      /* GPR3 holds destination address from Pin_Goto */      addHRegUse(u, HRmWrite, hregPPC_GPR3(mode64));      if (i->Pin.Goto.jk != Ijk_Boring          && i->Pin.Goto.jk != Ijk_Call          && i->Pin.Goto.jk != Ijk_Ret)            /* note, this is irrelevant since the guest state pointer               register is not actually available to the allocator.               But still .. */         addHRegUse(u, HRmWrite, GuestStatePtr(mode64));      return;   case Pin_CMov:      addRegUsage_PPCRI(u,  i->Pin.CMov.src);      addHRegUse(u, HRmWrite, i->Pin.CMov.dst);      return;   case Pin_Load:      addRegUsage_PPCAMode(u, i->Pin.Load.src);      addHRegUse(u, HRmWrite, i->Pin.Load.dst);      return;   case Pin_Store:      addHRegUse(u, HRmRead,  i->Pin.Store.src);      addRegUsage_PPCAMode(u, i->Pin.Store.dst);      return;   case Pin_Set:      addHRegUse(u, HRmWrite, i->Pin.Set.dst);      return;   case Pin_MfCR:      addHRegUse(u, HRmWrite, i->Pin.MfCR.dst);      return;   case Pin_MFence:      return;   case Pin_FpUnary:      addHRegUse(u, HRmWrite, i->Pin.FpUnary.dst);      addHRegUse(u, HRmRead,  i->Pin.FpUnary.src);      return;   case Pin_FpBinary:      addHRegUse(u, HRmWrite, i->Pin.FpBinary.dst);      addHRegUse(u, HRmRead,  i->Pin.FpBinary.srcL);      addHRegUse(u, HRmRead,  i->Pin.FpBinary.srcR);      return;   case Pin_FpMulAcc:      addHRegUse(u, HRmWrite, i->Pin.FpMulAcc.dst);      addHRegUse(u, HRmRead,  i->Pin.FpMulAcc.srcML);      addHRegUse(u, HRmRead,  i->Pin.FpMulAcc.srcMR);      addHRegUse(u, HRmRead,  i->Pin.FpMulAcc.srcAcc);      return;   case Pin_FpLdSt:      addHRegUse(u, (i->Pin.FpLdSt.isLoad ? HRmWrite : HRmRead),                 i->Pin.FpLdSt.reg);      addRegUsage_PPCAMode(u, i->Pin.FpLdSt.addr);      return;   case Pin_FpSTFIW:      addHRegUse(u, HRmRead, i->Pin.FpSTFIW.addr);      addHRegUse(u, HRmRead, i->Pin.FpSTFIW.data);      return;   case Pin_FpRSP:      addHRegUse(u, HRmWrite, i->Pin.FpRSP.dst);      addHRegUse(u, HRmRead,  i->Pin.FpRSP.src);      return;   case Pin_FpCftI:      addHRegUse(u, HRmWrite, i->Pin.FpCftI.dst);      addHRegUse(u, HRmRead,  i->Pin.FpCftI.src);      return;   case Pin_FpCMov:      addHRegUse(u, HRmModify, i->Pin.FpCMov.dst);      addHRegUse(u, HRmRead,   i->Pin.FpCMov.src);      return;   case Pin_FpLdFPSCR:      addHRegUse(u, HRmRead, i->Pin.FpLdFPSCR.src);      return;   case Pin_FpCmp:      addHRegUse(u, HRmWrite, i->Pin.FpCmp.dst);      addHRegUse(u, HRmRead,  i->Pin.FpCmp.srcL);      addHRegUse(u, HRmRead,  i->Pin.FpCmp.srcR);      return;   case Pin_RdWrLR:      addHRegUse(u, (i->Pin.RdWrLR.wrLR ? HRmRead : HRmWrite),                 i->Pin.RdWrLR.gpr);      return;   case Pin_AvLdSt:      addHRegUse(u, (i->Pin.AvLdSt.isLoad ? HRmWrite : HRmRead),                 i->Pin.AvLdSt.reg);      if (i->Pin.AvLdSt.addr->tag == Pam_IR)         addHRegUse(u, HRmWrite, hregPPC_GPR30(mode64));      addRegUsage_PPCAMode(u, i->Pin.AvLdSt.addr);      return;   case Pin_AvUnary:      addHRegUse(u, HRmWrite, i->Pin.AvUnary.dst);      addHRegUse(u, HRmRead,  i->Pin.AvUnary.src);      return;   case Pin_AvBinary:      if (i->Pin.AvBinary.op == Pav_XOR          && i->Pin.AvBinary.dst == i->Pin.AvBinary.srcL          && i->Pin.AvBinary.dst == i->Pin.AvBinary.srcR) {         /* reg-alloc needs to understand 'xor r,r,r' as a write of r */         /* (as opposed to a rite of passage :-) */         addHRegUse(u, HRmWrite, i->Pin.AvBinary.dst);      } else {         addHRegUse(u, HRmWrite, i->Pin.AvBinary.dst);         addHRegUse(u, HRmRead,  i->Pin.AvBinary.srcL);         addHRegUse(u, HRmRead,  i->Pin.AvBinary.srcR);      }      return;   case Pin_AvBin8x16:      addHRegUse(u, HRmWrite, i->Pin.AvBin8x16.dst);      addHRegUse(u, HRmRead,  i->Pin.AvBin8x16.srcL);      addHRegUse(u, HRmRead,  i->Pin.AvBin8x16.srcR);      return;   case Pin_AvBin16x8:      addHRegUse(u, HRmWrite, i->Pin.AvBin16x8.dst);      addHRegUse(u, HRmRead,  i->Pin.AvBin16x8.srcL);      addHRegUse(u, HRmRead,  i->Pin.AvBin16x8.srcR);      return;   case Pin_AvBin32x4:      addHRegUse(u, HRmWrite, i->Pin.AvBin32x4.dst);      addHRegUse(u, HRmRead,  i->Pin.AvBin32x4.srcL);      addHRegUse(u, HRmRead,  i->Pin.AvBin32x4.srcR);      return;   case Pin_AvBin32Fx4:      addHRegUse(u, HRmWrite, i->Pin.AvBin32Fx4.dst);      addHRegUse(u, HRmRead,  i->Pin.AvBin32Fx4.srcL);      addHRegUse(u, HRmRead,  i->Pin.AvBin32Fx4.srcR);      if (i->Pin.AvBin32Fx4.op == Pavfp_MULF)         addHRegUse(u, HRmWrite, hregPPC_VR29());      return;   case Pin_AvUn32Fx4:      addHRegUse(u, HRmWrite, i->Pin.AvUn32Fx4.dst);      addHRegUse(u, HRmRead,  i->Pin.AvUn32Fx4.src);      return;   case Pin_AvPerm:      addHRegUse(u, HRmWrite, i->Pin.AvPerm.dst);      addHRegUse(u, HRmRead,  i->Pin.AvPerm.srcL);      addHRegUse(u, HRmRead,  i->Pin.AvPerm.srcR);      addHRegUse(u, HRmRead,  i->Pin.AvPerm.ctl);      return;   case Pin_AvSel:      addHRegUse(u, HRmWrite, i->Pin.AvSel.dst);      addHRegUse(u, HRmRead,  i->Pin.AvSel.ctl);      addHRegUse(u, HRmRead,  i->Pin.AvSel.srcL);      addHRegUse(u, HRmRead,  i->Pin.AvSel.srcR);      return;   case Pin_AvShlDbl:      addHRegUse(u, HRmWrite, i->Pin.AvShlDbl.dst);      addHRegUse(u, HRmRead,  i->Pin.AvShlDbl.srcL);      addHRegUse(u, HRmRead,  i->Pin.AvShlDbl.srcR);      return;   case Pin_AvSplat:      addHRegUse(u, HRmWrite, i->Pin.AvSplat.dst);      addRegUsage_PPCVI5s(u,  i->Pin.AvSplat.src);      return;   case Pin_AvCMov:      addHRegUse(u, HRmModify, i->Pin.AvCMov.dst);      addHRegUse(u, HRmRead,   i->Pin.AvCMov.src);      return;   case Pin_AvLdVSCR:      addHRegUse(u, HRmRead, i->Pin.AvLdVSCR.src);      return;   default:      ppPPCInstr(i, mode64);      vpanic("getRegUsage_PPCInstr");   }}/* local helper */static void mapReg( HRegRemap* m, HReg* r ){   *r = lookupHRegRemap(m, *r);}void mapRegs_PPCInstr ( HRegRemap* m, PPCInstr* i, Bool mode64 ){   switch (i->tag) {   case Pin_LI:      mapReg(m, &i->Pin.LI.dst);      return;   case Pin_Alu:      mapReg(m, &i->Pin.Alu.dst);      mapReg(m, &i->Pin.Alu.srcL);      mapRegs_PPCRH(m, i->Pin.Alu.srcR);      return;   case Pin_Shft:      mapReg(m, &i->Pin.Shft.dst);      mapReg(m, &i->Pin.Shft.srcL);      mapRegs_PPCRH(m, i->Pin.Shft.srcR);      return;   case Pin_AddSubC:      mapReg(m, &i->Pin.AddSubC.dst);      mapReg(m, &i->Pin.AddSubC.srcL);      mapReg(m, &i->Pin.AddSubC.srcR);      return;   case Pin_Cmp:      mapReg(m, &i->Pin.Cmp.srcL);      mapRegs_PPCRH(m, i->Pin.Cmp.srcR);      return;   case Pin_Unary:      mapReg(m

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -