|
From: <sv...@va...> - 2007-01-09 13:10:20
|
Author: njn
Date: 2007-01-09 13:10:12 +0000 (Tue, 09 Jan 2007)
New Revision: 6493
Log:
Handle a few extra cases where origin sizes and the word size don't match=
.
And update the expected output for pushfpopf. All the regtests now work =
the
same on my machine as in the trunk.
Modified:
branches/ORIGIN_TRACKING/memcheck/mc_translate.c
branches/ORIGIN_TRACKING/memcheck/tests/x86/pushfpopf.stderr.exp
Modified: branches/ORIGIN_TRACKING/memcheck/mc_translate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ORIGIN_TRACKING/memcheck/mc_translate.c 2007-01-08 06:43:25 =
UTC (rev 6492)
+++ branches/ORIGIN_TRACKING/memcheck/mc_translate.c 2007-01-09 13:10:12 =
UTC (rev 6493)
@@ -1158,28 +1158,87 @@
n_origins_found =3D originTmps.tmps_nextfree;
}
=20
- // foreach (t) in finish_list {
- // 32-bit machines:
- // if (4 =3D=3D sizeof(t)) --> use t
- // if (8 =3D=3D sizeof(t)) --> use Iop_64HIto32(t) // pass in =
high word
- //=20
- // 64-bit machines:
- // if (4 =3D=3D sizeof(t)) --> use Iop(32HLto64)(0, t)
- // if (8 =3D=3D sizeof(t)) --> use t
- // }
+ // Here we pass in one 32-bit origin per word. Even on 64-bit machin=
es
+ // -- we extend the 32-bit origin to be 64-bits.
+ tl_assert(4 =3D=3D VG_WORDSIZE || 8 =3D=3D VG_WORDSIZE);
+
for (j =3D 0; j < n_origins_found; j++) {
- IRTemp tmp =3D originTmps.tmps[j];
- Int tmp_szB =3D sizeofIRType(typeOfIRTemp(mce->bb_in->tyenv, tm=
p));
- // XXX: in the 16=3D=3Dtmp_szB case, convert using Iop_128HIto64, =
then
- // Iop_64HIto32
- if (8 =3D=3D tmp_szB && 4 =3D=3D VG_WORDSIZE) {
- //convert using Iop_64HIto32, rename in the originTmps array
- tl_assert2(0, "XXX: 64-bit operand, not yet handled");
- } else if (4 =3D=3D tmp_szB && 8 =3D=3D VG_WORDSIZE) {
- // convert using Iop_32HLto64, rename in the originTmps array
- tl_assert2(0, "XXX: 32-bit operand on 64-bit $PLAT, not yet han=
dled");
- } else {
- tl_assert(VG_WORDSIZE =3D=3D tmp_szB);
+ IRTemp tX =3D originTmps.tmps[j];
+ IRType tX_ty =3D typeOfIRTemp(mce->bb_in->tyenv, tX);
+
+ switch (tX_ty) {
+ case Ity_I32:
+ if (4 =3D=3D VG_WORDSIZE) {
+ // Word-size, ok to pass as-is: do nothing
+ } else {
+ // XXX
+ // convert using Iop_32HLto64, rename in the originTmps arra=
y
+ tl_assert2(0, "XXX: I32 tmp on 64-bit $PLAT, not yet handled=
");
+ }
+ break;
+
+ case Ity_F32:
+ if (4 =3D=3D VG_WORDSIZE) {
+ // tX is an F32, add "tY =3D ReinterpF32asI32(tX)", rename t=
X as
+ // tY in originTmps.
+ IRTemp tY =3D newIRTemp(mce->bb_out->tyenv, Ity_I32);
+ IRExpr* expr =3D unop(Iop_ReinterpF32asI32, mkexpr(tX));
+ assign( mce->bb_out, tY, expr );
+ originTmps.tmps[j] =3D tY;
+ } else {
+ // Need to reinterpF32asI32, then use 32HLto64 to zero-exten=
d,
+ // and rename in the originTmps array.
+ tl_assert2(0, "XXX: F32 tmp on 64-bit $PLAT, not yet handled=
");
+ }
+ break;
+
+ case Ity_I64:
+ if (8 =3D=3D VG_WORDSIZE) {
+ // Word-sized, ok to pass as-is: do nothing
+ } else {
+ // XXX: when this occurs, try the code below (which should w=
ork)
+ // by removing the assertion.
+ // tX is an I64, add "tY =3D 64HIto32(tX)", rename tX as
+ // tY in originTmps.
+ IRTemp tY =3D newIRTemp(mce->bb_out->tyenv, Ity_I32);
+ IRExpr* expr =3D unop(Iop_64HIto32, mkexpr(tX));
+ assign( mce->bb_out, tY, expr );
+ originTmps.tmps[j] =3D tY;
+ }
+ break;
+
+ case Ity_F64:
+ if (8 =3D=3D VG_WORDSIZE) {
+ // XXX: when this occurs, try the code below (which should w=
ork)
+ // by removing this assertion.
+ // tX is an F64, add "tY =3D ReinterpF64asI64(tX)", rename t=
X as
+ // tY in originTmps.
+ IRTemp tY =3D newIRTemp(mce->bb_out->tyenv, Ity_I64);
+ IRExpr* expr =3D unop(Iop_ReinterpF64asI64, mkexpr(tX));
+ assign( mce->bb_out, tY, expr );
+ originTmps.tmps[j] =3D tY;
+ tl_assert2(0, "XXX: F64 on 64-bit, not yet handled");
+ } else {
+ // tX is an F64, add:
+ // tY =3D ReinterpF64asI64(tX)
+ // tZ =3D 64HIto32(tY)
+ // and rename tX as tZ in originTmps.
+ IRTemp tY =3D newIRTemp(mce->bb_out->tyenv, Ity_I64);
+ IRTemp tZ =3D newIRTemp(mce->bb_out->tyenv, Ity_I32);
+ IRExpr* expr1 =3D unop(Iop_ReinterpF64asI64, mkexpr(tX));
+ IRExpr* expr2 =3D unop(Iop_64HIto32, mkexpr(tY));
+ assign( mce->bb_out, tY, expr1 );
+ assign( mce->bb_out, tZ, expr2 );
+ originTmps.tmps[j] =3D tZ;
+ }
+ break;
+
+ default:
+ // XXX: I1, I8, I16, I128, F32, F64, V128
+ // XXX: in the 16=3D=3Dtmp_szB case, convert using Iop_128HIto6=
4, then
+ // Iop_64HIto32
+ ppIRType(tX_ty);
+ tl_assert2(0, "complainIfUndefined: unhandled type");
}
}
=20
Modified: branches/ORIGIN_TRACKING/memcheck/tests/x86/pushfpopf.stderr.ex=
p
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ORIGIN_TRACKING/memcheck/tests/x86/pushfpopf.stderr.exp 2007=
-01-08 06:43:25 UTC (rev 6492)
+++ branches/ORIGIN_TRACKING/memcheck/tests/x86/pushfpopf.stderr.exp 2007=
-01-09 13:10:12 UTC (rev 6493)
@@ -1,7 +1,9 @@
Conditional jump or move depends on uninitialised value(s)
at 0x........: fooble (...)
by 0x........: main (pushfpopf_c.c:12)
+ Uninitialised value has unknown origin
=20
Conditional jump or move depends on uninitialised value(s)
at 0x........: fooble (...)
by 0x........: main (pushfpopf_c.c:12)
+ Uninitialised value has unknown origin
|