[ARM] Generate 8.1-m CSINC, CSNEG and CSINV instructions.
[llvm-core.git] / lib / ExecutionEngine / Orc / Legacy.cpp
blobce6368b57a89dd4f8580b360559a6149da6e820c
1 //===------- Legacy.cpp - Adapters for ExecutionEngine API interop --------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ExecutionEngine/Orc/Legacy.h"
11 namespace llvm {
12 namespace orc {
14 void SymbolResolver::anchor() {}
16 JITSymbolResolverAdapter::JITSymbolResolverAdapter(
17 ExecutionSession &ES, SymbolResolver &R, MaterializationResponsibility *MR)
18 : ES(ES), R(R), MR(MR) {}
20 void JITSymbolResolverAdapter::lookup(const LookupSet &Symbols,
21 OnResolvedFunction OnResolved) {
22 SymbolNameSet InternedSymbols;
23 for (auto &S : Symbols)
24 InternedSymbols.insert(ES.intern(S));
26 auto OnResolvedWithUnwrap = [OnResolved](Expected<SymbolMap> InternedResult) {
27 if (!InternedResult) {
28 OnResolved(InternedResult.takeError());
29 return;
32 LookupResult Result;
33 for (auto &KV : *InternedResult)
34 Result[*KV.first] = std::move(KV.second);
35 OnResolved(Result);
38 auto Q = std::make_shared<AsynchronousSymbolQuery>(
39 InternedSymbols, SymbolState::Resolved, OnResolvedWithUnwrap);
41 auto Unresolved = R.lookup(Q, InternedSymbols);
42 if (Unresolved.empty()) {
43 if (MR)
44 MR->addDependenciesForAll(Q->QueryRegistrations);
45 } else
46 ES.legacyFailQuery(*Q, make_error<SymbolsNotFound>(std::move(Unresolved)));
49 Expected<JITSymbolResolverAdapter::LookupSet>
50 JITSymbolResolverAdapter::getResponsibilitySet(const LookupSet &Symbols) {
51 SymbolNameSet InternedSymbols;
52 for (auto &S : Symbols)
53 InternedSymbols.insert(ES.intern(S));
55 auto InternedResult = R.getResponsibilitySet(InternedSymbols);
56 LookupSet Result;
57 for (auto &S : InternedResult) {
58 ResolvedStrings.insert(S);
59 Result.insert(*S);
62 return Result;
65 } // End namespace orc.
66 } // End namespace llvm.