Ejemplo n.º 1
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);
      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;
}
Ejemplo n.º 2
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);
    
    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.details->descr),
                              vx_dopyIRExpr(s->Ist.PutI.details->ix),
                              s->Ist.PutI.details->bias,
                              vx_dopyIRExpr(s->Ist.PutI.details->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));
    
    case Ist_CAS:
    
        return vx_IRStmt_CAS(vx_dopyIRCAS(s->Ist.CAS.details));
    
    case Ist_LLSC:
    
        return vx_IRStmt_LLSC(s->Ist.LLSC.end,
                              s->Ist.LLSC.result,
                              vx_dopyIRExpr(s->Ist.LLSC.addr),
                              s->Ist.LLSC.storedata
                              ? vx_dopyIRExpr(s->Ist.LLSC.storedata)
                              : NULL);

    default:
    
        _panic("vx_dopyIRStmt(): unknown statement");
    }

    return NULL;
}
Ejemplo n.º 3
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;
}