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

📄 hdefs.c

📁 The Valgrind distribution has multiple tools. The most popular is the memory checking tool (called M
💻 C
📖 第 1 页 / 共 5 页
字号:
         ppHRegPPC(dst);         vex_printf(",");         ppHRegPPC(dst);         vex_printf(",0x%x", (UInt)(imm >>  0) & 0xFFFF);      }   }#endif}static void ppMovReg ( HReg dst, HReg src ) {   if (hregNumber(dst) != hregNumber(src)) {      vex_printf("mr ");      ppHRegPPC(dst);      vex_printf(",");      ppHRegPPC(src);   }}void ppPPCInstr ( PPCInstr* i, Bool mode64 ){   switch (i->tag) {   case Pin_LI:      ppLoadImm(i->Pin.LI.dst, i->Pin.LI.imm64, mode64);      break;   case Pin_Alu: {      HReg   r_srcL  = i->Pin.Alu.srcL;      PPCRH* rh_srcR = i->Pin.Alu.srcR;      /* special-case "mr" */      if (i->Pin.Alu.op == Palu_OR &&   // or Rd,Rs,Rs == mr Rd,Rs          rh_srcR->tag == Prh_Reg &&          rh_srcR->Prh.Reg.reg == r_srcL) {         vex_printf("mr ");         ppHRegPPC(i->Pin.Alu.dst);         vex_printf(",");         ppHRegPPC(r_srcL);         return;      }      /* special-case "li" */      if (i->Pin.Alu.op == Palu_ADD &&   // addi Rd,0,imm == li Rd,imm          rh_srcR->tag == Prh_Imm &&          hregNumber(r_srcL) == 0) {         vex_printf("li ");         ppHRegPPC(i->Pin.Alu.dst);         vex_printf(",");         ppPPCRH(rh_srcR);         return;      }      /* generic */      vex_printf("%s ", showPPCAluOp(i->Pin.Alu.op,                                     toBool(rh_srcR->tag == Prh_Imm)));      ppHRegPPC(i->Pin.Alu.dst);      vex_printf(",");      ppHRegPPC(r_srcL);      vex_printf(",");      ppPPCRH(rh_srcR);      return;   }   case Pin_Shft: {      HReg   r_srcL  = i->Pin.Shft.srcL;      PPCRH* rh_srcR = i->Pin.Shft.srcR;      vex_printf("%s ", showPPCShftOp(i->Pin.Shft.op,                                      toBool(rh_srcR->tag == Prh_Imm),                                      i->Pin.Shft.sz32));      ppHRegPPC(i->Pin.Shft.dst);      vex_printf(",");      ppHRegPPC(r_srcL);      vex_printf(",");      ppPPCRH(rh_srcR);      return;   }   case Pin_AddSubC:      vex_printf("%s%s ",                 i->Pin.AddSubC.isAdd ? "add" : "sub",                 i->Pin.AddSubC.setC ? "c" : "e");      ppHRegPPC(i->Pin.AddSubC.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AddSubC.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AddSubC.srcR);      return;   case Pin_Cmp:      vex_printf("%s%c%s %%cr%u,",                 i->Pin.Cmp.syned ? "cmp" : "cmpl",                 i->Pin.Cmp.sz32 ? 'w' : 'd',                 i->Pin.Cmp.srcR->tag == Prh_Imm ? "i" : "",                 i->Pin.Cmp.crfD);      ppHRegPPC(i->Pin.Cmp.srcL);      vex_printf(",");      ppPPCRH(i->Pin.Cmp.srcR);      return;   case Pin_Unary:      vex_printf("%s ", showPPCUnaryOp(i->Pin.Unary.op));      ppHRegPPC(i->Pin.Unary.dst);      vex_printf(",");      ppHRegPPC(i->Pin.Unary.src);      return;   case Pin_MulL:      vex_printf("mul%c%c%s ",                 i->Pin.MulL.hi ? 'h' : 'l',                 i->Pin.MulL.sz32 ? 'w' : 'd',                 i->Pin.MulL.hi ? (i->Pin.MulL.syned ? "s" : "u") : "");      ppHRegPPC(i->Pin.MulL.dst);      vex_printf(",");      ppHRegPPC(i->Pin.MulL.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.MulL.srcR);      return;   case Pin_Div:      vex_printf("div%c%s ",                 i->Pin.Div.sz32 ? 'w' : 'd',                 i->Pin.Div.syned ? "" : "u");      ppHRegPPC(i->Pin.Div.dst);      vex_printf(",");      ppHRegPPC(i->Pin.Div.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.Div.srcR);      return;   case Pin_Call: {      Int n;      vex_printf("call: ");      if (i->Pin.Call.cond.test != Pct_ALWAYS) {         vex_printf("if (%s) ", showPPCCondCode(i->Pin.Call.cond));      }      vex_printf("{ ");      ppLoadImm(hregPPC_GPR10(mode64), i->Pin.Call.target, mode64);      vex_printf(" ; mtctr r10 ; bctrl [");      for (n = 0; n < 32; n++) {         if (i->Pin.Call.argiregs & (1<<n)) {            vex_printf("r%d", n);            if ((i->Pin.Call.argiregs >> n) > 1)               vex_printf(",");         }      }      vex_printf("] }");      break;   }   case Pin_Goto:      vex_printf("goto: ");      if (i->Pin.Goto.cond.test != Pct_ALWAYS) {         vex_printf("if (%s) ", showPPCCondCode(i->Pin.Goto.cond));      }      vex_printf("{ ");      if (i->Pin.Goto.jk != Ijk_Boring          && i->Pin.Goto.jk != Ijk_Call          && i->Pin.Goto.jk != Ijk_Ret) {         vex_printf("li %%r31,$");         ppIRJumpKind(i->Pin.Goto.jk);         vex_printf(" ; ");      }      if (i->Pin.Goto.dst->tag == Pri_Imm) {         ppLoadImm(hregPPC_GPR3(mode64), i->Pin.Goto.dst->Pri.Imm,                   mode64);      } else {         ppMovReg(hregPPC_GPR3(mode64), i->Pin.Goto.dst->Pri.Reg);      }      vex_printf(" ; blr }");      return;   case Pin_CMov:      vex_printf("cmov (%s) ", showPPCCondCode(i->Pin.CMov.cond));      ppHRegPPC(i->Pin.CMov.dst);      vex_printf(",");      ppPPCRI(i->Pin.CMov.src);      vex_printf(": ");      if (i->Pin.CMov.cond.test != Pct_ALWAYS) {         vex_printf("if (%s) ", showPPCCondCode(i->Pin.CMov.cond));      }      vex_printf("{ ");      if (i->Pin.CMov.src->tag == Pri_Imm) {         ppLoadImm(i->Pin.CMov.dst, i->Pin.CMov.src->Pri.Imm, mode64);      } else {         ppMovReg(i->Pin.CMov.dst, i->Pin.CMov.src->Pri.Reg);      }      vex_printf(" }");      return;   case Pin_Load: {      Bool idxd = toBool(i->Pin.Load.src->tag == Pam_RR);      UChar sz = i->Pin.Load.sz;      UChar c_sz = sz==1 ? 'b' : sz==2 ? 'h' : sz==4 ? 'w' : 'd';      vex_printf("l%cz%s ", c_sz, idxd ? "x" : "" );      ppHRegPPC(i->Pin.Load.dst);      vex_printf(",");      ppPPCAMode(i->Pin.Load.src);      return;   }   case Pin_Store: {      UChar sz = i->Pin.Store.sz;      Bool idxd = toBool(i->Pin.Store.dst->tag == Pam_RR);      UChar c_sz = sz==1 ? 'b' : sz==2 ? 'h' : sz==4 ? 'w' : /*8*/ 'd';      vex_printf("st%c%s ", c_sz, idxd ? "x" : "" );      ppHRegPPC(i->Pin.Store.src);      vex_printf(",");      ppPPCAMode(i->Pin.Store.dst);      return;   }   case Pin_Set: {      PPCCondCode cc = i->Pin.Set.cond;      vex_printf("set (%s),", showPPCCondCode(cc));      ppHRegPPC(i->Pin.Set.dst);      if (cc.test == Pct_ALWAYS) {         vex_printf(": { li ");         ppHRegPPC(i->Pin.Set.dst);         vex_printf(",1 }");      } else {         vex_printf(": { mfcr r0 ; rlwinm ");         ppHRegPPC(i->Pin.Set.dst);         vex_printf(",r0,%u,31,31", cc.flag+1);         if (cc.test == Pct_FALSE) {            vex_printf("; xori ");            ppHRegPPC(i->Pin.Set.dst);            vex_printf(",");            ppHRegPPC(i->Pin.Set.dst);            vex_printf(",1");         }         vex_printf(" }");      }      return;   }   case Pin_MfCR:      vex_printf("mfcr ");      ppHRegPPC(i->Pin.MfCR.dst);      break;   case Pin_MFence:      vex_printf("mfence (=sync)");      return;   case Pin_FpUnary:      vex_printf("%s ", showPPCFpOp(i->Pin.FpUnary.op));      ppHRegPPC(i->Pin.FpUnary.dst);      vex_printf(",");      ppHRegPPC(i->Pin.FpUnary.src);      return;   case Pin_FpBinary:      vex_printf("%s ", showPPCFpOp(i->Pin.FpBinary.op));      ppHRegPPC(i->Pin.FpBinary.dst);      vex_printf(",");      ppHRegPPC(i->Pin.FpBinary.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.FpBinary.srcR);      return;   case Pin_FpMulAcc:      vex_printf("%s ", showPPCFpOp(i->Pin.FpMulAcc.op));      ppHRegPPC(i->Pin.FpMulAcc.dst);      vex_printf(",");      ppHRegPPC(i->Pin.FpMulAcc.srcML);      vex_printf(",");      ppHRegPPC(i->Pin.FpMulAcc.srcMR);      vex_printf(",");      ppHRegPPC(i->Pin.FpMulAcc.srcAcc);      return;   case Pin_FpLdSt: {      UChar sz = i->Pin.FpLdSt.sz;      Bool idxd = toBool(i->Pin.FpLdSt.addr->tag == Pam_RR);      if (i->Pin.FpLdSt.isLoad) {         vex_printf("lf%c%s ",                    (sz==4 ? 's' : 'd'),                    idxd ? "x" : "" );         ppHRegPPC(i->Pin.FpLdSt.reg);         vex_printf(",");         ppPPCAMode(i->Pin.FpLdSt.addr);      } else {         vex_printf("stf%c%s ",                    (sz==4 ? 's' : 'd'),                    idxd ? "x" : "" );         ppHRegPPC(i->Pin.FpLdSt.reg);         vex_printf(",");         ppPPCAMode(i->Pin.FpLdSt.addr);      }      return;   }   case Pin_FpSTFIW:      vex_printf("stfiwz ");      ppHRegPPC(i->Pin.FpSTFIW.data);      vex_printf(",0(");      ppHRegPPC(i->Pin.FpSTFIW.addr);      vex_printf(")");      return;   case Pin_FpRSP:      vex_printf("frsp ");      ppHRegPPC(i->Pin.FpRSP.dst);      vex_printf(",");      ppHRegPPC(i->Pin.FpRSP.src);      return;   case Pin_FpCftI: {      HChar* str = "fc???";      if (i->Pin.FpCftI.fromI == False && i->Pin.FpCftI.int32 == False)         str = "fctid";      else      if (i->Pin.FpCftI.fromI == False && i->Pin.FpCftI.int32 == True)         str = "fctiw";      else      if (i->Pin.FpCftI.fromI == True && i->Pin.FpCftI.int32 == False)         str = "fcfid";      vex_printf("%s ", str);      ppHRegPPC(i->Pin.FpCftI.dst);      vex_printf(",");      ppHRegPPC(i->Pin.FpCftI.src);      return;   }   case Pin_FpCMov:      vex_printf("fpcmov (%s) ", showPPCCondCode(i->Pin.FpCMov.cond));      ppHRegPPC(i->Pin.FpCMov.dst);      vex_printf(",");      ppHRegPPC(i->Pin.FpCMov.src);      vex_printf(": ");      vex_printf("if (fr_dst != fr_src) { ");      if (i->Pin.FpCMov.cond.test != Pct_ALWAYS) {         vex_printf("if (%s) { ", showPPCCondCode(i->Pin.FpCMov.cond));      }      vex_printf("fmr ");      ppHRegPPC(i->Pin.FpCMov.dst);      vex_printf(",");      ppHRegPPC(i->Pin.FpCMov.src);      if (i->Pin.FpCMov.cond.test != Pct_ALWAYS)         vex_printf(" }");      vex_printf(" }");      return;   case Pin_FpLdFPSCR:      vex_printf("mtfsf 0xFF,");      ppHRegPPC(i->Pin.FpLdFPSCR.src);      return;   case Pin_FpCmp:      vex_printf("fcmpo %%cr1,");      ppHRegPPC(i->Pin.FpCmp.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.FpCmp.srcR);      vex_printf("; mfcr ");      ppHRegPPC(i->Pin.FpCmp.dst);      vex_printf("; rlwinm ");      ppHRegPPC(i->Pin.FpCmp.dst);      vex_printf(",");      ppHRegPPC(i->Pin.FpCmp.dst);      vex_printf(",8,28,31");      return;   case Pin_RdWrLR:      vex_printf("%s ", i->Pin.RdWrLR.wrLR ? "mtlr" : "mflr");      ppHRegPPC(i->Pin.RdWrLR.gpr);      return;   case Pin_AvLdSt: {      UChar  sz = i->Pin.AvLdSt.sz;      HChar* str_size;      if (i->Pin.AvLdSt.addr->tag == Pam_IR) {         ppLoadImm(hregPPC_GPR30(mode64),                   i->Pin.AvLdSt.addr->Pam.RR.index, mode64);         vex_printf(" ; ");      }      str_size = sz==1 ? "eb" : sz==2 ? "eh" : sz==4 ? "ew" : "";      if (i->Pin.AvLdSt.isLoad)         vex_printf("lv%sx ", str_size);      else         vex_printf("stv%sx ", str_size);      ppHRegPPC(i->Pin.AvLdSt.reg);      vex_printf(",");      if (i->Pin.AvLdSt.addr->tag == Pam_IR)         vex_printf("%%r30");      else          ppHRegPPC(i->Pin.AvLdSt.addr->Pam.RR.index);      vex_printf(",");      ppHRegPPC(i->Pin.AvLdSt.addr->Pam.RR.base);      return;   }   case Pin_AvUnary:      vex_printf("%s ", showPPCAvOp(i->Pin.AvUnary.op));      ppHRegPPC(i->Pin.AvUnary.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvUnary.src);      return;   case Pin_AvBinary:      vex_printf("%s ", showPPCAvOp(i->Pin.AvBinary.op));      ppHRegPPC(i->Pin.AvBinary.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvBinary.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AvBinary.srcR);      return;   case Pin_AvBin8x16:      vex_printf("%s(b) ", showPPCAvOp(i->Pin.AvBin8x16.op));      ppHRegPPC(i->Pin.AvBin8x16.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvBin8x16.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AvBin8x16.srcR);      return;   case Pin_AvBin16x8:      vex_printf("%s(h) ", showPPCAvOp(i->Pin.AvBin16x8.op));      ppHRegPPC(i->Pin.AvBin16x8.dst);      vex_printf(",");      ppHRegPPC(i->Pin.AvBin16x8.srcL);      vex_printf(",");      ppHRegPPC(i->Pin.AvBin16x8.srcR);      return;   case Pin_AvBin32x4:

⌨️ 快捷键说明

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