[llvm] r212202 - Constify the Function pointers in the result of makeSubprogramMap
David Blaikie
dblaikie at gmail.com
Wed Jul 2 11:30:05 PDT 2014
Author: dblaikie
Date: Wed Jul 2 13:30:05 2014
New Revision: 212202
URL: http://llvm.org/viewvc/llvm-project?rev=212202&view=rev
Log:
Constify the Function pointers in the result of makeSubprogramMap
These don't need to be mutable and callers being added soon in CodeGen
won't have access to non-const Module&.
Modified:
llvm/trunk/include/llvm/IR/DebugInfo.h
llvm/trunk/lib/IR/DebugInfo.cpp
llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=212202&r1=212201&r2=212202&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Wed Jul 2 13:30:05 2014
@@ -935,7 +935,7 @@ private:
bool TypeMapInitialized;
};
-DenseMap<Function *, DISubprogram> makeSubprogramMap(Module &M);
+DenseMap<const Function *, DISubprogram> makeSubprogramMap(const Module &M);
} // end namespace llvm
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=212202&r1=212201&r2=212202&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Wed Jul 2 13:30:05 2014
@@ -1527,8 +1527,9 @@ unsigned llvm::getDebugMetadataVersionFr
return cast<ConstantInt>(Val)->getZExtValue();
}
-llvm::DenseMap<llvm::Function *, llvm::DISubprogram> llvm::makeSubprogramMap(Module &M) {
- DenseMap<Function *, DISubprogram> R;
+llvm::DenseMap<const llvm::Function *, llvm::DISubprogram>
+llvm::makeSubprogramMap(const Module &M) {
+ DenseMap<const Function *, DISubprogram> R;
NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu");
if (!CU_Nodes)
Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=212202&r1=212201&r2=212202&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Jul 2 13:30:05 2014
@@ -84,7 +84,7 @@ namespace {
bool doInitialization(CallGraph &CG) override;
/// The maximum number of elements to expand, or 0 for unlimited.
unsigned maxElements;
- DenseMap<Function *, DISubprogram> FunctionDIs;
+ DenseMap<const Function *, DISubprogram> FunctionDIs;
};
}
Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=212202&r1=212201&r2=212202&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Jul 2 13:30:05 2014
@@ -127,8 +127,7 @@ namespace {
// As the code generation for module is finished (and DIBuilder is
// finalized) we assume that subprogram descriptors won't be changed, and
// they are stored in map for short duration anyway.
- typedef DenseMap<Function*, DISubprogram> FunctionDIMap;
- FunctionDIMap FunctionDIs;
+ DenseMap<const Function *, DISubprogram> FunctionDIs;
protected:
// DAH uses this to specify a different ID.
@@ -297,7 +296,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn
}
// Patch the pointer to LLVM function in debug info descriptor.
- FunctionDIMap::iterator DI = FunctionDIs.find(&Fn);
+ auto DI = FunctionDIs.find(&Fn);
if (DI != FunctionDIs.end())
DI->second.replaceFunction(NF);
@@ -1057,7 +1056,7 @@ bool DAE::RemoveDeadStuffFromFunction(Fu
}
// Patch the pointer to LLVM function in debug info descriptor.
- FunctionDIMap::iterator DI = FunctionDIs.find(F);
+ auto DI = FunctionDIs.find(F);
if (DI != FunctionDIs.end())
DI->second.replaceFunction(NF);
More information about the llvm-commits
mailing list