summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope
Commit message (Collapse)AuthorAgeFilesLines
* [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
* [ORC] Move ORC IR layer interface from addModuleSet to addModule and fix theLang Hames2017-06-236-68/+42
| | | | | | module type as std::shared_ptr<Module>. llvm-svn: 306166
* [ORC] Switch the object layer API from addObjectSet to addObject (singular), andLang Hames2017-06-226-12/+12
| | | | | | | | | move the ObjectCache from the IRCompileLayer to SimpleCompiler. This is the first in a series of patches aimed at cleaning up and improving the robustness and performance of the ORC APIs. llvm-svn: 306058
* [Examples] Fix some Clang-tidy modernize-use-using and Include What You Use ↵Eugene Zelenko2017-05-267-44/+43
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 303944
* [Kaleidoscope] toy.cpp use after move fixPeter Szecsi2017-05-076-6/+6
| | | | | | | | | | The variable Proto is moved at the beginning of the codegen() function. According to the comment above, the pointed object should be used due the reference P. Differential Revision: https://reviews.llvm.org/D32939 llvm-svn: 302369
* llvm/examples/Kaleidoscope/BuildingAJIT: More fixup corresponding to r295636.NAKAMURA Takumi2017-02-205-10/+10
| | | | | | I missed updating them since I just ran check-llvm (with examples) in r295645. llvm-svn: 295646
* llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h: Fixup corresponding to ↵NAKAMURA Takumi2017-02-201-2/+2
| | | | | | r295636. llvm-svn: 295645
* Kaleidoscope-Ch7: Add TranformUtils for ↵NAKAMURA Takumi2017-02-121-0/+1
| | | | | | llvm::createPromoteMemoryToRegisterPass() added in r294870. llvm-svn: 294881
* Update Kaleidoscope tutorial and improve Windows supportMehdi Amini2017-02-118-27/+90
| | | | | | | | | | | | | | | Many quoted code blocks were not in sync with the actual toy.cpp files. Improve tutorial text slightly in several places. Added some step descriptions crucial to avoid crashes (like InitializeNativeTarget* calls). Solve/workaround problems with Windows (JIT'ed method not found, using custom and standard library functions from host process). Patch by: Moritz Kroll <moritz.kroll@gmx.de> Differential Revision: https://reviews.llvm.org/D29864 llvm-svn: 294870
* Use print() instead of dump() in codeMatthias Braun2017-01-2817-36/+67
| | | | | | | The dump() functions are meant to be used in a debugger, code should typically use something like print(errs()); llvm-svn: 293365
* Chapter3/KaleidoscopeJIT.h: Fix a warning. [-Wunused-lambda-capture]NAKAMURA Takumi2017-01-261-1/+1
| | | | | | "this", aka class members, is not referred in the body. llvm-svn: 293159
* [Examples] Fix some Clang-tidy modernize-use-default and Include What You ↵Eugene Zelenko2016-11-1818-56/+216
| | | | | | | | Use warnings; other minor fixes. Differential revision: https://reviews.llvm.org/D26433 llvm-svn: 287384
* [Orc] Update the BuildingAJIT Chapter 5 server class for the recent RPC changes.Lang Hames2016-11-111-13/+3
| | | | llvm-svn: 286642
* [ORC] Re-apply 286620 with fixes for the ErrorSuccess class.Lang Hames2016-11-112-5/+5
| | | | llvm-svn: 286639
* [ORC] Revert r286620 while I investigate a bot failure.Lang Hames2016-11-112-5/+5
| | | | llvm-svn: 286621
* [ORC] Refactor the ORC RPC utilities to add some new features.Lang Hames2016-11-112-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) Add support for function key negotiation. The previous version of the RPC required both sides to maintain the same enumeration for functions in the API. This means that any version skew between the client and server would result in communication failure. With this version of the patch functions (and serializable types) are defined with string names, and the derived function signature strings are used to negotiate the actual function keys (which are used for efficient call serialization). This allows clients to connect to any server that supports a superset of the API (based on the function signatures it supports). (2) Add a callAsync primitive. The callAsync primitive can be used to install a return value handler that will run as soon as the RPC function's return value is sent back from the remote. (3) Launch policies for RPC function handlers. The new addHandler method, which installs handlers for RPC functions, takes two arguments: (1) the handler itself, and (2) an optional "launch policy". When the RPC function is called, the launch policy (if present) is invoked to actually launch the handler. This allows the handler to be spawned on a background thread, or added to a work list. If no launch policy is used, the handler is run on the server thread itself. This should only be used for short-running handlers, or entirely synchronous RPC APIs. (4) Zero cost cross type serialization. You can now define serialization from any type to a different "wire" type. For example, this allows you to call an RPC function that's defined to take a std::string while passing a StringRef argument. If a serializer from StringRef to std::string has been defined for the channel type this will be used to serialize the argument without having to construct a std::string instance. This allows buffer reference types to be used as arguments to RPC calls without requiring a copy of the buffer to be made. llvm-svn: 286620
* [BuildingAJIT] Use the remote target triple to construct the TargetMachine inLang Hames2016-10-191-1/+2
| | | | | | | | | | Chapter 5. Chapter 5 demonstrates remote JITing: code is executed on the remote, not the machine running the REPL, so it's the remote's triple (and TargetMachine) that we need. llvm-svn: 284657
* [BuildingAJIT] Make the chapter 5 server export symbols.Lang Hames2016-10-191-0/+2
| | | | | | This will allow chapter 5 to work on Linux. llvm-svn: 284637
* [Kaleidoscope] Make Chapter 2 use llvm::make_unique, rather than a helper.Lang Hames2016-09-192-22/+15
| | | | | | | This essentially reverts r251936, minimizing the difference between Chapter2 and Chapter 3, and making Chapter 2's code match the tutorial text. llvm-svn: 281945
* [ORC] Update examples for header changes in r281171.Lang Hames2016-09-111-2/+2
| | | | llvm-svn: 281178
* Fix singlton -> singleton typo.Eric Christopher2016-08-265-5/+5
| | | | llvm-svn: 279801
* Use the range variant of find instead of unpacking begin/endDavid Majnemer2016-08-111-2/+1
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278433
* [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.Lang Hames2016-08-016-35/+33
| | | | | | | | | | | | | | | | This patch replaces RuntimeDyld::SymbolInfo with JITSymbol: A symbol class that is capable of lazy materialization (i.e. the symbol definition needn't be emitted until the address is requested). This can be used to support common and weak symbols in the JIT (though this is not implemented in this patch). For consistency, RuntimeDyld::SymbolResolver is renamed to JITSymbolResolver. For space efficiency a new class, JITEvaluatedSymbol, is introduced that behaves like the old RuntimeDyld::SymbolInfo - i.e. it is just a pair of an address and symbol flags. Instances of JITEvaluatedSymbol can be used in symbol-tables to avoid paying the space cost of the materializer. llvm-svn: 277386
* [Kaleidoscope][BuildingAJIT] Start filling in text for chapter 3.Lang Hames2016-07-153-14/+17
| | | | llvm-svn: 275518
* New Kaleidoscope chapter: Creating object filesWilfred Hughes2016-07-024-328/+1552
| | | | | | | | | | | | This new chapter describes compiling LLVM IR to object files. The new chaper is chapter 8, so later chapters have been renumbered. Since this brings us to 10 chapters total, I've also needed to rename the other chapters to use two digit numbering. Differential Revision: http://reviews.llvm.org/D18070 llvm-svn: 274441
* [Orc] Add conversion to/from RuntimeDyld::SymbolInfo for JITSymbol.Lang Hames2016-05-316-8/+8
| | | | | | | | | | This tidies up some code that was manually constructing RuntimeDyld::SymbolInfo instances from JITSymbols. It will save more mess in the future when JITSymbol::getAddress is extended to return an Expected<TargetAddress> rather than just a TargetAddress, since we'll be able to embed the error checking in the conversion. llvm-svn: 271350
OpenPOWER on IntegriCloud