aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2015-05-06 11:46:36 -0700
committerPirama Arumuga Nainar <pirama@google.com>2015-05-18 10:52:30 -0700
commit2c3e0051c31c3f5b2328b447eadf1cf9c4427442 (patch)
treec0104029af14e9f47c2ef58ca60e6137691f3c9b /include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h
parente1bc145815f4334641be19f1c45ecf85d25b6e5a (diff)
downloadexternal_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.zip
external_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.tar.gz
external_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.tar.bz2
Update aosp/master LLVM for rebase to r235153
Change-Id: I9bf53792f9fc30570e81a8d80d296c681d005ea7 (cherry picked from commit 0c7f116bb6950ef819323d855415b2f2b0aad987)
Diffstat (limited to 'include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h')
-rw-r--r--include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h92
1 files changed, 0 insertions, 92 deletions
diff --git a/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h b/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h
deleted file mode 100644
index 4456404..0000000
--- a/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//===- LookasideRTDyldMM - Redirect symbol lookup via a functor -*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Defines an adapter for RuntimeDyldMM that allows lookups for external
-// symbols to go via a functor.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_EXECUTIONENGINE_ORC_LOOKASIDERTDYLDMM_H
-#define LLVM_EXECUTIONENGINE_ORC_LOOKASIDERTDYLDMM_H
-
-#include "llvm/ADT/STLExtras.h"
-#include <memory>
-#include <vector>
-
-namespace llvm {
-namespace orc {
-
-/// @brief Defines an adapter for RuntimeDyldMM that allows lookups for external
-/// symbols to go via a functor, before falling back to the lookup logic
-/// provided by the underlying RuntimeDyldMM instance.
-///
-/// This class is useful for redirecting symbol lookup back to various layers
-/// of a JIT component stack, e.g. to enable lazy module emission.
-///
-template <typename BaseRTDyldMM, typename ExternalLookupFtor,
- typename DylibLookupFtor>
-class LookasideRTDyldMM : public BaseRTDyldMM {
-public:
- /// @brief Create a LookasideRTDyldMM intance.
- LookasideRTDyldMM(ExternalLookupFtor ExternalLookup,
- DylibLookupFtor DylibLookup)
- : ExternalLookup(std::move(ExternalLookup)),
- DylibLookup(std::move(DylibLookup)) {}
-
- /// @brief Look up the given symbol address, first via the functor this
- /// instance was created with, then (if the symbol isn't found)
- /// via the underlying RuntimeDyldMM.
- uint64_t getSymbolAddress(const std::string &Name) override {
- if (uint64_t Addr = ExternalLookup(Name))
- return Addr;
- return BaseRTDyldMM::getSymbolAddress(Name);
- }
-
- uint64_t getSymbolAddressInLogicalDylib(const std::string &Name) override {
- if (uint64_t Addr = DylibLookup(Name))
- return Addr;
- return BaseRTDyldMM::getSymbolAddressInLogicalDylib(Name);
- };
-
- /// @brief Get a reference to the ExternalLookup functor.
- ExternalLookupFtor &getExternalLookup() { return ExternalLookup; }
-
- /// @brief Get a const-reference to the ExternalLookup functor.
- const ExternalLookupFtor &getExternalLookup() const { return ExternalLookup; }
-
- /// @brief Get a reference to the DylibLookup functor.
- DylibLookupFtor &getDylibLookup() { return DylibLookup; }
-
- /// @brief Get a const-reference to the DylibLookup functor.
- const DylibLookupFtor &getDylibLookup() const { return DylibLookup; }
-
-private:
- ExternalLookupFtor ExternalLookup;
- DylibLookupFtor DylibLookup;
-};
-
-/// @brief Create a LookasideRTDyldMM from a base memory manager type, an
-/// external lookup functor, and a dylib lookup functor.
-template <typename BaseRTDyldMM, typename ExternalLookupFtor,
- typename DylibLookupFtor>
-std::unique_ptr<
- LookasideRTDyldMM<BaseRTDyldMM, ExternalLookupFtor, DylibLookupFtor>>
-createLookasideRTDyldMM(ExternalLookupFtor &&ExternalLookup,
- DylibLookupFtor &&DylibLookup) {
- typedef LookasideRTDyldMM<BaseRTDyldMM, ExternalLookupFtor, DylibLookupFtor>
- ThisLookasideMM;
- return llvm::make_unique<ThisLookasideMM>(
- std::forward<ExternalLookupFtor>(ExternalLookup),
- std::forward<DylibLookupFtor>(DylibLookup));
-}
-
-} // End namespace orc.
-} // End namespace llvm.
-
-#endif // LLVM_EXECUTIONENGINE_ORC_LOOKASIDERTDYLDMM_H