[llvm-commits] CVS: llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Wed Aug 20 13:19:01 PDT 2003
Changes in directory llvm/lib/Reoptimizer/Mapping:
getLLVMinfo.cpp updated: 1.15 -> 1.16
---
Log message:
Make getReverseBBMap, getBasicBlockInfo, and getLLVMInstrInfo reinitialize
themselves based on the module or function they're looking at instead of a
Boolean.
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp
diff -u llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.15 llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.16
--- llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.15 Wed Aug 20 13:01:01 2003
+++ llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp Wed Aug 20 13:17:57 2003
@@ -74,7 +74,7 @@
Module *M = F->getParent();
static Module *lastUsedModule = NULL;
- if(lastUsedModule != M){
+ if (lastUsedModule != M) {
// First time we see a given Module, we have to create the tables
// we use to look up Instructions for that Module.
createFunctionKey(M);
@@ -96,11 +96,12 @@
// Get pointer to the Module that contains BB.
Module *M = BB->getParent()->getParent();
- static bool initialized_fwdbbmap = false;
- if(!initialized_fwdbbmap){
- // First time through, create the table we use to look up BasicBlocks.
+ static Module *lastUsedModule = NULL;
+ if (lastUsedModule != M) {
+ // First time we see a given Module, create the table we use to
+ // look up addresses for BasicBlocks in that Module.
createBBmapFwdF(M);
- initialized_fwdbbmap = true;
+ lastUsedModule = M;
}
if(BBMapFwd.find(BB) == BBMapFwd.end())
@@ -114,11 +115,12 @@
/// false.
///
bool getReverseBBMap(uint64_t addr, Module *M, BasicBlock* &bb){
- static bool initialized_rev = false;
- if(!initialized_rev){
- // First time through, create the table we use to look up addresses.
+ static Module *lastUsedModule = NULL;
+ if (lastUsedModule != M) {
+ // First time we see a given Module, create the table we use to
+ // look up BasicBlocks for addresses in that module.
createBBmapRevF(M);
- initialized_rev = true;
+ lastUsedModule = M;
}
if(BBmapReverse.find(addr) != BBmapReverse.end()){
@@ -133,12 +135,12 @@
static vector<unsigned> &getLLVMInstrInfo(unsigned FunctionNo,
unsigned BasicBlockNo,
unsigned LLVMInstrNo){
- static unsigned initialized_LMI = ~0;
- if(initialized_LMI!=FunctionNo){
+ static unsigned lastUsedFunctionNo = ~0;
+ if (lastUsedFunction != FunctionNo) {
unsigned char *LIMap = FunctionLI[FunctionNo];
unsigned length = *(unsigned *)LIMap - 4;
createMImapF(&LIMap[4], length);
- initialized_LMI = FunctionNo;
+ lastUsedFunctionNo = FunctionNo;
}
return MImapF[BasicBlockNo][LLVMInstrNo];
}
More information about the llvm-commits
mailing list