#pragma ident "@(#)$RCSfile: trace.inst.c,v $ $Revision: 1.1.2.2 $ (DEC) $Date: 1995/04/27 19:50:10 $" #include #include void InstrumentInit(int p1, char **p2) { AddCallProto("OpenFile()"); AddCallProto("InstReference(REGV)"); AddCallProto("DataReadReference(VALUE)"); AddCallProto("DataWriteReference(VALUE)"); AddCallProto("CloseFile()"); AddCallProgram(ProgramBefore,"OpenFile"); AddCallProgram(ProgramAfter,"CloseFile"); } Instrument(int argc, char **argv, Obj *obj) { Proc *p; Block *b; Inst *i; for (p = GetFirstObjProc(obj); p != NULL; p = GetNextProc(p)) { for (b = GetFirstBlock(p); b != NULL; b = GetNextBlock(b)) { for (i = GetFirstInst(b); i != NULL; i = GetNextInst(i)) { AddCallInst(i,InstBefore,"InstReference",REG_PC); if (IsInstType(i,InstTypeLoad)) AddCallInst(i,InstBefore,"DataReadReference",EffAddrValue); else if (IsInstType(i,InstTypeStore)) AddCallInst(i,InstBefore,"DataWriteReference",EffAddrValue); } } } }