463 Commits

Author SHA1 Message Date
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
Lang Hames
1399f710b3 [ORC] Use a gtest fixture to remove a bunch of boilerplate in CoreAPIsTest.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336757 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 03:09:36 +00:00
Lang Hames
635418475a [ORC] Generalize alias materialization to support re-exports (i.e. aliasing of
symbols in another VSO).

Also fixes a bug where chained aliases within a single VSO would deadlock on
materialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336741 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10 23:34:56 +00:00
Lang Hames
ae0f1dc928 [ORC] Rename MaterializationResponsibility::delegate to replace and add a new
delegate method (and unit test).

The name 'replace' better captures what the old delegate method did: it
returned materialization responsibility for a set of symbols to the VSO.

The new delegate method delegates responsibility for a set of symbols to a new
MaterializationResponsibility instance. This can be used to split responsibility
between multiple threads, or multiple materialization methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336603 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09 20:54:36 +00:00
Lang Hames
7ca1126ca8 [ORC] Add a symbolAliases function to the Core APIs.
symbolAliases can be used to define symbol aliases within a VSO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335565 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 01:22:29 +00:00
Lang Hames
00bb1a1722 [ORC] Only notify queries that they are resolved/ready when the query state
changes.

This guards against redundant notifications.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334916 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-17 18:59:01 +00:00
Lang Hames
05afd8a029 [ORC] Erase empty dependence sets when adding new symbol dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334910 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-17 16:59:53 +00:00
Lang Hames
a94df7d526 [ORC] Strip weak flags from a symbol once it is selected for materialization.
Once a symbol has been selected for materialization it can no longer be
overridden. Stripping the weak flag guarantees this (override attempts will
then be treated as duplicate definitions and result in a DuplicateDefinition
error).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334771 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-14 21:16:29 +00:00
Lang Hames
c6679d1e09 [ORC] Filter out self-dependencies in VSO::addDependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334724 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-14 15:32:59 +00:00
Lang Hames
fd5548df54 [ORC] Add a fallback definition generator for VSOs.
If a VSO has a fallback definition generator attached it will be called during
lookup (and lookupFlags) for any unresolved symbols. The definition generator
can add new definitions to the VSO for any unresolved symbol. This allows VSOs
to generate new definitions on demand.

The immediate use case for this code is supporting VSOs that can import
definitions found via dlsym on demand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334538 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 20:43:18 +00:00
Lang Hames
cff463369b [ORC] Use JITEvaluatedSymbol for IndirectStubsManager findStub and findPointer.
Existing implementations of these methods do not require lazy materialization,
and switching to JITEvaluatedSymbol allows us to remove error checking on the
client side.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333835 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-03 02:18:03 +00:00
Lang Hames
e9015c7760 [ORC] Add a getRequestedSymbols method to MaterializationResponsibility.
This method returns the set of symbols in the target VSO that have queries
waiting on them. This can be used to make decisions about which symbols to
delegate to another MaterializationUnit (typically this will involve
delegating all symbols that have *not* been requested to another
MaterializationUnit so that materialization of those symbols can be
deferred until they are requested).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333684 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31 19:29:03 +00:00
Lang Hames
543cda4110 [ORC] Update JITCompileCallbackManager to support multi-threaded code.
Previously JITCompileCallbackManager only supported single threaded code. This
patch embeds a VSO (see include/llvm/ExecutionEngine/Orc/Core.h) in the callback
manager. The VSO ensures that the compile callback is only executed once and that
the resulting address cached for use by subsequent re-entries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333490 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30 01:57:45 +00:00
Andres Freund
130bebd92f [ORC] Add findSymbolIn() wrapper to C bindings, take #2.
Re-appply r333147, reverted in r333152 due to a pre-existing bug. As
D47308 has been merged in r333206, the OSX issue should now be
resolved.

In many cases JIT users will know in which module a symbol
resides. Avoiding to search other modules can be more efficient. It
also allows to handle duplicate symbol names between modules.

Reviewed By: lhames

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333215 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 18:44:34 +00:00
Andres Freund
017f7dfd70 Revert r333147 "[ORC] Add findSymbolIn() wrapper to C bindings."
This reverts r333147 until https://reviews.llvm.org/D47308 is ready to
be reviewed. r333147 exposed a behavioural difference between
OrcCBindingsStack::findSymbolIn() and OrcCBindingsStack::findSymbol(),
where only the latter does name mangling. After r333147 that causes a
test failure on OSX, because the new test looks for main using
findSymbolIn() but the mangled name is _main.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333152 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 05:10:19 +00:00
Andres Freund
41d411071a [ORC] Add findSymbolIn() wrapper to C bindings.
In many cases JIT users will know in which module a symbol
resides. Avoiding to search other modules can be more efficient. It
also allows to handle duplicate symbol names between modules.

Reviewed By: lhames

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333147 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 01:01:42 +00:00
Lang Hames
1b804fe0ec [ORC] Remove the optional MaterializationResponsibility argument from lookup.
The lookup function provides blocking symbol resolution for JIT clients (not
layers themselves) so it does not need to track symbol dependencies via a
MaterializationResponsibility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332897 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 21:11:21 +00:00
Lang Hames
fe651d1a0e [ORC] Consolidate materialization errors, and generate them in VSO's
notifyFailed method rather than passing in an error generator.

VSO::notifyFailed is responsible for notifying queries that they will not
succeed due to error. In practice the queries don't care about the details
of the failure, just the fact that a failure occurred for some symbols.
Having VSO::notifyFailed take care of this simplifies the interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 20:48:58 +00:00
Lang Hames
bb60b65608 [ORC] Rewrite the VSO symbol table yet again. Update related utilities.
VSOs now track dependencies for materializing symbols. Each symbol must have its
dependencies registered with the VSO prior to finalization. Usually this will
involve registering the dependencies returned in
AsynchronousSymbolQuery::ResolutionResults for queries made while linking the
symbols being materialized.

Queries against symbols are notified that a symbol is ready once it and all of
its transitive dependencies are finalized, allowing compilation work to be
broken up and moved between threads without queries returning until their
symbols fully safe to access / execute.

Related utilities (VSO, MaterializationUnit, MaterializationResponsibility) are
updated to support dependence tracking and more explicitly track responsibility
for symbols from the point of definition until they are finalized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332541 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 22:24:30 +00:00
Nico Weber
0f38c60baf IWYU for llvm-config.h in llvm, additions.
See r331124 for how I made a list of files missing the include.
I then ran this Python script:

    for f in open('filelist.txt'):
        f = f.strip()
        fl = open(f).readlines()

        found = False
        for i in xrange(len(fl)):
            p = '#include "llvm/'
            if not fl[i].startswith(p):
                continue
            if fl[i][len(p):] > 'Config':
                fl.insert(i, '#include "llvm/Config/llvm-config.h"\n')
                found = True
                break
        if not found:
            print 'not found', f
        else:
            open(f, 'w').write(''.join(fl))

and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p`
and tried to fix include ordering and whatnot.

No intended behavior change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331184 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30 14:59:11 +00:00
Nico Weber
63033d33c8 s/LLVM_ON_WIN32/_WIN32/, llvm
LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too.  Just use the
default macro instead of a reinvented one.

See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.

This moves over all uses of the macro, but doesn't remove the definition
of it in (llvm-)config.h yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331127 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-29 00:45:03 +00:00
Roman Lebedev
c3aaa9b38e Link to AggressiveInstCombine in a few places. Unbreaks build for me.
/usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass()
>>> referenced by cc1_main.cpp
>>>               tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp)

And so on

The bot coverage is clearly missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330693 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 08:40:37 +00:00
Lang Hames
08893d364d [ORC] Add a MaterializationResponsibility class to track responsibility for
materializing function definitions.

MaterializationUnit instances are responsible for resolving and finalizing
symbol definitions when their materialize method is called. By contract, the
MaterializationUnit must materialize all definitions it is responsible for and
no others. If it can not materialize all definitions (because of some error)
then it must notify the associated VSO about each definition that could not be
materialized. The MaterializationResponsibility class tracks this
responsibility, asserting that all required symbols are resolved and finalized,
and that no extraneous symbols are resolved or finalized. In the event of an
error it provides a convenience method for notifying the VSO about each
definition that could not be materialized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330142 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16 18:05:24 +00:00
Lang Hames
3963b7d5e4 [ORC] Merge VSO notifyResolutionFailed and notifyFinalizationFailed in to
notifyMaterializationFailed.

The notifyMaterializationFailed method can determine which error to raise by
looking at which queue the pending queries are in (resolution or finalization).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330141 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16 18:05:22 +00:00
Lang Hames
741d7afdf1 [ORC] Plumb error notifications through the VSO interface.
This allows materializers to notify the VSO that they were unable to
resolve or finalize symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329934 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 18:35:08 +00:00
Lang Hames
73bcd8b27c [ORC] Create a new SymbolStringPool by default in ExecutionSession constructor.
This makes the common case of constructing an ExecutionSession tidier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329013 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 20:57:56 +00:00
Lang Hames
9e19b76c0b [ORC] Restore the narrower check from before r328687.
This should get the builders green again while I investigate why r328706 was
insufficient.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328711 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-28 15:58:14 +00:00
Lang Hames
c584e9e80e [ORC] Re-add the Windows check that was dropped in r328687.
This check prevents the ORC execution tests from running on Windows (which is
not supported yet).

This should fix the windows bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328706 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-28 14:47:11 +00:00
Lang Hames
de6ad3a31f [ORC] Fix ORC on platforms without indirection support.
Previously this crashed because a nullptr (returned by
createLocalIndirectStubsManagerBuilder() on platforms without
indirection support) functor was unconditionally invoked.

Patch by Andres Freund. Thanks Andres!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328687 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-28 03:41:45 +00:00
Benjamin Kramer
5277548f84 [ORC] Join materialization thread in unit test
There's are race between this thread and the destructor of the test ORC
components on the main threads. I saw flaky failures there in about 4%
of the runs of this unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328300 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23 10:14:19 +00:00
Lang Hames
507d7742b9 [ORC] Rename SymbolSource to MaterializationUnit, and make the materialization
operation all-or-nothing, rather than allowing materialization on a per-symbol
basis.

This addresses a shortcoming of per-symbol materialization: If a
MaterializationUnit (/SymbolSource) wants to materialize more symbols than
requested (which is likely: most materializers will want to materialize whole
modules) then it needs a way to notify the symbol table about the extra symbols
being materialized. This process (checking what has been requested against what
is being provided and notifying the symbol table about the difference) has to
be repeated at every level of the JIT stack. Making materialization
all-or-nothing eliminates this issue, simplifying both materializer
implementations and the symbol table (VSO class) API. The cost is that
per-symbol materialization (e.g. for individual symbols in a module) now
requires multiple MaterializationUnits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327946 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-20 03:49:29 +00:00
Lang Hames
6531c3164c [ORC] Re-apply r327566 with a fix for test-global-ctors.ll.
Also clang-formats the patch, which I should have done the first time around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327594 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15 00:30:14 +00:00
Reid Kleckner
d1e7e3c8a8 Revert "[ORC] Switch from shared_ptr to unique_ptr for addModule methods."
This reverts commit r327566, it breaks
test/ExecutionEngine/OrcMCJIT/test-global-ctors.ll.

The test doesn't crash with a stack trace, unfortunately. It merely
returns 1 as the exit code.

ASan didn't produce a report, and I reproduced this on my Linux machine
and Windows box.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327576 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 21:32:34 +00:00
Lang Hames
96ae7f8910 [ORC] Switch from shared_ptr to unique_ptr for addModule methods.
Layer implementations typically mutate module state, and this is better
reflected by having layers own the Module they are operating on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327566 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 20:29:45 +00:00
Lang Hames
a4b7c02dd5 [ORC] Add a 'lookup' convenience function for finding symbols in a list of VSOs.
The lookup function takes a list of VSOs, a set of symbol names (or just one
symbol name) and a materialization function object. It returns an
Expected<SymbolMap> (if given a set of names) or an Expected<JITEvaluatedSymbol>
(if given just one name). The lookup method constructs an
AsynchronousSymbolQuery for the given names, applies that query to each VSO in
the list in turn, and then blocks waiting for the query to complete. If
threading is enabled then the materialization function object can be used to
execute the materialization on different threads. If threading is disabled the
MaterializeOnCurrentThread utility must be used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327474 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 04:18:04 +00:00
Lang Hames
734c4808f8 [ORC] Switch to shared_ptr ownership for SymbolSources in VSOs.
This makes it easy to free a SymbolSource (and any related
resources) when the last reference in a VSO is dropped.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325727 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-21 21:55:57 +00:00
Lang Hames
fc8ba497cd [ORC] Switch RTDyldObjectLinkingLayer to take a unique_ptr<MemoryBuffer> rather
than a shared ObjectFile/MemoryBuffer pair.

There's no need to pre-parse the buffer into an ObjectFile before passing it
down to the linking layer, and moving the parsing into the linking layer allows
us remove the parsing code at each call site.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325725 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-21 21:55:49 +00:00
Lang Hames
8115e01f12 [ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
unified GetResources callback.

Having a single 'GetResources' callback will simplify adding new resources in
the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325180 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 22:13:02 +00:00
Lang Hames
d8d27ad50d [ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.
Queries need to stay alive until each owner has set the values they are
responsible for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325179 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 22:12:56 +00:00
Lang Hames
8c824db15a [ORC] Remove Layer handles from the layer concept.
Handles were returned by addModule and used as keys for removeModule,
findSymbolIn, and emitAndFinalize. Their job is now subsumed by VModuleKeys,
which simplify resource management by providing a consistent handle across all
layers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324700 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-09 02:30:40 +00:00
Lang Hames
35ca32d346 [ORC] Start migrating ORC layers to use the new ORC Core.h APIs.
In particular this patch switches RTDyldObjectLinkingLayer to use
orc::SymbolResolver and threads the requried changse (ExecutionSession
references and VModuleKeys) through the existing layer APIs.

The purpose of the new resolver interface is to improve query performance and
better support parallelism, both in JIT'd code and within the compiler itself.

The most visibile change is switch of the <Layer>::addModule signatures from:

Expected<Handle> addModule(std::shared_ptr<ModuleType> Mod,
                           std::shared_ptr<JITSymbolResolver> Resolver)

to:

Expected<Handle> addModule(VModuleKey K, std::shared_ptr<ModuleType> Mod);

Typical usage of addModule will now look like:

auto K = ES.allocateVModuleKey();
Resolvers[K] = createSymbolResolver(...);
Layer.addModule(K, std::move(Mod));

See the BuildingAJIT tutorial code for example usage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324405 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 21:25:11 +00:00