|
From: David G. <dav...@gm...> - 2011-07-12 05:41:08
|
Hi! I'm currently trying to develop a simple profiling tool on top of
callgrind. I've created a structure that contains information about
every executed block and its memory accesses. To do that, every time
the function callgrind/bbcc.c/CLG_(setup_bbcc) is called I add a new
block to that structure and then go through every statement of that
block and:
add an address to the read list of that block every time I get an
Ist_WrTmp statement;
and add an address to the write list of that block every time I get
an Ist_Store statement:
for (/*use current i*/; i < sbInCalc->stmts_used; i++) {
st = sbInCalc->stmts[i];
VG_(printf)("\n");
ppIRStmt(st);
switch (st->tag) {
..........
case Ist_WrTmp: {
IRExpr* data = st->Ist.WrTmp.data;
if (data->tag == Iex_Load) {
IRExpr* aexpr = data->Iex.Load.addr;
addRead(aexpr);
VG_(printf)("____Ist_WrTmp/Iex_Load -> addRead()\n");
}
break;
}
case Ist_Store: {
IRExpr* aexpr = st->Ist.Store.addr;
addWrite(aexpr);
VG_(printf)("____Ist_Store -> addWrite()\n");
break;
}
......
default:
break;
}
The problem is that most of the time, the addresses I get are from
temporaries (ex: t25) which is undesirable:
------ IMark(0x1000016A8, 1) ------
t0 = GET:I64(40)
t21 = GET:I64(32)
t20 = Sub64(t21,0x8:I64)
PUT(32) = t20
STle(t20) = t0____Ist_Store -> addWrite()
------ IMark(0x1000016A9, 3) ------
PUT(40) = t20
------ IMark(0x1000016AC, 4) ------
PUT(168) = 0x1000016AC:I64
t23 = Add64(t20,0xFFFFFFFFFFFFFFE8:I64)
t25 = GET:I64(56)
STle(t23) = t25____Ist_Store -> addWrite()
------ IMark(0x1000016B0, 4) ------
PUT(168) = 0x1000016B0:I64
t26 = Add64(t20,0xFFFFFFFFFFFFFFE8:I64)
t28 = LDle:I64(t26)____Ist_WrTmp/Iex_Load -> addRead()
Sometimes the addresses are like I want them to be:
------ IMark(0x100001647, 3) ------
PUT(40) = t12
------ IMark(0x10000164A, 7) ------
------ IMark(0x100001651, 2) ------
PUT(168) = 0x100001651:I64
t16 = LDle:I32(0x100002090:I64)____Ist_WrTmp/Iex_Load -> addRead()
Is there any way I can get the address stored at those temporaries?
Thank you very much!
|