Guest User

Untitled

a guest
Feb 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. TRACE_AddInstrumentFunction(Trace, 0); //called in main
  2.  
  3. class readStore //This is for both read and write. Named read for historical reasons...
  4. {
  5. public:
  6. UINT64 addr;
  7. std::vector<LEVEL_BASE::REG> vread_regs;
  8. std::vector<LEVEL_BASE::REG> vwrite_regs;
  9. };
  10.  
  11. for(BBL bbl=TRACE_BblHead(trace);BBL_Valid(bbl);bbl= BBL_Next(bbl))
  12. {
  13. BBL_InsertCall(bbl, IPOINT_BEFORE, AFUNPTR(docount), IARG_UINT32, BBL_NumIns(bbl), IARG_END);
  14.  
  15. for(INS ins = BBL_InsHead(bbl); INS_Valid(ins); ins=INS_Next(ins))
  16. {
  17. LEVEL_BASE::REG readReg;
  18. LEVEL_BASE::REG writeReg;
  19. readStore *rs_temp= new readStore;
  20.  
  21. noRRegs=INS_MaxNumRRegs(ins); //get count of read regs
  22. noWRegs=INS_MaxNumWRegs(ins);
  23. for(UINT32 i=0;i<noRRegs;i++)
  24. {
  25. readReg =INS_RegR(ins,i); //returns readR type
  26. if(REG_is_gr_type(readReg))
  27. {
  28. rs_temp->vread_regs.push_back(readReg) ;
  29. }
  30. //may want to add else condition
  31. }
  32. for(UINT32 j=0;j<noWRegs;j++) //store all write regs
  33. {
  34. writeReg= INS_RegW(ins,j);
  35. if(REG_is_gr_type(writeReg))
  36. {
  37. rs_temp->vwrite_regs.push_back(writeReg);
  38. }
  39.  
  40. }
  41. rs_temp->addr= INS_Address(ins);
  42. cout << rs_temp->addr;
  43. cout << "n";
  44. readstore.push_back(*rs_temp);//array of objects with everything in it
Add Comment
Please, Sign In to add comment