summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope
Commit message (Collapse)AuthorAgeFilesLines
* [ORC] Update examples to incorporate changes in ce2207abaf9.Lang Hames2020-01-292-2/+4
| | | | | | | This should fix the builders that were failing due to broken JIT examples after ce2207abaf9. (cherry picked from commit 98e55477558a823b1045b54d5a09681a3c0b819a)
* [examples] Add missing dependency in llvm examplesHiroshi Inoue2020-01-112-0/+2
| | | | To fix build failure with BUILD_SHARED_LIBS=ON
* [Kaleidoscope][BuildingAJIT] Add a missing std::move.Lang Hames2019-12-151-1/+1
| | | | | This should fix the build failure described in https://github.com/llvm/llvm-project/issues/63.
* [ORC] Remove the automagic Main JITDylib fram ExecutionSession.Lang Hames2019-12-052-12/+15
| | | | | | | | | | | | This patch removes the magic "main" JITDylib from ExecutionEngine. The main JITDylib was created automatically at ExecutionSession construction time, and all subsequently created JITDylibs were added to the main JITDylib's links-against list by default. This saves a couple of lines of boilerplate for simple JIT setups, but this isn't worth introducing magical behavior for. ORCv2 clients should now construct their own main JITDylib using ExecutionSession::createJITDylib and set up its linkages manually using JITDylib::setSearchOrder (or related methods in JITDylib).
* Move CodeGenFileType enum to Support/CodeGen.hReid Kleckner2019-11-131-1/+1
| | | | | | | Avoids the need to include TargetMachine.h from various places just for an enum. Various other enums live here, such as the optimization level, TLS model, etc. Data suggests that this change probably doesn't matter, but it seems nice to have anyway.
* Break out OrcError and RPCChris Bieneman2019-10-291-1/+1
| | | | | | | | | | | | | | | | | | | Summary: When createing an ORC remote JIT target the current library split forces the target process to link large portions of LLVM (Core, Execution Engine, JITLink, Object, MC, Passes, RuntimeDyld, Support, Target, and TransformUtils). This occurs because the ORC RPC interfaces rely on the static globals the ORC Error types require, which starts a cycle of pulling in more and more. This patch breaks the ORC RPC Error implementations out into an "OrcError" library which only depends on LLVM Support. It also pulls the ORC RPC headers into their own subdirectory. With this patch code can include the Orc/RPC/*.h headers and will only incur link dependencies on LLVMOrcError and LLVMSupport. Reviewers: lhames Reviewed By: lhames Subscribers: mgorny, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68732
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-1518-185/+185
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* [ORC] Fix BuildingAJIT tutorial code broken by r368707.Lang Hames2019-08-132-2/+2
| | | | llvm-svn: 368740
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-051-1/+1
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* [ORC] Change the locking scheme for ThreadSafeModule.Lang Hames2019-08-021-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ThreadSafeModule/ThreadSafeContext are used to manage lifetimes and locking for LLVMContexts in ORCv2. Prior to this patch contexts were locked as soon as an associated Module was emitted (to be compiled and linked), and were not unlocked until the emit call returned. This could lead to deadlocks if interdependent modules that shared contexts were compiled on different threads: when, during emission of the first module, the dependence was discovered the second module (which would provide the required symbol) could not be emitted as the thread emitting the first module still held the lock. This patch eliminates this possibility by moving to a finer-grained locking scheme. Each client holds the module lock only while they are actively operating on it. To make this finer grained locking simpler/safer to implement this patch removes the explicit lock method, 'getContextLock', from ThreadSafeModule and replaces it with a new method, 'withModuleDo', that implicitly locks the context, calls a user-supplied function object to operate on the Module, then implicitly unlocks the context before returning the result. ThreadSafeModule TSM = getModule(...); size_t NumFunctions = TSM.withModuleDo( [](Module &M) { // <- context locked before entry to lambda. return M.size(); }); Existing ORCv2 layers that operate on ThreadSafeModules are updated to use the new method. This method is used to introduce Module locking into each of the existing layers. llvm-svn: 367686
* [ORC] Add deprecation warnings to ORCv1 layers and utilities.Lang Hames2019-07-174-23/+26
| | | | | | | | | | | | | | | | | Summary: ORCv1 is deprecated. The current aim is to remove it before the LLVM 10.0 release. This patch adds deprecation attributes to the ORCv1 layers and utilities to warn clients of the change. Reviewers: dblaikie, sgraenitz, AlexDenisov Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64609 llvm-svn: 366344
* [JITLink] Update BuildingAJIT tutorials to account for API changes in r358818.Lang Hames2019-04-202-2/+4
| | | | | | | DynamicLibrarySearchGenerator::GetForCurrentProcess now takes a char (the global prefix) rather than a DataLayout reference. llvm-svn: 358820
* [Kaleidoscope] Fix symbol resolver to search in reverse order.Lang Hames2019-02-211-1/+1
| | | | | | | This should allow more recent definitions of functions in the Kaleidoscope REPL to override old ones, as the tutorial text promises. llvm-svn: 354598
* Fix some warnings on MSVCAlexandre Ganea2019-01-271-0/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D56329 llvm-svn: 352322
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-197-28/+21
| | | | | | | | | | | | | | | | | 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. llvm-svn: 351636
* Python compat - print statementSerge Guelton2019-01-035-13/+23
| | | | | | | | | Make sure all print statements are compatible with Python 2 and Python3 using the `from __future__ import print_function` statement. Differential Revision: https://reviews.llvm.org/D56249 llvm-svn: 350307
* Fix build break from r347239Paul Robinson2018-11-191-3/+2
| | | | llvm-svn: 347246
* Add bracket that was lost in rL346727 and has been causing buildbot failures ↵Simon Pilgrim2018-11-131-1/+1
| | | | | | for some time. llvm-svn: 346752
* [BuildingAJIT] Fixing the build by inserting a forgotten paren.George Karpenkov2018-11-131-1/+1
| | | | llvm-svn: 346730
* [BuildingAJIT] Clang-format chapters 1 and 2.Lang Hames2018-11-133-12/+7
| | | | llvm-svn: 346727
* [BuildingAJIT] Update chapter 2 to use the ORCv2 APIs.Lang Hames2018-11-132-133/+126
| | | | llvm-svn: 346726
* [BuildingAJIT] Update the Ch1 KaleidoscopeJIT class to expose errors to clients.Lang Hames2018-10-182-36/+38
| | | | | | | | Returning the error to clients provides an opportunity to introduce readers to the Expected and Error APIs and makes the tutorial more useful as a starting point for a real JIT class, while only slightly complicating the code. llvm-svn: 344720
* [BuildingAJIT] Update chapter 1 to use the ORCv2 APIs.Lang Hames2018-10-172-125/+116
| | | | llvm-svn: 344667
* [ORC] Rename ORC layers to make the "new" ORC layers the default.Lang Hames2018-10-156-22/+22
| | | | | | | | | | | | | 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. llvm-svn: 344572
* [ORC] Fix BuildingAJIT tutorial examples that were broken by r343059.Lang Hames2018-09-262-4/+4
| | | | | | | createLocalCompileCallbackManager now returns an Expected value. This commit wraps the call with cantFail to unwrap it. llvm-svn: 343060
* [ORC] Update JITCompileCallbackManager to support multi-threaded code.Lang Hames2018-05-304-76/+76
| | | | | | | | | 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. llvm-svn: 333490
* Test Commit Access - Removed Whitespace Luke Geeson2018-05-291-3/+3
| | | | llvm-svn: 333406
* Unbreak kaleidoscope example.Peter Collingbourne2018-05-211-1/+1
| | | | llvm-svn: 332908
* [ORC] Rewrite the VSO symbol table yet again. Update related utilities.Lang Hames2018-05-166-0/+6
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 332541
* s/LLVM_ON_WIN32/_WIN32/, llvmNico Weber2018-04-297-8/+8
| | | | | | | | | | | | | | 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. llvm-svn: 331127
* Fix build breaks in examples due to moving stuff from Scalar.h to InstCombine.hDavid Blaikie2018-04-244-3/+7
| | | | llvm-svn: 330670
* InstCombine: Fix layering by not including Scalar.h in InstCombineDavid Blaikie2018-04-244-5/+9
| | | | | | | | (notionally Scalar.h is part of libLLVMScalarOpts, so it shouldn't be included by InstCombine which doesn't/shouldn't need to depend on ScalarOpts) llvm-svn: 330669
* [ORC] Create a new SymbolStringPool by default in ExecutionSession constructor.Lang Hames2018-04-026-17/+6
| | | | | | This makes the common case of constructing an ExecutionSession tidier. llvm-svn: 329013
* Transforms: Introduce Transforms/Utils.h rather than spreading the ↵David Blaikie2018-03-281-2/+3
| | | | | | | | | declarations amongst Scalar.h and IPO.h Fixes layering - Transforms/Utils shouldn't depend on including a Scalar or IPO header, because Scalar and IPO depend on Utils. llvm-svn: 328717
* [ORC] Re-apply r327566 with a fix for test-global-ctors.ll.Lang Hames2018-03-154-12/+12
| | | | | | Also clang-formats the patch, which I should have done the first time around. llvm-svn: 327594
* Revert "[ORC] Switch from shared_ptr to unique_ptr for addModule methods."Reid Kleckner2018-03-144-12/+12
| | | | | | | | | | | | | 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. llvm-svn: 327576
* [ORC] Switch from shared_ptr to unique_ptr for addModule methods.Lang Hames2018-03-144-12/+12
| | | | | | | Layer implementations typically mutate module state, and this is better reflected by having layers own the Module they are operating on. llvm-svn: 327566
* [ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into aLang Hames2018-02-146-29/+31
| | | | | | | | | unified GetResources callback. Having a single 'GetResources' callback will simplify adding new resources in the future. llvm-svn: 325180
* [ORC] Remove Layer handles from the layer concept.Lang Hames2018-02-096-39/+39
| | | | | | | | | 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. llvm-svn: 324700
* Add OrcJIT dependency for Kaleidoscope Chapter 9.Lang Hames2018-02-061-0/+1
| | | | | | | This should fix the error at http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10421 llvm-svn: 324413
* [ORC] Start migrating ORC layers to use the new ORC Core.h APIs.Lang Hames2018-02-0612-155/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 324405
* PR35705: Fix Chapter 9 example code for API changes to DIBuilderDavid Blaikie2017-12-202-2/+4
| | | | llvm-svn: 321214
* [ORC] Refactor OrcRemoteTarget code to expose its RPC API, reduceLang Hames2017-09-042-16/+4
| | | | | | | | | | | | | | | | | | | | | | code duplication in the client, and improve error propagation. This patch moves the OrcRemoteTarget rpc::Function declarations from OrcRemoteTargetRPCAPI into their own namespaces under llvm::orc::remote so that they can be used in new contexts (in particular, a remote-object-file adapter layer that I will commit shortly). Code duplication in OrcRemoteTargetClient (especially in loops processing the code, rw-data and ro-data allocations) is removed by moving the loop bodies into their own functions. Error propagation is (slightly) improved by adding an ErrorReporter functor to the OrcRemoteTargetClient -- Errors that can't be returned (because they occur in destructors, or behind stable APIs that don't provide error returns) can be sent to the ErrorReporter instead. Some methods in the Client API are also changed to make better use of the Expected class: returning Expected<T>s rather than returning Errors and taking T&s to store the results. llvm-svn: 312500
* [ORC] Add an Error return to the JITCompileCallbackManager::grow method.Lang Hames2017-09-032-2/+2
| | | | | | | | Calling grow may result in an error if, for example, this is a callback manager for a remote target. We need to be able to return this error to the callee. llvm-svn: 312429
* [ORC][Kaleidoscope] Update Chapter 1 of BuildingAJIT to incorporate recent ORCLang Hames2017-08-152-7/+9
| | | | | | API changes. llvm-svn: 310947
* fix typos in comments and error messges; NFCHiroshi Inoue2017-07-131-1/+1
| | | | llvm-svn: 307885
* [ORC] Errorize the ORC APIs.Lang Hames2017-07-0715-29/+28
| | | | | | | | This patch updates the ORC layers and utilities to return and propagate llvm::Errors where appropriate. This is necessary to allow ORC to safely handle error cases in cross-process and remote JITing. llvm-svn: 307350
* [Orc] Remove the memory manager argument to addModule, and de-templatize theLang Hames2017-07-046-13/+14
| | | | | | | | | | | | | | | | symbol resolver argument. De-templatizing the symbol resolver is part of the ongoing simplification of ORC layer API. Removing the memory management argument (and delegating construction of memory managers for RTDyldObjectLinkingLayer to a functor passed in to the constructor) allows us to build JITs whose base object layers need not be compatible with RTDyldObjectLinkingLayer's memory mangement scheme. For example, a 'remote object layer' that sends fully relocatable objects directly to the remote does not need a memory management scheme at all (that will be handled by the remote). llvm-svn: 307058
* [ORC] Re-apply r306166 and r306168 with fix for regression test.Lang Hames2017-06-236-68/+42
| | | | llvm-svn: 306182
* This reverts commit r306166 and r306168.Rafael Espindola2017-06-236-42/+68
| | | | | | | | | Revert "[ORC] Remove redundant semicolons from DEFINE_SIMPLE_CONVERSION_FUNCTIONS uses." Revert "[ORC] Move ORC IR layer interface from addModuleSet to addModule and fix the module type as std::shared_ptr<Module>." They broke ExecutionEngine/OrcMCJIT/test-global-ctors.ll on linux. llvm-svn: 306176
OpenPOWER on IntegriCloud