Commit Graph

303 Commits

Author SHA1 Message Date
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
Lang Hames
b8254a56a9 [Orc][Kaleidoscope] Update the MainLoop code of the orc/kaleidoscope tutorials
to get rid of the duplicate prompt. NFC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 05:36:59 +00:00
NAKAMURA Takumi
36fcfaf54e [CMake] Add RuntimeDyld to libdeps corresponding to r229343.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229351 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-16 02:13:30 +00:00
Aaron Ballman
66981fe208 Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229340 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-15 22:54:22 +00:00
Chandler Carruth
7ea33e53c7 [PM] Update the examples to reflect the removal of the
llvm/PassManager.h wrapper header and its using declarations. These now
directly use the legacy namespace.

I had updated the #include lines in my large commit but forgot that the
examples weren't being built and didn't update the code to use the
correct namespace. Sorry for the noise here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229095 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 10:21:05 +00:00
Chandler Carruth
417c5c172c [PM] Remove the old 'PassManager.h' header file at the top level of
LLVM's include tree and the use of using declarations to hide the
'legacy' namespace for the old pass manager.

This undoes the primary modules-hostile change I made to keep
out-of-tree targets building. I sent an email inquiring about whether
this would be reasonable to do at this phase and people seemed fine with
it, so making it a reality. This should allow us to start bootstrapping
with modules to a certain extent along with making it easier to mix and
match headers in general.

The updates to any code for users of LLVM are very mechanical. Switch
from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h".
Qualify the types which now produce compile errors with "legacy::". The
most common ones are "PassManager", "PassManagerBase", and
"FunctionPassManager".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229094 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 10:01:29 +00:00
Chandler Carruth
09c9b6f0c4 Re-sort the #include lines in bindings and examples which I managed to
miss previously.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229089 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 09:14:30 +00:00
Lang Hames
7d5ae5bc1f [Orc] Add a JITSymbol class to the Orc APIs, refactor APIs, update clients.
This patch refactors a key piece of the Orc APIs: It removes the
*::getSymbolAddress and *::lookupSymbolAddressIn methods, which returned target
addresses (uint64_ts), and replaces them with *::findSymbol and *::findSymbolIn
respectively, which return instances of the new JITSymbol type. Unlike the old
methods, calling findSymbol or findSymbolIn does not cause the symbol to be
immediately materialized when found. Instead, the symbol will be materialized
if/when the getAddress method is called on the returned JITSymbol. This allows
us to query for the existence of symbols without actually materializing them. In
the future I expect more information to be attached to the JITSymbol class, for
example whether the returned symbol is a weak or strong definition. This will
allow us to properly handle weak symbols and multiple definitions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228557 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-09 01:20:51 +00:00
David Blaikie
861a3dd510 Kaleidoscope-Orc: Reuse the IRGen utility function in later chapters, and remove an unused parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228543 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 21:03:30 +00:00
David Blaikie
9044440ba5 Kaleidoscope-Orc: Extract IRGen work into a utility function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228539 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 20:29:28 +00:00
David Blaikie
aa5b4fa8ae Constify the Orc Kaleidoscope examples IRGen functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228537 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 20:15:01 +00:00
Lang Hames
4f79dee97c [Orc][Kaleidoscope] Build Kaleidoscope/Orc tutorials with warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228531 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 19:15:33 +00:00
Lang Hames
13f2d9943f [Orc][Kaleidoscope] Remove fixed sized buffers from string conversion code and
further c++ify the Kaleidoscope/Orc tutorials.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228530 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 19:14:56 +00:00
NAKAMURA Takumi
186332c0c9 [CMake] Kaleidoscope-Orc: Update libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 11:15:08 +00:00
David Blaikie
b1ffebbbdb Add CMake build support for Orc examples (& fix some clang -Werror build
breaks due to unused variables).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228520 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 07:20:04 +00:00
Lang Hames
b7e0983d80 [Orc][Kaleidoscope] Fix method-name think-o. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228519 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 04:34:13 +00:00
Lang Hames
2db85d688d [Orc] Add a Kaleidoscope/Orc tutorial demonstrating lazy-irgen.
This tutorial builds on the lazy_codegen kaleidoscope/orc tutorial by making
a small set of changes (~75 lines diff) to defer ir-generation for function
definitions until functions are actually referenced.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228466 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 23:26:33 +00:00
Lang Hames
ead6da39e9 [Orc] Add a Kaleidoscope/Orc tutorial demonstrating lazy-codegen.
This tutorial builds on the initial kaleidoscope/orc tutorial by adding a
LazyEmittingLayer to the custom stack. This extra layer defers compilation
of modules in the JIT until they are statically referenced.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228459 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 23:04:53 +00:00
Lang Hames
eddb26303b [Orc] Add a Kaleidoscope tutorial for Orc demonstrating eager compilation.
This tutorial demonstrates a very basic custom Orc JIT stack that performs eager
compilation: All modules are CodeGen'd immediately upon being added to the JIT.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228456 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 22:52:04 +00:00
NAKAMURA Takumi
15587b485b Reorder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226419 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 00:35:33 +00:00
NAKAMURA Takumi
724aec2be3 [CMake] examples/Kaleidoscope: Prune redundant libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226418 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 00:35:25 +00:00
NAKAMURA Takumi
5960f02b04 [CMake] Update libdeps in examples/Kaleidoscope/Chapter4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226417 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 00:35:18 +00:00
Lang Hames
2c0f0f92f2 [Kaleidoscope] Run clang-format over chapter 4 of kaleidoscope.
I forgot to do this for r226308. Thanks to Eric Christopher for the reminder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226327 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 21:42:07 +00:00
Lang Hames
e639d4f967 [Kaleidoscope] Fix a bug in Chapter 4 of the Kaleidoscope tutorial where repeat
calls to functions weren't evaluated correctly.

Patch by Charlie Turner. Thanks Charlie!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226308 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 19:44:46 +00:00
Aaron Ballman
7b057dbcde Manually specify the folder that Kaleidescope should reside in for CMake-produced solutions that care about such things (like MSVC). This takes the Kaleidescope target out of the root solution folder and places it into the Examples folder where it belongs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 14:26:07 +00:00
Duncan P. N. Exon Smith
82f16e76be Kaleidoscope: Value => Metadata
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225320 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 23:48:22 +00:00
Duncan P. N. Exon Smith
c182476974 cmake: Add Kaleidoscope target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225318 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 23:39:37 +00:00
Eric Christopher
2848d92620 Add a subdirectory in CMake for Chapter 8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225315 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 23:23:24 +00:00
Eric Christopher
28eb431b8c Once more on the cmake build. nativecodegen->native on the dependencies.
Thanks to Rafael Espindola for testing assistance.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223678 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08 18:24:06 +00:00
Eric Christopher
28b439e6e1 Attempt to fix the cmake build by requiring mcjit on the cmake
dependencies for the KS tutorials

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223677 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08 18:20:50 +00:00
Eric Christopher
6efccd025c Fix KS tutorial build failure.
make all doesn't build the examples and it was uniquified since
last build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223675 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08 18:12:28 +00:00
Eric Christopher
23cf05ab9e Add Chapter 8 to the Kaleidoscope tutorial. This chapter adds
a description of how to add debug information using DWARF and
DIBuilder to the language.

Thanks to David Blaikie for his assistance with this tutorial.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223671 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08 18:00:47 +00:00
Eric Christopher
72878a54ff Fix the JIT code for the Kaleidoscope tutorial.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223670 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08 18:00:38 +00:00
NAKAMURA Takumi
8cc929ea00 ExceptionDemo: Let setMCJITMemoryManager() take unique_ptr, since r223183.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223188 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 02:05:51 +00:00
NAKAMURA Takumi
65e4532b78 [CMake] llvm/examples: Update libdeps for unoptimized builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220962 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-31 15:27:16 +00:00
Rafael Espindola
3b670550ad Add doInitialization/doFinalization to DataLayoutPass.
With this a DataLayoutPass can be reused for multiple modules.

Once we have doInitialization/doFinalization, it doesn't seem necessary to pass
a Module to the constructor.

Overall this change seems in line with the idea of making DataLayout a required
part of Module. With it the only way of having a DataLayout used is to add it
to the Module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217548 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10 21:27:43 +00:00
Iain Sandoe
b449c2885f Fix configure and make build of llvm examples.
Replaced link component 'jit' with 'mcjit'.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217032 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 13:12:16 +00:00
Eric Christopher
d5dd8ce2a5 Reinstate "Nuke the old JIT."
Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

This reinstates commits r215111, 215115, 215116, 215117, 215136.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216982 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 22:28:02 +00:00
Rafael Espindola
8c96862847 Modernize raw_fd_ostream's constructor a bit.
Take a StringRef instead of a "const char *".
Take a "std::error_code &" instead of a "std::string &" for error.

A create static method would be even better, but this patch is already a bit too
big.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216393 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 18:16:47 +00:00