|
From: <sv...@va...> - 2005-10-23 12:07:06
|
Author: sewardj
Date: 2005-10-23 13:06:55 +0100 (Sun, 23 Oct 2005)
New Revision: 4967
Log:
Don't assume the first statement is an IRMark, since it could instead
be part of a self-check. Instead, copy verbatim any IR preamble
preceding the first IMark. This stops cachegrind asserting on
self-checking translations.
Modified:
trunk/cachegrind/cg_main.c
Modified: trunk/cachegrind/cg_main.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
--- trunk/cachegrind/cg_main.c 2005-10-23 09:30:35 UTC (rev 4966)
+++ trunk/cachegrind/cg_main.c 2005-10-23 12:06:55 UTC (rev 4967)
@@ -743,7 +743,6 @@
IRTypeEnv* tyenv =3D bbIn->tyenv;
InstrInfo* curr_inode =3D NULL;
=20
-
if (gWordTy !=3D hWordTy) {
/* We don't currently support this case. */
VG_(tool_panic)("host/guest word size mismatch");
@@ -756,10 +755,17 @@
cgs.bbOut->next =3D dopyIRExpr(bbIn->next);
cgs.bbOut->jumpkind =3D bbIn->jumpkind;
=20
+ // Copy verbatim any IR preamble preceding the first IMark
+ i =3D 0;
+ while (i < bbIn->stmts_used && bbIn->stmts[i]->tag !=3D Ist_IMark) {
+ addStmtToIRBB( cgs.bbOut, bbIn->stmts[i] );
+ i++;
+ }
+
// Get the first statement, and initial cia from it
- i =3D 0;
tl_assert(bbIn->stmts_used > 0);
- st =3D bbIn->stmts[0];
+ tl_assert(i < bbIn->stmts_used);
+ st =3D bbIn->stmts[i];
tl_assert(Ist_IMark =3D=3D st->tag);
cia =3D st->Ist.IMark.addr;
=20
@@ -773,7 +779,7 @@
=20
// Traverse the block, initialising inodes, adding events and flushin=
g as
// necessary.
- for (i =3D 0; i < bbIn->stmts_used; i++) {
+ for (/*use current i*/; i < bbIn->stmts_used; i++) {
=20
st =3D bbIn->stmts[i];
tl_assert(isFlatIRStmt(st));
|