Lines Matching refs:cgs
675 InstrInfo* setup_InstrInfo ( CgState* cgs, Addr instr_addr, UInt instr_len ) in setup_InstrInfo() argument
678 tl_assert(cgs->sbInfo_i >= 0); in setup_InstrInfo()
679 tl_assert(cgs->sbInfo_i < cgs->sbInfo->n_instrs); in setup_InstrInfo()
680 i_node = &cgs->sbInfo->instrs[ cgs->sbInfo_i ]; in setup_InstrInfo()
684 cgs->sbInfo_i++; in setup_InstrInfo()
693 static void flushEvents ( CgState* cgs ) in flushEvents() argument
706 while (i < cgs->events_used) { in flushEvents()
715 tl_assert(i >= 0 && i < cgs->events_used); in flushEvents()
717 ev = &cgs->events[i]; in flushEvents()
718 ev2 = ( i < cgs->events_used-1 ? &cgs->events[i+1] : NULL ); in flushEvents()
719 ev3 = ( i < cgs->events_used-2 ? &cgs->events[i+2] : NULL ); in flushEvents()
869 addStmtToIRSB( cgs->sbOut, IRStmt_Dirty(di) ); in flushEvents()
872 cgs->events_used = 0; in flushEvents()
875 static void addEvent_Ir ( CgState* cgs, InstrInfo* inode ) in addEvent_Ir() argument
878 if (cgs->events_used == N_EVENTS) in addEvent_Ir()
879 flushEvents(cgs); in addEvent_Ir()
880 tl_assert(cgs->events_used >= 0 && cgs->events_used < N_EVENTS); in addEvent_Ir()
881 evt = &cgs->events[cgs->events_used]; in addEvent_Ir()
891 cgs->events_used++; in addEvent_Ir()
895 void addEvent_Dr ( CgState* cgs, InstrInfo* inode, Int datasize, IRAtom* ea ) in addEvent_Dr() argument
902 if (cgs->events_used == N_EVENTS) in addEvent_Dr()
903 flushEvents(cgs); in addEvent_Dr()
904 tl_assert(cgs->events_used >= 0 && cgs->events_used < N_EVENTS); in addEvent_Dr()
905 evt = &cgs->events[cgs->events_used]; in addEvent_Dr()
911 cgs->events_used++; in addEvent_Dr()
915 void addEvent_Dw ( CgState* cgs, InstrInfo* inode, Int datasize, IRAtom* ea ) in addEvent_Dw() argument
927 lastEvt = &cgs->events[cgs->events_used-1]; in addEvent_Dw()
928 if (cgs->events_used > 0 in addEvent_Dw()
939 if (cgs->events_used == N_EVENTS) in addEvent_Dw()
940 flushEvents(cgs); in addEvent_Dw()
941 tl_assert(cgs->events_used >= 0 && cgs->events_used < N_EVENTS); in addEvent_Dw()
942 evt = &cgs->events[cgs->events_used]; in addEvent_Dw()
948 cgs->events_used++; in addEvent_Dw()
952 void addEvent_D_guarded ( CgState* cgs, InstrInfo* inode, in addEvent_D_guarded() argument
970 tl_assert(cgs->events_used >= 0); in addEvent_D_guarded()
971 flushEvents(cgs); in addEvent_D_guarded()
972 tl_assert(cgs->events_used == 0); in addEvent_D_guarded()
993 addStmtToIRSB( cgs->sbOut, IRStmt_Dirty(di) ); in addEvent_D_guarded()
998 void addEvent_Bc ( CgState* cgs, InstrInfo* inode, IRAtom* guard ) in addEvent_Bc() argument
1002 tl_assert(typeOfIRExpr(cgs->sbOut->tyenv, guard) in addEvent_Bc()
1006 if (cgs->events_used == N_EVENTS) in addEvent_Bc()
1007 flushEvents(cgs); in addEvent_Bc()
1008 tl_assert(cgs->events_used >= 0 && cgs->events_used < N_EVENTS); in addEvent_Bc()
1009 evt = &cgs->events[cgs->events_used]; in addEvent_Bc()
1014 cgs->events_used++; in addEvent_Bc()
1018 void addEvent_Bi ( CgState* cgs, InstrInfo* inode, IRAtom* whereTo ) in addEvent_Bi() argument
1022 tl_assert(typeOfIRExpr(cgs->sbOut->tyenv, whereTo) in addEvent_Bi()
1026 if (cgs->events_used == N_EVENTS) in addEvent_Bi()
1027 flushEvents(cgs); in addEvent_Bi()
1028 tl_assert(cgs->events_used >= 0 && cgs->events_used < N_EVENTS); in addEvent_Bi()
1029 evt = &cgs->events[cgs->events_used]; in addEvent_Bi()
1034 cgs->events_used++; in addEvent_Bi()
1052 CgState cgs; in cg_instrument() local
1062 cgs.sbOut = deepCopyIRSBExceptStmts(sbIn); in cg_instrument()
1067 addStmtToIRSB( cgs.sbOut, sbIn->stmts[i] ); in cg_instrument()
1085 cgs.events_used = 0; in cg_instrument()
1086 cgs.sbInfo = get_SB_info(sbIn, (Addr)closure->readdr); in cg_instrument()
1087 cgs.sbInfo_i = 0; in cg_instrument()
1122 curr_inode = setup_InstrInfo(&cgs, cia, isize); in cg_instrument()
1124 addEvent_Ir( &cgs, curr_inode ); in cg_instrument()
1133 addEvent_Dr( &cgs, curr_inode, sizeofIRType(data->Iex.Load.ty), in cg_instrument()
1142 addEvent_Dw( &cgs, curr_inode, in cg_instrument()
1153 addEvent_D_guarded( &cgs, curr_inode, in cg_instrument()
1166 addEvent_D_guarded( &cgs, curr_inode, in cg_instrument()
1187 addEvent_Dr( &cgs, curr_inode, dataSize, d->mAddr ); in cg_instrument()
1189 addEvent_Dw( &cgs, curr_inode, dataSize, d->mAddr ); in cg_instrument()
1213 addEvent_Dr( &cgs, curr_inode, dataSize, cas->addr ); in cg_instrument()
1214 addEvent_Dw( &cgs, curr_inode, dataSize, cas->addr ); in cg_instrument()
1223 addEvent_Dr( &cgs, curr_inode, in cg_instrument()
1226 flushEvents( &cgs ); in cg_instrument()
1230 addEvent_Dw( &cgs, curr_inode, in cg_instrument()
1251 IRTemp guard1 = newIRTemp(cgs.sbOut->tyenv, Ity_I1); in cg_instrument()
1252 IRTemp guardW = newIRTemp(cgs.sbOut->tyenv, tyW); in cg_instrument()
1253 IRTemp guard = newIRTemp(cgs.sbOut->tyenv, tyW); in cg_instrument()
1277 addStmtToIRSB( cgs.sbOut, in cg_instrument()
1279 addStmtToIRSB( cgs.sbOut, in cg_instrument()
1285 cgs.sbOut, in cg_instrument()
1292 addEvent_Bc( &cgs, curr_inode, IRExpr_RdTmp(guard) ); in cg_instrument()
1297 flushEvents( &cgs ); in cg_instrument()
1308 addStmtToIRSB( cgs.sbOut, st ); in cg_instrument()
1326 addEvent_Bi( &cgs, curr_inode, sbIn->next ); in cg_instrument()
1337 flushEvents( &cgs ); in cg_instrument()
1340 tl_assert(cgs.sbInfo_i == cgs.sbInfo->n_instrs); in cg_instrument()
1350 return cgs.sbOut; in cg_instrument()