[llvm-commits] CVS: llvm/include/llvm/Reoptimizer/TraceCache.h
Anand Shukla
ashukla at cs.uiuc.edu
Thu Jul 10 14:01:01 PDT 2003
Changes in directory llvm/include/llvm/Reoptimizer:
TraceCache.h updated: 1.11 -> 1.12
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/include/llvm/Reoptimizer/TraceCache.h
diff -u llvm/include/llvm/Reoptimizer/TraceCache.h:1.11 llvm/include/llvm/Reoptimizer/TraceCache.h:1.12
--- llvm/include/llvm/Reoptimizer/TraceCache.h:1.11 Mon Jun 30 16:58:31 2003
+++ llvm/include/llvm/Reoptimizer/TraceCache.h Thu Jul 10 14:00:47 2003
@@ -15,16 +15,17 @@
class VirtualMem;
class MemoryManager;
-class TraceCache2;
+//class TraceCache2;
class TraceCache{
private:
std::map<uint64_t, uint64_t> traces; //map from addr to addr
+ std::map<uint64_t, uint64_t> endAddress; //end of loop address
std::map<uint64_t, int> traceSize;//size of trace allocatted
- std::map<int, uint64_t> traceId;
- std::map<uint64_t, int> reverseTraceId;
+ std::map<uint64_t, uint64_t> traceId; //id -> startAddr map
+ std::map<uint64_t, uint64_t> reverseTraceId; //startAddr->ID
- std::map<uint64_t, int> uniqueID;
+ //std::map<uint64_t, int> uniqueID;
std::map<uint64_t, std::vector<unsigned int> > traceInstructions;
@@ -61,8 +62,19 @@
uint64_t getAddrLessThan(uint64_t brAddr);
+ uint64_t getEndAddress(uint64_t addr);
+
bool hasMaxSize(){ return isLimitSet;}
bool hasTraceAddr(uint64_t n){ return (traces.find(n)!=traces.end()); }
+
+ bool hasTraceAddr(uint64_t start, uint64_t end){
+ return hasTraceAddr(start) && getEndAddress(start) == end;
+ }
+
+ bool hasTraceWithId(uint64_t addr, uint64_t id){
+ return hasTraceAddr(addr) && reverseTraceId[addr] == id;
+ }
+
bool hasTraceId(int n) { return (traceId.find(n)!=traceId.end()); }
bool hasTraceInstructions(uint64_t addr);
@@ -73,12 +85,26 @@
return reverseMap[n];
}
- unsigned int getAddr(uint64_t addr);
+ unsigned int getAddr(uint64_t addr); //return instruction at an address
+
+ //address where trace starts
+ uint64_t getStartAddr(uint64_t addr){
+ assert(hasTraceAddr(addr) && "No such trace!");
+ return traces[addr];
+ }
+
+ //see if there is a trace in trace cache that could be
+ //within some address range
+ bool hasTraceInRange(uint64_t addr1, uint64_t addr2);
//constructors
TraceCache(int limitSize);
TraceCache(VirtualMem *vmem);
+ TraceCache(unsigned int size, VirtualMem *vmem);
TraceCache();
+ //the code region of dfunc is used for memory allocation
+ //instead of default memory allocation space used by memory manager
+ TraceCache(int (*dfunc)(int), unsigned int memSize, VirtualMem *vmem);
//remove the branch from the original code into the trace
void patchTrace(uint64_t n);
@@ -91,41 +117,36 @@
//addresses to jump to the new location for addresses that use the
//basic block bb as target
- bool addTrace(uint64_t instAddr,
+ //USING THIS
+ bool addTrace(uint64_t &instAddr, uint64_t &endAddr,
std::vector<unsigned int> &trace,
- int traceUniqId,
+ uint64_t traceUniqId,
std::map<int, uint64_t> &callMap,
- std::map<int, int> &branchMap);
-
- bool addTrace(uint64_t instAddr,
- std::vector<unsigned int> &trace,
- int traceUniqId,
- std::map<int, uint64_t> &callMap,
- std::map<int, uint64_t> &branchMap, TraceCache2 *tr2);
+ std::map<int, uint64_t> &branchMap, TraceCache *tr2);
bool addTrace(uint64_t instAddr,
std::vector<unsigned int> &trace,
- int traceUniqId,
+ uint64_t traceUniqId,
std::map<int, uint64_t> &callMap,
std::map<int, int> &branchMap,
std::vector<unsigned int> *exitStubs);
- bool addTrace(uint64_t instAddr, int sz, int traceUniqId,
+ bool addTrace(uint64_t instAddr, int sz, uint64_t traceUniqId,
uint64_t &addr);
-
- bool addTrace(uint64_t instAddr,
+ //for managing multiple traces:
+ //the firstLevelTraceStartAddr is the address
+ //where a branch should be placed to jump to new
+ //trace
+ bool addTrace(uint64_t instAddr,
+ uint64_t endAddr,
std::vector<unsigned int> &trace,
- int traceUniqId,
+ uint64_t traceUniqId,
std::map<int, uint64_t> &callMap,
std::map<int, uint64_t> &myBranchMap,
std::map<int, int> &branchMap,
- uint64_t firstLevelTraceStartAddr);
-
- //bool addTrace(uint64_t instAddr, unsigned int trace[], int sz,
- // std::vector<uint64_t> &inBranches,
- // std::vector<std::pair<uint64_t, uint64_t> > &outBranches, int traceUniqId);
-
+ uint64_t firstLevelTraceStartAddr, TraceCache *tr);
+
//remove trace starting with address n
void removeTrace(uint64_t n);
More information about the llvm-commits
mailing list