00001 #ifndef _BasicBlockTracer_h_
00002 #define _BasicBlockTracer_h_
00003
00004 #include <CommonMethods.h>
00005
00006 class BasicBlockTracer : public CommonMethods {
00007 protected:
00008 uint32_t* allBlockInfo;
00009 uint64_t blockPointerOffset;
00010 public:
00011 BasicBlockTracer(XCoffFile* xcoff,char* extension,uint32_t phaseNo);
00012 virtual ~BasicBlockTracer() { }
00013
00014 void selectInstrumentationPoints(char* blockFile);
00015
00016 uint32_t maxByteCountPerInst() { return 32 * sizeof(uint32_t); }
00017 uint32_t byteCountForInst(uint32_t instPointIdx,uint64_t instStubAddress,TextSection* textSect);
00018 uint32_t generateCodeForInst(uint32_t instPointIdx,uint64_t instStubAddress,TextSection* textSect,
00019 BaseGen* gen,uint32_t genBufferOffset);
00020 bool filterBlockForInst(BasicBlock* bb);
00021 uint32_t howManyBufferEntry() { return 0; }
00022 char* getSharedLibFuncName(uint32_t i){
00023 ASSERT(i < getNumOfSharedLibFuncs());
00024 return "MetaSim_allFuncCall_Exec";
00025 }
00026 char* getGenClassName() { return "BasicBlockTracer"; }
00027 void reserveDataForInstrumentation();
00028 uint32_t generateSharedLibFuncWrapper(uint32_t libFuncIdx,uint64_t funcCallAddr,
00029 uint32_t genBufferOffset,BaseGen* gen);
00030 uint32_t getBlockPointerOffset(uint32_t idx)
00031 { return (int32_t)(allBlockInfo[idx] - execTOCAddress - tocDistUpdateVal); }
00032 void initializeReservedData(DataSection* dataSect,BaseGen* gen);
00033 uint32_t getBlockPointerOffsetSaveOffset()
00034 { return (int32_t)(blockPointerOffset - execTOCAddress - tocDistUpdateVal); }
00035 void getSharedLibraryPathAndObj(char** path,char** name,char** obj);
00036 };
00037
00038 #endif