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

📄 hdefs.c

📁 The Valgrind distribution has multiple tools. The most popular is the memory checking tool (called M
💻 C
📖 第 1 页 / 共 5 页
字号:
      vpanic("mapRegs_PPCAMode");   }}/* --------- Operand, which can be a reg or a u16/s16. --------- */PPCRH* PPCRH_Imm ( Bool syned, UShort imm16 ) {   PPCRH* op         = LibVEX_Alloc(sizeof(PPCRH));   op->tag           = Prh_Imm;   op->Prh.Imm.syned = syned;   op->Prh.Imm.imm16 = imm16;   /* If this is a signed value, ensure it's not -32768, so that we      are guaranteed always to be able to negate if needed. */   if (syned)      vassert(imm16 != 0x8000);   vassert(syned == True || syned == False);   return op;}PPCRH* PPCRH_Reg ( HReg reg ) {   PPCRH* op       = LibVEX_Alloc(sizeof(PPCRH));   op->tag         = Prh_Reg;   op->Prh.Reg.reg = reg;   return op;}void ppPPCRH ( PPCRH* op ) {   switch (op->tag) {   case Prh_Imm:       if (op->Prh.Imm.syned)         vex_printf("%d", (Int)(Short)op->Prh.Imm.imm16);      else         vex_printf("%u", (UInt)(UShort)op->Prh.Imm.imm16);      return;   case Prh_Reg:       ppHRegPPC(op->Prh.Reg.reg);      return;   default:       vpanic("ppPPCRH");   }}/* An PPCRH can only be used in a "read" context (what would it mean   to write or modify a literal?) and so we enumerate its registers   accordingly. */static void addRegUsage_PPCRH ( HRegUsage* u, PPCRH* op ) {   switch (op->tag) {   case Prh_Imm:       return;   case Prh_Reg:       addHRegUse(u, HRmRead, op->Prh.Reg.reg);      return;   default:       vpanic("addRegUsage_PPCRH");   }}static void mapRegs_PPCRH ( HRegRemap* m, PPCRH* op ) {   switch (op->tag) {   case Prh_Imm:       return;   case Prh_Reg:       op->Prh.Reg.reg = lookupHRegRemap(m, op->Prh.Reg.reg);      return;   default:       vpanic("mapRegs_PPCRH");   }}/* --------- Operand, which can be a reg or a u32/64. --------- */PPCRI* PPCRI_Imm ( ULong imm64 ) {   PPCRI* op   = LibVEX_Alloc(sizeof(PPCRI));   op->tag     = Pri_Imm;   op->Pri.Imm = imm64;   return op;}PPCRI* PPCRI_Reg ( HReg reg ) {   PPCRI* op   = LibVEX_Alloc(sizeof(PPCRI));   op->tag     = Pri_Reg;   op->Pri.Reg = reg;   return op;}void ppPPCRI ( PPCRI* dst ) {   switch (dst->tag) {      case Pri_Imm:          vex_printf("0x%llx", dst->Pri.Imm);         break;      case Pri_Reg:          ppHRegPPC(dst->Pri.Reg);         break;      default:          vpanic("ppPPCRI");   }}/* An PPCRI can only be used in a "read" context (what would it   mean to write or modify a literal?) and so we enumerate its   registers accordingly. */static void addRegUsage_PPCRI ( HRegUsage* u, PPCRI* dst ) {   switch (dst->tag) {      case Pri_Imm:          return;      case Pri_Reg:          addHRegUse(u, HRmRead, dst->Pri.Reg);         return;      default:          vpanic("addRegUsage_PPCRI");   }}static void mapRegs_PPCRI ( HRegRemap* m, PPCRI* dst ) {   switch (dst->tag) {      case Pri_Imm:          return;      case Pri_Reg:          dst->Pri.Reg = lookupHRegRemap(m, dst->Pri.Reg);         return;      default:          vpanic("mapRegs_PPCRI");   }}/* --------- Operand, which can be a vector reg or a simm5. --------- */PPCVI5s* PPCVI5s_Imm ( Char simm5 ) {   PPCVI5s* op   = LibVEX_Alloc(sizeof(PPCVI5s));   op->tag       = Pvi_Imm;   op->Pvi.Imm5s = simm5;   vassert(simm5 >= -16 && simm5 <= 15);   return op;}PPCVI5s* PPCVI5s_Reg ( HReg reg ) {   PPCVI5s* op = LibVEX_Alloc(sizeof(PPCVI5s));   op->tag     = Pvi_Reg;   op->Pvi.Reg = reg;   vassert(hregClass(reg) == HRcVec128);   return op;}void ppPPCVI5s ( PPCVI5s* src ) {   switch (src->tag) {      case Pvi_Imm:          vex_printf("%d", (Int)src->Pvi.Imm5s);         break;      case Pvi_Reg:          ppHRegPPC(src->Pvi.Reg);         break;      default:          vpanic("ppPPCVI5s");   }}/* An PPCVI5s can only be used in a "read" context (what would it   mean to write or modify a literal?) and so we enumerate its   registers accordingly. */static void addRegUsage_PPCVI5s ( HRegUsage* u, PPCVI5s* dst ) {   switch (dst->tag) {      case Pvi_Imm:          return;      case Pvi_Reg:          addHRegUse(u, HRmRead, dst->Pvi.Reg);         return;      default:          vpanic("addRegUsage_PPCVI5s");   }}static void mapRegs_PPCVI5s ( HRegRemap* m, PPCVI5s* dst ) {   switch (dst->tag) {      case Pvi_Imm:          return;      case Pvi_Reg:          dst->Pvi.Reg = lookupHRegRemap(m, dst->Pvi.Reg);         return;      default:          vpanic("mapRegs_PPCVI5s");   }}/* --------- Instructions. --------- */HChar* showPPCUnaryOp ( PPCUnaryOp op ) {   switch (op) {   case Pun_NOT:   return "not";   case Pun_NEG:   return "neg";   case Pun_CLZ32: return "cntlzw";   case Pun_CLZ64: return "cntlzd";   case Pun_EXTSW: return "extsw";   default: vpanic("showPPCUnaryOp");   }}HChar* showPPCAluOp ( PPCAluOp op, Bool immR ) {   switch (op) {      case Palu_ADD: return immR ? "addi"  : "add";      case Palu_SUB: return immR ? "subi"  : "sub";      case Palu_AND: return immR ? "andi." : "and";      case Palu_OR:  return immR ? "ori"   : "or";      case Palu_XOR: return immR ? "xori"  : "xor";      default: vpanic("showPPCAluOp");   }}HChar* showPPCShftOp ( PPCShftOp op, Bool immR, Bool sz32 ) {   switch (op) {      case Pshft_SHL: return sz32 ? (immR ? "slwi"  : "slw") :                                     (immR ? "sldi"  : "sld");      case Pshft_SHR: return sz32 ? (immR ? "srwi"  : "srw") :                                    (immR ? "srdi"  : "srd");      case Pshft_SAR: return sz32 ? (immR ? "srawi" : "sraw") :                                    (immR ? "sradi" : "srad");      default: vpanic("showPPCShftOp");   }}HChar* showPPCFpOp ( PPCFpOp op ) {   switch (op) {      case Pfp_ADDD:   return "fadd";      case Pfp_SUBD:   return "fsub";      case Pfp_MULD:   return "fmul";      case Pfp_DIVD:   return "fdiv";      case Pfp_MADDD:  return "fmadd";      case Pfp_MSUBD:  return "fmsub";      case Pfp_MADDS:  return "fmadds";      case Pfp_MSUBS:  return "fmsubs";      case Pfp_ADDS:   return "fadds";      case Pfp_SUBS:   return "fsubs";      case Pfp_MULS:   return "fmuls";      case Pfp_DIVS:   return "fdivs";      case Pfp_SQRT:   return "fsqrt";      case Pfp_ABS:    return "fabs";      case Pfp_NEG:    return "fneg";      case Pfp_MOV:    return "fmr";      case Pfp_RES:    return "fres";      case Pfp_RSQRTE: return "frsqrte";      default: vpanic("showPPCFpOp");   }}HChar* showPPCAvOp ( PPCAvOp op ) {   switch (op) {   /* Unary */   case Pav_MOV:       return "vmr";      /* Mov */        case Pav_AND:       return "vand";     /* Bitwise */   case Pav_OR:        return "vor";   case Pav_XOR:       return "vxor";   case Pav_NOT:       return "vnot";   case Pav_UNPCKH8S:  return "vupkhsb";  /* Unpack */   case Pav_UNPCKH16S: return "vupkhsh";   case Pav_UNPCKL8S:  return "vupklsb";   case Pav_UNPCKL16S: return "vupklsh";   case Pav_UNPCKHPIX: return "vupkhpx";   case Pav_UNPCKLPIX: return "vupklpx";   /* Integer binary */   case Pav_ADDU:      return "vaddu_m";  // b,h,w   case Pav_QADDU:     return "vaddu_s";  // b,h,w   case Pav_QADDS:     return "vadds_s";  // b,h,w        case Pav_SUBU:      return "vsubu_m";  // b,h,w   case Pav_QSUBU:     return "vsubu_s";  // b,h,w   case Pav_QSUBS:     return "vsubs_s";  // b,h,w        case Pav_OMULU:     return "vmulou";   // b,h   case Pav_OMULS:     return "vmulos";   // b,h   case Pav_EMULU:     return "vmuleu";   // b,h   case Pav_EMULS:     return "vmules";   // b,h     case Pav_AVGU:      return "vavgu";    // b,h,w   case Pav_AVGS:      return "vavgs";    // b,h,w        case Pav_MAXU:      return "vmaxu";    // b,h,w   case Pav_MAXS:      return "vmaxs";    // b,h,w        case Pav_MINU:      return "vminu";    // b,h,w   case Pav_MINS:      return "vmins";    // b,h,w        /* Compare (always affects CR field 6) */   case Pav_CMPEQU:    return "vcmpequ";  // b,h,w   case Pav_CMPGTU:    return "vcmpgtu";  // b,h,w   case Pav_CMPGTS:    return "vcmpgts";  // b,h,w   /* Shift */   case Pav_SHL:       return "vsl";      // ' ',b,h,w   case Pav_SHR:       return "vsr";      // ' ',b,h,w   case Pav_SAR:       return "vsra";     // b,h,w   case Pav_ROTL:      return "vrl";      // b,h,w   /* Pack */   case Pav_PACKUU:    return "vpku_um";  // h,w   case Pav_QPACKUU:   return "vpku_us";  // h,w   case Pav_QPACKSU:   return "vpks_us";  // h,w   case Pav_QPACKSS:   return "vpks_ss";  // h,w   case Pav_PACKPXL:   return "vpkpx";   /* Merge */   case Pav_MRGHI:     return "vmrgh";    // b,h,w   case Pav_MRGLO:     return "vmrgl";    // b,h,w   default: vpanic("showPPCAvOp");   }}HChar* showPPCAvFpOp ( PPCAvFpOp op ) {   switch (op) {   /* Floating Point Binary */   case Pavfp_ADDF:      return "vaddfp";   case Pavfp_SUBF:      return "vsubfp";   case Pavfp_MULF:      return "vmaddfp";   case Pavfp_MAXF:      return "vmaxfp";   case Pavfp_MINF:      return "vminfp";   case Pavfp_CMPEQF:    return "vcmpeqfp";   case Pavfp_CMPGTF:    return "vcmpgtfp";   case Pavfp_CMPGEF:    return "vcmpgefp";        /* Floating Point Unary */   case Pavfp_RCPF:      return "vrefp";   case Pavfp_RSQRTF:    return "vrsqrtefp";   case Pavfp_CVTU2F:    return "vcfux";   case Pavfp_CVTS2F:    return "vcfsx";   case Pavfp_QCVTF2U:   return "vctuxs";   case Pavfp_QCVTF2S:   return "vctsxs";   case Pavfp_ROUNDM:    return "vrfim";   case Pavfp_ROUNDP:    return "vrfip";   case Pavfp_ROUNDN:    return "vrfin";   case Pavfp_ROUNDZ:    return "vrfiz";   default: vpanic("showPPCAvFpOp");   }}PPCInstr* PPCInstr_LI ( HReg dst, ULong imm64, Bool mode64 ){   PPCInstr* i     = LibVEX_Alloc(sizeof(PPCInstr));   i->tag          = Pin_LI;   i->Pin.LI.dst   = dst;   i->Pin.LI.imm64 = imm64;   if (!mode64)      vassert( (Long)imm64 == (Long)(Int)(UInt)imm64 );   return i;}PPCInstr* PPCInstr_Alu ( PPCAluOp op, HReg dst,                          HReg srcL, PPCRH* srcR ) {   PPCInstr* i     = LibVEX_Alloc(sizeof(PPCInstr));   i->tag          = Pin_Alu;   i->Pin.Alu.op   = op;   i->Pin.Alu.dst  = dst;   i->Pin.Alu.srcL = srcL;   i->Pin.Alu.srcR = srcR;   return i;}PPCInstr* PPCInstr_Shft ( PPCShftOp op, Bool sz32,                           HReg dst, HReg srcL, PPCRH* srcR ) {   PPCInstr* i      = LibVEX_Alloc(sizeof(PPCInstr));   i->tag           = Pin_Shft;   i->Pin.Shft.op   = op;   i->Pin.Shft.sz32 = sz32;   i->Pin.Shft.dst  = dst;   i->Pin.Shft.srcL = srcL;   i->Pin.Shft.srcR = srcR;   return i;}PPCInstr* PPCInstr_AddSubC ( Bool isAdd, Bool setC,                             HReg dst, HReg srcL, HReg srcR ) {   PPCInstr* i          = LibVEX_Alloc(sizeof(PPCInstr));   i->tag               = Pin_AddSubC;   i->Pin.AddSubC.isAdd = isAdd;   i->Pin.AddSubC.setC  = setC;   i->Pin.AddSubC.dst   = dst;   i->Pin.AddSubC.srcL  = srcL;   i->Pin.AddSubC.srcR  = srcR;   return i;}PPCInstr* PPCInstr_Cmp ( Bool syned, Bool sz32,                          UInt crfD, HReg srcL, PPCRH* srcR ) {   PPCInstr* i      = LibVEX_Alloc(sizeof(PPCInstr));   i->tag           = Pin_Cmp;   i->Pin.Cmp.syned = syned;   i->Pin.Cmp.sz32  = sz32;   i->Pin.Cmp.crfD  = crfD;   i->Pin.Cmp.srcL  = srcL;   i->Pin.Cmp.srcR  = srcR;   return i;}PPCInstr* PPCInstr_Unary ( PPCUnaryOp op, HReg dst, HReg src ) {   PPCInstr* i      = LibVEX_Alloc(sizeof(PPCInstr));

⌨️ 快捷键说明

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