[llvm-commits] CVS: llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp
Brian Gaeke
gaeke at niobe.cs.uiuc.edu
Wed Aug 20 12:54:00 PDT 2003
Changes in directory llvm/lib/Reoptimizer/Mapping:
getLLVMinfo.cpp updated: 1.13 -> 1.14
---
Log message:
Add more comments.
Fix an apparent oversight in getLLVMInstrPositionInfo() - it wasn't
initializing all the tables it was using.
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp
diff -u llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.13 llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.14
--- llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.13 Wed Aug 20 12:43:30 2003
+++ llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp Wed Aug 20 12:53:29 2003
@@ -70,16 +70,19 @@
/// getLLVMInstrInfo (I'll figure this out later.)
///
vector<unsigned int> getLLVMInstrPositionInfo(Instruction *LI){
- // Get pointers to the BasicBlock and Function which contain LI.
+ // Get pointers to the BasicBlock, Function, and Module which contain LI.
BasicBlock *BB = LI->getParent();
Function *F = BB->getParent();
+ Module *M = F->getParent();
- static bool initialized_tables_LI = false;
- if(!initialized_tables_LI){
- // First time through, create the table we use to look up Instructions
- // for this Function's Module.
- createllvmInstructionKey(F->getParent());
- initialized_tables_LI = true;
+ static Module *lastUsedModule = NULL;
+ 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);
+ createBasicBlockKey(M);
+ createllvmInstructionKey(M);
+ lastUsedModule = M;
}
return getLLVMInstrInfo(FunctionKey[F], BasicBlockKey[BB], llvmInstructionKey[LI]);
@@ -87,8 +90,9 @@
/// getBasicBlockInfo(BasicBlock *) - Find the given BasicBlock in the
/// forward basic block map, and return the pair of 64-bit addresses
-/// that corresponds to it. It is a runtime error to call this
-/// function on a basic block which is not in the map.
+/// that corresponds to that basic block's starting and ending address
+/// (I think). It is a runtime error to call this function on a basic
+/// block which is not in the map.
///
pair<uint64_t, uint64_t> getBasicBlockInfo(BasicBlock *BB){
// Get pointer to the Module that contains BB.
@@ -114,6 +118,7 @@
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.
createBBmapRevF(M);
initialized_rev = true;
}
More information about the llvm-commits
mailing list