503 Commits

Author SHA1 Message Date
James Y Knight
6c00b3f35f [opaque pointer types] Pass value type to LoadInst creation.
This cleans up all LoadInst creation in LLVM to explicitly pass the
value type rather than deriving it from the pointer's element-type.

Differential Revision: https://reviews.llvm.org/D57172

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352911 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-01 20:44:24 +00:00
Chandler Carruth
6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
James Y Knight
28a460d130 Remove TypeBuilder.h, and fix the few locations using it.
This shortcut mechanism for creating types was added 10 years ago, but
has seen almost no uptake since then, neither internally nor in
external projects.

The very small number of characters saved by using it does not seem
worth the mental overhead of an additional type-creation API, so,
delete it.

Differential Revision: https://reviews.llvm.org/D56573

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351020 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-13 16:09:28 +00:00
Jonas Devlieghere
686dfe3676 [Support] Make error banner optional in logAllUnhandledErrors
In a lot of places an empty string was passed as the ErrorBanner to
logAllUnhandledErrors. This patch makes that argument optional to
simplify the call sites.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346604 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-11 01:46:03 +00:00
Lang Hames
8b9cbda1b3 [ORC] Re-apply r345077 with fixes to remove ambiguity in lookup calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345098 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 23:01:39 +00:00
Reid Kleckner
1989ce13fd Revert r345077 "[ORC] Change how non-exported symbols are matched during lookup."
Doesn't build on Windows. The call to 'lookup' is ambiguous. Clang and
MSVC agree, anyway.

http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/787
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315): error C2668: 'llvm::orc::ExecutionSession::lookup': ambiguous call to overloaded function
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(823): note: could be 'llvm::Expected<llvm::JITEvaluatedSymbol> llvm::orc::ExecutionSession::lookup(llvm::ArrayRef<llvm::orc::JITDylib *>,llvm::orc::SymbolStringPtr)'
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(817): note: or       'llvm::Expected<llvm::JITEvaluatedSymbol> llvm::orc::ExecutionSession::lookup(const llvm::orc::JITDylibSearchList &,llvm::orc::SymbolStringPtr)'
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315): note: while trying to match the argument list '(initializer list, llvm::orc::SymbolStringPtr)'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345078 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 20:54:43 +00:00
Lang Hames
e4c9c3925c [ORC] Change how non-exported symbols are matched during lookup.
In the new scheme the client passes a list of (JITDylib&, bool) pairs, rather
than a list of JITDylibs. For each JITDylib the boolean indicates whether or not
to match against non-exported symbols (true means that they should be found,
false means that they should not). The MatchNonExportedInJD and MatchNonExported
parameters on lookup are removed.

The new scheme is more flexible, and easier to understand.

This patch also updates JITDylib search orders to be lists of (JITDylib&, bool)
pairs to match the new lookup scheme. Error handling is also plumbed through
the LLJIT class to allow regression tests to fail predictably when a lookup from
a lazy call-through fails.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345077 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 20:20:22 +00:00
Lang Hames
e87aaa1093 [ORC] Make the VModuleKey optional, propagate it via MaterializationUnit and
MaterializationResponsibility.

VModuleKeys are intended to enable selective removal of modules from a JIT
session, however for a wide variety of use cases selective removal is not
needed and introduces unnecessary overhead. As of this commit, the default
constructed VModuleKey value is reserved as a "do not track" value, and
becomes the default when adding a new module to the JIT.

This commit also changes the propagation of VModuleKeys. They were passed
alongside the MaterializationResponsibity instance in XXLayer::emit methods,
but are now propagated as part of the MaterializationResponsibility instance
itself (and as part of MaterializationUnit when stored in a JITDylib).
Associating VModuleKeys with MaterializationUnits in this way should allow
for a thread-safe module removal mechanism in the future, even when a module
is in the process of being compiled, by having the
MaterializationResponsibility object check in on its VModuleKey's state
before commiting its results to the JITDylib.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344643 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-16 20:13:06 +00:00
Lang Hames
582b119624 [ORC] Rename ORC layers to make the "new" ORC layers the default.
This commit adds a 'Legacy' prefix to old ORC layers and utilities, and removes
the '2' suffix from the new ORC layers. If you wish to continue using the old
ORC layers you will need to add a 'Legacy' prefix to your classes. If you were
already using the new ORC layers you will need to drop the '2' suffix.

The legacy layers will remain in-tree until the new layers reach feature
parity with them. This will involve adding support for removing code from the
new layers, and ensuring that performance is comperable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344572 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 22:56:10 +00:00
Lang Hames
aa8c49dafa [ORC] Simplify naming for JITDylib definition generators.
Renames:
  JITDylib's setFallbackDefinitionGenerator method to setGenerator.
  DynamicLibraryFallbackGenerator class to DynamicLibrarySearchGenerator.
  ReexportsFallbackDefinitionGenerator to ReexportsGenerator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344489 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 05:07:54 +00:00
Lang Hames
54d4881c35 [ORC] During lookup, do not match against hidden symbols in other JITDylibs.
This adds two arguments to the main ExecutionSession::lookup method:
MatchNonExportedInJD, and MatchNonExported. These control whether and where
hidden symbols should be matched when searching a list of JITDylibs.

A similar effect could have been achieved by filtering search results, but
this would have involved materializing symbol definitions (since materialization
is triggered on lookup) only to throw the results away, among other issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344467 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-13 21:53:40 +00:00
Lang Hames
f66e35e8c0 [ORC] Consume unhandled errors in unit test.
This should fix the failures on the debug buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343929 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-07 01:08:02 +00:00
Lang Hames
ee5c35b1a7 [ORC] Add a 'remove' method to JITDylib to remove symbols.
Symbols can be removed provided that all are present in the JITDylib and none
are currently in the materializing state. On success all requested symbols are
removed. On failure an error is returned and no symbols are removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343928 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-06 23:03:59 +00:00
Lang Hames
c8d6c1623d [ORC] Pass symbol name to discard by const reference.
This saves some unnecessary atomic ref-counting operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343927 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-06 23:02:06 +00:00
Lang Hames
0e735f0b53 [ORC] Add an 'intern' method to ExecutionEngine for interning symbol names.
This cuts down on boilerplate by reducing 'ES.getSymbolStringPool().intern(...)'
to 'ES.intern(...)'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343427 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-30 23:18:24 +00:00
Lang Hames
04756ee526 [ORC] Extract and tidy up JITTargetMachineBuilder, add unit test.
(1) Adds comments for the API.

(2) Removes the setArch method: This is redundant: the setArchStr method on the
    triple should be used instead.

(3) Turns EmulatedTLS on by default. This matches EngineBuilder's behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343423 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-30 19:12:23 +00:00
Lang Hames
168e4a5c93 [ORC] Fix the unit tests that were broken by r343323.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343326 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 15:09:14 +00:00
Lang Hames
217504b6a8 [ORC] clang-format the ThreadSafeModule code.
Evidently I forgot to do this before committing r343055.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343288 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 01:41:33 +00:00
Lang Hames
ed523f9336 Re-reapply r343129 with more fixes.
Fixes order-of-operand-evaluation bugs in the ThreadSafeModule unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343162 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 02:09:37 +00:00
Lang Hames
d177f9e9bf Revert "Re-revert r343129."
This reverts commit 4e2557dbc76704beb8c4cf1191cb786e719db5d3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343161 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 02:09:36 +00:00
Lang Hames
4e2557dbc7 Re-revert r343129.
Apparently the fixes in r343149 did not cover all the issues. Re-reverting
while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343151 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 23:32:53 +00:00
Lang Hames
1f88aa3059 Reapply r343129 with fix.
Explicitly defines ThreadSafeModule's move-assignment operator to move fields in
reverse order. This is required to ensure that the context field outlives the
module field.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343149 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 22:34:33 +00:00
Lang Hames
bdab5ef14b Revert r343129 "[ORC] Change the field order of ThreadSafeModule to ensure the "
It broke several bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343133 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 19:36:30 +00:00
Lang Hames
665fc45e84 [ORC] Change the field order of ThreadSafeModule to ensure the Module is
destroyed before its ThreadSharedContext.

Destroying the context first is an error if this ThreadSafeModule is the only
owner of its underlying context.

Add a unit test for ThreadSafeModule/ThreadSafeContext to catch this and other
basic usage issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343129 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 18:50:01 +00:00
Lang Hames
62e9680cdc [ORC] Add a "lazy call-through" utility based on the same underlying trampoline
implementation as lazy compile callbacks, and a "lazy re-exports" utility that
builds lazy call-throughs.

Lazy call-throughs are similar to lazy compile callbacks (and are based on the
same underlying state saving/restoring trampolines) but resolve their targets
by performing a standard ORC lookup rather than invoking a user supplied
compiler callback. This allows them to inherit the thread-safety of ORC lookups
while blocking only the calling thread (whereas compile callbacks also block one
compile thread).

Lazy re-exports provide a simple way of building lazy call-throughs. Unlike a
regular re-export, a lazy re-export generates a new address (a stub entry point)
that will act like the re-exported symbol when called. The first call via a
lazy re-export will trigger compilation of the re-exported symbol before calling
through to it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343061 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 04:18:30 +00:00
Lang Hames
089f5d0e08 [ORC] Refactor trampoline pool management out of JITCompileCallbackManager.
This will allow trampoline pools to be re-used for a new lazy-reexport utility
that generates looks up function bodies using the standard symbol lookup process
(rather than using a user provided compile function). This new utility provides
the same capabilities (since MaterializationUnits already allow user supplied
compile functions to be run) as JITCompileCallbackManager, but can use the new
asynchronous lookup functions to avoid blocking a compile thread.

This patch also updates createLocalCompileCallbackManager to return an error if
a callback manager can not be created, and updates clients of that API to
account for the change. Finally, the OrcCBindingsStack is updates so that if
a callback manager is not available for the target platform a valid stack
(without support for lazy compilation) can still be constructed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343059 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 03:32:12 +00:00
Lang Hames
d813c35f4c [ORC] Add ThreadSafeModule and ThreadSafeContext wrappers to support concurrent
compilation of IR in the JIT.

ThreadSafeContext is a pair of an LLVMContext and a mutex that can be used to
lock that context when it needs to be accessed from multiple threads.

ThreadSafeModule is a pair of a unique_ptr<Module> and a
shared_ptr<ThreadSafeContext>. This allows the lifetime of a ThreadSafeContext
to be managed automatically in terms of the ThreadSafeModules that refer to it:
Once all modules using a ThreadSafeContext are destructed, and providing the
client has not held on to a copy of shared context pointer, the context will be
automatically destructed.

This scheme is necessary due to the following constraits: (1) We need multiple
contexts for multithreaded compilation (at least one per compile thread plus
one to store any IR not currently being compiled, though one context per module
is simpler). (2) We need to free contexts that are no longer being used so that
the JIT does not leak memory over time. (3) Module lifetimes are not
predictable (modules are compiled as needed depending on the flow of JIT'd
code) so there is no single point where contexts could be reclaimed.

JIT clients not using concurrency can safely use one ThreadSafeContext for all
ThreadSafeModules.

JIT clients who want to be able to compile concurrently should use a different
ThreadSafeContext for each module, or call setCloneToNewContextOnEmit on their
top-level IRLayer. The former reduces compile latency (since no clone step is
needed) at the cost of additional memory overhead for uncompiled modules (as
every uncompiled module will duplicate the LLVM types, constants and metadata
that have been shared).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343055 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 01:24:12 +00:00
Lang Hames
9a1147152d [ORC] Add a special 'main' JITDylib that is created on ExecutionSession
construction, a new convenience lookup method, and add-to layer methods.

ExecutionSession now creates a special 'main' JITDylib upon construction. All
subsequently created JITDylibs are added to the main JITDylib's search order by
default (controlled by the AddToMainDylibSearchOrder parameter to
ExecutionSession::createDylib). The main JITDylib's search order will be used in
the future to properly handle cross-JITDylib weak symbols, with the first
definition in this search order selected.

This commit also adds a new ExecutionSession::lookup convenience method that
performs a blocking lookup using the main JITDylib's search order, as this will
be a very common operation for clients.

Finally, new convenience overloads of IRLayer and ObjectLayer's add methods are
introduced that add the given program representations to the main dylib, which
is likely to be the common case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342086 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 21:48:59 +00:00
Lang Hames
4d5299cbae [ORC] Make RuntimeDyldObjectLinkingLayer2 take memory managers by unique_ptr.
The existing memory manager API can not be shared between objects when linking
concurrently (since there is no way to know which concurrent allocations were
performed on behalf of which object, and hence which allocations would be safe
to finalize when finalizeMemory is called). For now, we can work around this by
requiring a new memory manager for each object.

This change only affects the concurrent version of the ORC APIs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341579 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 19:39:26 +00:00
Lang Hames
1b5f73005f Remove some unnecessary constructor arguments.
ExecutionSession defaults to creating a new shared pool if none is provided,
so explicitly passing one in is unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341494 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-05 20:57:41 +00:00
Lang Hames
0cc8ff4014 [ORC] Tidy up JITSymbolFlags to remove the need for some explicit static_casts.
Removes the implicit conversion to the underlying type for
JITSymbolFlags::FlagNames and replaces it with some bitwise and comparison
operators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341282 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-02 01:28:26 +00:00
Lang Hames
b93b2b7c04 [ORC] Remove a stray debugging output line left in a unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341155 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 00:53:53 +00:00
Lang Hames
39a71331ff [ORC] Add utilities to RTDyldObjectLinkingLayer2 to simplify symbol flag
management and materialization responsibility registration.

The setOverrideObjectFlagsWithResponsibilityFlags method instructs
RTDyldObjectlinkingLayer2 to override the symbol flags produced by RuntimeDyld with
the flags provided by the MaterializationResponsibility instance. This can be used
to enable symbol visibility (hidden/exported) for COFF object files, which do not
currently support the SF_Exported flag.

The setAutoClaimResponsibilityForObjectSymbols method instructs
RTDyldObjectLinkingLayer2 to claim responsibility for any symbols provided by a
given object file that were not already in the MaterializationResponsibility
instance. Setting this flag allows higher-level program representations (e.g.
LLVM IR) to be added based on only a subset of the symbols they provide, without
having to write intervening layers to scan and add the additional symbols. This
trades diagnostic quality for convenience however: If all symbols are enumerated
up-front then clashes can be detected and reported early. If this option is set,
clashes for the additional symbols may not be detected until late, and detection
may depend on the flow of control through JIT'd code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341154 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 00:53:17 +00:00
Lang Hames
702730fc21 [ORC] Replace lookupFlags in JITSymbolResolver with getResponsibilitySet.
The new method name/behavior more closely models the way it was being used.
It also fixes an assertion that can occur when using the new ORC Core APIs,
where flags alone don't necessarily provide enough context to decide whether
the caller is responsible for materializing a given symbol (which was always
the reason this API existed).

The default implementation of getResponsibilitySet uses lookupFlags to determine
responsibility as before, so existing JITSymbolResolvers should continue to
work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340874 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-28 21:18:05 +00:00
Lang Hames
412085b4f3 [ORC] Add unit tests for the new RTDyldObjectLinkingLayer2 class.
The new unit tests match the old ones, which will remain in tree until the
old RTDyldObjectLinkingLayer is removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340786 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-27 22:30:57 +00:00
Lang Hames
a66b87aa57 [ORC] Remove a workaround for systems lacking 8-byte atomics.
SymbolStringPool ref counts are now size_t, rather than uint64_t, so I do not
think this is necessary any more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340704 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-26 16:46:02 +00:00
Lang Hames
7af2fdceb0 [ORC] Rename 'finalize' to 'emit' to avoid potential confusion.
An emitted symbol has had its contents written and its memory protections
applied, but it is not automatically ready to execute.

Prior to ORC supporting concurrent compilation, the term "finalized" could be
interpreted two different (but effectively equivalent) ways: (1) The finalized
symbol's contents have been written and its memory protections applied, and (2)
the symbol is ready to run. Now that ORC supports concurrent compilation, sense
(1) no longer implies sense (2). We have already introduced a new term, 'ready',
to capture sense (2), so rename sense (1) to 'emitted' to avoid any lingering
confusion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340115 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-18 02:06:18 +00:00
Lang Hames
7aacef06ca [ORC] Rename VSO to JITDylib.
VSO was a little close to VDSO (an acronym on Linux for Virtual Dynamic Shared
Object) for comfort. It also risks giving the impression that instances of this
class could be shared between ExecutionSessions, which they can not.

JITDylib seems moderately less confusing, while still hinting at how this
class is intended to be used, i.e. as a JIT-compiled stand-in for a dynamic
library (code that would have been a dynamic library if you had wanted to
compile it ahead of time).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340084 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-17 21:18:18 +00:00
Lang Hames
e3f12bdc7b [ORC] Add a re-exports fallback definition generator.
An instance of ReexportsFallbackDefinitionGenerator can be attached to a VSO
(via setFallbackDefinitionGenerator) to re-export symbols on demandy from a
backing VSO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338764 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 20:13:58 +00:00
Lang Hames
865d24fcb4 [ORC] Add SerializationTraits for std::set and std::map.
Also, make SerializationTraits for pairs forward the actual pair
template type arguments to the underlying serializer. This allows, for example,
std::pair<StringRef, bool> to be passed as an argument to an RPC call expecting
a std::pair<std::string, bool>, since there is an underlying serializer from
StringRef to std::string that can be used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338305 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 21:08:06 +00:00
Lang Hames
9d8e9ef491 [ORC] Re-apply r336760 with fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337637 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-21 00:12:05 +00:00
Lang Hames
845fa153ca Re-apply r337595 with fix for LLVM_ENABLE_THREADS=Off.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337626 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 22:22:19 +00:00
Reid Kleckner
1f565f54cd Revert r337595 "[ORC] Add new symbol lookup methods to ExecutionSessionBase in preparation for"
Breaks the build with LLVM_ENABLE_THREADS=OFF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337608 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 20:20:45 +00:00
Lang Hames
7891d706da [ORC] Add new symbol lookup methods to ExecutionSessionBase in preparation for
deprecating SymbolResolver and AsynchronousSymbolQuery.

Both lookup overloads take a VSO search order to perform the lookup. The first
overload is non-blocking and takes OnResolved and OnReady callbacks. The second
is blocking, takes a boolean flag to indicate whether to wait until all symbols
are ready, and returns a SymbolMap. Both overloads take a RegisterDependencies
function to register symbol dependencies (if any) on the query.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337595 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 18:31:53 +00:00
Lang Hames
ec3e95710f [ORC] Simplify VSO::lookupFlags to return the flags map.
This discards the unresolved symbols set and returns the flags map directly
(rather than mutating it via the first argument).

The unresolved symbols result made it easy to chain lookupFlags calls, but such
chaining should be rare to non-existant (especially now that symbol resolvers
are being deprecated) so the simpler method signature is preferable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337594 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 18:31:52 +00:00
Lang Hames
cea401e58a [ORC] Replace SymbolResolvers in the new ORC layers with search orders on VSOs.
A search order is a list of VSOs to be searched linearly to find symbols. Each
VSO now has a search order that will be used when fixing up definitions in that
VSO. Each VSO's search order defaults to just that VSO itself.

This is a first step towards removing symbol resolvers from ORC altogether. In
practice symbol resolvers tended to be used to implement a search order anyway,
sometimes with additional programatic generation of symbols. Now that VSOs
support programmatic generation of definitions via fallback generators, search
orders provide a cleaner way to achieve the desired effect (while removing a lot
of boilerplate).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337593 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 18:31:50 +00:00
Lang Hames
bcf1a2ec72 Revert r336760: "[ORC] Add unit tests for the reexports utility that were..."
This patch broke a few buildbots. I will investigate and re-apply when I have
a fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336767 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 06:46:17 +00:00
Lang Hames
eb79fe3796 [ORC] Remove a shadowing definition.
There is already a VSO member V in the CoreAPIsStandardTest test fixture.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336761 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 04:39:12 +00:00
Lang Hames
d16b7e5784 [ORC] Add unit tests for the reexports utility that were left out of r336741,
and fix a bug that these exposed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336760 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 04:39:11 +00:00
Lang Hames
8cbf4142f3 [ORC] Drop constexpr in unit test to appease a bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336758 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 03:58:47 +00:00