You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
(3) |
2
(2) |
3
|
4
(1) |
|
5
|
6
(2) |
7
|
8
(1) |
9
|
10
(2) |
11
(8) |
|
12
(2) |
13
(9) |
14
(2) |
15
(6) |
16
(5) |
17
(3) |
18
|
|
19
|
20
(1) |
21
(1) |
22
(6) |
23
(8) |
24
(2) |
25
(1) |
|
26
|
27
(3) |
28
(8) |
29
(17) |
30
(6) |
31
(3) |
|
|
From: <sv...@va...> - 2017-03-22 23:42:02
|
Author: iraisr
Date: Wed Mar 22 23:41:55 2017
New Revision: 16281
Log:
Necessary changes in Memcheck for pretty printing nested IRStmt's.
Modified:
branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
Modified: branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
==============================================================================
--- branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c (original)
+++ branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c Wed Mar 22 23:41:55 2017
@@ -207,6 +207,7 @@
IRStmtVec* stmts;
IRTypeEnv* tyenv;
IRTyEnvID id;
+ UInt depth; /* for indenting properly nested statements */
/* MODIFIED: a table [0 .. #temps_in_sb-1] which gives the
current kind and possibly shadow temps for each temp in the
@@ -337,6 +338,7 @@
mce->stmts = stmts_out;
mce->tyenv = stmts_out->tyenv;
mce->id = mce->tyenv->id;
+ mce->depth = (parent_mce != NULL) ? parent_mce->depth + 1 : 0;
mce->parent = parent_mce;
mce->settings = (parent_mce != NULL) ? parent_mce->settings : NULL;
@@ -6497,7 +6499,7 @@
if (mce->settings->trace) {
VG_(printf)("\n");
- ppIRStmt(st);
+ ppIRStmt_wrk(st, mce->depth);
VG_(printf)("\n");
}
@@ -6604,8 +6606,7 @@
if (0 && mce->settings->trace) {
for (UInt j = first_stmt; j < mce->stmts->stmts_used; j++) {
- VG_(printf)(" ");
- ppIRStmt(mce->stmts->stmts[j]);
+ ppIRStmt_wrk(mce->stmts->stmts[j], mce->depth + 1);
VG_(printf)("\n");
}
VG_(printf)("\n");
@@ -6763,8 +6764,7 @@
if (0 && verboze) {
for (UInt j = first_stmt; j < sb_out->stmts->stmts_used; j++) {
- VG_(printf)(" ");
- ppIRStmt(sb_out->stmts->stmts[j]);
+ ppIRStmt_wrk(sb_out->stmts->stmts[j], 1);
VG_(printf)("\n");
}
VG_(printf)("\n");
|
|
From: <sv...@va...> - 2017-03-22 23:40:52
|
Author: iraisr
Date: Wed Mar 22 23:40:44 2017
New Revision: 3324
Log:
Support pretty printing IRStmt's with proper indentation depth.
Modified:
branches/VEX_JIT_HACKS/priv/guest_generic_bb_to_IR.c
branches/VEX_JIT_HACKS/priv/guest_x86_toIR.c
branches/VEX_JIT_HACKS/priv/ir_defs.c
branches/VEX_JIT_HACKS/pub/libvex_ir.h
branches/VEX_JIT_HACKS/useful/test_main.c
Modified: branches/VEX_JIT_HACKS/priv/guest_generic_bb_to_IR.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/guest_generic_bb_to_IR.c (original)
+++ branches/VEX_JIT_HACKS/priv/guest_generic_bb_to_IR.c Wed Mar 22 23:40:44 2017
@@ -392,10 +392,9 @@
imark->Ist.IMark.len = dres.len;
/* Print the resulting IR, if needed. */
- if (vex_traceflags & VEX_TRACE_FE) {
+ if (debug_print) {
for (i = first_stmt_idx; i < irsb->stmts->stmts_used; i++) {
- vex_printf(" ");
- ppIRStmt(irsb->stmts->stmts[i]);
+ ppIRStmt_wrk(irsb->stmts->stmts[i], 3);
vex_printf("\n");
}
}
@@ -753,7 +752,7 @@
Print it if necessary.*/
vassert(irsb->next != NULL);
if (debug_print) {
- vex_printf(" ");
+ vex_printf(" ");
vex_printf( "PUT(%d) = ", irsb->offsIP);
ppIRExpr( irsb->next );
vex_printf( "; exit-");
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 23:40:44 2017
@@ -15475,8 +15475,7 @@
callback_opaque,
delta, archinfo, abiinfo, sigill_diag_IN );
for (i = x1; i < x2; i++) {
- vex_printf("\t\t");
- ppIRStmt(irsb_IN->stmts->stmts[i]);
+ ppIRStmt_wrk(irsb_IN->stmts->stmts[i], 4);
vex_printf("\n");
}
/* Failure of this assertion is serious and denotes a bug in
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 23:40:44 2017
@@ -1579,17 +1579,30 @@
vex_printf(")");
}
-void ppIRPhiVec(const IRPhiVec* phis)
+static void print_depth(UInt depth) {
+ for (UInt i = 0; i < depth; i++) {
+ vex_printf(" ");
+ }
+}
+
+static void ppIRPhiVec_wrk(const IRPhiVec* phis, UInt depth)
{
for (UInt i = 0; i < phis->phis_used; i++) {
- vex_printf(" ");
+ print_depth(depth);
ppIRPhi(phis->phis[i]);
vex_printf("\n");
}
}
-void ppIRStmt ( const IRStmt* s )
+void ppIRPhiVec(const IRPhiVec* phis)
{
+ ppIRPhiVec_wrk(phis, 0);
+}
+
+void ppIRStmt_wrk(const IRStmt* s, UInt depth)
+{
+ print_depth(depth);
+
if (!s) {
vex_printf("!!! IRStmt* which is NULL !!!");
return;
@@ -1674,13 +1687,15 @@
vex_printf("if (");
ppIRExpr(s->Ist.IfThenElse.cond);
vex_printf(") then {\n");
- ppIRStmtVec(s->Ist.IfThenElse.then_leg); // TODO-JIT: indent properly
+ ppIRStmtVec_wrk(s->Ist.IfThenElse.then_leg, depth + 1);
+ print_depth(depth);
vex_printf("} else {\n");
- ppIRStmtVec(s->Ist.IfThenElse.else_leg); // TODO-JIT: indent properly
+ ppIRStmtVec_wrk(s->Ist.IfThenElse.else_leg, depth + 1);
+ print_depth(depth);
vex_printf("}\n");
IRPhiVec* phi_nodes = s->Ist.IfThenElse.phi_nodes;
if (phi_nodes != NULL) {
- ppIRPhiVec(phi_nodes);
+ ppIRPhiVec_wrk(phi_nodes, depth);
}
break;
default:
@@ -1688,11 +1703,16 @@
}
}
-void ppIRTypeEnv ( const IRTypeEnv* env )
+void ppIRStmt(const IRStmt* s)
+{
+ ppIRStmt_wrk(s, 0);
+}
+
+static void ppIRTypeEnv_wrk(const IRTypeEnv* env, UInt depth)
{
for (UInt i = 0; i < env->types_used; i++) {
if (i % 8 == 0)
- vex_printf( " ");
+ print_depth(depth);
IRTemp temp = mkIRTemp(env->id, i);
ppIRTemp(temp);
vex_printf("=");
@@ -1706,23 +1726,34 @@
vex_printf( "\n");
}
-/* TODO-JIT: account for indentation */
-void ppIRStmtVec(const IRStmtVec* stmts)
+void ppIRTypeEnv(const IRTypeEnv* env)
+{
+ ppIRTypeEnv_wrk(env, 0);
+}
+
+void ppIRStmtVec_wrk(const IRStmtVec* stmts, UInt depth)
{
- ppIRTypeEnv(stmts->tyenv);
+ ppIRTypeEnv_wrk(stmts->tyenv, depth);
vex_printf("\n");
for (UInt i = 0; i < stmts->stmts_used; i++) {
- vex_printf( " ");
- ppIRStmt(stmts->stmts[i]);
+ ppIRStmt_wrk(stmts->stmts[i], depth);
vex_printf("\n");
}
}
+void ppIRStmtVec(const IRStmtVec* stmts)
+{
+ ppIRStmtVec_wrk(stmts, 0);
+}
+
void ppIRSB ( const IRSB* bb )
{
+ UInt depth = 0;
+
vex_printf("IRSB {\n");
- ppIRStmtVec(bb->stmts);
- vex_printf( " PUT(%d) = ", bb->offsIP );
+ ppIRStmtVec_wrk(bb->stmts, depth + 1);
+ print_depth(depth + 1);
+ vex_printf("PUT(%d) = ", bb->offsIP);
ppIRExpr( bb->next );
vex_printf( "; exit-");
ppIRJumpKind(bb->jumpkind);
@@ -4053,7 +4084,7 @@
ppIRSB(bb);
if (stmt) {
vex_printf("\nIN STATEMENT:\n\n");
- ppIRStmt(stmt);
+ ppIRStmt_wrk(stmt, 1);
}
vex_printf("\n\nERROR = %s\n\n", what );
vpanic("sanityCheckFail: exiting due to bad IR");
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 23:40:44 2017
@@ -2822,6 +2822,7 @@
IRStmtVec;
extern void ppIRStmtVec(const IRStmtVec*);
+extern void ppIRStmtVec_wrk(const IRStmtVec*, UInt depth);
/* Allocates an empty IRStmtVec with an invalid IRTyEnvID.
Such an IRStmtVec needs to have a valid IRTyEnvId - get it from
@@ -3155,6 +3156,7 @@
/* Pretty-print an IRStmt. */
extern void ppIRStmt ( const IRStmt* );
+extern void ppIRStmt_wrk(const IRStmt*, UInt depth);
/* ------------------ Basic Blocks ------------------ */
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 23:40:44 2017
@@ -2715,8 +2715,7 @@
if (verboze) {
for (UInt j = first_stmt; j < bb->stmts->stmts_used; j++) {
- VG_(printf)(" ");
- ppIRStmt(bb->stmts->stmts[j]);
+ ppIRStmt_wrk(bb->stmts->stmts[j], 1);
VG_(printf)("\n");
}
VG_(printf)("\n");
@@ -2739,8 +2738,7 @@
if (verboze) {
for (UInt j = first_stmt; j < bb->stmts->stmts_used; j++) {
- VG_(printf)(" ");
- ppIRStmt(bb->stmts->stmts[j]);
+ ppIRStmt_wrk(bb->stmts->stmts[j], 1);
VG_(printf)("\n");
}
VG_(printf)("\n");
|
|
From: <sv...@va...> - 2017-03-22 22:02:20
|
Author: iraisr
Date: Wed Mar 22 22:02:13 2017
New Revision: 16280
Log:
Necessary changes for typeOfIRTemp() and typeOfIRExpr()
in coregrind and memcheck.
Modified:
branches/VALGRIND_JIT_HACKS/coregrind/m_translate.c
branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
Modified: branches/VALGRIND_JIT_HACKS/coregrind/m_translate.c
==============================================================================
--- branches/VALGRIND_JIT_HACKS/coregrind/m_translate.c (original)
+++ branches/VALGRIND_JIT_HACKS/coregrind/m_translate.c Wed Mar 22 22:02:13 2017
@@ -406,7 +406,7 @@
if (e->tag != Iex_Get) goto case2;
if (e->Iex.Get.offset != offset_SP) goto case2;
if (e->Iex.Get.ty != typeof_SP) goto case2;
- vg_assert( typeOfIRTemp(out->tyenv, st->Ist.WrTmp.tmp) == typeof_SP );
+ vg_assert( typeOfIRTemp(out, st->Ist.WrTmp.tmp) == typeof_SP );
add_SP_alias(st->Ist.WrTmp.tmp, 0);
addStmtToIRStmtVec(out, st);
continue;
@@ -421,7 +421,7 @@
if (e->Iex.Binop.arg2->tag != Iex_Const) goto case3;
if (!IS_ADD_OR_SUB(e->Iex.Binop.op)) goto case3;
con = GET_CONST(e->Iex.Binop.arg2->Iex.Const.con);
- vg_assert( typeOfIRTemp(out->tyenv, st->Ist.WrTmp.tmp) == typeof_SP );
+ vg_assert( typeOfIRTemp(out, st->Ist.WrTmp.tmp) == typeof_SP );
if (IS_ADD(e->Iex.Binop.op)) {
add_SP_alias(st->Ist.WrTmp.tmp, delta + con);
} else {
@@ -436,7 +436,7 @@
e = st->Ist.WrTmp.data;
if (e->tag != Iex_RdTmp) goto case4;
if (!get_SP_delta(e->Iex.RdTmp.tmp, &delta)) goto case4;
- vg_assert( typeOfIRTemp(out->tyenv, st->Ist.WrTmp.tmp) == typeof_SP );
+ vg_assert( typeOfIRTemp(out, st->Ist.WrTmp.tmp) == typeof_SP );
add_SP_alias(st->Ist.WrTmp.tmp, delta);
addStmtToIRStmtVec(out, st);
continue;
@@ -451,7 +451,7 @@
last_SP = first_SP + sizeof_SP - 1;
first_Put = st->Ist.Put.offset;
last_Put = first_Put
- + sizeofIRType(typeOfIRExpr(out->tyenv, st->Ist.Put.data))
+ + sizeofIRType(typeOfIRExpr(out, st->Ist.Put.data))
- 1;
vg_assert(first_SP <= last_SP);
vg_assert(first_Put <= last_Put);
@@ -469,7 +469,7 @@
put_SP_alias is immediately preceded by an assertion that
we are putting in a binding for a correctly-typed
temporary. */
- vg_assert( typeOfIRTemp(out->tyenv, tttmp) == typeof_SP );
+ vg_assert( typeOfIRTemp(out, tttmp) == typeof_SP );
/* From the same type-and-offset-correctness argument, if
we found a useable alias, it must for an "exact" write of SP. */
vg_assert(first_SP == first_Put);
@@ -609,7 +609,7 @@
if (first_Put == first_SP && last_Put == last_SP
&& st->Ist.Put.data->tag == Iex_RdTmp) {
- vg_assert( typeOfIRTemp(out->tyenv, st->Ist.Put.data->Iex.RdTmp.tmp)
+ vg_assert( typeOfIRTemp(out, st->Ist.Put.data->Iex.RdTmp.tmp)
== typeof_SP );
add_SP_alias(st->Ist.Put.data->Iex.RdTmp.tmp, 0);
}
@@ -1029,11 +1029,11 @@
static IRExpr* mkU8 ( UChar n ) {
return IRExpr_Const(IRConst_U8(n));
}
-static IRExpr* narrowTo32 ( IRTypeEnv* tyenv, IRExpr* e ) {
- if (typeOfIRExpr(tyenv, e) == Ity_I32) {
+static IRExpr* narrowTo32 ( IRStmtVec* stmts, IRExpr* e ) {
+ if (typeOfIRExpr(stmts, e) == Ity_I32) {
return e;
} else {
- vg_assert(typeOfIRExpr(tyenv, e) == Ity_I64);
+ vg_assert(typeOfIRExpr(stmts, e) == Ity_I64);
return IRExpr_Unop(Iop_64to32, e);
}
}
@@ -1086,7 +1086,7 @@
t1 = newIRTemp( bb->tyenv, ty_Word );
one = mkU(1);
- vg_assert(typeOfIRExpr(bb->tyenv, e) == ty_Word);
+ vg_assert(typeOfIRExpr(bb->stmts, e) == ty_Word);
/* t1 = guest_REDIR_SP + 1 */
addStmtToIRSB(
@@ -1132,7 +1132,7 @@
addStmtToIRSB(
bb,
IRStmt_PutI(mkIRPutI(descr,
- narrowTo32(bb->tyenv,IRExpr_RdTmp(t1)), 0, e)));
+ narrowTo32(bb->stmts, IRExpr_RdTmp(t1)), 0, e)));
}
@@ -1212,7 +1212,7 @@
bb,
IRStmt_WrTmp(
res,
- IRExpr_GetI(descr, narrowTo32(bb->tyenv,IRExpr_RdTmp(t1)), 0)
+ IRExpr_GetI(descr, narrowTo32(bb->stmts, IRExpr_RdTmp(t1)), 0)
)
);
Modified: branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
==============================================================================
--- branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c (original)
+++ branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c Wed Mar 22 22:02:13 2017
@@ -220,7 +220,7 @@
The reason for this strange split (types in one place, all
other info in another) is that we need the types to be
attached to sb so as to make it possible to do
- "typeOfIRExpr(mce->tyenv, ...)" at various places in the
+ "typeOfIRExpr(mce->stmts, ...)" at various places in the
instrumentation process. */
XArray* /* of TempMapEnt */ tmpMap;
@@ -525,7 +525,7 @@
{
TempKind k;
IRTemp t;
- IRType tyE = typeOfIRExpr(mce->tyenv, e);
+ IRType tyE = typeOfIRExpr(mce->stmts, e);
tl_assert(tyE == ty); /* so 'ty' is redundant (!) */
switch (cat) {
@@ -829,7 +829,7 @@
/* Note, dst_ty is a shadow type, not an original type. */
tl_assert(isShadowAtom(mce,vbits));
- src_ty = typeOfIRExpr(mce->tyenv, vbits);
+ src_ty = typeOfIRExpr(mce->stmts, vbits);
/* Fast-track some common cases */
if (src_ty == Ity_I32 && dst_ty == Ity_I32)
@@ -1319,7 +1319,7 @@
tl_assert(isShadowAtom(mce, vatom));
tl_assert(sameKindedAtoms(atom, vatom));
- ty = typeOfIRExpr(mce->tyenv, vatom);
+ ty = typeOfIRExpr(mce->stmts, vatom);
/* sz is only used for constructing the error message */
sz = ty==Ity_I1 ? 0 : sizeofIRType(ty);
@@ -1532,7 +1532,7 @@
tl_assert(isShadowAtom(mce, vatom));
}
- ty = typeOfIRExpr(mce->tyenv, vatom);
+ ty = typeOfIRExpr(mce->stmts, vatom);
tl_assert(ty != Ity_I1);
if (isAlwaysDefd(mce, offset, sizeofIRType(ty))) {
/* later: no ... */
@@ -1659,8 +1659,8 @@
IRAtom* mkLazy2 ( MCEnv* mce, IRType finalVty, IRAtom* va1, IRAtom* va2 )
{
IRAtom* at;
- IRType t1 = typeOfIRExpr(mce->tyenv, va1);
- IRType t2 = typeOfIRExpr(mce->tyenv, va2);
+ IRType t1 = typeOfIRExpr(mce->stmts, va1);
+ IRType t2 = typeOfIRExpr(mce->stmts, va2);
tl_assert(isShadowAtom(mce,va1));
tl_assert(isShadowAtom(mce,va2));
@@ -1716,9 +1716,9 @@
IRAtom* va1, IRAtom* va2, IRAtom* va3 )
{
IRAtom* at;
- IRType t1 = typeOfIRExpr(mce->tyenv, va1);
- IRType t2 = typeOfIRExpr(mce->tyenv, va2);
- IRType t3 = typeOfIRExpr(mce->tyenv, va3);
+ IRType t1 = typeOfIRExpr(mce->stmts, va1);
+ IRType t2 = typeOfIRExpr(mce->stmts, va2);
+ IRType t3 = typeOfIRExpr(mce->stmts, va3);
tl_assert(isShadowAtom(mce,va1));
tl_assert(isShadowAtom(mce,va2));
tl_assert(isShadowAtom(mce,va3));
@@ -1850,10 +1850,10 @@
IRAtom* va1, IRAtom* va2, IRAtom* va3, IRAtom* va4 )
{
IRAtom* at;
- IRType t1 = typeOfIRExpr(mce->tyenv, va1);
- IRType t2 = typeOfIRExpr(mce->tyenv, va2);
- IRType t3 = typeOfIRExpr(mce->tyenv, va3);
- IRType t4 = typeOfIRExpr(mce->tyenv, va4);
+ IRType t1 = typeOfIRExpr(mce->stmts, va1);
+ IRType t2 = typeOfIRExpr(mce->stmts, va2);
+ IRType t3 = typeOfIRExpr(mce->stmts, va3);
+ IRType t4 = typeOfIRExpr(mce->stmts, va4);
tl_assert(isShadowAtom(mce,va1));
tl_assert(isShadowAtom(mce,va2));
tl_assert(isShadowAtom(mce,va3));
@@ -1952,7 +1952,7 @@
tl_assert(isOriginalAtom(mce, exprvec[i]));
if (cee->mcx_mask & (1<<i))
continue;
- if (typeOfIRExpr(mce->tyenv, exprvec[i]) != Ity_I64)
+ if (typeOfIRExpr(mce->stmts, exprvec[i]) != Ity_I64)
mergeTy64 = False;
}
@@ -5028,7 +5028,7 @@
vbitsC = expr2vbits(mce, cond);
vbits1 = expr2vbits(mce, iftrue);
vbits0 = expr2vbits(mce, iffalse);
- ty = typeOfIRExpr(mce->tyenv, vbits0);
+ ty = typeOfIRExpr(mce->stmts, vbits0);
return
mkUifU(mce, ty, assignNew('V', mce, ty,
@@ -5054,7 +5054,7 @@
return IRExpr_RdTmp( findShadowTmpV(mce, e->Iex.RdTmp.tmp) );
case Iex_Const:
- return definedOfType(shadowTypeV(typeOfIRExpr(mce->tyenv, e)));
+ return definedOfType(shadowTypeV(typeOfIRExpr(mce->stmts, e)));
case Iex_Qop:
return expr2vbits_Qop(
@@ -5119,7 +5119,7 @@
/* vatom is vbits-value and as such can only have a shadow type. */
tl_assert(isShadowAtom(mce,vatom));
- ty = typeOfIRExpr(mce->tyenv, vatom);
+ ty = typeOfIRExpr(mce->stmts, vatom);
tyH = mce->settings->hWordTy;
if (tyH == Ity_I32) {
@@ -5199,10 +5199,10 @@
if (guard) {
tl_assert(isOriginalAtom(mce, guard));
- tl_assert(typeOfIRExpr(mce->tyenv, guard) == Ity_I1);
+ tl_assert(typeOfIRExpr(mce->stmts, guard) == Ity_I1);
}
- ty = typeOfIRExpr(mce->tyenv, vdata);
+ ty = typeOfIRExpr(mce->stmts, vdata);
// If we're not doing undefined value checking, pretend that this value
// is "all valid". That lets Vex's optimiser remove some of the V bit
@@ -5530,7 +5530,7 @@
tl_assert(d->mAddr);
complainIfUndefined(mce, d->mAddr, d->guard);
- tyAddr = typeOfIRExpr(mce->tyenv, d->mAddr);
+ tyAddr = typeOfIRExpr(mce->stmts, d->mAddr);
tl_assert(tyAddr == Ity_I32 || tyAddr == Ity_I64);
tl_assert(tyAddr == mce->settings->hWordTy); /* not really right */
}
@@ -5581,7 +5581,7 @@
/* Outputs: the destination temporary, if there is one. */
if (!isIRTempInvalid(d->tmp)) {
dst = findShadowTmpV(mce, d->tmp);
- tyDst = typeOfIRTemp(mce->tyenv, d->tmp);
+ tyDst = typeOfIRTemp(mce->stmts, d->tmp);
assign( 'V', mce, dst, mkPCastTo( mce, tyDst, curr) );
}
@@ -5913,7 +5913,7 @@
tl_assert(cas->expdHi == NULL);
tl_assert(cas->dataHi == NULL);
- elemTy = typeOfIRExpr(mce->tyenv, cas->expdLo);
+ elemTy = typeOfIRExpr(mce->stmts, cas->expdLo);
switch (elemTy) {
case Ity_I8: elemSzB = 1; opCasCmpEQ = Iop_CasCmpEQ8; break;
case Ity_I16: elemSzB = 2; opCasCmpEQ = Iop_CasCmpEQ16; break;
@@ -6007,7 +6007,7 @@
tl_assert(cas->expdHi != NULL);
tl_assert(cas->dataHi != NULL);
- elemTy = typeOfIRExpr(mce->tyenv, cas->expdLo);
+ elemTy = typeOfIRExpr(mce->stmts, cas->expdLo);
switch (elemTy) {
case Ity_I8:
opCasCmpEQ = Iop_CasCmpEQ8; opOr = Iop_Or8; opXor = Iop_Xor8;
@@ -6161,7 +6161,7 @@
assignment of the loaded (shadow) data to the result temporary.
Treat a store-conditional like a normal store, and mark the
result temporary as defined. */
- IRType resTy = typeOfIRTemp(mce->tyenv, stResult);
+ IRType resTy = typeOfIRTemp(mce->stmts, stResult);
IRTemp resTmp = findShadowTmpV(mce, stResult);
tl_assert(isIRAtom(stAddr));
@@ -6182,7 +6182,7 @@
} else {
/* Store Conditional */
/* Stay sane */
- IRType dataTy = typeOfIRExpr(mce->tyenv,
+ IRType dataTy = typeOfIRExpr(mce->stmts,
stStoredata);
tl_assert(dataTy == Ity_I64 || dataTy == Ity_I32
|| dataTy == Ity_I16 || dataTy == Ity_I8);
@@ -6728,11 +6728,11 @@
no need to assert that here. */
IRTemp tmp_o = sb_in->stmts->stmts[j]->Ist.WrTmp.tmp;
IRTemp tmp_v = findShadowTmpV(&mce, tmp_o);
- IRType ty_v = typeOfIRTemp(mce.tyenv, tmp_v);
+ IRType ty_v = typeOfIRTemp(mce.stmts, tmp_v);
assign('V', &mce, tmp_v, definedOfType(ty_v));
if (MC_(clo_mc_level) == 3) {
IRTemp tmp_b = findShadowTmpB(&mce, tmp_o);
- tl_assert(typeOfIRTemp(mce.tyenv, tmp_b) == Ity_I32);
+ tl_assert(typeOfIRTemp(mce.stmts, tmp_b) == Ity_I32);
assign('B', &mce, tmp_b, mkU32(0)/* UNKNOWN ORIGIN */);
}
if (0) {
@@ -7089,7 +7089,7 @@
const HChar* hName;
IRTemp bTmp;
IRDirty* di;
- IRType aTy = typeOfIRExpr( mce->tyenv, baseaddr );
+ IRType aTy = typeOfIRExpr(mce->stmts, baseaddr);
IROp opAdd = aTy == Ity_I32 ? Iop_Add32 : Iop_Add64;
IRAtom* ea = baseaddr;
if (offset != 0) {
@@ -7204,12 +7204,12 @@
void* hFun;
const HChar* hName;
IRDirty* di;
- IRType aTy = typeOfIRExpr( mce->tyenv, baseaddr );
+ IRType aTy = typeOfIRExpr(mce->stmts, baseaddr);
IROp opAdd = aTy == Ity_I32 ? Iop_Add32 : Iop_Add64;
IRAtom* ea = baseaddr;
if (guard) {
tl_assert(isOriginalAtom(mce, guard));
- tl_assert(typeOfIRExpr(mce->tyenv, guard) == Ity_I1);
+ tl_assert(typeOfIRExpr(mce->stmts, guard) == Ity_I1);
}
if (offset != 0) {
IRAtom* off = aTy == Ity_I32 ? mkU32( offset )
@@ -7252,7 +7252,7 @@
}
static IRAtom* narrowTo32 ( MCEnv* mce, IRAtom* e ) {
- IRType eTy = typeOfIRExpr(mce->tyenv, e);
+ IRType eTy = typeOfIRExpr(mce->stmts, e);
if (eTy == Ity_I64)
return assignNew( 'B', mce, Ity_I32, unop(Iop_64to32, e) );
if (eTy == Ity_I32)
@@ -7261,7 +7261,7 @@
}
static IRAtom* zWidenFrom32 ( MCEnv* mce, IRType dstTy, IRAtom* e ) {
- IRType eTy = typeOfIRExpr(mce->tyenv, e);
+ IRType eTy = typeOfIRExpr(mce->stmts, e);
tl_assert(eTy == Ity_I32);
if (dstTy == Ity_I64)
return assignNew( 'B', mce, Ity_I64, unop(Iop_32Uto64, e) );
@@ -7627,7 +7627,7 @@
XXXX how does this actually ensure that?? */
tl_assert(isIRAtom(stAddr));
tl_assert(isIRAtom(stData));
- dszB = sizeofIRType( typeOfIRExpr(mce->tyenv, stData ) );
+ dszB = sizeofIRType( typeOfIRExpr(mce->stmts, stData ) );
dataB = schemeE( mce, stData );
gen_store_b( mce, dszB, stAddr, 0/*offset*/, dataB, guard );
}
@@ -7746,7 +7746,7 @@
if (st->Ist.LLSC.storedata == NULL) {
/* Load Linked */
IRType resTy
- = typeOfIRTemp(mce->tyenv, st->Ist.LLSC.result);
+ = typeOfIRTemp(mce->stmts, st->Ist.LLSC.result);
IRExpr* vanillaLoad
= IRExpr_Load(st->Ist.LLSC.end, resTy, st->Ist.LLSC.addr);
tl_assert(resTy == Ity_I64 || resTy == Ity_I32
@@ -7772,7 +7772,7 @@
Int b_offset
= MC_(get_otrack_shadow_offset)(
st->Ist.Put.offset,
- sizeofIRType(typeOfIRExpr(mce->tyenv, st->Ist.Put.data))
+ sizeofIRType(typeOfIRExpr(mce->stmts, st->Ist.Put.data))
);
if (b_offset >= 0) {
/* FIXME: this isn't an atom! */
|
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));
}
|
|
From: <sv...@va...> - 2017-03-22 20:21:43
|
Author: iraisr
Date: Wed Mar 22 20:21:34 2017
New Revision: 3322
Log:
Fix sanity checking of phi nodes when traversing IRStmtVec.
Modified:
branches/VEX_JIT_HACKS/priv/ir_defs.c
branches/VEX_JIT_HACKS/pub/libvex_ir.h
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 20:21:34 2017
@@ -3755,6 +3755,7 @@
inline
IRType typeOfIRTemp ( const IRTypeEnv* env, IRTemp tmp )
{
+ vassert(tmp.id == env->id);
vassert(tmp.index >= 0);
vassert(tmp.index < env->types_used);
return env->types[tmp.index];
@@ -4214,32 +4215,31 @@
}
}
-static
-void useBeforeDef_PhiNodes(const IRSB* bb, const IRStmtVec* stmts,
- const IRStmt* stmt, const IRPhiVec* phi_nodes,
- UInt* def_counts[])
+static void useBeforeDef_IRPhi(const IRSB* bb, const IRStmtVec* stmts,
+ const IRStmt* stmt, const IRPhi* phi,
+ UInt* def_counts[])
{
vassert(stmt->tag == Ist_IfThenElse);
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- const IRPhi* phi = phi_nodes->phis[i];
- useBeforeDef_Temp(bb, stmts, stmt, phi->srcThen, def_counts);
- useBeforeDef_Temp(bb, stmts, stmt, phi->srcElse, def_counts);
+ IRStmtVec* then_leg = stmt->Ist.IfThenElse.then_leg;
+ IRStmtVec* else_leg = stmt->Ist.IfThenElse.else_leg;
- /* Check also that referenced IRStmtVec's actually exist and belong to
- "parent", "then", and "else", respectively. */
- if (phi->dst.id != stmts->tyenv->id) {
- sanityCheckFail(bb,stmt,"Istmt.IfThenElse.Phi.dst does not "
- "reference parent IRStmtVec");
- }
- if (phi->srcThen.id != stmt->Ist.IfThenElse.then_leg->tyenv->id) {
- sanityCheckFail(bb,stmt,"Istmt.IfThenElse.Phi.srcThen does not "
- "reference \"then\" IRStmtVec leg");
- }
- if (phi->srcElse.id != stmt->Ist.IfThenElse.else_leg->tyenv->id) {
- sanityCheckFail(bb,stmt,"Istmt.IfThenElse.Phi.srcElse does not "
- "reference \"else\" IRStmtVec leg");
- }
+ useBeforeDef_Temp(bb, then_leg, stmt, phi->srcThen, def_counts);
+ useBeforeDef_Temp(bb, else_leg, stmt, phi->srcElse, def_counts);
+
+ /* Check also that referenced IRStmtVec's actually exist and belong to
+ "parent", "then", and "else", respectively. */
+ if (phi->dst.id != stmts->tyenv->id) {
+ sanityCheckFail(bb, stmt, "Istmt.IfThenElse.Phi.dst does not "
+ "reference parent IRStmtVec");
+ }
+ if (phi->srcThen.id != then_leg->tyenv->id) {
+ sanityCheckFail(bb, stmt, "Istmt.IfThenElse.Phi.srcThen does not "
+ "reference \"then\" IRStmtVec leg");
+ }
+ if (phi->srcElse.id != else_leg->tyenv->id) {
+ sanityCheckFail(bb, stmt, "Istmt.IfThenElse.Phi.srcElse does not "
+ "reference \"else\" IRStmtVec leg");
}
}
@@ -4326,11 +4326,8 @@
case Ist_IfThenElse:
useBeforeDef_Expr(bb, stmts, stmt, stmt->Ist.IfThenElse.cond,
def_counts);
- /* Traversing into legs driven from sanityCheckIRStmtVec(). */
- if (stmt->Ist.IfThenElse.phi_nodes != NULL) {
- useBeforeDef_PhiNodes(bb, stmts, stmt,
- stmt->Ist.IfThenElse.phi_nodes, def_counts);
- }
+ /* Traversing into legs and phi nodes driven from
+ sanityCheckIRStmtVec(). */
break;
default:
vpanic("useBeforeDef_Stmt");
@@ -4387,17 +4384,8 @@
"IRStmt.LLSC: destination tmp is assigned more than once");
break;
case Ist_IfThenElse: {
- /* Traversing into legs driven from sanityCheckIRStmtVec(). */
- const IRPhiVec* phi_nodes = stmt->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- assignedOnce_Temp(
- bb, stmts, stmt, phi_nodes->phis[i]->dst, def_counts,
- "IRStmt.IfThenElse.Phi: destination tmp is out of range",
- "IRStmt.IfThenElse.Phi: destination tmp is out of scope",
- "IRStmt.IfThenElse: destination tmp is assigned more than once");
- }
- }
+ /* Traversing into legs and phi nodes driven from
+ sanityCheckIRStmtVec(). */
break;
}
// Ignore all other cases
@@ -4409,6 +4397,16 @@
}
}
+static void assignedOnce_IRPhi(const IRSB* bb, const IRStmtVec* stmts,
+ const IRStmt* stmt, const IRPhi* phi,
+ UInt* def_counts[])
+{
+ assignedOnce_Temp(bb, stmts, stmt, phi->dst, def_counts,
+ "IRStmt.IfThenElse.Phi: destination tmp is out of range",
+ "IRStmt.IfThenElse.Phi: destination tmp is out of scope",
+ "IRStmt.IfThenElse: destination tmp is assigned more than once");
+}
+
static
void tcExpr(const IRSB* bb, const IRStmtVec* stmts, const IRStmt* stmt,
const IRExpr* expr, IRType gWordTy)
@@ -4918,19 +4916,25 @@
tcExpr(bb, stmts, stmt, stmt->Ist.IfThenElse.cond, gWordTy);
if (typeOfIRExpr(tyenv, stmt->Ist.IfThenElse.cond) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.IfThenElse.cond: not :: Ity_I1");
- /* Traversing into legs driven from sanityCheckIRStmtVec(). */
- const IRPhiVec* phi_nodes = stmt->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- tcPhi(bb, stmts, stmt, phi_nodes->phis[i]);
- }
- }
+ /* Traversing into legs and phi nodes driven from
+ sanityCheckIRStmtVec(). */
break;
default:
vpanic("tcStmt");
}
}
+static void sanityCheckIRPhiNodes(const IRSB* bb, const IRStmtVec* stmts,
+ const IRStmt* stmt, const IRPhiVec* phi_nodes, UInt *def_counts[])
+{
+ for (UInt i = 0; i < phi_nodes->phis_used; i++) {
+ const IRPhi* phi = phi_nodes->phis[i];
+ useBeforeDef_IRPhi(bb, stmts, stmt, phi, def_counts);
+ assignedOnce_IRPhi(bb, stmts, stmt, phi, def_counts);
+ tcPhi(bb, stmts, stmt, phi);
+ }
+}
+
static
void sanityCheckIRStmtVec(const IRSB* bb, const IRStmtVec* stmts,
Bool require_flat, UInt* def_counts[],
@@ -4997,10 +5001,32 @@
tcStmt(bb, stmts, stmt, require_flat, gWordTy);
if (stmt->tag == Ist_IfThenElse) {
- sanityCheckIRStmtVec(bb, stmt->Ist.IfThenElse.then_leg, require_flat,
- def_counts, n_stmt_vecs, id_counts, gWordTy);
- sanityCheckIRStmtVec(bb, stmt->Ist.IfThenElse.else_leg, require_flat,
- def_counts, n_stmt_vecs, id_counts, gWordTy);
+ const IRStmtVec* then_leg = stmt->Ist.IfThenElse.then_leg;
+ const IRStmtVec* else_leg = stmt->Ist.IfThenElse.else_leg;
+
+ if (then_leg->parent == NULL) {
+ sanityCheckFail(bb, stmt, "IfThenElse.then.parent is NULL");
+ }
+ if (else_leg->parent == NULL) {
+ sanityCheckFail(bb, stmt, "IfThenElse.else.parent is NULL");
+ }
+ if (then_leg->parent != stmts) {
+ sanityCheckFail(bb, stmt, "IfThenElse.then.parent does not point "
+ "to its parent");
+ }
+ if (else_leg->parent != stmts) {
+ sanityCheckFail(bb, stmt, "IfThenElse.else.parent does not point "
+ "to its parent");
+ }
+
+ sanityCheckIRStmtVec(bb, then_leg, require_flat, def_counts,
+ n_stmt_vecs, id_counts, gWordTy);
+ sanityCheckIRStmtVec(bb, else_leg, require_flat, def_counts,
+ n_stmt_vecs, id_counts, gWordTy);
+ if (stmt->Ist.IfThenElse.phi_nodes != NULL) {
+ sanityCheckIRPhiNodes(bb, stmts, stmt,
+ stmt->Ist.IfThenElse.phi_nodes, def_counts);
+ }
}
}
}
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 20:21:34 2017
@@ -2826,7 +2826,8 @@
/* Allocates an empty IRStmtVec with an invalid IRTyEnvID.
Such an IRStmtVec needs to have a valid IRTyEnvId - get it from
nextIRTyEnvID(). Only after this is done, then such an IRStmtVec is ready
- for newIRTemp() to give out new temporaries. */
+ for newIRTemp() to give out new temporaries.
+ Nested IRStmtVec also needs to have correctly set its parent. */
extern IRStmtVec* emptyIRStmtVec(void);
extern IRStmtVec* deepCopyIRStmtVec(const IRStmtVec* src, IRStmtVec* parent);
|
|
From: Ivo R. <iv...@iv...> - 2017-03-22 16:40:08
|
Dear Valgrind developers,
Please let me know if you have any objections to a small fix for Linux
fcntl syscall wrapper
which was missing checks on flock structure of some fcntl commands.
Bug 377930 fcntl syscall wrapper is missing flock structure check:
https://bugs.kde.org/show_bug.cgi?id=377930
Patch:
https://bugsfiles.kde.org/attachment.cgi?id=104688
Thank you,
I.
|