コード例 #1
0
ファイル: vexmem.cpp プロジェクト: bengheng/Expose
IRExpr* vx_dopyIRExpr ( IRExpr* e )
{
   switch (e->tag) {
      case Iex_Get: 
         return vx_IRExpr_Get(e->Iex.Get.offset, e->Iex.Get.ty);
      case Iex_GetI: 
         return vx_IRExpr_GetI(vx_dopyIRRegArray(e->Iex.GetI.descr), 
                            vx_dopyIRExpr(e->Iex.GetI.ix),
                            e->Iex.GetI.bias);
      case Iex_RdTmp: 
        return vx_IRExpr_Tmp(e->Iex.RdTmp.tmp);
      case Iex_Qop: 
         return vx_IRExpr_Qop(e->Iex.Qop.op,
                           vx_dopyIRExpr(e->Iex.Qop.arg1),
                           vx_dopyIRExpr(e->Iex.Qop.arg2),
                           vx_dopyIRExpr(e->Iex.Qop.arg3),
                           vx_dopyIRExpr(e->Iex.Qop.arg4));
      case Iex_Triop: 
         return vx_IRExpr_Triop(e->Iex.Triop.op,
                             vx_dopyIRExpr(e->Iex.Triop.arg1),
                             vx_dopyIRExpr(e->Iex.Triop.arg2),
                             vx_dopyIRExpr(e->Iex.Triop.arg3));
      case Iex_Binop: 
         return vx_IRExpr_Binop(e->Iex.Binop.op,
                             vx_dopyIRExpr(e->Iex.Binop.arg1),
                             vx_dopyIRExpr(e->Iex.Binop.arg2));
      case Iex_Unop: 
         return vx_IRExpr_Unop(e->Iex.Unop.op,
                            vx_dopyIRExpr(e->Iex.Unop.arg));
      case Iex_Load: 
         return vx_IRExpr_Load(e->Iex.Load.end,
                            e->Iex.Load.ty,
                            vx_dopyIRExpr(e->Iex.Load.addr));
      case Iex_Const: 
         return vx_IRExpr_Const(vx_dopyIRConst(e->Iex.Const.con));
      case Iex_CCall:
         return vx_IRExpr_CCall(vx_dopyIRCallee(e->Iex.CCall.cee),
                             e->Iex.CCall.retty,
                             vx_dopyIRExprVec(e->Iex.CCall.args));

      case Iex_Mux0X: 
         return vx_IRExpr_Mux0X(vx_dopyIRExpr(e->Iex.Mux0X.cond),
                             vx_dopyIRExpr(e->Iex.Mux0X.expr0),
                             vx_dopyIRExpr(e->Iex.Mux0X.exprX));
      default:
         vx_panic("vx_dopyIRExpr");
   }

   return NULL;
}
コード例 #2
0
ファイル: vexmem.cpp プロジェクト: bengheng/Expose
IRConst* vx_dopyIRConst ( IRConst* c )
{
   switch (c->tag) {
      case Ico_U1:   return vx_IRConst_U1(c->Ico.U1);
      case Ico_U8:   return vx_IRConst_U8(c->Ico.U8);
      case Ico_U16:  return vx_IRConst_U16(c->Ico.U16);
      case Ico_U32:  return vx_IRConst_U32(c->Ico.U32);
      case Ico_U64:  return vx_IRConst_U64(c->Ico.U64);
      case Ico_F64:  return vx_IRConst_F64(c->Ico.F64);
      case Ico_F64i: return vx_IRConst_F64i(c->Ico.F64i);
      case Ico_V128: return vx_IRConst_V128(c->Ico.V128);
      default: vx_panic("vx_dopyIRConst");
   }

   return NULL;
}
コード例 #3
0
ファイル: vexmem.cpp プロジェクト: bengheng/Expose
IRStmt* vx_dopyIRStmt ( IRStmt* s )
{
   switch (s->tag) {
      case Ist_NoOp:
         return vx_IRStmt_NoOp();
      case Ist_AbiHint:
         return vx_IRStmt_AbiHint(vx_dopyIRExpr(s->Ist.AbiHint.base),
                               s->Ist.AbiHint.len);
      case Ist_IMark:
         return vx_IRStmt_IMark(s->Ist.IMark.addr, s->Ist.IMark.len);
      case Ist_Put: 
         return vx_IRStmt_Put(s->Ist.Put.offset, 
                           vx_dopyIRExpr(s->Ist.Put.data));
      case Ist_PutI: 
         return vx_IRStmt_PutI(vx_dopyIRRegArray(s->Ist.PutI.descr),
                            vx_dopyIRExpr(s->Ist.PutI.ix),
                            s->Ist.PutI.bias, 
                            vx_dopyIRExpr(s->Ist.PutI.data));
      case Ist_WrTmp:
         return vx_IRStmt_Tmp(s->Ist.WrTmp.tmp,
                           vx_dopyIRExpr(s->Ist.WrTmp.data));
      case Ist_Store: 
         return vx_IRStmt_Store(s->Ist.Store.end,
                             vx_dopyIRExpr(s->Ist.Store.addr),
                             vx_dopyIRExpr(s->Ist.Store.data));
      case Ist_Dirty: 
         return vx_IRStmt_Dirty(vx_dopyIRDirty(s->Ist.Dirty.details));
      case Ist_MFence:
         return vx_IRStmt_MFence();
      case Ist_Exit: 
         return vx_IRStmt_Exit(vx_dopyIRExpr(s->Ist.Exit.guard),
                            s->Ist.Exit.jk,
                            vx_dopyIRConst(s->Ist.Exit.dst));
      default: 
         vx_panic("vx_dopyIRStmt");
   }

   return NULL;
}
コード例 #4
0
IRStmt* vx_dopyIRStmt ( IRStmt* s )
{
   switch (s->tag) {
      case Ist_NoOp:
         return vx_IRStmt_NoOp();
      case Ist_AbiHint:
         return vx_IRStmt_AbiHint(vx_dopyIRExpr(s->Ist.AbiHint.base),
				  s->Ist.AbiHint.len,
#if VEX_VERSION >= 1832
				  s->Ist.AbiHint.nia
#else
				  0
#endif
				  );
      case Ist_IMark:
         return vx_IRStmt_IMark(s->Ist.IMark.addr, s->Ist.IMark.len,
#if VEX_VERSION >= 2153
				s->Ist.IMark.delta
#else
				0
#endif
				);
      case Ist_Put: 
         return vx_IRStmt_Put(s->Ist.Put.offset, 
                           vx_dopyIRExpr(s->Ist.Put.data));
      case Ist_PutI: 
#if VEX_VERSION < 2361
         return vx_IRStmt_PutI(vx_dopyIRRegArray(s->Ist.PutI.descr),
                            vx_dopyIRExpr(s->Ist.PutI.ix),
                            s->Ist.PutI.bias, 
                            vx_dopyIRExpr(s->Ist.PutI.data));
#else
         return vx_IRStmt_PutI(vx_dopyIRRegArray(s->Ist.PutI.details->descr),
                            vx_dopyIRExpr(s->Ist.PutI.details->ix),
                            s->Ist.PutI.details->bias, 
                            vx_dopyIRExpr(s->Ist.PutI.details->data));
#endif
      case Ist_WrTmp:
         return vx_IRStmt_Tmp(s->Ist.WrTmp.tmp,
                           vx_dopyIRExpr(s->Ist.WrTmp.data));
      case Ist_Store: 
         return vx_IRStmt_Store(s->Ist.Store.end,
                             vx_dopyIRExpr(s->Ist.Store.addr),
                             vx_dopyIRExpr(s->Ist.Store.data));
      case Ist_Dirty: 
         return vx_IRStmt_Dirty(vx_dopyIRDirty(s->Ist.Dirty.details));
#if LIBASMIR_VEX_VERSION < 1793
      case Ist_MFence:
         return vx_IRStmt_MFence();
#else
      case Ist_MBE:
         return vx_IRStmt_MBE(s->Ist.MBE.event);
#endif
      case Ist_Exit: 
         return vx_IRStmt_Exit(vx_dopyIRExpr(s->Ist.Exit.guard),
                            s->Ist.Exit.jk,
                            vx_dopyIRConst(s->Ist.Exit.dst));
#if VEX_VERSION >= 1901
      case Ist_CAS:
	 return vx_IRStmt_CAS(vx_dopyIRCAS(s->Ist.CAS.details));
#endif
#if VEX_VERSION >= 1930
      case Ist_LLSC:
	 {
	    IRExpr* addr = s->Ist.LLSC.addr;
	    IRExpr* addr2 = addr ? vx_dopyIRExpr(addr) : NULL;
	    IRExpr* storedata = s->Ist.LLSC.storedata;
	    IRExpr* storedata2 = storedata ? vx_dopyIRExpr(storedata) : NULL;
	    return vx_IRStmt_LLSC(s->Ist.LLSC.end, s->Ist.LLSC.result,
				  addr2, storedata2);
	 }
#endif
#if VEX_VERSION >= 2642
      case Ist_StoreG: {
         const IRStoreG* sg = s->Ist.StoreG.details;
         return vx_IRStmt_StoreG(sg->end,
				 vx_dopyIRExpr(sg->addr),
				 vx_dopyIRExpr(sg->data),
				 vx_dopyIRExpr(sg->guard));
      }
      case Ist_LoadG: {
         const IRLoadG* lg = s->Ist.LoadG.details;
         return vx_IRStmt_LoadG(lg->end, lg->cvt, lg->dst,
				vx_dopyIRExpr(lg->addr),
				vx_dopyIRExpr(lg->alt),
				vx_dopyIRExpr(lg->guard));
      }
#endif
      default: 
         vx_panic("vx_dopyIRStmt");
   }

   return NULL;
}
コード例 #5
0
IRExpr* vx_dopyIRExpr ( IRExpr* e )
{
   switch (e->tag) {
      case Iex_Get: 
         return vx_IRExpr_Get(e->Iex.Get.offset, e->Iex.Get.ty);
      case Iex_GetI: 
         return vx_IRExpr_GetI(vx_dopyIRRegArray(e->Iex.GetI.descr), 
                            vx_dopyIRExpr(e->Iex.GetI.ix),
                            e->Iex.GetI.bias);
      case Iex_RdTmp: 
        return vx_IRExpr_Tmp(e->Iex.RdTmp.tmp);
      case Iex_Qop: 
#if VEX_VERSION < 2363
	return vx_IRExpr_Qop(e->Iex.Qop.op,
                           vx_dopyIRExpr(e->Iex.Qop.arg1),
                           vx_dopyIRExpr(e->Iex.Qop.arg2),
                           vx_dopyIRExpr(e->Iex.Qop.arg3),
                           vx_dopyIRExpr(e->Iex.Qop.arg4));
#else
	return vx_IRExpr_Qop(e->Iex.Qop.details->op,
                           vx_dopyIRExpr(e->Iex.Qop.details->arg1),
                           vx_dopyIRExpr(e->Iex.Qop.details->arg2),
                           vx_dopyIRExpr(e->Iex.Qop.details->arg3),
                           vx_dopyIRExpr(e->Iex.Qop.details->arg4));
#endif
      case Iex_Triop: 
#if VEX_VERSION < 2366
        return vx_IRExpr_Triop(e->Iex.Triop.op,
                             vx_dopyIRExpr(e->Iex.Triop.arg1),
                             vx_dopyIRExpr(e->Iex.Triop.arg2),
                             vx_dopyIRExpr(e->Iex.Triop.arg3));
#else
        return vx_IRExpr_Triop(e->Iex.Triop.details->op,
                             vx_dopyIRExpr(e->Iex.Triop.details->arg1),
                             vx_dopyIRExpr(e->Iex.Triop.details->arg2),
                             vx_dopyIRExpr(e->Iex.Triop.details->arg3));
#endif
      case Iex_Binop: 
         return vx_IRExpr_Binop(e->Iex.Binop.op,
                             vx_dopyIRExpr(e->Iex.Binop.arg1),
                             vx_dopyIRExpr(e->Iex.Binop.arg2));
      case Iex_Unop: 
         return vx_IRExpr_Unop(e->Iex.Unop.op,
                            vx_dopyIRExpr(e->Iex.Unop.arg));
      case Iex_Load: 
         return vx_IRExpr_Load(e->Iex.Load.end,
                            e->Iex.Load.ty,
                            vx_dopyIRExpr(e->Iex.Load.addr));
      case Iex_Const: 
         return vx_IRExpr_Const(vx_dopyIRConst(e->Iex.Const.con));
      case Iex_CCall:
         return vx_IRExpr_CCall(vx_dopyIRCallee(e->Iex.CCall.cee),
                             e->Iex.CCall.retty,
                             vx_dopyIRExprVec(e->Iex.CCall.args));

#if VEX_VERSION < 2668
      case Iex_Mux0X: 
         return vx_IRExpr_Mux0X(vx_dopyIRExpr(e->Iex.Mux0X.cond),
                             vx_dopyIRExpr(e->Iex.Mux0X.expr0),
                             vx_dopyIRExpr(e->Iex.Mux0X.exprX));
#else
      case Iex_ITE: 
         return vx_IRExpr_ITE(vx_dopyIRExpr(e->Iex.ITE.cond),
                             vx_dopyIRExpr(e->Iex.ITE.iftrue),
                             vx_dopyIRExpr(e->Iex.ITE.iffalse));
#endif
#if VEX_VERSION >= 2742
      case Iex_VECRET:
         return vx_IRExpr_VECRET();
      case Iex_BBPTR:
         return vx_IRExpr_BBPTR();
#endif
      default:
         vx_panic("Unhandled type in vx_dopyIRExpr");
   }

   return NULL;
}