Lines Matching refs:stmt
3762 void sanityCheckFail ( const IRSB* bb, const IRStmt* stmt, const HChar* what )
3766 if (stmt) {
3768 ppIRStmt(stmt);
3808 /* Traverse a Stmt/Expr, inspecting IRTemp uses. Report any out of
3813 void useBeforeDef_Temp ( const IRSB* bb, const IRStmt* stmt, IRTemp tmp,
3817 sanityCheckFail(bb,stmt, "out of range Temp in IRExpr");
3819 sanityCheckFail(bb,stmt, "IRTemp use before def in IRExpr");
3823 void useBeforeDef_Expr ( const IRSB* bb, const IRStmt* stmt,
3831 useBeforeDef_Expr(bb,stmt,expr->Iex.GetI.ix,def_counts);
3834 useBeforeDef_Temp(bb,stmt,expr->Iex.RdTmp.tmp,def_counts);
3838 useBeforeDef_Expr(bb,stmt,qop->arg1,def_counts);
3839 useBeforeDef_Expr(bb,stmt,qop->arg2,def_counts);
3840 useBeforeDef_Expr(bb,stmt,qop->arg3,def_counts);
3841 useBeforeDef_Expr(bb,stmt,qop->arg4,def_counts);
3846 useBeforeDef_Expr(bb,stmt,triop->arg1,def_counts);
3847 useBeforeDef_Expr(bb,stmt,triop->arg2,def_counts);
3848 useBeforeDef_Expr(bb,stmt,triop->arg3,def_counts);
3852 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg1,def_counts);
3853 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg2,def_counts);
3856 useBeforeDef_Expr(bb,stmt,expr->Iex.Unop.arg,def_counts);
3859 useBeforeDef_Expr(bb,stmt,expr->Iex.Load.addr,def_counts);
3870 sanityCheckFail(bb,stmt, "IRExprP__* value in CCall arg list");
3872 useBeforeDef_Expr(bb,stmt,arg,def_counts);
3877 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.cond,def_counts);
3878 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.iftrue,def_counts);
3879 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.iffalse,def_counts);
3887 void useBeforeDef_Stmt ( const IRSB* bb, const IRStmt* stmt, Int* def_counts )
3895 switch (stmt->tag) {
3899 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.base,def_counts);
3900 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.nia,def_counts);
3903 useBeforeDef_Expr(bb,stmt,stmt->Ist.Put.data,def_counts);
3906 puti = stmt->Ist.PutI.details;
3907 useBeforeDef_Expr(bb,stmt,puti->ix,def_counts);
3908 useBeforeDef_Expr(bb,stmt,puti->data,def_counts);
3911 useBeforeDef_Expr(bb,stmt,stmt->Ist.WrTmp.data,def_counts);
3914 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.addr,def_counts);
3915 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.data,def_counts);
3918 sg = stmt->Ist.StoreG.details;
3919 useBeforeDef_Expr(bb,stmt,sg->addr,def_counts);
3920 useBeforeDef_Expr(bb,stmt,sg->data,def_counts);
3921 useBeforeDef_Expr(bb,stmt,sg->guard,def_counts);
3924 lg = stmt->Ist.LoadG.details;
3925 useBeforeDef_Expr(bb,stmt,lg->addr,def_counts);
3926 useBeforeDef_Expr(bb,stmt,lg->alt,def_counts);
3927 useBeforeDef_Expr(bb,stmt,lg->guard,def_counts);
3930 cas = stmt->Ist.CAS.details;
3931 useBeforeDef_Expr(bb,stmt,cas->addr,def_counts);
3933 useBeforeDef_Expr(bb,stmt,cas->expdHi,def_counts);
3934 useBeforeDef_Expr(bb,stmt,cas->expdLo,def_counts);
3936 useBeforeDef_Expr(bb,stmt,cas->dataHi,def_counts);
3937 useBeforeDef_Expr(bb,stmt,cas->dataLo,def_counts);
3940 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.addr,def_counts);
3941 if (stmt->Ist.LLSC.storedata != NULL)
3942 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.storedata,def_counts);
3945 d = stmt->Ist.Dirty.details;
3952 useBeforeDef_Expr(bb,stmt,arg,def_counts);
3956 useBeforeDef_Expr(bb,stmt,d->mAddr,def_counts);
3962 useBeforeDef_Expr(bb,stmt,stmt->Ist.Exit.guard,def_counts);
3970 void tcExpr ( const IRSB* bb, const IRStmt* stmt, const IRExpr* expr,
3981 tcExpr(bb,stmt, expr->Iex.GetI.ix, gWordTy );
3983 sanityCheckFail(bb,stmt,"IRExpr.GetI.ix: not :: Ity_I32");
3985 sanityCheckFail(bb,stmt,"IRExpr.GetI.descr: invalid descr");
3990 tcExpr(bb,stmt, qop->arg1, gWordTy );
3991 tcExpr(bb,stmt, qop->arg2, gWordTy );
3992 tcExpr(bb,stmt, qop->arg3, gWordTy );
3993 tcExpr(bb,stmt, qop->arg4, gWordTy );
4001 sanityCheckFail(bb,stmt,
4033 sanityCheckFail(bb,stmt,
4042 tcExpr(bb,stmt, triop->arg1, gWordTy );
4043 tcExpr(bb,stmt, triop->arg2, gWordTy );
4044 tcExpr(bb,stmt, triop->arg3, gWordTy );
4052 sanityCheckFail(bb,stmt,
4078 sanityCheckFail(bb,stmt,
4086 tcExpr(bb,stmt, expr->Iex.Binop.arg1, gWordTy );
4087 tcExpr(bb,stmt, expr->Iex.Binop.arg2, gWordTy );
4095 sanityCheckFail(bb,stmt,
4116 sanityCheckFail(bb,stmt,
4123 tcExpr(bb,stmt, expr->Iex.Unop.arg, gWordTy );
4128 sanityCheckFail(bb,stmt,"Iex.Unop: wrong arity op");
4130 sanityCheckFail(bb,stmt,"Iex.Unop: arg ty doesn't match op ty");
4133 tcExpr(bb,stmt, expr->Iex.Load.addr, gWordTy);
4135 sanityCheckFail(bb,stmt,"Iex.Load.addr: not :: guest word type");
4137 sanityCheckFail(bb,stmt,"Iex.Load.end: bogus endianness");
4141 sanityCheckFail(bb,stmt,"Iex.CCall.cee: bad IRCallee");
4143 sanityCheckFail(bb,stmt,"Iex.CCall.cee: #regparms > #args");
4146 sanityCheckFail(bb,stmt,"Iex.CCall: > 32 args");
4149 sanityCheckFail(bb,stmt,"Iex.CCall.args: is VECRET/BBPTR");
4150 tcExpr(bb,stmt, arg, gWordTy);
4153 sanityCheckFail(bb,stmt,"Iex.CCall.retty: cannot return :: Ity_I1");
4156 sanityCheckFail(bb,stmt,"Iex.CCall.arg: arg :: Ity_I1");
4160 sanityCheckFail(bb,stmt,"Iex.Const.con: invalid const");
4163 tcExpr(bb,stmt, expr->Iex.ITE.cond, gWordTy);
4164 tcExpr(bb,stmt, expr->Iex.ITE.iftrue, gWordTy);
4165 tcExpr(bb,stmt, expr->Iex.ITE.iffalse, gWordTy);
4167 sanityCheckFail(bb,stmt,"Iex.ITE.cond: cond :: Ity_I1");
4170 sanityCheckFail(bb,stmt,"Iex.ITE: iftrue/iffalse mismatch");
4179 void tcStmt ( const IRSB* bb, const IRStmt* stmt, IRType gWordTy )
4184 switch (stmt->tag) {
4188 if (stmt->Ist.IMark.len > 24)
4189 sanityCheckFail(bb,stmt,"IRStmt.IMark.len: implausible");
4190 if (stmt->Ist.IMark.delta > 1)
4191 sanityCheckFail(bb,stmt
4194 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.base) != gWordTy)
4195 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.base: "
4197 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.nia) != gWordTy)
4198 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.nia: "
4202 tcExpr( bb, stmt, stmt->Ist.Put.data, gWordTy );
4203 if (typeOfIRExpr(tyenv,stmt->Ist.Put.data) == Ity_I1)
4204 sanityCheckFail(bb,stmt,"IRStmt.Put.data: cannot Put :: Ity_I1");
4207 const IRPutI* puti = stmt->Ist.PutI.details;
4208 tcExpr( bb, stmt, puti->data, gWordTy );
4209 tcExpr( bb, stmt, puti->ix, gWordTy );
4211 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: cannot PutI :: Ity_I1");
4214 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: data ty != elem ty");
4216 sanityCheckFail(bb,stmt,"IRStmt.PutI.ix: not :: Ity_I32");
4218 sanityCheckFail(bb,stmt,"IRStmt.PutI.descr: invalid descr");
4222 tcExpr( bb, stmt, stmt->Ist.WrTmp.data, gWordTy );
4223 if (typeOfIRTemp(tyenv, stmt->Ist.WrTmp.tmp)
4224 != typeOfIRExpr(tyenv, stmt->Ist.WrTmp.data))
4225 sanityCheckFail(bb,stmt,
4229 tcExpr( bb, stmt, stmt->Ist.Store.addr, gWordTy );
4230 tcExpr( bb, stmt, stmt->Ist.Store.data, gWordTy );
4231 if (typeOfIRExpr(tyenv, stmt->Ist.Store.addr) != gWordTy)
4232 sanityCheckFail(bb,stmt,
4234 if (typeOfIRExpr(tyenv, stmt->Ist.Store.data) == Ity_I1)
4235 sanityCheckFail(bb,stmt,
4237 if (stmt->Ist.Store.end != Iend_LE && stmt->Ist.Store.end != Iend_BE)
4238 sanityCheckFail(bb,stmt,"Ist.Store.end: bogus endianness");
4241 const IRStoreG* sg = stmt->Ist.StoreG.details;
4242 tcExpr( bb, stmt, sg->addr, gWordTy );
4243 tcExpr( bb, stmt, sg->data, gWordTy );
4244 tcExpr( bb, stmt, sg->guard, gWordTy );
4246 sanityCheckFail(bb,stmt,"IRStmtG...addr: not :: guest word type");
4248 sanityCheckFail(bb,stmt,"IRStmtG...data: cannot Store :: Ity_I1");
4250 sanityCheckFail(bb,stmt,"IRStmtG...guard: not :: Ity_I1");
4252 sanityCheckFail(bb,stmt,"IRStmtG...end: bogus endianness");
4256 const IRLoadG* lg = stmt->Ist.LoadG.details;
4257 tcExpr( bb, stmt, lg->addr, gWordTy );
4258 tcExpr( bb, stmt, lg->alt, gWordTy );
4259 tcExpr( bb, stmt, lg->guard, gWordTy );
4261 sanityCheckFail(bb,stmt,"IRStmt.LoadG.guard: not :: Ity_I1");
4263 sanityCheckFail(bb,stmt,"IRStmt.LoadG.addr: not "
4266 sanityCheckFail(bb,stmt,"IRStmt.LoadG: dst/alt type mismatch");
4270 sanityCheckFail(bb,stmt,"IRStmt.LoadG: dst/loaded type mismatch");
4274 const IRCAS* cas = stmt->Ist.CAS.details;
4290 tcExpr( bb, stmt, cas->addr, gWordTy );
4321 sanityCheckFail(bb,stmt,"IRStmt.CAS: ill-formed");
4326 if (typeOfIRExpr(tyenv, stmt->Ist.LLSC.addr) != gWordTy)
4327 sanityCheckFail(bb,stmt,"IRStmt.LLSC.addr: not :: guest word type");
4328 if (stmt->Ist.LLSC.end != Iend_LE && stmt->Ist.LLSC.end != Iend_BE)
4329 sanityCheckFail(bb,stmt,"Ist.LLSC.end: bogus endianness");
4330 tyRes = typeOfIRTemp(tyenv, stmt->Ist.LLSC.result);
4331 if (stmt->Ist.LLSC.storedata == NULL) {
4335 sanityCheckFail(bb,stmt,"Ist.LLSC(LL).result :: bogus");
4339 sanityCheckFail(bb,stmt,"Ist.LLSC(SC).result: not :: Ity_I1");
4340 tyData = typeOfIRExpr(tyenv, stmt->Ist.LLSC.storedata);
4343 sanityCheckFail(bb,stmt,
4350 const IRDirty* d = stmt->Ist.Dirty.details;
4378 tcExpr( bb, stmt, d->guard, gWordTy );
4380 sanityCheckFail(bb,stmt,"IRStmt.Dirty.guard not :: Ity_I1");
4386 sanityCheckFail(bb,stmt,"IRStmt.Dirty.dst :: Ity_I1");
4391 sanityCheckFail(bb,stmt,"IRStmt.Dirty: > 32 args");
4399 sanityCheckFail(bb,stmt,"IRStmt.Dirty.arg[i] :: Ity_I1");
4402 sanityCheckFail(bb,stmt,"IRStmt.Dirty.args: > 1 BBPTR arg");
4407 sanityCheckFail(bb,stmt,
4413 sanityCheckFail(bb,stmt,
4417 sanityCheckFail(bb,stmt,
4422 sanityCheckFail(bb,stmt,
4428 sanityCheckFail(bb,stmt,
4434 sanityCheckFail(bb,stmt,"IRStmt.Dirty: ill-formed");
4440 switch (stmt->Ist.MBE.event) {
4443 default: sanityCheckFail(bb,stmt,"IRStmt.MBE.event: unknown");
4448 tcExpr( bb, stmt, stmt->Ist.Exit.guard, gWordTy );
4449 if (typeOfIRExpr(tyenv,stmt->Ist.Exit.guard) != Ity_I1)
4450 sanityCheckFail(bb,stmt,"IRStmt.Exit.guard: not :: Ity_I1");
4451 if (!saneIRConst(stmt->Ist.Exit.dst))
4452 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: bad dst");
4453 if (typeOfIRConst(stmt->Ist.Exit.dst) != gWordTy)
4454 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: not :: guest word type");
4456 if (stmt->Ist.Exit.offsIP < 16)
4457 sanityCheckFail(bb,stmt,"IRStmt.Exit.offsIP: too low");
4492 const IRStmt* stmt;
4497 stmt = bb->stmts[i];
4498 if (!stmt)
4499 sanityCheckFail(bb, stmt, "IRStmt: is NULL");
4500 if (!isFlatIRStmt(stmt))
4501 sanityCheckFail(bb, stmt, "IRStmt: is not flat");
4514 stmt = bb->stmts[i];
4516 useBeforeDef_Stmt(bb,stmt,def_counts);
4519 switch (stmt->tag) {
4521 if (stmt->Ist.WrTmp.tmp < 0 || stmt->Ist.WrTmp.tmp >= n_temps)
4522 sanityCheckFail(bb, stmt,
4524 def_counts[stmt->Ist.WrTmp.tmp]++;
4525 if (def_counts[stmt->Ist.WrTmp.tmp] > 1)
4526 sanityCheckFail(bb, stmt,
4530 const IRLoadG* lg = stmt->Ist.LoadG.details;
4532 sanityCheckFail(bb, stmt,
4536 sanityCheckFail(bb, stmt,
4541 const IRDirty* d = stmt->Ist.Dirty.details;
4544 sanityCheckFail(bb, stmt,
4548 sanityCheckFail(bb, stmt,
4554 const IRCAS* cas = stmt->Ist.CAS.details;
4557 sanityCheckFail(bb, stmt,
4561 sanityCheckFail(bb, stmt,
4565 sanityCheckFail(bb, stmt,
4569 sanityCheckFail(bb, stmt,
4574 if (stmtstmt->Ist.LLSC.result >= n_temps)
4575 sanityCheckFail(bb, stmt,
4577 def_counts[stmt->Ist.LLSC.result]++;
4578 if (def_counts[stmt->Ist.LLSC.result] > 1)
4579 sanityCheckFail(bb, stmt,