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

📄 irdefs.c

📁 unix下调试内存泄露的工具源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
IRConst* IRConst_V128 ( UShort con ){   IRConst* c  = LibVEX_Alloc(sizeof(IRConst));   c->tag      = Ico_V128;   c->Ico.V128 = con;   return c;}/* Constructors -- IRCallee */IRCallee* mkIRCallee ( Int regparms, HChar* name, void* addr ){   IRCallee* ce = LibVEX_Alloc(sizeof(IRCallee));   ce->regparms = regparms;   ce->name     = name;   ce->addr     = addr;   ce->mcx_mask = 0;   vassert(regparms >= 0 && regparms <= 3);   vassert(name != NULL);   vassert(addr != 0);   return ce;}/* Constructors -- IRArray */IRArray* mkIRArray ( Int base, IRType elemTy, Int nElems ){   IRArray* arr = LibVEX_Alloc(sizeof(IRArray));   arr->base    = base;   arr->elemTy  = elemTy;   arr->nElems  = nElems;   vassert(!(arr->base < 0 || arr->base > 10000 /* somewhat arbitrary */));   vassert(!(arr->elemTy == Ity_I1));   vassert(!(arr->nElems <= 0 || arr->nElems > 500 /* somewhat arbitrary */));   return arr;}/* Constructors -- IRExpr */IRExpr* IRExpr_Binder ( Int binder ) {   IRExpr* e            = LibVEX_Alloc(sizeof(IRExpr));   e->tag               = Iex_Binder;   e->Iex.Binder.binder = binder;   return e;}IRExpr* IRExpr_Get ( Int off, IRType ty ) {   IRExpr* e         = LibVEX_Alloc(sizeof(IRExpr));   e->tag            = Iex_Get;   e->Iex.Get.offset = off;   e->Iex.Get.ty     = ty;   return e;}IRExpr* IRExpr_GetI ( IRArray* descr, IRExpr* ix, Int bias ) {   IRExpr* e         = LibVEX_Alloc(sizeof(IRExpr));   e->tag            = Iex_GetI;   e->Iex.GetI.descr = descr;   e->Iex.GetI.ix    = ix;   e->Iex.GetI.bias  = bias;   return e;}IRExpr* IRExpr_Tmp ( IRTemp tmp ) {   IRExpr* e      = LibVEX_Alloc(sizeof(IRExpr));   e->tag         = Iex_Tmp;   e->Iex.Tmp.tmp = tmp;   return e;}IRExpr* IRExpr_Binop ( IROp op, IRExpr* arg1, IRExpr* arg2 ) {   IRExpr* e         = LibVEX_Alloc(sizeof(IRExpr));   e->tag            = Iex_Binop;   e->Iex.Binop.op   = op;   e->Iex.Binop.arg1 = arg1;   e->Iex.Binop.arg2 = arg2;   return e;}IRExpr* IRExpr_Unop ( IROp op, IRExpr* arg ) {   IRExpr* e       = LibVEX_Alloc(sizeof(IRExpr));   e->tag          = Iex_Unop;   e->Iex.Unop.op  = op;   e->Iex.Unop.arg = arg;   return e;}IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) {   IRExpr* e        = LibVEX_Alloc(sizeof(IRExpr));   e->tag           = Iex_Load;   e->Iex.Load.end  = end;   e->Iex.Load.ty   = ty;   e->Iex.Load.addr = addr;   vassert(end == Iend_LE || end == Iend_BE);   return e;}IRExpr* IRExpr_Const ( IRConst* con ) {   IRExpr* e        = LibVEX_Alloc(sizeof(IRExpr));   e->tag           = Iex_Const;   e->Iex.Const.con = con;   return e;}IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) {   IRExpr* e          = LibVEX_Alloc(sizeof(IRExpr));   e->tag             = Iex_CCall;   e->Iex.CCall.cee   = cee;   e->Iex.CCall.retty = retty;   e->Iex.CCall.args  = args;   return e;}IRExpr* IRExpr_Mux0X ( IRExpr* cond, IRExpr* expr0, IRExpr* exprX ) {   IRExpr* e          = LibVEX_Alloc(sizeof(IRExpr));   e->tag             = Iex_Mux0X;   e->Iex.Mux0X.cond  = cond;   e->Iex.Mux0X.expr0 = expr0;   e->Iex.Mux0X.exprX = exprX;   return e;}/* Constructors for NULL-terminated IRExpr expression vectors,   suitable for use as arg lists in clean/dirty helper calls. */IRExpr** mkIRExprVec_0 ( void ) {   IRExpr** vec = LibVEX_Alloc(1 * sizeof(IRExpr*));   vec[0] = NULL;   return vec;}IRExpr** mkIRExprVec_1 ( IRExpr* arg1 ) {   IRExpr** vec = LibVEX_Alloc(2 * sizeof(IRExpr*));   vec[0] = arg1;   vec[1] = NULL;   return vec;}IRExpr** mkIRExprVec_2 ( IRExpr* arg1, IRExpr* arg2 ) {   IRExpr** vec = LibVEX_Alloc(3 * sizeof(IRExpr*));   vec[0] = arg1;   vec[1] = arg2;   vec[2] = NULL;   return vec;}IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) {   IRExpr** vec = LibVEX_Alloc(4 * sizeof(IRExpr*));   vec[0] = arg1;   vec[1] = arg2;   vec[2] = arg3;   vec[3] = NULL;   return vec;}IRExpr** mkIRExprVec_4 ( IRExpr* arg1, IRExpr* arg2,                          IRExpr* arg3, IRExpr* arg4 ) {   IRExpr** vec = LibVEX_Alloc(5 * sizeof(IRExpr*));   vec[0] = arg1;   vec[1] = arg2;   vec[2] = arg3;   vec[3] = arg4;   vec[4] = NULL;   return vec;}IRExpr** mkIRExprVec_5 ( IRExpr* arg1, IRExpr* arg2,                          IRExpr* arg3, IRExpr* arg4, IRExpr* arg5 ) {   IRExpr** vec = LibVEX_Alloc(6 * sizeof(IRExpr*));   vec[0] = arg1;   vec[1] = arg2;   vec[2] = arg3;   vec[3] = arg4;   vec[4] = arg5;   vec[5] = NULL;   return vec;}/* Constructors -- IRDirty */IRDirty* emptyIRDirty ( void ) {   IRDirty* d = LibVEX_Alloc(sizeof(IRDirty));   d->cee      = NULL;   d->guard    = NULL;   d->args     = NULL;   d->tmp      = IRTemp_INVALID;   d->mFx      = Ifx_None;   d->mAddr    = NULL;   d->mSize    = 0;   d->needsBBP = False;   d->nFxState = 0;   return d;}/* Constructors -- IRStmt */IRStmt* IRStmt_NoOp ( void ){   /* Just use a single static closure. */   static IRStmt static_closure;   static_closure.tag = Ist_NoOp;   return &static_closure;}IRStmt* IRStmt_IMark ( Addr64 addr, Int len ) {   IRStmt* s         = LibVEX_Alloc(sizeof(IRStmt));   s->tag            = Ist_IMark;   s->Ist.IMark.addr = addr;   s->Ist.IMark.len  = len;   return s;}IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len ) {   IRStmt* s           = LibVEX_Alloc(sizeof(IRStmt));   s->tag              = Ist_AbiHint;   s->Ist.AbiHint.base = base;   s->Ist.AbiHint.len  = len;   return s;}IRStmt* IRStmt_Put ( Int off, IRExpr* data ) {   IRStmt* s         = LibVEX_Alloc(sizeof(IRStmt));   s->tag            = Ist_Put;   s->Ist.Put.offset = off;   s->Ist.Put.data   = data;   return s;}IRStmt* IRStmt_PutI ( IRArray* descr, IRExpr* ix,                      Int bias, IRExpr* data ) {   IRStmt* s         = LibVEX_Alloc(sizeof(IRStmt));   s->tag            = Ist_PutI;   s->Ist.PutI.descr = descr;   s->Ist.PutI.ix    = ix;   s->Ist.PutI.bias  = bias;   s->Ist.PutI.data  = data;   return s;}IRStmt* IRStmt_Tmp ( IRTemp tmp, IRExpr* data ) {   IRStmt* s       = LibVEX_Alloc(sizeof(IRStmt));   s->tag          = Ist_Tmp;   s->Ist.Tmp.tmp  = tmp;   s->Ist.Tmp.data = data;   return s;}IRStmt* IRStmt_Store ( IREndness end, IRExpr* addr, IRExpr* data ) {   IRStmt* s         = LibVEX_Alloc(sizeof(IRStmt));   s->tag            = Ist_Store;   s->Ist.Store.end  = end;   s->Ist.Store.addr = addr;   s->Ist.Store.data = data;   vassert(end == Iend_LE || end == Iend_BE);   return s;}IRStmt* IRStmt_Dirty ( IRDirty* d ){   IRStmt* s            = LibVEX_Alloc(sizeof(IRStmt));   s->tag               = Ist_Dirty;   s->Ist.Dirty.details = d;   return s;}IRStmt* IRStmt_MFence ( void ){   /* Just use a single static closure. */   static IRStmt static_closure;   static_closure.tag = Ist_MFence;   return &static_closure;}IRStmt* IRStmt_Exit ( IRExpr* guard, IRJumpKind jk, IRConst* dst ) {   IRStmt* s         = LibVEX_Alloc(sizeof(IRStmt));   s->tag            = Ist_Exit;   s->Ist.Exit.guard = guard;   s->Ist.Exit.jk    = jk;   s->Ist.Exit.dst   = dst;   return s;}/* Constructors -- IRTypeEnv */IRTypeEnv* emptyIRTypeEnv ( void ){   IRTypeEnv* env   = LibVEX_Alloc(sizeof(IRTypeEnv));   env->types       = LibVEX_Alloc(8 * sizeof(IRType));   env->types_size  = 8;   env->types_used  = 0;   return env;}/* Constructors -- IRBB */IRBB* emptyIRBB ( void ){   IRBB* bb       = LibVEX_Alloc(sizeof(IRBB));   bb->tyenv      = emptyIRTypeEnv();   bb->stmts_used = 0;   bb->stmts_size = 8;   bb->stmts      = LibVEX_Alloc(bb->stmts_size * sizeof(IRStmt*));   bb->next       = NULL;   bb->jumpkind   = Ijk_Boring;   return bb;}/*---------------------------------------------------------------*//*--- (Deep) copy constructors.  These make complete copies   ---*//*--- the original, which can be modified without affecting   ---*//*--- the original.                                           ---*//*---------------------------------------------------------------*//* Copying IR Expr vectors (for call args). *//* Shallow copy of an IRExpr vector */IRExpr** sopyIRExprVec ( IRExpr** vec ){   Int      i;   IRExpr** newvec;   for (i = 0; vec[i]; i++)      ;   newvec = LibVEX_Alloc((i+1)*sizeof(IRExpr*));   for (i = 0; vec[i]; i++)      newvec[i] = vec[i];   newvec[i] = NULL;   return newvec;}/* Deep copy of an IRExpr vector */IRExpr** dopyIRExprVec ( IRExpr** vec ){   Int      i;   IRExpr** newvec = sopyIRExprVec( vec );   for (i = 0; newvec[i]; i++)      newvec[i] = dopyIRExpr(newvec[i]);   return newvec;}/* Deep copy constructors for all heap-allocated IR types follow. */IRConst* dopyIRConst ( IRConst* c ){   switch (c->tag) {      case Ico_U1:   return IRConst_U1(c->Ico.U1);      case Ico_U8:   return IRConst_U8(c->Ico.U8);      case Ico_U16:  return IRConst_U16(c->Ico.U16);      case Ico_U32:  return IRConst_U32(c->Ico.U32);      case Ico_U64:  return IRConst_U64(c->Ico.U64);      case Ico_F64:  return IRConst_F64(c->Ico.F64);      case Ico_F64i: return IRConst_F64i(c->Ico.F64i);      case Ico_V128: return IRConst_V128(c->Ico.V128);      default: vpanic("dopyIRConst");   }}IRCallee* dopyIRCallee ( IRCallee* ce ){   IRCallee* ce2 = mkIRCallee(ce->regparms, ce->name, ce->addr);   ce2->mcx_mask = ce->mcx_mask;   return ce2;}IRArray* dopyIRArray ( IRArray* d ){   return mkIRArray(d->base, d->elemTy, d->nElems);}IRExpr* dopyIRExpr ( IRExpr* e ){   switch (e->tag) {      case Iex_Get:          return IRExpr_Get(e->Iex.Get.offset, e->Iex.Get.ty);      case Iex_GetI:          return IRExpr_GetI(dopyIRArray(e->Iex.GetI.descr),                             dopyIRExpr(e->Iex.GetI.ix),                            e->Iex.GetI.bias);      case Iex_Tmp:          return IRExpr_Tmp(e->Iex.Tmp.tmp);      case Iex_Binop:          return IRExpr_Binop(e->Iex.Binop.op,                             dopyIRExpr(e->Iex.Binop.arg1),                             dopyIRExpr(e->Iex.Binop.arg2));      case Iex_Unop:          return IRExpr_Unop(e->Iex.Unop.op,                            dopyIRExpr(e->Iex.Unop.arg));      case Iex_Load:          return IRExpr_Load(e->Iex.Load.end,                            e->Iex.Load.ty,                            dopyIRExpr(e->Iex.Load.addr));      case Iex_Const:          return IRExpr_Const(dopyIRConst(e->Iex.Const.con));      case Iex_CCall:         return IRExpr_CCall(dopyIRCallee(e->Iex.CCall.cee),                             e->Iex.CCall.retty,                             dopyIRExprVec(e->Iex.CCall.args));      case Iex_Mux0X: 

⌨️ 快捷键说明

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