Author: iraisr
Date: Wed Mar 22 22:00:23 2017
New Revision: 3323
Log:
Let typeOfIRTemp() and typeOfIRExpr() figure out the type of any
IRTemp or IRExpr within the scope of current IRStmtVec.
Modified:
branches/VEX_JIT_HACKS/priv/guest_x86_toIR.c
branches/VEX_JIT_HACKS/priv/host_x86_isel.c
branches/VEX_JIT_HACKS/priv/ir_defs.c
branches/VEX_JIT_HACKS/priv/ir_inject.c
branches/VEX_JIT_HACKS/priv/ir_opt.c
branches/VEX_JIT_HACKS/pub/libvex_ir.h
branches/VEX_JIT_HACKS/useful/test_main.c
Modified: branches/VEX_JIT_HACKS/priv/guest_x86_toIR.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/guest_x86_toIR.c (original)
+++ branches/VEX_JIT_HACKS/priv/guest_x86_toIR.c Wed Mar 22 22:00:23 2017
@@ -548,7 +548,7 @@
/* Ditto, but write to a reg instead. */
static void putIReg ( Int sz, UInt archreg, IRExpr* e )
{
- IRType ty = typeOfIRExpr(irsb->stmts->tyenv, e);
+ IRType ty = typeOfIRExpr(irsb->stmts, e);
switch (sz) {
case 1: vassert(ty == Ity_I8); break;
case 2: vassert(ty == Ity_I16); break;
@@ -566,7 +566,7 @@
static void putSReg ( UInt sreg, IRExpr* e )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_I16);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_I16);
stmt( IRStmt_Put( segmentGuestRegOffset(sreg), e ) );
}
@@ -597,37 +597,37 @@
static void putXMMReg ( UInt xmmreg, IRExpr* e )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_V128);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_V128);
stmt( IRStmt_Put( xmmGuestRegOffset(xmmreg), e ) );
}
static void putXMMRegLane64 ( UInt xmmreg, Int laneno, IRExpr* e )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_I64);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_I64);
stmt( IRStmt_Put( xmmGuestRegLane64offset(xmmreg,laneno), e ) );
}
static void putXMMRegLane64F ( UInt xmmreg, Int laneno, IRExpr* e )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_F64);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_F64);
stmt( IRStmt_Put( xmmGuestRegLane64offset(xmmreg,laneno), e ) );
}
static void putXMMRegLane32F ( UInt xmmreg, Int laneno, IRExpr* e )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_F32);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_F32);
stmt( IRStmt_Put( xmmGuestRegLane32offset(xmmreg,laneno), e ) );
}
static void putXMMRegLane32 ( UInt xmmreg, Int laneno, IRExpr* e )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_I32);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_I32);
stmt( IRStmt_Put( xmmGuestRegLane32offset(xmmreg,laneno), e ) );
}
static void putXMMRegLane16 ( UInt xmmreg, Int laneno, IRExpr* e )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_I16);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_I16);
stmt( IRStmt_Put( xmmGuestRegLane16offset(xmmreg,laneno), e ) );
}
@@ -735,8 +735,8 @@
static IRExpr* mkAnd1 ( IRExpr* x, IRExpr* y )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, x) == Ity_I1);
- vassert(typeOfIRExpr(irsb->stmts->tyenv, y) == Ity_I1);
+ vassert(typeOfIRExpr(irsb->stmts, x) == Ity_I1);
+ vassert(typeOfIRExpr(irsb->stmts, y) == Ity_I1);
return unop(Iop_32to1,
binop(Iop_And32,
unop(Iop_1Uto32,x),
@@ -753,8 +753,8 @@
Addr32 restart_point )
{
IRCAS* cas;
- IRType tyE = typeOfIRExpr(irsb->stmts->tyenv, expVal);
- IRType tyN = typeOfIRExpr(irsb->stmts->tyenv, newVal);
+ IRType tyE = typeOfIRExpr(irsb->stmts, expVal);
+ IRType tyN = typeOfIRExpr(irsb->stmts, newVal);
IRTemp oldTmp = newTemp(tyE);
IRTemp expTmp = newTemp(tyE);
vassert(tyE == tyN);
@@ -868,7 +868,7 @@
/* U-widen 8/16/32 bit int expr to 32. */
static IRExpr* widenUto32 ( IRExpr* e )
{
- switch (typeOfIRExpr(irsb->stmts->tyenv, e)) {
+ switch (typeOfIRExpr(irsb->stmts, e)) {
case Ity_I32: return e;
case Ity_I16: return unop(Iop_16Uto32,e);
case Ity_I8: return unop(Iop_8Uto32,e);
@@ -879,7 +879,7 @@
/* S-widen 8/16/32 bit int expr to 32. */
static IRExpr* widenSto32 ( IRExpr* e )
{
- switch (typeOfIRExpr(irsb->stmts->tyenv, e)) {
+ switch (typeOfIRExpr(irsb->stmts, e)) {
case Ity_I32: return e;
case Ity_I16: return unop(Iop_16Sto32,e);
case Ity_I8: return unop(Iop_8Sto32,e);
@@ -891,7 +891,7 @@
of these combinations make sense. */
static IRExpr* narrowTo ( IRType dst_ty, IRExpr* e )
{
- IRType src_ty = typeOfIRExpr(irsb->stmts->tyenv, e);
+ IRType src_ty = typeOfIRExpr(irsb->stmts, e);
if (src_ty == dst_ty)
return e;
if (src_ty == Ity_I32 && dst_ty == Ity_I16)
@@ -1133,7 +1133,7 @@
IROp plus = mkSizedOp(ty, Iop_Add8);
IROp xor = mkSizedOp(ty, Iop_Xor8);
- vassert(typeOfIRTemp(irsb->stmts->tyenv, tres) == ty);
+ vassert(typeOfIRTemp(irsb->stmts, tres) == ty);
vassert(sz == 1 || sz == 2 || sz == 4);
thunkOp = sz==4 ? X86G_CC_OP_ADCL
: (sz==2 ? X86G_CC_OP_ADCW : X86G_CC_OP_ADCB);
@@ -1156,7 +1156,7 @@
vassert(restart_point == 0);
storeLE( mkexpr(taddr), mkexpr(tres) );
} else {
- vassert(typeOfIRTemp(irsb->stmts->tyenv, texpVal) == ty);
+ vassert(typeOfIRTemp(irsb->stmts, texpVal) == ty);
/* .. and hence 'texpVal' has the same type as 'tres'. */
casLE( mkexpr(taddr),
mkexpr(texpVal), mkexpr(tres), restart_point );
@@ -1187,7 +1187,7 @@
IROp minus = mkSizedOp(ty, Iop_Sub8);
IROp xor = mkSizedOp(ty, Iop_Xor8);
- vassert(typeOfIRTemp(irsb->stmts->tyenv, tres) == ty);
+ vassert(typeOfIRTemp(irsb->stmts, tres) == ty);
vassert(sz == 1 || sz == 2 || sz == 4);
thunkOp = sz==4 ? X86G_CC_OP_SBBL
: (sz==2 ? X86G_CC_OP_SBBW : X86G_CC_OP_SBBB);
@@ -1210,7 +1210,7 @@
vassert(restart_point == 0);
storeLE( mkexpr(taddr), mkexpr(tres) );
} else {
- vassert(typeOfIRTemp(irsb->stmts->tyenv, texpVal) == ty);
+ vassert(typeOfIRTemp(irsb->stmts, texpVal) == ty);
/* .. and hence 'texpVal' has the same type as 'tres'. */
casLE( mkexpr(taddr),
mkexpr(texpVal), mkexpr(tres), restart_point );
@@ -3451,7 +3451,7 @@
static void put_emwarn ( IRExpr* e /* :: Ity_I32 */ )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_I32);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_I32);
stmt( IRStmt_Put( OFFB_EMNOTE, e ) );
}
@@ -3475,7 +3475,7 @@
static void put_ftop ( IRExpr* e )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_I32);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_I32);
stmt( IRStmt_Put( OFFB_FTOP, e ) );
}
@@ -3527,7 +3527,7 @@
static void put_ST_TAG ( Int i, IRExpr* value )
{
IRRegArray* descr;
- vassert(typeOfIRExpr(irsb->stmts->tyenv, value) == Ity_I8);
+ vassert(typeOfIRExpr(irsb->stmts, value) == Ity_I8);
descr = mkIRRegArray( OFFB_FPTAGS, Ity_I8, 8 );
stmt( IRStmt_PutI( mkIRPutI(descr, get_ftop(), i, value) ) );
}
@@ -3551,7 +3551,7 @@
static void put_ST_UNCHECKED ( Int i, IRExpr* value )
{
IRRegArray* descr;
- vassert(typeOfIRExpr(irsb->stmts->tyenv, value) == Ity_F64);
+ vassert(typeOfIRExpr(irsb->stmts, value) == Ity_F64);
descr = mkIRRegArray( OFFB_FPREGS, Ity_F64, 8 );
stmt( IRStmt_PutI( mkIRPutI(descr, get_ftop(), i, value) ) );
/* Mark the register as in-use. */
@@ -5141,7 +5141,7 @@
case 7: { /* FNSTSW m16 */
IRExpr* sw = get_FPU_sw();
- vassert(typeOfIRExpr(irsb->stmts->tyenv, sw) == Ity_I16);
+ vassert(typeOfIRExpr(irsb->stmts, sw) == Ity_I16);
storeLE( mkexpr(addr), sw );
DIP("fnstsw %s\n", dis_buf);
break;
@@ -5543,7 +5543,7 @@
static void putMMXReg ( UInt archreg, IRExpr* e )
{
vassert(archreg < 8);
- vassert(typeOfIRExpr(irsb->stmts->tyenv, e) == Ity_I64);
+ vassert(typeOfIRExpr(irsb->stmts, e) == Ity_I64);
stmt( IRStmt_Put( OFFB_FPREGS + 8 * archreg, e ) );
}
@@ -7542,7 +7542,7 @@
static void put_sse_roundingmode ( IRExpr* sseround )
{
- vassert(typeOfIRExpr(irsb->stmts->tyenv, sseround) == Ity_I32);
+ vassert(typeOfIRExpr(irsb->stmts, sseround) == Ity_I32);
stmt( IRStmt_Put( OFFB_SSEROUND, sseround ) );
}
@@ -7642,7 +7642,7 @@
Bool emit_AC_emwarn,
Addr32 next_insn_EIP )
{
- vassert(typeOfIRTemp(irsb->stmts->tyenv,t1) == Ity_I32);
+ vassert(typeOfIRTemp(irsb->stmts,t1) == Ity_I32);
/* t1 is the flag word. Mask out everything except OSZACP and set
the flags thunk to X86G_CC_OP_COPY. */
Modified: branches/VEX_JIT_HACKS/priv/host_x86_isel.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/host_x86_isel.c (original)
+++ branches/VEX_JIT_HACKS/priv/host_x86_isel.c Wed Mar 22 22:00:23 2017
@@ -172,7 +172,7 @@
typedef
struct {
/* Constant -- are set at the start and do not change. */
- IRTypeEnv* type_env;
+ IRStmtVec* stmts;
HReg* vregmap;
HReg* vregmapHI;
@@ -359,7 +359,7 @@
return 1;
}
/* Else it's a "normal" expression. */
- IRType arg_ty = typeOfIRExpr(env->type_env, arg);
+ IRType arg_ty = typeOfIRExpr(env->stmts, arg);
if (arg_ty == Ity_I32) {
addInstr(env, X86Instr_Push(iselIntExpr_RMI(env, arg)));
return 1;
@@ -593,7 +593,7 @@
else if (UNLIKELY(arg->tag == Iex_GSPTR)) {
vassert(0); //ATC
} else {
- vassert(typeOfIRExpr(env->type_env, arg) == Ity_I32);
+ vassert(typeOfIRExpr(env->stmts, arg) == Ity_I32);
tmpregs[argreg] = iselIntExpr_R(env, arg);
}
not_done_yet--;
@@ -620,7 +620,7 @@
else if (UNLIKELY(arg->tag == Iex_GSPTR)) {
vassert(0); //ATC
} else {
- vassert(typeOfIRExpr(env->type_env, arg) == Ity_I32);
+ vassert(typeOfIRExpr(env->stmts, arg) == Ity_I32);
addInstr(env, X86Instr_Alu32R(Xalu_MOV,
iselIntExpr_RMI(env, arg),
argregs[argreg]));
@@ -854,7 +854,7 @@
{
MatchInfo mi;
- IRType ty = typeOfIRExpr(env->type_env,e);
+ IRType ty = typeOfIRExpr(env->stmts, e);
vassert(ty == Ity_I32 || ty == Ity_I16 || ty == Ity_I8);
switch (e->tag) {
@@ -1495,7 +1495,7 @@
/* --------- MULTIPLEX --------- */
case Iex_ITE: { // VFD
if ((ty == Ity_I32 || ty == Ity_I16 || ty == Ity_I8)
- && typeOfIRExpr(env->type_env,e->Iex.ITE.cond) == Ity_I1) {
+ && typeOfIRExpr(env->stmts, e->Iex.ITE.cond) == Ity_I1) {
HReg r1 = iselIntExpr_R(env, e->Iex.ITE.iftrue);
X86RM* r0 = iselIntExpr_RM(env, e->Iex.ITE.iffalse);
HReg dst = newVRegI(env);
@@ -1558,7 +1558,7 @@
/* DO NOT CALL THIS DIRECTLY ! */
static X86AMode* iselIntExpr_AMode_wrk ( ISelEnv* env, const IRExpr* e )
{
- IRType ty = typeOfIRExpr(env->type_env,e);
+ IRType ty = typeOfIRExpr(env->stmts, e);
vassert(ty == Ity_I32);
/* Add32( Add32(expr1, Shl32(expr2, simm)), imm32 ) */
@@ -1645,7 +1645,7 @@
/* DO NOT CALL THIS DIRECTLY ! */
static X86RMI* iselIntExpr_RMI_wrk ( ISelEnv* env, const IRExpr* e )
{
- IRType ty = typeOfIRExpr(env->type_env,e);
+ IRType ty = typeOfIRExpr(env->stmts, e);
vassert(ty == Ity_I32 || ty == Ity_I16 || ty == Ity_I8);
/* special case: immediate */
@@ -1705,7 +1705,7 @@
/* DO NOT CALL THIS DIRECTLY ! */
static X86RI* iselIntExpr_RI_wrk ( ISelEnv* env, const IRExpr* e )
{
- IRType ty = typeOfIRExpr(env->type_env,e);
+ IRType ty = typeOfIRExpr(env->stmts, e);
vassert(ty == Ity_I32 || ty == Ity_I16 || ty == Ity_I8);
/* special case: immediate */
@@ -1753,7 +1753,7 @@
/* DO NOT CALL THIS DIRECTLY ! */
static X86RM* iselIntExpr_RM_wrk ( ISelEnv* env, const IRExpr* e )
{
- IRType ty = typeOfIRExpr(env->type_env,e);
+ IRType ty = typeOfIRExpr(env->stmts, e);
vassert(ty == Ity_I32 || ty == Ity_I16 || ty == Ity_I8);
/* special case: 32-bit GET */
@@ -1790,7 +1790,7 @@
MatchInfo mi;
vassert(e);
- vassert(typeOfIRExpr(env->type_env,e) == Ity_I1);
+ vassert(typeOfIRExpr(env->stmts, e) == Ity_I1);
/* var */
if (e->tag == Iex_RdTmp) {
@@ -2091,7 +2091,7 @@
MatchInfo mi;
HWord fn = 0; /* helper fn for most SIMD64 stuff */
vassert(e);
- vassert(typeOfIRExpr(env->type_env,e) == Ity_I64);
+ vassert(typeOfIRExpr(env->stmts, e) == Ity_I64);
/* 64-bit literal */
if (e->tag == Iex_Const) {
@@ -2889,7 +2889,7 @@
/* DO NOT CALL THIS DIRECTLY */
static HReg iselFltExpr_wrk ( ISelEnv* env, const IRExpr* e )
{
- IRType ty = typeOfIRExpr(env->type_env,e);
+ IRType ty = typeOfIRExpr(env->stmts, e);
vassert(ty == Ity_F32);
if (e->tag == Iex_RdTmp) {
@@ -3006,7 +3006,7 @@
/* DO NOT CALL THIS DIRECTLY */
static HReg iselDblExpr_wrk ( ISelEnv* env, const IRExpr* e )
{
- IRType ty = typeOfIRExpr(env->type_env,e);
+ IRType ty = typeOfIRExpr(env->stmts, e);
vassert(e);
vassert(ty == Ity_F64);
@@ -3223,7 +3223,7 @@
/* --------- MULTIPLEX --------- */
if (e->tag == Iex_ITE) { // VFD
if (ty == Ity_F64
- && typeOfIRExpr(env->type_env,e->Iex.ITE.cond) == Ity_I1) {
+ && typeOfIRExpr(env->stmts, e->Iex.ITE.cond) == Ity_I1) {
HReg r1 = iselDblExpr(env, e->Iex.ITE.iftrue);
HReg r0 = iselDblExpr(env, e->Iex.ITE.iffalse);
HReg dst = newVRegF(env);
@@ -3277,7 +3277,7 @@
MatchInfo mi;
Bool arg1isEReg = False;
X86SseOp op = Xsse_INVALID;
- IRType ty = typeOfIRExpr(env->type_env,e);
+ IRType ty = typeOfIRExpr(env->stmts, e);
vassert(e);
vassert(ty == Ity_V128);
@@ -3873,8 +3873,8 @@
/* --------- STORE --------- */
case Ist_Store: {
- IRType tya = typeOfIRExpr(env->type_env, stmt->Ist.Store.addr);
- IRType tyd = typeOfIRExpr(env->type_env, stmt->Ist.Store.data);
+ IRType tya = typeOfIRExpr(env->stmts, stmt->Ist.Store.addr);
+ IRType tyd = typeOfIRExpr(env->stmts, stmt->Ist.Store.data);
IREndness end = stmt->Ist.Store.end;
if (tya != Ity_I32 || end != Iend_LE)
@@ -3926,7 +3926,7 @@
/* --------- PUT --------- */
case Ist_Put: {
- IRType ty = typeOfIRExpr(env->type_env, stmt->Ist.Put.data);
+ IRType ty = typeOfIRExpr(env->stmts, stmt->Ist.Put.data);
if (ty == Ity_I32) {
/* We're going to write to memory, so compute the RHS into an
X86RI. */
@@ -3989,7 +3989,7 @@
env, puti->descr,
puti->ix, puti->bias );
- IRType ty = typeOfIRExpr(env->type_env, puti->data);
+ IRType ty = typeOfIRExpr(env->stmts, puti->data);
if (ty == Ity_F64) {
HReg val = iselDblExpr(env, puti->data);
addInstr(env, X86Instr_FpLdSt( False/*store*/, 8, val, am ));
@@ -4019,7 +4019,7 @@
/* --------- TMP --------- */
case Ist_WrTmp: {
IRTemp tmp = stmt->Ist.WrTmp.tmp;
- IRType ty = typeOfIRTemp(env->type_env, tmp);
+ IRType ty = typeOfIRTemp(env->stmts, tmp);
/* optimisation: if stmt->Ist.WrTmp.data is Add32(..,..),
compute it into an AMode and then use LEA. This usually
@@ -4092,7 +4092,7 @@
/* Figure out the return type, if any. */
IRType retty = Ity_INVALID;
if (!isIRTempInvalid(d->tmp))
- retty = typeOfIRTemp(env->type_env, d->tmp);
+ retty = typeOfIRTemp(env->stmts, d->tmp);
Bool retty_ok = False;
switch (retty) {
@@ -4180,7 +4180,7 @@
/* "normal" singleton CAS */
UChar sz;
IRCAS* cas = stmt->Ist.CAS.details;
- IRType ty = typeOfIRExpr(env->type_env, cas->dataLo);
+ IRType ty = typeOfIRExpr(env->stmts, cas->dataLo);
/* get: cas->expdLo into %eax, and cas->dataLo into %ebx */
X86AMode* am = iselIntExpr_AMode(env, cas->addr);
HReg rDataLo = iselIntExpr_R(env, cas->dataLo);
@@ -4205,7 +4205,7 @@
} else {
/* double CAS */
IRCAS* cas = stmt->Ist.CAS.details;
- IRType ty = typeOfIRExpr(env->type_env, cas->dataLo);
+ IRType ty = typeOfIRExpr(env->stmts, cas->dataLo);
/* only 32-bit allowed in this case */
/* get: cas->expdLo into %eax, and cas->dataLo into %ebx */
/* get: cas->expdHi into %edx, and cas->dataHi into %ecx */
@@ -4457,9 +4457,9 @@
env->code = newHInstrArray();
/* Copy BB's type env. */
- /* TODO-JIT: Works only with IRTypeEnv ID #0. */
- vassert(bb->stmts->tyenv->id == 0);
- env->type_env = bb->stmts->tyenv;
+ /* TODO-JIT: Currently works only with no if-then-else statements. */
+ vassert(bb->id_seq == 1);
+ env->stmts = bb->stmts;
/* Make up an IRTemp -> virtual HReg mapping. This doesn't
change as we go along. */
Modified: branches/VEX_JIT_HACKS/priv/ir_defs.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_defs.c (original)
+++ branches/VEX_JIT_HACKS/priv/ir_defs.c Wed Mar 22 22:00:23 2017
@@ -3753,12 +3753,18 @@
/*---------------------------------------------------------------*/
inline
-IRType typeOfIRTemp ( const IRTypeEnv* env, IRTemp tmp )
+IRType typeOfIRTemp(const IRStmtVec* stmts, IRTemp tmp)
{
- vassert(tmp.id == env->id);
- vassert(tmp.index >= 0);
- vassert(tmp.index < env->types_used);
- return env->types[tmp.index];
+ const IRTypeEnv* tyenv = stmts->tyenv;
+ if (tyenv->id == tmp.id) {
+ vassert(tmp.index >= 0);
+ vassert(tmp.index < tyenv->types_used);
+ return tyenv->types[tmp.index];
+ } else if (stmts->parent != NULL) {
+ return typeOfIRTemp(stmts->parent, tmp);
+ } else {
+ vpanic("typeOfIRTemp");
+ }
}
IRType typeOfIRConst ( const IRConst* con )
@@ -3798,7 +3804,7 @@
}
}
-IRType typeOfIRExpr ( const IRTypeEnv* tyenv, const IRExpr* e )
+IRType typeOfIRExpr ( const IRStmtVec* stmts, const IRExpr* e )
{
IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
start:
@@ -3810,7 +3816,7 @@
case Iex_GetI:
return e->Iex.GetI.descr->elemTy;
case Iex_RdTmp:
- return typeOfIRTemp(tyenv, e->Iex.RdTmp.tmp);
+ return typeOfIRTemp(stmts, e->Iex.RdTmp.tmp);
case Iex_Const:
return typeOfIRConst(e->Iex.Const.con);
case Iex_Qop:
@@ -3834,7 +3840,7 @@
case Iex_ITE:
e = e->Iex.ITE.iffalse;
goto start;
- /* return typeOfIRExpr(tyenv, e->Iex.ITE.iffalse); */
+ /* return typeOfIRExpr(stmts, e->Iex.ITE.iffalse); */
case Iex_Binder:
vpanic("typeOfIRExpr: Binder is not a valid expression");
case Iex_VECRET:
@@ -4411,16 +4417,15 @@
void tcExpr(const IRSB* bb, const IRStmtVec* stmts, const IRStmt* stmt,
const IRExpr* expr, IRType gWordTy)
{
- Int i;
- IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
- const IRTypeEnv* tyenv = stmts->tyenv;
+ Int i;
+ IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
switch (expr->tag) {
case Iex_Get:
case Iex_RdTmp:
break;
case Iex_GetI:
tcExpr(bb, stmts, stmt, expr->Iex.GetI.ix, gWordTy);
- if (typeOfIRExpr(tyenv,expr->Iex.GetI.ix) != Ity_I32)
+ if (typeOfIRExpr(stmts, expr->Iex.GetI.ix) != Ity_I32)
sanityCheckFail(bb,stmt,"IRExpr.GetI.ix: not :: Ity_I32");
if (!saneIRRegArray(expr->Iex.GetI.descr))
sanityCheckFail(bb,stmt,"IRExpr.GetI.descr: invalid descr");
@@ -4443,10 +4448,10 @@
"Iex.Qop: wrong arity op\n"
"... name of op precedes BB printout\n");
}
- ttarg1 = typeOfIRExpr(tyenv, qop->arg1);
- ttarg2 = typeOfIRExpr(tyenv, qop->arg2);
- ttarg3 = typeOfIRExpr(tyenv, qop->arg3);
- ttarg4 = typeOfIRExpr(tyenv, qop->arg4);
+ ttarg1 = typeOfIRExpr(stmts, qop->arg1);
+ ttarg2 = typeOfIRExpr(stmts, qop->arg2);
+ ttarg3 = typeOfIRExpr(stmts, qop->arg3);
+ ttarg4 = typeOfIRExpr(stmts, qop->arg4);
if (t_arg1 != ttarg1 || t_arg2 != ttarg2
|| t_arg3 != ttarg3 || t_arg4 != ttarg4) {
vex_printf(" op name: ");
@@ -4494,9 +4499,9 @@
"Iex.Triop: wrong arity op\n"
"... name of op precedes BB printout\n");
}
- ttarg1 = typeOfIRExpr(tyenv, triop->arg1);
- ttarg2 = typeOfIRExpr(tyenv, triop->arg2);
- ttarg3 = typeOfIRExpr(tyenv, triop->arg3);
+ ttarg1 = typeOfIRExpr(stmts, triop->arg1);
+ ttarg2 = typeOfIRExpr(stmts, triop->arg2);
+ ttarg3 = typeOfIRExpr(stmts, triop->arg3);
if (t_arg1 != ttarg1 || t_arg2 != ttarg2 || t_arg3 != ttarg3) {
vex_printf(" op name: ");
ppIROp(triop->op);
@@ -4537,8 +4542,8 @@
"Iex.Binop: wrong arity op\n"
"... name of op precedes BB printout\n");
}
- ttarg1 = typeOfIRExpr(tyenv, expr->Iex.Binop.arg1);
- ttarg2 = typeOfIRExpr(tyenv, expr->Iex.Binop.arg2);
+ ttarg1 = typeOfIRExpr(stmts, expr->Iex.Binop.arg1);
+ ttarg2 = typeOfIRExpr(stmts, expr->Iex.Binop.arg2);
if (t_arg1 != ttarg1 || t_arg2 != ttarg2) {
vex_printf(" op name: ");
ppIROp(expr->Iex.Binop.op);
@@ -4567,12 +4572,12 @@
if (t_arg1 == Ity_INVALID || t_arg2 != Ity_INVALID
|| t_arg3 != Ity_INVALID || t_arg4 != Ity_INVALID)
sanityCheckFail(bb,stmt,"Iex.Unop: wrong arity op");
- if (t_arg1 != typeOfIRExpr(tyenv, expr->Iex.Unop.arg))
+ if (t_arg1 != typeOfIRExpr(stmts, expr->Iex.Unop.arg))
sanityCheckFail(bb,stmt,"Iex.Unop: arg ty doesn't match op ty");
break;
case Iex_Load:
tcExpr(bb, stmts, stmt, expr->Iex.Load.addr, gWordTy);
- if (typeOfIRExpr(tyenv, expr->Iex.Load.addr) != gWordTy)
+ if (typeOfIRExpr(stmts, expr->Iex.Load.addr) != gWordTy)
sanityCheckFail(bb,stmt,"Iex.Load.addr: not :: guest word type");
if (expr->Iex.Load.end != Iend_LE && expr->Iex.Load.end != Iend_BE)
sanityCheckFail(bb,stmt,"Iex.Load.end: bogus endianness");
@@ -4594,7 +4599,7 @@
sanityCheckFail(bb,stmt,
"Iex.CCall.retty: cannot return :: Ity_I1");
for (i = 0; expr->Iex.CCall.args[i]; i++)
- if (typeOfIRExpr(tyenv, expr->Iex.CCall.args[i]) == Ity_I1)
+ if (typeOfIRExpr(stmts, expr->Iex.CCall.args[i]) == Ity_I1)
sanityCheckFail(bb,stmt,"Iex.CCall.arg: arg :: Ity_I1");
break;
case Iex_Const:
@@ -4605,10 +4610,10 @@
tcExpr(bb, stmts, stmt, expr->Iex.ITE.cond, gWordTy);
tcExpr(bb, stmts, stmt, expr->Iex.ITE.iftrue, gWordTy);
tcExpr(bb, stmts, stmt, expr->Iex.ITE.iffalse, gWordTy);
- if (typeOfIRExpr(tyenv, expr->Iex.ITE.cond) != Ity_I1)
+ if (typeOfIRExpr(stmts, expr->Iex.ITE.cond) != Ity_I1)
sanityCheckFail(bb,stmt,"Iex.ITE.cond: cond :: Ity_I1");
- if (typeOfIRExpr(tyenv, expr->Iex.ITE.iftrue)
- != typeOfIRExpr(tyenv, expr->Iex.ITE.iffalse))
+ if (typeOfIRExpr(stmts, expr->Iex.ITE.iftrue)
+ != typeOfIRExpr(stmts, expr->Iex.ITE.iffalse))
sanityCheckFail(bb,stmt,"Iex.ITE: iftrue/iffalse mismatch");
break;
default:
@@ -4620,12 +4625,16 @@
void tcPhi(const IRSB* bb, const IRStmtVec* stmts, const IRStmt* stmt,
const IRPhi* phi)
{
- const IRTypeEnv* tyenv = stmts->tyenv;
- if (typeOfIRTemp(tyenv, phi->srcThen) != typeOfIRTemp(tyenv, phi->srcElse)) {
+ vassert(stmt->tag == Ist_IfThenElse);
+ const IRStmtVec* then_leg = stmt->Ist.IfThenElse.then_leg;
+ const IRStmtVec* else_leg = stmt->Ist.IfThenElse.else_leg;
+
+ if (typeOfIRTemp(then_leg, phi->srcThen)
+ != typeOfIRTemp(else_leg, phi->srcElse)) {
sanityCheckFail(bb,stmt,"IRStmt.IfThenElse.Phi: 'then' and 'else' "
"tmp do not match");
}
- if (typeOfIRTemp(tyenv, phi->dst) != typeOfIRTemp(tyenv, phi->srcThen)) {
+ if (typeOfIRTemp(stmts, phi->dst) != typeOfIRTemp(then_leg, phi->srcThen)) {
sanityCheckFail(bb,stmt,"IRStmt.IfThenElse.Phi: 'dst' and 'then' "
"tmp do not match");
}
@@ -4635,8 +4644,7 @@
void tcStmt(const IRSB* bb, const IRStmtVec* stmts, const IRStmt* stmt,
Bool require_flat, IRType gWordTy)
{
- IRType tyExpd, tyData;
- const IRTypeEnv* tyenv = stmts->tyenv;
+ IRType tyExpd, tyData;
switch (stmt->tag) {
case Ist_IMark:
/* Somewhat heuristic, but rule out totally implausible
@@ -4647,28 +4655,28 @@
sanityCheckFail(bb,stmt,"IRStmt.IMark.delta: implausible");
break;
case Ist_AbiHint:
- if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.base) != gWordTy)
+ if (typeOfIRExpr(stmts, stmt->Ist.AbiHint.base) != gWordTy)
sanityCheckFail(bb,stmt,"IRStmt.AbiHint.base: "
"not :: guest word type");
- if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.nia) != gWordTy)
+ if (typeOfIRExpr(stmts, stmt->Ist.AbiHint.nia) != gWordTy)
sanityCheckFail(bb,stmt,"IRStmt.AbiHint.nia: "
"not :: guest word type");
break;
case Ist_Put:
tcExpr(bb, stmts, stmt, stmt->Ist.Put.data, gWordTy);
- if (typeOfIRExpr(tyenv,stmt->Ist.Put.data) == Ity_I1)
+ if (typeOfIRExpr(stmts, stmt->Ist.Put.data) == Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.Put.data: cannot Put :: Ity_I1");
break;
case Ist_PutI:{
const IRPutI* puti = stmt->Ist.PutI.details;
tcExpr(bb, stmts, stmt, puti->data, gWordTy);
tcExpr(bb, stmts, stmt, puti->ix, gWordTy);
- if (typeOfIRExpr(tyenv,puti->data) == Ity_I1)
+ if (typeOfIRExpr(stmts, puti->data) == Ity_I1)
sanityCheckFail(bb,stmt,
"IRStmt.PutI.data: cannot PutI :: Ity_I1");
- if (typeOfIRExpr(tyenv,puti->data) != puti->descr->elemTy)
+ if (typeOfIRExpr(stmts, puti->data) != puti->descr->elemTy)
sanityCheckFail(bb,stmt,"IRStmt.PutI.data: data ty != elem ty");
- if (typeOfIRExpr(tyenv,puti->ix) != Ity_I32)
+ if (typeOfIRExpr(stmts, puti->ix) != Ity_I32)
sanityCheckFail(bb,stmt,"IRStmt.PutI.ix: not :: Ity_I32");
if (!saneIRRegArray(puti->descr))
sanityCheckFail(bb,stmt,"IRStmt.PutI.descr: invalid descr");
@@ -4676,18 +4684,18 @@
}
case Ist_WrTmp:
tcExpr(bb, stmts, stmt, stmt->Ist.WrTmp.data, gWordTy);
- if (typeOfIRTemp(tyenv, stmt->Ist.WrTmp.tmp)
- != typeOfIRExpr(tyenv, stmt->Ist.WrTmp.data))
+ if (typeOfIRTemp(stmts, stmt->Ist.WrTmp.tmp)
+ != typeOfIRExpr(stmts, stmt->Ist.WrTmp.data))
sanityCheckFail(bb,stmt,
"IRStmt.Put.Tmp: tmp and expr do not match");
break;
case Ist_Store:
tcExpr(bb, stmts, stmt, stmt->Ist.Store.addr, gWordTy);
tcExpr(bb, stmts, stmt, stmt->Ist.Store.data, gWordTy);
- if (typeOfIRExpr(tyenv, stmt->Ist.Store.addr) != gWordTy)
+ if (typeOfIRExpr(stmts, stmt->Ist.Store.addr) != gWordTy)
sanityCheckFail(bb,stmt,
"IRStmt.Store.addr: not :: guest word type");
- if (typeOfIRExpr(tyenv, stmt->Ist.Store.data) == Ity_I1)
+ if (typeOfIRExpr(stmts, stmt->Ist.Store.data) == Ity_I1)
sanityCheckFail(bb,stmt,
"IRStmt.Store.data: cannot Store :: Ity_I1");
if (stmt->Ist.Store.end != Iend_LE && stmt->Ist.Store.end != Iend_BE)
@@ -4698,11 +4706,11 @@
tcExpr(bb, stmts, stmt, sg->addr, gWordTy);
tcExpr(bb, stmts, stmt, sg->data, gWordTy);
tcExpr(bb, stmts, stmt, sg->guard, gWordTy);
- if (typeOfIRExpr(tyenv, sg->addr) != gWordTy)
+ if (typeOfIRExpr(stmts, sg->addr) != gWordTy)
sanityCheckFail(bb,stmt,"IRStmtG...addr: not :: guest word type");
- if (typeOfIRExpr(tyenv, sg->data) == Ity_I1)
+ if (typeOfIRExpr(stmts, sg->data) == Ity_I1)
sanityCheckFail(bb,stmt,"IRStmtG...data: cannot Store :: Ity_I1");
- if (typeOfIRExpr(tyenv, sg->guard) != Ity_I1)
+ if (typeOfIRExpr(stmts, sg->guard) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmtG...guard: not :: Ity_I1");
if (sg->end != Iend_LE && sg->end != Iend_BE)
sanityCheckFail(bb,stmt,"IRStmtG...end: bogus endianness");
@@ -4713,16 +4721,16 @@
tcExpr(bb, stmts, stmt, lg->addr, gWordTy);
tcExpr(bb, stmts, stmt, lg->alt, gWordTy);
tcExpr(bb, stmts, stmt, lg->guard, gWordTy);
- if (typeOfIRExpr(tyenv, lg->guard) != Ity_I1)
+ if (typeOfIRExpr(stmts, lg->guard) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.LoadG.guard: not :: Ity_I1");
- if (typeOfIRExpr(tyenv, lg->addr) != gWordTy)
+ if (typeOfIRExpr(stmts, lg->addr) != gWordTy)
sanityCheckFail(bb,stmt,"IRStmt.LoadG.addr: not "
":: guest word type");
- if (typeOfIRExpr(tyenv, lg->alt) != typeOfIRTemp(tyenv, lg->dst))
+ if (typeOfIRExpr(stmts, lg->alt) != typeOfIRTemp(stmts, lg->dst))
sanityCheckFail(bb,stmt,"IRStmt.LoadG: dst/alt type mismatch");
IRType cvtRes = Ity_INVALID, cvtArg = Ity_INVALID;
typeOfIRLoadGOp(lg->cvt, &cvtRes, &cvtArg);
- if (cvtRes != typeOfIRTemp(tyenv, lg->dst))
+ if (cvtRes != typeOfIRTemp(stmts, lg->dst))
sanityCheckFail(bb,stmt,"IRStmt.LoadG: dst/loaded type mismatch");
break;
}
@@ -4744,12 +4752,12 @@
}
/* check the address type */
tcExpr(bb, stmts, stmt, cas->addr, gWordTy);
- if (typeOfIRExpr(tyenv, cas->addr) != gWordTy) goto bad_cas;
+ if (typeOfIRExpr(stmts, cas->addr) != gWordTy) goto bad_cas;
/* check types on the {old,expd,data}Lo components agree */
- tyExpd = typeOfIRExpr(tyenv, cas->expdLo);
- tyData = typeOfIRExpr(tyenv, cas->dataLo);
+ tyExpd = typeOfIRExpr(stmts, cas->expdLo);
+ tyData = typeOfIRExpr(stmts, cas->dataLo);
if (tyExpd != tyData) goto bad_cas;
- if (tyExpd != typeOfIRTemp(tyenv, cas->oldLo))
+ if (tyExpd != typeOfIRTemp(stmts, cas->oldLo))
goto bad_cas;
/* check the base element type is sane */
if (tyExpd == Ity_I8 || tyExpd == Ity_I16 || tyExpd == Ity_I32
@@ -4761,15 +4769,15 @@
/* If it's a DCAS, check types on the {old,expd,data}Hi
components too */
if (!isIRTempInvalid(cas->oldHi)) {
- tyExpd = typeOfIRExpr(tyenv, cas->expdHi);
- tyData = typeOfIRExpr(tyenv, cas->dataHi);
+ tyExpd = typeOfIRExpr(stmts, cas->expdHi);
+ tyData = typeOfIRExpr(stmts, cas->dataHi);
if (tyExpd != tyData) goto bad_cas;
- if (tyExpd != typeOfIRTemp(tyenv, cas->oldHi))
+ if (tyExpd != typeOfIRTemp(stmts, cas->oldHi))
goto bad_cas;
/* and finally check that oldLo and oldHi have the same
type. This forces equivalence amongst all 6 types. */
- if (typeOfIRTemp(tyenv, cas->oldHi)
- != typeOfIRTemp(tyenv, cas->oldLo))
+ if (typeOfIRTemp(stmts, cas->oldHi)
+ != typeOfIRTemp(stmts, cas->oldLo))
goto bad_cas;
}
break;
@@ -4779,11 +4787,11 @@
}
case Ist_LLSC: {
IRType tyRes;
- if (typeOfIRExpr(tyenv, stmt->Ist.LLSC.addr) != gWordTy)
+ if (typeOfIRExpr(stmts, stmt->Ist.LLSC.addr) != gWordTy)
sanityCheckFail(bb,stmt,"IRStmt.LLSC.addr: not :: guest word type");
if (stmt->Ist.LLSC.end != Iend_LE && stmt->Ist.LLSC.end != Iend_BE)
sanityCheckFail(bb,stmt,"Ist.LLSC.end: bogus endianness");
- tyRes = typeOfIRTemp(tyenv, stmt->Ist.LLSC.result);
+ tyRes = typeOfIRTemp(stmts, stmt->Ist.LLSC.result);
if (stmt->Ist.LLSC.storedata == NULL) {
/* it's a LL */
if (tyRes != Ity_I64 && tyRes != Ity_I32
@@ -4793,7 +4801,7 @@
/* it's a SC */
if (tyRes != Ity_I1)
sanityCheckFail(bb,stmt,"Ist.LLSC(SC).result: not :: Ity_I1");
- tyData = typeOfIRExpr(tyenv, stmt->Ist.LLSC.storedata);
+ tyData = typeOfIRExpr(stmts, stmt->Ist.LLSC.storedata);
if (tyData != Ity_I64 && tyData != Ity_I32
&& tyData != Ity_I16 && tyData != Ity_I8)
sanityCheckFail(bb,stmt,
@@ -4832,12 +4840,12 @@
/* check guard */
if (d->guard == NULL) goto bad_dirty;
tcExpr(bb, stmts, stmt, d->guard, gWordTy);
- if (typeOfIRExpr(tyenv, d->guard) != Ity_I1)
+ if (typeOfIRExpr(stmts, d->guard) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.Dirty.guard not :: Ity_I1");
/* check types, minimally */
IRType retTy = Ity_INVALID;
if (!isIRTempInvalid(d->tmp)) {
- retTy = typeOfIRTemp(tyenv, d->tmp);
+ retTy = typeOfIRTemp(stmts, d->tmp);
if (retTy == Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.Dirty.dst :: Ity_I1");
}
@@ -4851,7 +4859,7 @@
} else if (UNLIKELY(arg->tag == Iex_GSPTR)) {
nGSPTRs++;
} else {
- if (typeOfIRExpr(tyenv, arg) == Ity_I1)
+ if (typeOfIRExpr(stmts, arg) == Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.Dirty.arg[i] :: Ity_I1");
}
if (nGSPTRs > 1) {
@@ -4902,7 +4910,7 @@
break;
case Ist_Exit:
tcExpr(bb, stmts, stmt, stmt->Ist.Exit.guard, gWordTy);
- if (typeOfIRExpr(tyenv,stmt->Ist.Exit.guard) != Ity_I1)
+ if (typeOfIRExpr(stmts,stmt->Ist.Exit.guard) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.Exit.guard: not :: Ity_I1");
if (!saneIRConst(stmt->Ist.Exit.dst))
sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: bad dst");
@@ -4914,7 +4922,7 @@
break;
case Ist_IfThenElse:
tcExpr(bb, stmts, stmt, stmt->Ist.IfThenElse.cond, gWordTy);
- if (typeOfIRExpr(tyenv, stmt->Ist.IfThenElse.cond) != Ity_I1)
+ if (typeOfIRExpr(stmts, stmt->Ist.IfThenElse.cond) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.IfThenElse.cond: not :: Ity_I1");
/* Traversing into legs and phi nodes driven from
sanityCheckIRStmtVec(). */
@@ -4973,7 +4981,7 @@
/* Ensure each temp has a plausible type. */
for (UInt i = 0; i < n_temps; i++) {
IRTemp temp = mkIRTemp(id, i);
- IRType ty = typeOfIRTemp(tyenv, temp);
+ IRType ty = typeOfIRTemp(stmts, temp);
if (!isPlausibleIRType(ty)) {
vex_printf("Temp ");
ppIRTemp(temp);
@@ -5060,7 +5068,7 @@
}
/* Typecheck also next destination. */
- if (typeOfIRExpr(bb->stmts->tyenv, bb->next) != gWordTy) {
+ if (typeOfIRExpr(bb->stmts, bb->next) != gWordTy) {
sanityCheckFail(bb, NULL, "bb->next field has wrong type");
}
/* because it would intersect with host_EvC_* */
Modified: branches/VEX_JIT_HACKS/priv/ir_inject.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_inject.c (original)
+++ branches/VEX_JIT_HACKS/priv/ir_inject.c Wed Mar 22 22:00:23 2017
@@ -125,13 +125,13 @@
static void
store_aux(IRSB *irsb, IREndness endian, IRExpr *addr, IRExpr *data)
{
- if (typeOfIRExpr(irsb->stmts->tyenv, data) == Ity_D64) {
+ if (typeOfIRExpr(irsb->stmts, data) == Ity_D64) {
/* The insn selectors do not support writing a DFP value to memory.
So we need to fix it here by reinterpreting the DFP value as an
integer and storing that. */
data = unop(Iop_ReinterpD64asI64, data);
}
- if (typeOfIRExpr(irsb->stmts->tyenv, data) == Ity_I1) {
+ if (typeOfIRExpr(irsb->stmts, data) == Ity_I1) {
/* We cannot store a single bit. So we store it in a 32-bit container.
See also load_aux. */
data = unop(Iop_1Uto32, data);
@@ -158,7 +158,7 @@
vpanic("invalid #bytes for address");
}
- IRType type = typeOfIRExpr(irsb->stmts->tyenv, data);
+ IRType type = typeOfIRExpr(irsb->stmts, data);
vassert(type == Ity_I1 || sizeofIRType(type) <= 16);
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 Wed Mar 22 22:00:23 2017
@@ -287,7 +287,7 @@
Int i;
IRExpr** newargs;
IRTypeEnv* tyenv = stmts->tyenv;
- IRType ty = typeOfIRExpr(tyenv, ex);
+ IRType ty = typeOfIRExpr(stmts, ex);
IRTemp t1;
switch (ex->tag) {
@@ -652,7 +652,7 @@
be to stick in a reinterpret-style cast, although that
would make maintaining flatness more difficult. */
IRExpr* valE = (IRExpr*)val;
- Bool typesOK = toBool( typeOfIRExpr(stmts->tyenv,valE)
+ Bool typesOK = toBool( typeOfIRExpr(stmts, valE)
== st->Ist.WrTmp.data->Iex.Get.ty );
if (typesOK && DEBUG_IROPT) {
vex_printf("rGET: "); ppIRExpr(get);
@@ -676,7 +676,7 @@
UInt k_lo, k_hi;
if (st->tag == Ist_Put) {
key = mk_key_GetPut( st->Ist.Put.offset,
- typeOfIRExpr(stmts->tyenv,st->Ist.Put.data) );
+ typeOfIRExpr(stmts, st->Ist.Put.data) );
} else {
vassert(st->tag == Ist_PutI);
key = mk_key_GetIPutI( st->Ist.PutI.details->descr );
@@ -960,7 +960,7 @@
case Ist_Put:
isPut = True;
key = mk_key_GetPut( st->Ist.Put.offset,
- typeOfIRExpr(stmts->tyenv,st->Ist.Put.data) );
+ typeOfIRExpr(stmts, st->Ist.Put.data) );
vassert(isIRAtom(st->Ist.Put.data));
break;
case Ist_PutI:
@@ -1024,7 +1024,7 @@
writes the IP (or, whatever it claims to write. We don't
care.) */
UInt key = mk_key_GetPut(bb->offsIP,
- typeOfIRExpr(bb->stmts->tyenv, bb->next));
+ typeOfIRExpr(bb->stmts, bb->next));
addToHHW(env, (HWord)key, 0);
redundant_put_removal_IRStmtVec(bb->stmts, preciseMemExnsFn, pxControl, env);
@@ -4086,7 +4086,7 @@
ae->u.GetIt.descr,
IRExpr_RdTmp(ae->u.GetIt.ix),
st->Ist.Put.offset,
- typeOfIRExpr(stmts->tyenv,st->Ist.Put.data)
+ typeOfIRExpr(stmts, st->Ist.Put.data)
) != NoAlias)
invalidate = True;
}
@@ -4399,7 +4399,7 @@
= getAliasingRelation_IC(
descrG, ixG,
st->Ist.Put.offset,
- typeOfIRExpr(stmts->tyenv,st->Ist.Put.data) );
+ typeOfIRExpr(stmts, st->Ist.Put.data) );
if (relation == NoAlias) {
/* we're OK; keep going */
@@ -4489,7 +4489,7 @@
static
Bool guestAccessWhichMightOverlapPutI (
- IRTypeEnv* tyenv, IRStmt* pi, IRStmt* s2
+ IRStmtVec* stmts, IRStmt* pi, IRStmt* s2
)
{
GSAliasing relation;
@@ -4531,7 +4531,7 @@
= getAliasingRelation_IC(
p1->descr, p1->ix,
s2->Ist.Put.offset,
- typeOfIRExpr(tyenv,s2->Ist.Put.data)
+ typeOfIRExpr(stmts, s2->Ist.Put.data)
);
goto have_relation;
@@ -4612,7 +4612,7 @@
if (replacement
&& isIRAtom(replacement)
/* Make sure we're doing a type-safe transformation! */
- && typeOfIRExpr(stmts->tyenv, replacement) == descr->elemTy) {
+ && typeOfIRExpr(stmts, replacement) == descr->elemTy) {
if (DEBUG_IROPT) {
vex_printf("rGI: ");
ppIRExpr(st->Ist.WrTmp.data);
@@ -4679,7 +4679,7 @@
if (st->tag == Ist_Dirty)
/* give up; could do better here */
break;
- if (guestAccessWhichMightOverlapPutI(stmts->tyenv, st, stj))
+ if (guestAccessWhichMightOverlapPutI(stmts, st, stj))
/* give up */
break;
}
@@ -5879,7 +5879,7 @@
switch (st->tag) {
case Ist_Put: {
Int offset = st->Ist.Put.offset;
- Int size = sizeofIRType(typeOfIRExpr(bb->stmts->tyenv, st->Ist.Put.data));
+ Int size = sizeofIRType(typeOfIRExpr(bb->stmts, st->Ist.Put.data));
*requiresPreciseMemExns
= preciseMemExnsFn(offset, offset + size - 1, pxControl);
@@ -6736,7 +6736,7 @@
case Ist_WrTmp:
if (st->Ist.WrTmp.data->tag == Iex_GetI)
*hasGetIorPutI = True;
- switch (typeOfIRTemp(stmts->tyenv, st->Ist.WrTmp.tmp)) {
+ switch (typeOfIRTemp(stmts, st->Ist.WrTmp.tmp)) {
case Ity_I1: case Ity_I8: case Ity_I16:
case Ity_I32: case Ity_I64: case Ity_I128:
break;
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 Wed Mar 22 22:00:23 2017
@@ -3215,8 +3215,8 @@
/* What is the type of this expression? */
extern IRType typeOfIRConst ( const IRConst* );
-extern IRType typeOfIRTemp ( const IRTypeEnv*, IRTemp );
-extern IRType typeOfIRExpr ( const IRTypeEnv*, const IRExpr* );
+extern IRType typeOfIRTemp ( const IRStmtVec*, IRTemp );
+extern IRType typeOfIRExpr ( const IRStmtVec*, const IRExpr* );
/* What are the arg and result type for this IRLoadGOp? */
extern void typeOfIRLoadGOp ( IRLoadGOp cvt,
Modified: branches/VEX_JIT_HACKS/useful/test_main.c
==============================================================================
--- branches/VEX_JIT_HACKS/useful/test_main.c (original)
+++ branches/VEX_JIT_HACKS/useful/test_main.c Wed Mar 22 22:00:23 2017
@@ -387,7 +387,7 @@
addr = st->Ist.STle.addr;
assert(isIRAtom(data));
assert(isIRAtom(addr));
- sz = sizeofIRType(typeOfIRExpr(bb_in->tyenv, data));
+ sz = sizeofIRType(typeOfIRExpr(bb_in->stmts, data));
needSz = False;
switch (sz) {
case 4: helper = mkIRCallee(1, "ac_helperc_STORE4",
@@ -982,7 +982,7 @@
/* Note, dst_ty is a shadow type, not an original type. */
/* First of all, collapse vbits down to a single bit. */
tl_assert(isShadowAtom(mce,vbits));
- ty = typeOfIRExpr(mce->bb->stmts->tyenv, vbits);
+ ty = typeOfIRExpr(mce->bb->stmts, vbits);
tmp1 = NULL;
switch (ty) {
case Ity_I1:
@@ -1074,7 +1074,7 @@
tl_assert(isShadowAtom(mce, vatom));
tl_assert(sameKindedAtoms(atom, vatom));
- ty = typeOfIRExpr(mce->bb->stmts->tyenv, vatom);
+ ty = typeOfIRExpr(mce->bb->stmts, vatom);
/* sz is only used for constructing the error message */
sz = ty==Ity_I1 ? 0 : sizeofIRType(ty);
@@ -1184,7 +1184,7 @@
tl_assert(isShadowAtom(mce, vatom));
}
- ty = typeOfIRExpr(mce->bb->stmts->tyenv, vatom);
+ ty = typeOfIRExpr(mce->bb->stmts, vatom);
tl_assert(ty != Ity_I1);
if (isAlwaysDefd(mce, offset, sizeofIRType(ty))) {
/* later: no ... */
@@ -2147,7 +2147,7 @@
vbitsC = expr2vbits(mce, cond);
vbits0 = expr2vbits(mce, iffalse);
vbits1 = expr2vbits(mce, iftrue);
- ty = typeOfIRExpr(mce->bb->stmts->tyenv, vbits0);
+ ty = typeOfIRExpr(mce->bb->stmts, vbits0);
return
mkUifU(mce, ty, assignNew(mce, ty, IRExpr_ITE(cond, vbits1, vbits0)),
@@ -2172,7 +2172,7 @@
return IRExpr_RdTmp( findShadowTmp(mce, e->Iex.RdTmp.tmp) );
case Iex_Const:
- return definedOfType(shadowType(typeOfIRExpr(mce->bb->stmts->tyenv, e)));
+ return definedOfType(shadowType(typeOfIRExpr(mce->bb->stmts, e)));
case Iex_Binop:
return expr2vbits_Binop(
@@ -2219,7 +2219,7 @@
/* vatom is vbits-value and as such can only have a shadow type. */
tl_assert(isShadowAtom(mce,vatom));
- ty = typeOfIRExpr(mce->bb->stmts->tyenv, vatom);
+ ty = typeOfIRExpr(mce->bb->stmts, vatom);
tyH = mce->hWordTy;
if (tyH == Ity_I32) {
@@ -2277,7 +2277,7 @@
tl_assert(isOriginalAtom(mce,addr));
tl_assert(isShadowAtom(mce,vdata));
- ty = typeOfIRExpr(mce->bb->stmts->tyenv, vdata);
+ ty = typeOfIRExpr(mce->bb->stmts, vdata);
/* First, emit a definedness test for the address. This also sets
the address (shadow) to 'defined' following the test. */
@@ -2443,7 +2443,7 @@
tl_assert(d->mAddr);
complainIfUndefined(mce, d->mAddr);
- tyAddr = typeOfIRExpr(mce->bb->stmts->tyenv, d->mAddr);
+ tyAddr = typeOfIRExpr(mce->bb->stmts, d->mAddr);
tl_assert(tyAddr == Ity_I32 || tyAddr == Ity_I64);
tl_assert(tyAddr == mce->hWordTy); /* not really right */
}
@@ -2482,7 +2482,7 @@
/* Outputs: the destination temporary, if there is one. */
if (!isIRTempInvalid(d->tmp)) {
dst = findShadowTmp(mce, d->tmp);
- tyDst = typeOfIRTemp(mce->bb->stmts->tyenv, d->tmp);
+ tyDst = typeOfIRTemp(mce->bb->stmts, d->tmp);
assign(mce->bb->stmts, dst, mkPCastTo(mce, tyDst, curr));
}
|