[Orc] Rename OrcTargetSupport to OrcArchitectureSupport to avoid confusion with the upcoming remote-target support classes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257302 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "Revert "[Orc] Directly emit machine code for the x86 resolver block and trampolines."" This reverts commit r251937. The test was updated to the new API, bring the API back. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251944 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "[Orc] Directly emit machine code for the x86 resolver block and trampolines." This reverts commit r251933. It broke the build of examples/Kaleidoscope/Orc/fully_lazy/toy.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251937 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Directly emit machine code for the x86 resolver block and trampolines. Bypassing LLVM for this has a number of benefits: 1) Laziness support becomes asm-syntax agnostic (previously lazy jitting didn't work on Windows as the resolver block was in Darwin asm). 2) For cross-process JITs, it allows resolver blocks and trampolines to be emitted directly in the target process, reducing cross process traffic. 3) It should be marginally faster. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251933 91177308-0d34-0410-b5e6-96231b3b80d8
Add a sys::OwningMemoryBlock class, which is a sys::MemoryBlock that owns its underlying memory, and will automatically release it on destruction. Use this to tidy up the orc::IndirectStubsInfo class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251731 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Teach IndirectStubsManager to manage an expandable pool of stubs, rather than a pre-allocated slab of stubs. Also add a convenience method for creating a single stub, rather than a whole block a time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251658 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Add license header to OrcTargetSupport. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251274 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Add support for emitting indirect stubs directly into the JIT target's memory, rather than representing the stubs in IR. Update the CompileOnDemand layer to use this functionality. Directly emitting stubs is much cheaper than building them in IR and codegen'ing them (see below). It also plays well with remote JITing - stubs can be emitted directly in the target process, rather than having to send them over the wire. The downsides are: (1) Care must be taken when resolving symbols, as stub symbols are held in a separate symbol table. This is only a problem for layer writers and other people using this API directly. The CompileOnDemand layer hides this detail. (2) Aliases of function stubs can't be symbolic any more (since there's no symbol definition in IR), but must be converted into a constant pointer expression. This means that modules containing aliases of stubs cannot be cached. In practice this is unlikely to be a problem: There's no benefit to caching such a module anyway. On balance I think the extra performance is more than worth the trade-offs: In a simple stress test with 10000 dummy functions requiring stubs and a single executed "hello world" main function, directly emitting stubs reduced user time for JITing / executing by over 90% (1.5s for IR stubs vs 0.1s for direct emission). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250712 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Use the 64-bit versions of FXSAVE/FXRSTOR for JIT reentry. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235325 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Save all the x86-64 GPRs before re-entering the JIT. The re-entry code should work for all calling conventions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234298 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Tidy up the assembly for the x86-64 resolver block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234138 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Refactor JITCompileCallbackManagerBase and CompileOnDemandLayer to support target-independent callback management. This is a prerequisite for adding orc-based lazy-jitting to lli. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233166 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Move delta-handling for trampoline sizes into the resolver block. This is the first step towards adding a target-independent callback handler API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233049 91177308-0d34-0410-b5e6-96231b3b80d8
[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
OrcJIT: Appease msc18 not to be confused on executeCompileCallback<OrcX86_64>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229494 91177308-0d34-0410-b5e6-96231b3b80d8
Reformat. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229493 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] Update the Orc indirection utils and refactor the CompileOnDemand layer. This patch replaces most of the Orc indirection utils API with a new class: JITCompileCallbackManager, which creates and manages JIT callbacks. Exposing this functionality directly allows the user to create callbacks that are associated with user supplied compilation actions. For example, you can create a callback to lazyily IR-gen something from an AST. (A kaleidoscope example demonstrating this will be committed shortly). This patch also refactors the CompileOnDemand layer to use the JITCompileCallbackManager API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229461 91177308-0d34-0410-b5e6-96231b3b80d8
Re-sort #include lines using my handy dandy ./utils/sort_includes.py script. This is in preparation for changes to lots of include lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229088 91177308-0d34-0410-b5e6-96231b3b80d8
[Orc] New JIT APIs. This patch adds a new set of JIT APIs to LLVM. The aim of these new APIs is to cleanly support a wider range of JIT use cases in LLVM, and encourage the development and contribution of re-usable infrastructure for LLVM JIT use-cases. These APIs are intended to live alongside the MCJIT APIs, and should not affect existing clients. Included in this patch: 1) New headers in include/llvm/ExecutionEngine/Orc that provide a set of components for building JIT infrastructure. Implementation code for these headers lives in lib/ExecutionEngine/Orc. 2) A prototype re-implementation of MCJIT (OrcMCJITReplacement) built out of the new components. 3) Minor changes to RTDyldMemoryManager needed to support the new components. These changes should not impact existing clients. 4) A new flag for lli, -use-orcmcjit, which will cause lli to use the OrcMCJITReplacement class as its underlying execution engine, rather than MCJIT itself. Tests to follow shortly. Special thanks to Michael Ilseman, Pete Cooper, David Blaikie, Eric Christopher, Justin Bogner, and Jim Grosbach for extensive feedback and discussion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226940 91177308-0d34-0410-b5e6-96231b3b80d8