|
From: <sv...@va...> - 2017-03-13 23:12:34
|
Author: iraisr
Date: Mon Mar 13 23:12:27 2017
New Revision: 3318
Log:
Fix uninitialised IRTemp.id in CSE pass.
Fix backwards loops in ir_opt.c.
At this point, all tests under 'none' pass as in trunk.
Modified:
branches/VEX_JIT_HACKS/priv/ir_opt.c
branches/VEX_JIT_HACKS/pub/libvex_ir.h
Modified: branches/VEX_JIT_HACKS/priv/ir_opt.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_opt.c (original)
+++ branches/VEX_JIT_HACKS/priv/ir_opt.c Mon Mar 13 23:12:27 2017
@@ -916,7 +916,7 @@
HashHW* env)
{
/* And now scan backwards through the statements. */
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
Bool isPut;
UInt key;
@@ -3226,7 +3226,7 @@
*i_unconditional_exit = -1;
/* Work backwards through the stmts */
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
if (st->tag == Ist_NoOp)
continue;
@@ -3301,7 +3301,7 @@
{
IRExpr* ex;
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
if (st->tag == Ist_IfThenElse) {
@@ -3790,7 +3790,7 @@
{
HWord res;
/* env :: IRTemp -> IRTemp */
- if (lookupHHW(env, &res, (HWord)tmp.index)) {
+ if (lookupHHW(env, &res, (HWord) tmp.index)) {
return mkIRTemp(tmp.id, res);
} else {
return tmp;
@@ -4005,7 +4005,6 @@
static Bool do_cse_IRStmtVec(IRStmtVec* stmts, Bool allowLoadsToBeCSEd)
{
Int j, paranoia;
- IRTemp t, q;
AvailExpr* eprime;
AvailExpr* ae;
Bool invalidate;
@@ -4059,7 +4058,7 @@
allowLoadsToBeCSEd);
paranoia = 0; break;
default:
- vpanic("do_cse_BB(1)");
+ vpanic("do_cse_IRStmtVec(1)");
}
if (paranoia > 0) {
@@ -4105,7 +4104,7 @@
invalidate = True;
}
else
- vpanic("do_cse_BB(2)");
+ vpanic("do_cse_IRStmtVec(2)");
}
if (invalidate) {
@@ -4121,7 +4120,7 @@
if (st->tag != Ist_WrTmp)
continue;
- t = st->Ist.WrTmp.tmp;
+ IRTemp t = st->Ist.WrTmp.tmp;
eprime = irExpr_to_AvailExpr(st->Ist.WrTmp.data, allowLoadsToBeCSEd);
/* ignore if not of AvailExpr form */
if (!eprime)
@@ -4141,7 +4140,7 @@
/* A binding E' -> q was found. Replace stmt by "t = q" and
note the t->q binding in tenv. */
/* (this is the core of the CSE action) */
- q.index = (IRTyEnvIndex) aenv->val[j];
+ IRTemp q = mkIRTemp(stmts->tyenv->id, (IRTyEnvIndex) aenv->val[j]);
stmts->stmts[i] = IRStmt_WrTmp(t, IRExpr_RdTmp(q));
addToHHW(tenv, (HWord) t.index, (HWord) q.index);
anyDone = True;
@@ -4258,7 +4257,7 @@
IRTemp var, var2;
Int con, con2;
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
if (st->tag == Ist_NoOp)
continue;
@@ -4386,7 +4385,7 @@
/* Scan backwards in bb from startHere to find a suitable PutI
binding for (descrG, ixG, biasG), if any. */
- for (UInt j = startHere; j >= 0; j--) {
+ for (Int j = startHere; j >= 0; j--) {
IRStmt* st = stmts->stmts[j];
if (st->tag == Ist_NoOp)
continue;
@@ -4598,7 +4597,7 @@
static
void do_redundant_GetI_elimination(IRStmtVec* stmts)
{
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
if (st->tag == Ist_NoOp)
continue;
Modified: branches/VEX_JIT_HACKS/pub/libvex_ir.h
==============================================================================
--- branches/VEX_JIT_HACKS/pub/libvex_ir.h (original)
+++ branches/VEX_JIT_HACKS/pub/libvex_ir.h Mon Mar 13 23:12:27 2017
@@ -3102,11 +3102,13 @@
} Exit;
/* If-Then-Else control flow diamond. It contains:
+ - Guard controling whether "then" or "else" leg is taken
- "then" and "else" legs with vectors of statements, together
with their associated type environments
At the moment, nested "if-then-else" statements are not supported.
- Phi nodes, which are used to merge temporaries from "then" and
"else" legs
+ - TODO-JIT: A hint which leg is more likely to be taken (hot path)
A leg can either end with an unconditional exit or join the main
flow.
|