mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
Fixup for r165490: Use DenseMap instead of std::map. Simplify the loop in CollectFunctionDIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165498 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
#include "llvm/ADT/DenseMap.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
@@ -129,7 +130,7 @@ namespace {
|
|||||||
// As the code generation for module is finished (and DIBuilder is
|
// As the code generation for module is finished (and DIBuilder is
|
||||||
// finalized) we assume that subprogram descriptors won't be changed, and
|
// finalized) we assume that subprogram descriptors won't be changed, and
|
||||||
// they are stored in map for short duration anyway.
|
// they are stored in map for short duration anyway.
|
||||||
typedef std::map<Function*, DISubprogram> FunctionDIMap;
|
typedef DenseMap<Function*, DISubprogram> FunctionDIMap;
|
||||||
FunctionDIMap FunctionDIs;
|
FunctionDIMap FunctionDIs;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -200,18 +201,20 @@ void DAE::CollectFunctionDIs(Module &M) {
|
|||||||
for (Module::named_metadata_iterator I = M.named_metadata_begin(),
|
for (Module::named_metadata_iterator I = M.named_metadata_begin(),
|
||||||
E = M.named_metadata_end(); I != E; ++I) {
|
E = M.named_metadata_end(); I != E; ++I) {
|
||||||
NamedMDNode &NMD = *I;
|
NamedMDNode &NMD = *I;
|
||||||
for (unsigned i = 0, n = NMD.getNumOperands(); i < n; ++i) {
|
for (unsigned MDIndex = 0, MDNum = NMD.getNumOperands();
|
||||||
MDNode *Node = NMD.getOperand(i);
|
MDIndex < MDNum; ++MDIndex) {
|
||||||
if (DIDescriptor(Node).isCompileUnit()) {
|
MDNode *Node = NMD.getOperand(MDIndex);
|
||||||
DICompileUnit CU(Node);
|
if (!DIDescriptor(Node).isCompileUnit())
|
||||||
const DIArray &SPs = CU.getSubprograms();
|
continue;
|
||||||
for (unsigned i = 0, n = SPs.getNumElements(); i < n; ++i) {
|
DICompileUnit CU(Node);
|
||||||
DISubprogram SP(SPs.getElement(i));
|
const DIArray &SPs = CU.getSubprograms();
|
||||||
if (SP.Verify()) {
|
for (unsigned SPIndex = 0, SPNum = SPs.getNumElements();
|
||||||
if (Function *F = SP.getFunction())
|
SPIndex < SPNum; ++SPIndex) {
|
||||||
FunctionDIs[F] = SP;
|
DISubprogram SP(SPs.getElement(SPIndex));
|
||||||
}
|
if (!SP.Verify())
|
||||||
}
|
continue;
|
||||||
|
if (Function *F = SP.getFunction())
|
||||||
|
FunctionDIs[F] = SP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user