Home | History | Annotate | Download | only in priv

Lines Matching defs:env

545    env and if it matches, replace the Get with the stored value.  If
548 On seeing 'Put (minoff,maxoff) = t or c', first remove in the env
595 /* invalidate any env entries which in any way overlap (k_lo
616 HashHW* env = newHHW();
635 if (lookupHHW(env, &val, (HWord)key)) {
656 addToHHW( env, (HWord)key,
661 /* Deal with Puts: invalidate any env entries overlapped by this
675 invalidateOverlaps(env, k_lo, k_hi);
680 Invalidate the entire env. We could do a lot better
690 /* dump the entire env (not clever, but correct ...) */
691 for (j = 0; j < env->used; j++)
692 env->inuse[j] = False;
693 if (0) vex_printf("rGET: trash env due to dirty helper\n");
697 /* add this one to the env, if appropriate */
700 addToHHW( env, (HWord)key, (HWord)(st->Ist.Put.data));
713 overlapping ranges listed in env. Due to the flattening phase, the
717 HashHW* env,
755 invalidateOverlaps(env, k_lo, k_hi);
777 for (j = 0; j < env->used; j++)
778 env->inuse[j] = False;
836 for (j = 0; j < env->used; j++)
837 env->inuse[j] = False;
846 for (j = 0; j < env->used; j++) {
847 if (!env->inuse[j])
851 HWord k_lo = (env->key[j] >> 16) & 0xFFFF;
852 HWord k_hi = env->key[j] & 0xFFFF;
854 env->inuse[j] = False;
898 HashHW* env = newHHW();
900 /* Initialise the running env with the fact that the final exit
904 addToHHW(env, (HWord)key, 0);
916 /* Need to throw out from the env, any part of it which
919 do this: (1) check whether env contains a write that
921 out env; and (3) if (1) was true, add the write done by
928 env is the safe case (we just nuke env if that
934 //re_add = lookupHHW(env, NULL, key);
936 for (j = 0; j < env->used; j++)
937 env->inuse[j] = False;
940 // addToHHW(env, (HWord)key, 0);
962 /* See if any single entry in env overlaps this Put. This is
964 or more entries in the env
967 if (lookupHHW(env, NULL, (HWord)key)) {
978 addToHHW(env, (HWord)key, 0);
988 handle_gets_Stmt( env, st, preciseMemExnsFn, pxControl );
1026 /* The env in this section is a map from IRTemp to IRExpr*,
1046 static Bool sameIRExprs_aux2 ( IRExpr** env, IRExpr* e1, IRExpr* e2 );
1049 static Bool sameIRExprs_aux ( IRExpr** env, IRExpr* e1, IRExpr* e2 )
1052 return sameIRExprs_aux2(env, e1, e2);
1056 static Bool sameIRExprs_aux2 ( IRExpr** env, IRExpr* e1, IRExpr* e2 )
1064 if (env[e1->Iex.RdTmp.tmp] && env[e2->Iex.RdTmp.tmp]) {
1065 Bool same = sameIRExprs_aux(env, env[e1->Iex.RdTmp.tmp],
1066 env[e2->Iex.RdTmp.tmp]);
1083 && sameIRExprs_aux( env, e1->Iex.Binop.arg1,
1085 && sameIRExprs_aux( env, e1->Iex.Binop.arg2,
1090 && sameIRExprs_aux( env, e1->Iex.Unop.arg,
1112 && sameIRExprs_aux( env, tri1->arg1, tri2->arg1 )
1113 && sameIRExprs_aux( env, tri1->arg2, tri2->arg2 )
1114 && sameIRExprs_aux( env, tri1->arg3, tri2->arg3 ));
1118 return toBool( sameIRExprs_aux( env, e1->Iex.ITE.cond,
1120 && sameIRExprs_aux( env, e1->Iex.ITE.iftrue,
1122 && sameIRExprs_aux( env, e1->Iex.ITE.iffalse,
1134 static Bool sameIRExprs ( IRExpr** env, IRExpr* e1, IRExpr* e2 )
1139 same = sameIRExprs_aux(env, e1, e2);
1342 'e' is a reference to a tmp, look it up in env -- repeatedly, if
1347 static IRExpr* chase ( IRExpr** env, IRExpr* e )
1354 e = env[(Int)e->Iex.RdTmp.tmp];
1361 static IRExpr* chase1 ( IRExpr** env, IRExpr* e )
1366 return env[(Int)e->Iex.RdTmp.tmp];
1369 static IRExpr* fold_Expr ( IRExpr** env, IRExpr* e )
2134 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2146 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2168 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2184 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2222 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2232 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2254 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2289 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2320 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2326 IRExpr* a1 = chase(env, e->Iex.Binop.arg1);
2341 if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2364 if (sameIRExprs(env, e->Iex.ITE.iftrue,
2379 bunch of extra plumbing to pass in a type env, so just use a
2395 && sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
2429 static IRExpr* subst_Expr ( IRExpr** env, IRExpr* ex )
2433 if (env[(Int)ex->Iex.RdTmp.tmp] != NULL) {
2434 IRExpr *rhs = env[(Int)ex->Iex.RdTmp.tmp];
2441 /* not bound in env */
2452 subst_Expr(env, ex->Iex.GetI.ix),
2464 subst_Expr(env, qop->arg1),
2465 subst_Expr(env, qop->arg2),
2466 subst_Expr(env, qop->arg3),
2467 subst_Expr(env, qop->arg4)
2478 subst_Expr(env, triop->arg1),
2479 subst_Expr(env, triop->arg2),
2480 subst_Expr(env, triop->arg3)
2489 subst_Expr(env, ex->Iex.Binop.arg1),
2490 subst_Expr(env, ex->Iex.Binop.arg2)
2497 subst_Expr(env, ex->Iex.Unop.arg)
2505 subst_Expr(env, ex->Iex.Load.addr)
2513 args2[i] = subst_Expr(env, args2[i]);
2527 subst_Expr(env, ex->Iex.ITE.cond),
2528 subst_Expr(env, ex->Iex.ITE.iftrue),
2529 subst_Expr(env, ex->Iex.ITE.iffalse)
2544 static IRStmt* subst_and_fold_Stmt ( IRExpr** env, IRStmt* st )
2557 fold_Expr(env, subst_Expr(env, st->Ist.AbiHint.base)),
2559 fold_Expr(env, subst_Expr(env, st->Ist.AbiHint.nia))
2565 fold_Expr(env, subst_Expr(env, st->Ist.Put.data))
2574 fold_Expr(env, subst_Expr(env, puti->ix)),
2576 fold_Expr(env, subst_Expr(env, puti->data)));
2585 fold_Expr(env, subst_Expr(env, st->Ist.WrTmp.data))
2593 fold_Expr(env, subst_Expr(env, st->Ist.Store.addr)),
2594 fold_Expr(env, subst_Expr(env, st->Ist.Store.data))
2602 IRExpr* faddr = fold_Expr(env, subst_Expr(env, sg->addr));
2603 IRExpr* fdata = fold_Expr(env, subst_Expr(env, sg->data));
2604 IRExpr* fguard = fold_Expr(env, subst_Expr(env, sg->guard));
2629 IRExpr* faddr = fold_Expr(env, subst_Expr(env, lg->addr));
2630 IRExpr* falt = fold_Expr(env, subst_Expr(env, lg->alt));
2631 IRExpr* fguard = fold_Expr(env, subst_Expr(env, lg->guard));
2663 fold_Expr(env, subst_Expr(env, cas->addr)),
2664 cas->expdHi ? fold_Expr(env, subst_Expr(env, cas->expdHi))
2666 fold_Expr(env, subst_Expr(env, cas->expdLo)),
2667 cas->dataHi ? fold_Expr(env, subst_Expr(env, cas->dataHi))
2669 fold_Expr(env, subst_Expr(env, cas->dataLo))
2681 fold_Expr(env, subst_Expr(env, st->Ist.LLSC.addr)),
2683 ? fold_Expr(env, subst_Expr(env, st->Ist.LLSC.storedata))
2696 d2->mAddr = fold_Expr(env, subst_Expr(env, d2->mAddr));
2699 d2->guard = fold_Expr(env, subst_Expr(env, d2->guard));
2704 d2->args[i] = fold_Expr(env, subst_Expr(env, arg));
2724 fcond = fold_Expr(env, subst_Expr(env, st->Ist.Exit.guard));
2761 IRExpr** env = LibVEX_Alloc_inline(n_tmps * sizeof(IRExpr*));
2771 /* Set up the env with which travels forward. This holds a
2777 env[i] = NULL;
2792 st2 = subst_and_fold_Stmt( env, st2 );
2807 vassert(env[(Int)(st2->Ist.WrTmp.tmp)] == NULL);
2808 env[(Int)(st2->Ist.WrTmp.tmp)] = st2->Ist.WrTmp.data;
2865 out->next = subst_Expr( env, in->next );
3646 static IRTemp subst_AvailExpr_Temp ( HashHW* env, IRTemp tmp )
3649 /* env :: IRTemp -> IRTemp */
3650 if (lookupHHW( env, &res, (HWord)tmp ))
3658 HashHW* env )
3660 /* env :: IRTemp -> IRTemp */
3662 tc->u.tmp = subst_AvailExpr_Temp( env, tc->u.tmp );
3666 static void subst_AvailExpr ( HashHW* env, AvailExpr* ae )
3668 /* env :: IRTemp -> IRTemp */
3671 ae->u.Ut.arg = subst_AvailExpr_Temp( env, ae->u.Ut.arg );
3674 ae->u.Btt.arg1 = subst_AvailExpr_Temp( env, ae->u.Btt.arg1 );
3675 ae->u.Btt.arg2 = subst_AvailExpr_Temp( env, ae->u.Btt.arg2 );
3678 ae->u.Btc.arg1 = subst_AvailExpr_Temp( env, ae->u.Btc.arg1 );
3681 ae->u.Bct.arg2 = subst_AvailExpr_Temp( env, ae->u.Bct.arg2 );
3686 ae->u.Ittt.co = subst_AvailExpr_Temp( env, ae->u.Ittt.co );
3687 ae->u.Ittt.e1 = subst_AvailExpr_Temp( env, ae->u.Ittt.e1 );
3688 ae->u.Ittt.e0 = subst_AvailExpr_Temp( env, ae->u.Ittt.e0 );
3691 ae->u.Ittc.co = subst_AvailExpr_Temp( env, ae->u.Ittc.co );
3692 ae->u.Ittc.e1 = subst_AvailExpr_Temp( env, ae->u.Ittc.e1 );
3695 ae->u.Itct.co = subst_AvailExpr_Temp( env, ae->u.Itct.co );
3696 ae->u.Itct.e0 = subst_AvailExpr_Temp( env, ae->u.Itct.e0 );
3699 ae->u.Itcc.co = subst_AvailExpr_Temp( env, ae->u.Itcc.co );
3702 ae->u.GetIt.ix = subst_AvailExpr_Temp( env, ae->u.GetIt.ix );
3707 subst_AvailExpr_TmpOrConst(&ae->u.CCall.args[i], env);
3712 subst_AvailExpr_TmpOrConst(&ae->u.Load.addr, env);
3980 /* ------ ENV invalidate aenv bindings ------ */
4922 The number of times the env becomes full and we have to dump
4924 rapidly as the env size increases. 8 gives reasonable performance
4980 static void ppAEnv ( ATmpInfo* env )
4984 vex_printf("%d tmp %d val ", i, (Int)env[i].binder);
4985 if (env[i].bindee)
4986 ppIRExpr(env[i].bindee);
5059 /* Add a binding to the front of the env and slide all the rest
5061 static void addToEnvFront ( ATmpInfo* env, IRTemp binder, IRExpr* bindee )
5064 vassert(env[A_NENV-1].bindee == NULL);
5066 env[i] = env[i-1];
5067 env[0].binder = binder;
5068 env[0].bindee = bindee;
5069 env[0].doesLoad = False; /* filled in later */
5070 env[0].getInterval.present = False; /* filled in later */
5071 env[0].getInterval.low = -1; /* filled in later */
5072 env[0].getInterval.high = -1; /* filled in later */
5077 to the env.
5143 to the env.
5222 /* Look up a binding for tmp in the env. If found, return the bound
5223 expression, and set the env's binding to NULL so it is marked as
5226 static IRExpr* atbSubst_Temp ( ATmpInfo* env, IRTemp tmp )
5230 if (env[i].binder == tmp && env[i].bindee != NULL) {
5231 IRExpr* bindee = env[i].bindee;
5232 env[i].bindee = NULL;
5239 /* Traverse e, looking for temps. For each observed temp, see if env
5241 The env has the property that any binding it holds is
5426 static IRExpr* atbSubst_Expr ( ATmpInfo* env, IRExpr* e )
5437 args2[i] = atbSubst_Expr(env,args2[i]);
5444 e2 = atbSubst_Temp(env, e->Iex.RdTmp.tmp);
5448 atbSubst_Expr(env, e->Iex.ITE.cond),
5449 atbSubst_Expr(env, e->Iex.ITE.iftrue),
5450 atbSubst_Expr(env, e->Iex.ITE.iffalse)
5455 atbSubst_Expr(env, e->Iex.Qop.details->arg1),
5456 atbSubst_Expr(env, e->Iex.Qop.details->arg2),
5457 atbSubst_Expr(env, e->Iex.Qop.details->arg3),
5458 atbSubst_Expr(env, e->Iex.Qop.details->arg4)
5463 atbSubst_Expr(env, e->Iex.Triop.details->arg1),
5464 atbSubst_Expr(env, e->Iex.Triop.details->arg2),
5465 atbSubst_Expr(env, e->Iex.Triop.details->arg3)
5470 atbSubst_Expr(env, e->Iex.Binop.arg1),
5471 atbSubst_Expr(env, e->Iex.Binop.arg2)
5476 atbSubst_Expr(env, e->Iex.Unop.arg)
5482 atbSubst_Expr(env, e->Iex.Load.addr)
5487 atbSubst_Expr(env, e->Iex.GetI.ix),
5501 static IRStmt* atbSubst_Stmt ( ATmpInfo* env, IRStmt* st )
5511 atbSubst_Expr(env, st->Ist.AbiHint.base),
5513 atbSubst_Expr(env, st->Ist.AbiHint.nia)
5518 atbSubst_Expr(env, st->Ist.Store.addr),
5519 atbSubst_Expr(env, st->Ist.Store.data)
5524 atbSubst_Expr(env, sg->addr),
5525 atbSubst_Expr(env, sg->data),
5526 atbSubst_Expr(env, sg->guard));
5531 atbSubst_Expr(env, lg->addr),
5532 atbSubst_Expr(env, lg->alt),
5533 atbSubst_Expr(env, lg->guard));
5538 atbSubst_Expr(env, st->Ist.WrTmp.data)
5543 atbSubst_Expr(env, st->Ist.Put.data)
5548 atbSubst_Expr(env, puti->ix),
5550 atbSubst_Expr(env, puti->data));
5555 atbSubst_Expr(env, st->Ist.Exit.guard),
5572 atbSubst_Expr(env, cas->addr),
5573 cas->expdHi ? atbSubst_Expr(env, cas->expdHi) : NULL,
5574 atbSubst_Expr(env, cas->expdLo),
5575 cas->dataHi ? atbSubst_Expr(env, cas->dataHi) : NULL,
5576 atbSubst_Expr(env, cas->dataLo)
5583 atbSubst_Expr(env, st->Ist.LLSC.addr),
5585 ? atbSubst_Expr(env, st->Ist.LLSC.storedata) : NULL
5592 d2->mAddr = atbSubst_Expr(env, d2->mAddr);
5593 d2->guard = atbSubst_Expr(env, d2->guard);
5597 d2->args[i] = atbSubst_Expr(env, arg);
5730 ATmpInfo env[A_NENV];
5778 If the env is full, emit the end element. This guarantees
5782 let E'=env(E)
5784 add t -> E' to the front of the env
5789 let stmt' = env(stmt)
5790 remove from env any 't=E' binds invalidated by stmt
5793 compact any holes in env
5796 Finally, apply env to bb->next.
5800 env[i].bindee = NULL;
5801 env[i].binder = IRTemp_INVALID;
5816 /* Ensure there's at least one space in the env, by emitting
5818 if (env[A_NENV-1].bindee != NULL) {
5819 bb->stmts[j] = IRStmt_WrTmp( env[A_NENV-1].binder,
5820 env[A_NENV-1].bindee );
5823 env[A_NENV-1].bindee = NULL;
5841 e2 = atbSubst_Expr(env, e);
5842 addToEnvFront(env, st->Ist.WrTmp.tmp, e2);
5843 setHints_Expr(&env[0].doesLoad, &env[0].getInterval, e2);
5845 holding it temporarily in the env. */
5851 st2 = atbSubst_Stmt(env, st);
5853 /* Now, before this stmt, dump any bindings in env that it
5855 they originally entered env -- that means from oldest to
5880 if (env[k].bindee == NULL)
5887 (env[k].doesLoad && stmtStores)
5889 || ((env[k].getInterval.present && putInterval.present) &&
5890 intervals_overlap(env[k].getInterval, putInterval))
5899 || (env[k].doesLoad && putInterval.present &&
5910 bb->stmts[j] = IRStmt_WrTmp( env[k].binder, env[k].bindee );
5913 env[k].bindee = NULL;
5917 /* Slide in-use entries in env up to the front */
5920 if (env[k].bindee != NULL) {
5921 env[m] = env[k];
5926 env[m].bindee = NULL;
5941 bb->next = atbSubst_Expr(env, bb->next);
5979 static void print_flat_expr ( IRExpr** env, IRExpr* e )
5989 print_flat_expr(env, e->Iex.Binop.arg1);
5991 print_flat_expr(env, e->Iex.Binop.arg2);
5998 print_flat_expr(env, e->Iex.Unop.arg);
6005 print_flat_expr(env, chase(env, e));
6026 IRExpr** env, IRExpr* e,
6032 # define STEP(_e) chase1(env, (_e))
6171 static IRExpr* do_XOR_TRANSFORMS_IRExpr ( IRExpr** env, IRExpr* e )
6204 UInt variant = spotBitfieldAssignment(&aa, &bb, &cc, env, e, opAND, opXOR);
6243 IRExpr** env = LibVEX_Alloc_inline(n_tmps * sizeof(IRExpr*));
6245 env[i] = NULL;
6253 env[t] = st->Ist.WrTmp.data;
6277 = do_XOR_TRANSFORMS_IRExpr(env, st->Ist.WrTmp.data);