Lines Matching refs:stmt
3133 void sanityCheckFail ( IRSB* bb, IRStmt* stmt, HChar* what )
3137 if (stmt) {
3139 ppIRStmt(stmt);
3179 /* Traverse a Stmt/Expr, inspecting IRTemp uses. Report any out of
3184 void useBeforeDef_Temp ( IRSB* bb, IRStmt* stmt, IRTemp tmp, Int* def_counts )
3187 sanityCheckFail(bb,stmt, "out of range Temp in IRExpr");
3189 sanityCheckFail(bb,stmt, "IRTemp use before def in IRExpr");
3193 void useBeforeDef_Expr ( IRSB* bb, IRStmt* stmt, IRExpr* expr, Int* def_counts )
3200 useBeforeDef_Expr(bb,stmt,expr->Iex.GetI.ix,def_counts);
3203 useBeforeDef_Temp(bb,stmt,expr->Iex.RdTmp.tmp,def_counts);
3207 useBeforeDef_Expr(bb,stmt,qop->arg1,def_counts);
3208 useBeforeDef_Expr(bb,stmt,qop->arg2,def_counts);
3209 useBeforeDef_Expr(bb,stmt,qop->arg3,def_counts);
3210 useBeforeDef_Expr(bb,stmt,qop->arg4,def_counts);
3215 useBeforeDef_Expr(bb,stmt,triop->arg1,def_counts);
3216 useBeforeDef_Expr(bb,stmt,triop->arg2,def_counts);
3217 useBeforeDef_Expr(bb,stmt,triop->arg3,def_counts);
3221 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg1,def_counts);
3222 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg2,def_counts);
3225 useBeforeDef_Expr(bb,stmt,expr->Iex.Unop.arg,def_counts);
3228 useBeforeDef_Expr(bb,stmt,expr->Iex.Load.addr,def_counts);
3234 useBeforeDef_Expr(bb,stmt,expr->Iex.CCall.args[i],def_counts);
3237 useBeforeDef_Expr(bb,stmt,expr->Iex.Mux0X.cond,def_counts);
3238 useBeforeDef_Expr(bb,stmt,expr->Iex.Mux0X.expr0,def_counts);
3239 useBeforeDef_Expr(bb,stmt,expr->Iex.Mux0X.exprX,def_counts);
3247 void useBeforeDef_Stmt ( IRSB* bb, IRStmt* stmt, Int* def_counts )
3253 switch (stmt->tag) {
3257 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.base,def_counts);
3258 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.nia,def_counts);
3261 useBeforeDef_Expr(bb,stmt,stmt->Ist.Put.data,def_counts);
3264 puti = stmt->Ist.PutI.details;
3265 useBeforeDef_Expr(bb,stmt,puti->ix,def_counts);
3266 useBeforeDef_Expr(bb,stmt,puti->data,def_counts);
3269 useBeforeDef_Expr(bb,stmt,stmt->Ist.WrTmp.data,def_counts);
3272 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.addr,def_counts);
3273 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.data,def_counts);
3276 cas = stmt->Ist.CAS.details;
3277 useBeforeDef_Expr(bb,stmt,cas->addr,def_counts);
3279 useBeforeDef_Expr(bb,stmt,cas->expdHi,def_counts);
3280 useBeforeDef_Expr(bb,stmt,cas->expdLo,def_counts);
3282 useBeforeDef_Expr(bb,stmt,cas->dataHi,def_counts);
3283 useBeforeDef_Expr(bb,stmt,cas->dataLo,def_counts);
3286 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.addr,def_counts);
3287 if (stmt->Ist.LLSC.storedata != NULL)
3288 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.storedata,def_counts);
3291 d = stmt->Ist.Dirty.details;
3293 useBeforeDef_Expr(bb,stmt,d->args[i],def_counts);
3295 useBeforeDef_Expr(bb,stmt,d->mAddr,def_counts);
3301 useBeforeDef_Expr(bb,stmt,stmt->Ist.Exit.guard,def_counts);
3309 void tcExpr ( IRSB* bb, IRStmt* stmt, IRExpr* expr, IRType gWordTy )
3319 tcExpr(bb,stmt, expr->Iex.GetI.ix, gWordTy );
3321 sanityCheckFail(bb,stmt,"IRExpr.GetI.ix: not :: Ity_I32");
3323 sanityCheckFail(bb,stmt,"IRExpr.GetI.descr: invalid descr");
3328 tcExpr(bb,stmt, qop->arg1, gWordTy );
3329 tcExpr(bb,stmt, qop->arg2, gWordTy );
3330 tcExpr(bb,stmt, qop->arg3, gWordTy );
3331 tcExpr(bb,stmt, qop->arg4, gWordTy );
3339 sanityCheckFail(bb,stmt,
3371 sanityCheckFail(bb,stmt,
3380 tcExpr(bb,stmt, triop->arg1, gWordTy );
3381 tcExpr(bb,stmt, triop->arg2, gWordTy );
3382 tcExpr(bb,stmt, triop->arg3, gWordTy );
3390 sanityCheckFail(bb,stmt,
3416 sanityCheckFail(bb,stmt,
3424 tcExpr(bb,stmt, expr->Iex.Binop.arg1, gWordTy );
3425 tcExpr(bb,stmt, expr->Iex.Binop.arg2, gWordTy );
3433 sanityCheckFail(bb,stmt,
3454 sanityCheckFail(bb,stmt,
3461 tcExpr(bb,stmt, expr->Iex.Unop.arg, gWordTy );
3466 sanityCheckFail(bb,stmt,"Iex.Unop: wrong arity op");
3468 sanityCheckFail(bb,stmt,"Iex.Unop: arg ty doesn't match op ty");
3471 tcExpr(bb,stmt, expr->Iex.Load.addr, gWordTy);
3473 sanityCheckFail(bb,stmt,"Iex.Load.addr: not :: guest word type");
3475 sanityCheckFail(bb,stmt,"Iex.Load.end: bogus endianness");
3479 sanityCheckFail(bb,stmt,"Iex.CCall.cee: bad IRCallee");
3481 sanityCheckFail(bb,stmt,"Iex.CCall.cee: #regparms > #args");
3484 sanityCheckFail(bb,stmt,"Iex.CCall: > 32 args");
3485 tcExpr(bb,stmt, expr->Iex.CCall.args[i], gWordTy);
3488 sanityCheckFail(bb,stmt,"Iex.CCall.retty: cannot return :: Ity_I1");
3491 sanityCheckFail(bb,stmt,"Iex.CCall.arg: arg :: Ity_I1");
3495 sanityCheckFail(bb,stmt,"Iex.Const.con: invalid const");
3498 tcExpr(bb,stmt, expr->Iex.Mux0X.cond, gWordTy);
3499 tcExpr(bb,stmt, expr->Iex.Mux0X.expr0, gWordTy);
3500 tcExpr(bb,stmt, expr->Iex.Mux0X.exprX, gWordTy);
3502 sanityCheckFail(bb,stmt,"Iex.Mux0X.cond: cond :: Ity_I8");
3505 sanityCheckFail(bb,stmt,"Iex.Mux0X: expr0/exprX mismatch");
3514 void tcStmt ( IRSB* bb, IRStmt* stmt, IRType gWordTy )
3522 switch (stmt->tag) {
3526 if (stmt->Ist.IMark.len < 0 || stmt->Ist.IMark.len > 20)
3527 sanityCheckFail(bb,stmt,"IRStmt.IMark.len: implausible");
3528 if (stmt->Ist.IMark.delta > 1)
3529 sanityCheckFail(bb,stmt,"IRStmt.IMark.delta: implausible");
3532 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.base) != gWordTy)
3533 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.base: "
3535 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.nia) != gWordTy)
3536 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.nia: "
3540 tcExpr( bb, stmt, stmt->Ist.Put.data, gWordTy );
3541 if (typeOfIRExpr(tyenv,stmt->Ist.Put.data) == Ity_I1)
3542 sanityCheckFail(bb,stmt,"IRStmt.Put.data: cannot Put :: Ity_I1");
3545 puti = stmt->Ist.PutI.details;
3546 tcExpr( bb, stmt, puti->data, gWordTy );
3547 tcExpr( bb, stmt, puti->ix, gWordTy );
3549 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: cannot PutI :: Ity_I1");
3552 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: data ty != elem ty");
3554 sanityCheckFail(bb,stmt,"IRStmt.PutI.ix: not :: Ity_I32");
3556 sanityCheckFail(bb,stmt,"IRStmt.PutI.descr: invalid descr");
3559 tcExpr( bb, stmt, stmt->Ist.WrTmp.data, gWordTy );
3560 if (typeOfIRTemp(tyenv, stmt->Ist.WrTmp.tmp)
3561 != typeOfIRExpr(tyenv, stmt->Ist.WrTmp.data))
3562 sanityCheckFail(bb,stmt,"IRStmt.Put.Tmp: tmp and expr do not match");
3565 tcExpr( bb, stmt, stmt->Ist.Store.addr, gWordTy );
3566 tcExpr( bb, stmt, stmt->Ist.Store.data, gWordTy );
3567 if (typeOfIRExpr(tyenv, stmt->Ist.Store.addr) != gWordTy)
3568 sanityCheckFail(bb,stmt,"IRStmt.Store.addr: not :: guest word type");
3569 if (typeOfIRExpr(tyenv, stmt->Ist.Store.data) == Ity_I1)
3570 sanityCheckFail(bb,stmt,"IRStmt.Store.data: cannot Store :: Ity_I1");
3571 if (stmt->Ist.Store.end != Iend_LE && stmt->Ist.Store.end != Iend_BE)
3572 sanityCheckFail(bb,stmt,"Ist.Store.end: bogus endianness");
3575 cas = stmt->Ist.CAS.details;
3591 tcExpr( bb, stmt, cas->addr, gWordTy );
3622 sanityCheckFail(bb,stmt,"IRStmt.CAS: ill-formed");
3626 if (typeOfIRExpr(tyenv, stmt->Ist.LLSC.addr) != gWordTy)
3627 sanityCheckFail(bb,stmt,"IRStmt.LLSC.addr: not :: guest word type");
3628 if (stmt->Ist.LLSC.end != Iend_LE && stmt->Ist.LLSC.end != Iend_BE)
3629 sanityCheckFail(bb,stmt,"Ist.LLSC.end: bogus endianness");
3630 tyRes = typeOfIRTemp(tyenv, stmt->Ist.LLSC.result);
3631 if (stmt->Ist.LLSC.storedata == NULL) {
3635 sanityCheckFail(bb,stmt,"Ist.LLSC(LL).result :: bogus");
3639 sanityCheckFail(bb,stmt,"Ist.LLSC(SC).result: not :: Ity_I1");
3640 tyData = typeOfIRExpr(tyenv, stmt->Ist.LLSC.storedata);
3643 sanityCheckFail(bb,stmt,
3650 d = stmt->Ist.Dirty.details;
3680 tcExpr( bb, stmt, d->guard, gWordTy );
3682 sanityCheckFail(bb,stmt,"IRStmt.Dirty.guard not :: Ity_I1");
3690 sanityCheckFail(bb,stmt,"IRStmt.Dirty with a return value"
3695 sanityCheckFail(bb,stmt,"IRStmt.Dirty.dst :: Ity_I1");
3698 sanityCheckFail(bb,stmt,"IRStmt.Dirty: > 32 args");
3700 sanityCheckFail(bb,stmt,"IRStmt.Dirty.arg[i] :: Ity_I1");
3704 sanityCheckFail(bb,stmt,"IRStmt.Dirty: ill-formed");
3709 switch (stmt->Ist.MBE.event) {
3712 default: sanityCheckFail(bb,stmt,"IRStmt.MBE.event: unknown");
3717 tcExpr( bb, stmt, stmt->Ist.Exit.guard, gWordTy );
3718 if (typeOfIRExpr(tyenv,stmt->Ist.Exit.guard) != Ity_I1)
3719 sanityCheckFail(bb,stmt,"IRStmt.Exit.guard: not :: Ity_I1");
3720 if (!saneIRConst(stmt->Ist.Exit.dst))
3721 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: bad dst");
3722 if (typeOfIRConst(stmt->Ist.Exit.dst) != gWordTy)
3723 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: not :: guest word type");
3725 if (stmt->Ist.Exit.offsIP < 16)
3726 sanityCheckFail(bb,stmt,"IRStmt.Exit.offsIP: too low");
3737 IRStmt* stmt;
3765 stmt = bb->stmts[i];
3766 if (!stmt)
3767 sanityCheckFail(bb, stmt, "IRStmt: is NULL");
3768 if (!isFlatIRStmt(stmt))
3769 sanityCheckFail(bb, stmt, "IRStmt: is not flat");
3784 stmt = bb->stmts[i];
3786 useBeforeDef_Stmt(bb,stmt,def_counts);
3789 switch (stmt->tag) {
3791 if (stmt->Ist.WrTmp.tmp < 0 || stmt->Ist.WrTmp.tmp >= n_temps)
3792 sanityCheckFail(bb, stmt,
3794 def_counts[stmt->Ist.WrTmp.tmp]++;
3795 if (def_counts[stmt->Ist.WrTmp.tmp] > 1)
3796 sanityCheckFail(bb, stmt,
3802 if (stmt->Ist.Dirty.details->tmp != IRTemp_INVALID) {
3803 d = stmt->Ist.Dirty.details;
3805 sanityCheckFail(bb, stmt,
3809 sanityCheckFail(bb, stmt,
3814 cas = stmt->Ist.CAS.details;
3817 sanityCheckFail(bb, stmt,
3821 sanityCheckFail(bb, stmt,
3825 sanityCheckFail(bb, stmt,
3829 sanityCheckFail(bb, stmt,
3833 if (stmt->Ist.LLSC.result < 0 || stmt->Ist.LLSC.result >= n_temps)
3834 sanityCheckFail(bb, stmt,
3836 def_counts[stmt->Ist.LLSC.result]++;
3837 if (def_counts[stmt->Ist.LLSC.result] > 1)
3838 sanityCheckFail(bb, stmt,