diff options
author | Talin <viridia@gmail.com> | 2012-02-05 20:54:10 +0000 |
---|---|---|
committer | Talin <viridia@gmail.com> | 2012-02-05 20:54:10 +0000 |
commit | 2cb395eae71dacda49ca3fe758618fc3e0701659 (patch) | |
tree | c8abaa03940a385892716e78e1b80dcac0629880 /lib/VMCore/LLVMContextImpl.cpp | |
parent | fad4d40f3792b0d9e101c40738e1f691131007d2 (diff) | |
download | external_llvm-2cb395eae71dacda49ca3fe758618fc3e0701659.zip external_llvm-2cb395eae71dacda49ca3fe758618fc3e0701659.tar.gz external_llvm-2cb395eae71dacda49ca3fe758618fc3e0701659.tar.bz2 |
Efficient Constant Uniquing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149848 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/LLVMContextImpl.cpp')
-rw-r--r-- | lib/VMCore/LLVMContextImpl.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/VMCore/LLVMContextImpl.cpp b/lib/VMCore/LLVMContextImpl.cpp index 15c5c24..6279bb8 100644 --- a/lib/VMCore/LLVMContextImpl.cpp +++ b/lib/VMCore/LLVMContextImpl.cpp @@ -48,6 +48,16 @@ struct DropReferences { P.second->dropAllReferences(); } }; + +// Temporary - drops pair.first instead of second. +struct DropFirst { + // Takes the value_type of a ConstantUniqueMap's internal map, whose 'second' + // is a Constant*. + template<typename PairT> + void operator()(const PairT &P) { + P.first->dropAllReferences(); + } +}; } LLVMContextImpl::~LLVMContextImpl() { @@ -63,11 +73,11 @@ LLVMContextImpl::~LLVMContextImpl() { std::for_each(ExprConstants.map_begin(), ExprConstants.map_end(), DropReferences()); std::for_each(ArrayConstants.map_begin(), ArrayConstants.map_end(), - DropReferences()); + DropFirst()); std::for_each(StructConstants.map_begin(), StructConstants.map_end(), - DropReferences()); + DropFirst()); std::for_each(VectorConstants.map_begin(), VectorConstants.map_end(), - DropReferences()); + DropFirst()); ExprConstants.freeConstants(); ArrayConstants.freeConstants(); StructConstants.freeConstants(); |