Commit Graph

278 Commits

Author SHA1 Message Date
Lang Hames 9cebeb6666 [Orc][Kaleidoscope] Fix misnumbered steps in comments, plus tidy one
explanation up a little.

llvm-svn: 229467
2015-02-17 05:53:28 +00:00
Lang Hames 9b4b92bb21 [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.

llvm-svn: 229466
2015-02-17 05:40:42 +00:00
Lang Hames 31ab495e4e [Orc][Kaleidoscope] Update the MainLoop code of the orc/kaleidoscope tutorials
to get rid of the duplicate prompt. NFC.

llvm-svn: 229465
2015-02-17 05:36:59 +00:00
NAKAMURA Takumi 7540eafb5c [CMake] Add RuntimeDyld to libdeps corresponding to r229343.
llvm-svn: 229351
2015-02-16 02:13:30 +00:00
Aaron Ballman f9a1897c72 Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.
llvm-svn: 229340
2015-02-15 22:54:22 +00:00
Chandler Carruth 7ecd99163c [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.

llvm-svn: 229095
2015-02-13 10:21:05 +00:00
Chandler Carruth 30d69c2e36 [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".

llvm-svn: 229094
2015-02-13 10:01:29 +00:00
Chandler Carruth 1f832f7c27 Re-sort the #include lines in bindings and examples which I managed to
miss previously.

llvm-svn: 229089
2015-02-13 09:14:30 +00:00
Lang Hames 114b4f324b [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.

llvm-svn: 228557
2015-02-09 01:20:51 +00:00
David Blaikie 9c4c23b32e Kaleidoscope-Orc: Reuse the IRGen utility function in later chapters, and remove an unused parameter.
llvm-svn: 228543
2015-02-08 21:03:30 +00:00
David Blaikie 1803dc2639 Kaleidoscope-Orc: Extract IRGen work into a utility function.
llvm-svn: 228539
2015-02-08 20:29:28 +00:00
David Blaikie 055811ef72 Constify the Orc Kaleidoscope examples IRGen functions.
llvm-svn: 228537
2015-02-08 20:15:01 +00:00
Lang Hames d3bffbc2b3 [Orc][Kaleidoscope] Build Kaleidoscope/Orc tutorials with warnings.
llvm-svn: 228531
2015-02-08 19:15:33 +00:00
Lang Hames be9df34795 [Orc][Kaleidoscope] Remove fixed sized buffers from string conversion code and
further c++ify the Kaleidoscope/Orc tutorials.

llvm-svn: 228530
2015-02-08 19:14:56 +00:00
NAKAMURA Takumi b928d4c2fc [CMake] Kaleidoscope-Orc: Update libdeps.
llvm-svn: 228524
2015-02-08 11:15:08 +00:00
David Blaikie c38e5245c5 Add CMake build support for Orc examples (& fix some clang -Werror build
breaks due to unused variables).

llvm-svn: 228520
2015-02-08 07:20:04 +00:00
Lang Hames dac276ecaf [Orc][Kaleidoscope] Fix method-name think-o. NFC.
llvm-svn: 228519
2015-02-08 04:34:13 +00:00
Lang Hames e1d10711d1 [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.

llvm-svn: 228466
2015-02-06 23:26:33 +00:00
Lang Hames ed218a0da0 [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.

llvm-svn: 228459
2015-02-06 23:04:53 +00:00
Lang Hames d855e4515e [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.

llvm-svn: 228456
2015-02-06 22:52:04 +00:00
NAKAMURA Takumi ded8207c43 Reorder.
llvm-svn: 226419
2015-01-19 00:35:33 +00:00
NAKAMURA Takumi 86c8a9cc74 [CMake] examples/Kaleidoscope: Prune redundant libdeps.
llvm-svn: 226418
2015-01-19 00:35:25 +00:00
NAKAMURA Takumi bd1d5b1aea [CMake] Update libdeps in examples/Kaleidoscope/Chapter4.
llvm-svn: 226417
2015-01-19 00:35:18 +00:00
Lang Hames 37679193af [Kaleidoscope] Run clang-format over chapter 4 of kaleidoscope.
I forgot to do this for r226308. Thanks to Eric Christopher for the reminder.

llvm-svn: 226327
2015-01-16 21:42:07 +00:00
Lang Hames 1cb54811de [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!

llvm-svn: 226308
2015-01-16 19:44:46 +00:00
Aaron Ballman 1ec24c6a3d 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.
llvm-svn: 225354
2015-01-07 14:26:07 +00:00
Duncan P. N. Exon Smith 4e752fba92 Kaleidoscope: Value => Metadata
llvm-svn: 225320
2015-01-06 23:48:22 +00:00
Duncan P. N. Exon Smith 9e93701b57 cmake: Add Kaleidoscope target
llvm-svn: 225318
2015-01-06 23:39:37 +00:00
Eric Christopher 94c86e7226 Add a subdirectory in CMake for Chapter 8.
llvm-svn: 225315
2015-01-06 23:23:24 +00:00
Eric Christopher 32745dde08 Once more on the cmake build. nativecodegen->native on the dependencies.
Thanks to Rafael Espindola for testing assistance.

llvm-svn: 223678
2014-12-08 18:24:06 +00:00
Eric Christopher 3760e8457d Attempt to fix the cmake build by requiring mcjit on the cmake
dependencies for the KS tutorials

llvm-svn: 223677
2014-12-08 18:20:50 +00:00
Eric Christopher c02393604b Fix KS tutorial build failure.
make all doesn't build the examples and it was uniquified since
last build.

llvm-svn: 223675
2014-12-08 18:12:28 +00:00
Eric Christopher 05917fa600 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.

llvm-svn: 223671
2014-12-08 18:00:47 +00:00
Eric Christopher 1b74b65e9b Fix the JIT code for the Kaleidoscope tutorial.
llvm-svn: 223670
2014-12-08 18:00:38 +00:00
NAKAMURA Takumi 4c71cc1dcb ExceptionDemo: Let setMCJITMemoryManager() take unique_ptr, since r223183.
llvm-svn: 223188
2014-12-03 02:05:51 +00:00
NAKAMURA Takumi 0ad1c308ea [CMake] llvm/examples: Update libdeps for unoptimized builds.
llvm-svn: 220962
2014-10-31 15:27:16 +00:00
Rafael Espindola c435adcde0 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.

llvm-svn: 217548
2014-09-10 21:27:43 +00:00
Iain Sandoe d49305bfef Fix configure and make build of llvm examples.
Replaced link component 'jit' with 'mcjit'.

llvm-svn: 217032
2014-09-03 13:12:16 +00:00
Eric Christopher 79cc1e3ae7 Reinstate "Nuke the old JIT."
Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

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

llvm-svn: 216982
2014-09-02 22:28:02 +00:00
Rafael Espindola 3fd1e9933f 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.

llvm-svn: 216393
2014-08-25 18:16:47 +00:00
Rafael Espindola 2a8a2795ee Make it explicit that ExecutionEngine takes ownership of the modules.
llvm-svn: 215967
2014-08-19 04:04:25 +00:00
Eric Christopher b9fd9ed37e Temporarily Revert "Nuke the old JIT." as it's not quite ready to
be deleted. This will be reapplied as soon as possible and before
the 3.6 branch date at any rate.

Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

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

llvm-svn: 215154
2014-08-07 22:02:54 +00:00
Rafael Espindola f8b27c41e8 Nuke the old JIT.
I am sure we will be finding bits and pieces of dead code for years to
come, but this is a good start.

Thanks to Lang Hames for making MCJIT a good replacement!

llvm-svn: 215111
2014-08-07 14:21:18 +00:00
Dan Liew a5bdc846aa Added LLVM_ENABLE_RTTI and LLVM_ENABLE_EH options that allow RTTI and EH
to globally be controlled. Individual targets (e.g.  ExceptionDemo) can
still override this by using LLVM_REQUIRE_RTTI and LLVM_REQUIRE_EH if
they need to be compiled with RTTI or exception handling respectively.

llvm-svn: 213663
2014-07-22 15:41:18 +00:00
NAKAMURA Takumi 23b702c8de [CMake] Update libdeps.
llvm-svn: 212920
2014-07-14 05:01:53 +00:00
Benjamin Kramer 749965781b Try to fix the msvc build.
llvm-svn: 207594
2014-04-29 23:37:02 +00:00
Ahmed Charles de14dcc24f Fix warnings about an variable only used in asserts.
llvm-svn: 203089
2014-03-06 06:35:46 +00:00
Ahmed Charles 56440fd820 Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.

llvm-svn: 203083
2014-03-06 05:51:42 +00:00
Rafael Espindola 339430f993 Use DataLayout from the module when easily available.
Eventually DataLayoutPass should go away, but for now that is the only easy
way to get a DataLayout in some APIs. This patch only changes the ones that
have easy access to a Module.

One interesting issue with sometimes using DataLayoutPass and sometimes
fetching it from the Module is that we have to make sure they are equivalent.
We can get most of the way there by always constructing the pass with a Module.
In fact, the pass could be changed to point to an external DataLayout instead
of owning one to make this stricter.

Unfortunately, the C api passes a DataLayout, so it has to be up to the caller
to make sure the pass and the module are in sync.

llvm-svn: 202204
2014-02-25 23:25:17 +00:00
Rafael Espindola 935125126c Make DataLayout a plain object, not a pass.
Instead, have a DataLayoutPass that holds one. This will allow parts of LLVM
don't don't handle passes to also use DataLayout.

llvm-svn: 202168
2014-02-25 17:30:31 +00:00