Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

/users/u3/mtikir/PMaCInstrumentor_v1601/tools/CacheSimulator.h

Go to the documentation of this file.
00001 #ifndef _CacheSimulator_h_
00002 #define _CacheSimulator_h_
00003 
00004 #include <CommonMethods.h>
00005 
00006 class CacheSimulator : public CommonMethods {
00007 protected:
00008     bool     enableBBCounting;
00009     bool     enableLoopInclusion;
00010     char*    additionalInfo;
00011 public:
00012     CacheSimulator(XCoffFile* xcoff,char* extension,uint32_t phaseNo,char* blockFile,bool countBB=false,
00013                    bool loopIncl=false);
00014     virtual ~CacheSimulator() { if(additionalInfo) delete[] additionalInfo; }
00015 
00016     void selectInstrumentationPoints(char* blockFile);
00017 
00018     uint32_t maxByteCountPerInst()        { return 64 * sizeof(uint32_t); }
00019     uint32_t byteCountForInst(uint32_t instPointIdx,uint64_t instStubAddress,TextSection* textSect);
00020     uint32_t generateCodeForInst(uint32_t instPointIdx,uint64_t instStubAddress,TextSection* textSect,
00021                                  BaseGen* gen,uint32_t genBufferOffset);
00022     uint32_t bytesPerBufferEntry() { return (2*sizeof(uint64_t)); }
00023 #define BUFFER_SIZE 0x10000
00024     uint32_t howManyBufferEntry()  { return BUFFER_SIZE; }
00025     bool     filterBlockForInst(BasicBlock* bb);
00026     char*    getSharedLibFuncName(uint32_t i){
00027         ASSERT(i < getNumOfSharedLibFuncs());
00028         if(i == 0){
00029             return "MetaSim_endFuncCall_Simu";
00030         } else {
00031             return "MetaSim_simulFuncCall_Simu";
00032         }
00033         return NULL;
00034     }
00035     char* getGenClassName() { return (enableBBCounting ? "SimulatorWithCounters" : "CacheSimulator"); }
00036     uint32_t spaceForBlockInfo()   { 
00037         uint32_t ret = 0;
00038         if(enableBBCounting){
00039             ret = (uint32_t)(sizeof(uint64_t)*numberOfInstPoints);
00040         } else {
00041             ret = (uint32_t)(sizeof(uint16_t)*numberOfInstPoints);
00042         }
00043         return ret;
00044     }
00045     void getSharedLibraryPathAndObj(char** path,char** name,char** obj);
00046     void initializeReservedData(DataSection* dataSect,BaseGen* gen);
00047 
00048     int32_t getExtraBlockInfoAddress(uint32_t idx){
00049         int32_t ret = 0;
00050         if(enableBBCounting){
00051             ret = (int32_t)(extraBlockInfoAddress + (idx*sizeof(uint64_t)) - execTOCAddress - tocDistUpdateVal);
00052         } else {
00053             ret = (int32_t)(extraBlockInfoAddress + (idx*sizeof(uint16_t)) - execTOCAddress - tocDistUpdateVal);
00054         }
00055         return ret;
00056     }
00057 
00058     void setLoopInclusion(bool flg) { enableLoopInclusion = flg; }
00059     char* additionalInfoToPrint() { return additionalInfo; }
00060 };
00061 
00062 #endif /* _CacheSimulator_h_ */

Generated on Mon Jan 28 11:08:33 2008 for PMaCInstrumentor by doxygen 1.3.5