Commit Graph

18 Commits

Author SHA1 Message Date
Lang Hames
da62155c11 [MCJIT][Orc] Refactor RTDyldMemoryManager, weave RuntimeDyld::SymbolInfo through
MCJIT.

This patch decouples the two responsibilities of the RTDyldMemoryManager class,
memory management and symbol resolution, into two new classes:
RuntimeDyld::MemoryManager and RuntimeDyld::SymbolResolver.

The symbol resolution interface is modified slightly, from:

  uint64_t getSymbolAddress(const std::string &Name);

to:

  RuntimeDyld::SymbolInfo findSymbol(const std::string &Name);

The latter passes symbol flags along with symbol addresses, allowing RuntimeDyld
and others to reason about non-strong/non-exported symbols.


The memory management interface removes the following method:

  void notifyObjectLoaded(ExecutionEngine *EE,
                          const object::ObjectFile &) {}

as it is not related to memory management. (Note: Backwards compatibility *is*
maintained for this method in MCJIT and OrcMCJITReplacement, see below).


The RTDyldMemoryManager class remains in-tree for backwards compatibility.
It inherits directly from RuntimeDyld::SymbolResolver, and indirectly from
RuntimeDyld::MemoryManager via the new MCJITMemoryManager class, which
just subclasses RuntimeDyld::MemoryManager and reintroduces the
notifyObjectLoaded method for backwards compatibility).

The EngineBuilder class retains the existing method:

  EngineBuilder&
  setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm);

and includes two new methods:

  EngineBuilder&
  setMemoryManager(std::unique_ptr<MCJITMemoryManager> MM);

  EngineBuilder&
  setSymbolResolver(std::unique_ptr<RuntimeDyld::SymbolResolver> SR);

Clients should use EITHER:

A single call to setMCJITMemoryManager with an RTDyldMemoryManager.

OR (exclusive)

One call each to each of setMemoryManager and setSymbolResolver.

This patch should be fully compatible with existing uses of RTDyldMemoryManager.
If it is not it should be considered a bug, and the patch either fixed or
reverted.

If clients find the new API to be an improvement the goal will be to deprecate
and eventually remove the RTDyldMemoryManager class in favor of the new classes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233509 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 03:37:06 +00:00
Rafael Espindola
544763dcba Fix build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233171 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 04:36:20 +00:00
Mehdi Amini
c94da20917 Make DataLayout Non-Optional in the Module
Summary:
DataLayout keeps the string used for its creation.

As a side effect it is no longer needed in the Module.
This is "almost" NFC, the string is no longer
canonicalized, you can't rely on two "equals" DataLayout
having the same string returned by getStringRepresentation().

Get rid of DataLayoutPass: the DataLayout is in the Module

The DataLayout is "per-module", let's enforce this by not
duplicating it more than necessary.
One more step toward non-optionality of the DataLayout in the
module.

Make DataLayout Non-Optional in the Module

Module->getDataLayout() will never returns nullptr anymore.

Reviewers: echristo

Subscribers: resistor, llvm-commits, jholewinski

Differential Revision: http://reviews.llvm.org/D7992

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-04 18:43:29 +00:00
Lang Hames
e508109037 [Orc][Kaleidoscope] More tutorial cleanup, a little extra debugging output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230705 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 23:52:42 +00:00
Lang Hames
5300f55503 [Orc][Kaleidoscope] Fix a missed symbol mangling operation in the fully lazy tutorial.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230664 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 19:28:37 +00:00
Lang Hames
dd51ad933e [Orc][Kaleidoscope] Clean up the Orc/Kaleidoscope tutorials to minimize the diffs
between them.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230542 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 20:58:28 +00:00
Lang Hames
053ae4ce17 [Orc][Kaleidoscope] Tidy up the lazy_irgen tutorial, touch up a couple of
comments in the fully_lazy tutorial to minimize the diff between the two.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230202 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 04:45:05 +00:00
Lang Hames
88b2e585f3 [Orc][Kaleidoscope] Remove dead AST map in SessionContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230201 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 04:34:43 +00:00
Lang Hames
8d353ae157 [Orc] Move Orc code into a namespace (llvm::orc), update Kaleidoscope code.
NFC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230143 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-21 20:44:36 +00:00
Lang Hames
4796371615 [Orc][Kaleidoscope] Fix the orc/kaleidoscope tutorials on linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 02:03:30 +00:00
David Blaikie
9be681366a [orcjit] Include CMake support for the fully_lazy example and fix the build
Not sure if/how to make the CMake build use C++14 for the examples, so
let's stick to C++11 for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229888 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-19 19:06:04 +00:00
Lang Hames
668fc94ea5 [Orc][Kaleidoscope] Fix typo in tutorial comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229821 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-19 05:33:30 +00:00
Lang Hames
32f3cd95bb [Orc][Kaleidoscope] Make the 'fully lazy' orc kaleidoscope tutorial lazier still.
The new JIT doesn't IRGen stubs until they're referenced.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229807 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-19 01:32:43 +00:00
Lang Hames
2b42a5c3bd [Orc][Kaleidoscope] Fix a fixme - no reason we can't use C++14 in the tutorials.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229765 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 23:16:09 +00:00
Lang Hames
1cf7924e3f [Orc][Kaleidoscope] Make the Orc/Kaleidoscope tutorials easier to build on
Darwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 23:08:56 +00:00
Lang Hames
ba3836a530 [Orc][Kaleidoscope] Make sure to look for the mangled name when updating the
function body pointer in the fully lazy orc/kaleidoscope tutorial.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229760 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 23:07:13 +00:00
Lang Hames
cdc4c07360 [Orc][Kaleidoscope] Fix misnumbered steps in comments, plus tidy one
explanation up a little.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 05:53:28 +00:00
Lang Hames
a2fe1f3137 [Orc][Kaleidoscope] Add an example of extreme-laziness in Orc.
The version of the tutorial uses the new compile callbacks API to inject stubs
that trigger IRGen & Codegen of their respective function bodies when they are
first called.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229466 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 05:40:42 +00:00