From ebbcef945d33af5252486c1655ec6afdba4f97a7 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Mon, 19 Oct 2009 18:49:59 +0000 Subject: Clean up the JITResolver stub/callsite<->function maps. The JITResolver maps Functions to their canonical stubs and all callsites for lazily-compiled functions to their target Functions. To make Function destruction work, I'm going to need to remove all callsites on destruction, so this patch also adds the reverse mapping for that. There was an incorrect assumption in here that the only stub for a function would be the one caused by needing to lazily compile it, while x86-64 far calls and dlsym-stubs could also cause such stubs, but I didn't look for a test case that the assumption broke. This also adds DenseMapInfo so I can use DenseMaps instead of std::maps. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84522 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/ValueHandle.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/llvm/Support/ValueHandle.h') diff --git a/include/llvm/Support/ValueHandle.h b/include/llvm/Support/ValueHandle.h index 512a0ddba0..a9872a7be1 100644 --- a/include/llvm/Support/ValueHandle.h +++ b/include/llvm/Support/ValueHandle.h @@ -238,6 +238,31 @@ template<> struct simplify_type > { template<> struct simplify_type > : public simplify_type > {}; +// Specialize DenseMapInfo to allow AssertingVH to participate in DenseMap. +template +struct DenseMapInfo > { + typedef DenseMapInfo PointerInfo; + static inline AssertingVH getEmptyKey() { + return AssertingVH(PointerInfo::getEmptyKey()); + } + static inline T* getTombstoneKey() { + return AssertingVH(PointerInfo::getTombstoneKey()); + } + static unsigned getHashValue(const AssertingVH &Val) { + return PointerInfo::getHashValue(Val); + } + static bool isEqual(const AssertingVH &LHS, const AssertingVH &RHS) { + return LHS == RHS; + } + static bool isPod() { +#ifdef NDEBUG + return true; +#else + return false; +#endif + } +}; + /// TrackingVH - This is a value handle that tracks a Value (or Value subclass), /// even across RAUW operations. /// -- cgit v1.2.3