summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
Commit message (Collapse)AuthorAgeFilesLines
* Update ExecutionEngine/LLVMBuild.txt, to add LLVMCodeGen.NAKAMURA Takumi2015-05-231-1/+1
| | | | llvm-svn: 238096
* Stop resetting NoFramePointerElim in TargetMachine::resetTargetOptions.Akira Hatanaka2015-05-231-1/+8
| | | | | | | | | | | | | | This is part of the work to remove TargetMachine::resetTargetOptions. In this patch, instead of updating global variable NoFramePointerElim in resetTargetOptions, its use in DisableFramePointerElim is replaced with a call to TargetFrameLowering::noFramePointerElim. This function determines on a per-function basis if frame pointer elimination should be disabled. There is no change in functionality except that cl:opt option "disable-fp-elim" can now override function attribute "no-frame-pointer-elim". llvm-svn: 238080
* Reapply part of r237975, "Fix Clang -Wmissing-override warning", except for ↵NAKAMURA Takumi2015-05-223-12/+9
| | | | | | DIContext.h, to apease g++-4.7. llvm-svn: 238012
* Revert "Fix Clang -Wmissing-override warning"Tobias Grosser2015-05-223-9/+12
| | | | | | This reverts commit r237975. This seems also to break with gcc 4.7 llvm-svn: 238004
* Fix Clang -Wmissing-override warningDavid Blaikie2015-05-223-12/+9
| | | | | | | & remove the duplication by introducing a CRTP base to implement the clone behavior. llvm-svn: 237975
* Make it easier to use DwarfContext with MCJITKeno Fischer2015-05-214-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This supersedes http://reviews.llvm.org/D4010, hopefully properly dealing with the JIT case and also adds an actual test case. DwarfContext was basically already usable for the JIT (and back when we were overwriting ELF files it actually worked out of the box by accident), but in order to resolve relocations correctly it needs to know the load address of the section. Rather than trying to get this out of the ObjectFile or requiring the user to create a new ObjectFile just to get some debug info, this adds the capability to pass in that info directly. As part of this I separated out part of the LoadedObjectInfo struct from RuntimeDyld, since it is now required at a higher layer. Reviewers: lhames, echristo Reviewed By: echristo Subscribers: vtjnash, friss, rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D6961 llvm-svn: 237961
* [RuntimeDyld] Use isInt to assert that a relocation didn't overflowDavid Majnemer2015-05-151-6/+3
| | | | | | | | | | isInt is a little easier to read, let's use that more consistently. Incidentally, this also silences a warning for shifting a negative number. This fixes PR23532. llvm-svn: 237476
* Readdress r236990, use of static members on a non-static variable.David Blaikie2015-05-111-8/+6
| | | | | | | | | | | | The TargetRegistry is just a namespace-like class, instantiated in one place to use a range-based for loop. Instead, expose access to the registry via a range-based 'targets()' function instead. This makes most uses a bit awkward/more verbose - but eventually we should just add a range-based find_if function which will streamline these functions. I'm happy to mkae them a bit awkward in the interim as encouragement to improve the algorithms in time. llvm-svn: 237059
* [Orc] Reapply r236465 with fixes for the MSVC bots.Lang Hames2015-05-053-178/+87
| | | | llvm-svn: 236506
* [Orc] Revert r236465 - It broke the Windows bots.Lang Hames2015-05-043-87/+178
| | | | | | | Looks like the usual missing explicit move-constructor issue with MSVC. I should have a fix shortly. llvm-svn: 236472
* [Orc] Refactor the compile-on-demand layer to make module partitioning lazy,Lang Hames2015-05-043-178/+87
| | | | | | | | | | | | | | | and avoid cloning unused decls into every partition. Module partitioning showed up as a source of significant overhead when I profiled some trivial test cases. Avoiding the overhead of partitionging for uncalled functions helps to mitigate this. This change also means that it is no longer necessary to have a LazyEmittingLayer underneath the CompileOnDemand layer, since the CompileOnDemandLayer will not extract or emit function bodies until they are called. llvm-svn: 236465
* Reapply [RuntimeDyldELF] Fold Placeholder into AddendKeno Fischer2015-05-013-192/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reapplies r235060 and 235070, which were reverted because of test failures in LLDB. The failure was caused because at moment RuntimeDyld is processing relocations for all sections, irrespective of whether we actually load them into memory or not, but RuntimeDyld was not actually remembering where in memory the unrelocated section is. This commit includes a fix for that issue by remembering that pointer, though the longer term fix should be to stop processing unneeded sections. Original Summary: This allows us to get rid of the original unrelocated object file after we're done processing relocations (but before applying them). MachO and COFF already do not require this (currently we have temporary hacks to prevent ownership from being released, but those are brittle and should be removed soon). The placeholder mechanism allowed the relocation resolver to look at original object file to obtain more information that are required to apply the relocations. This is usually necessary in two cases: - For relocations targetting sub-word memory locations, there may be pieces of the instruction at the target address which we should not override. - Some relocations on some platforms allow an extra addend to be encoded in their immediate fields. The problem is that in the second case the information cannot be recovered after the relocations have been applied once because they will have been overridden. In the first case we also need to be careful to not use any bits that aren't fixed and may have been overriden by applying a first relocation. In the past both have been fixed by just looking at original object file. This patch attempts to recover the information from the first by looking at the relocated object file, while the extra addend in the second case is read upon relocation processing and addend to the regular addend. I have tested this on X86. Other platforms represent my best understanding of how those relocations should work, but I may have missed something because I do not have access to those platforms. We will keep the ugly workarounds in place for a couple of days, so this commit can be reverted if it breaks the bots. Differential Revision: http://reviews.llvm.org/D9028 llvm-svn: 236341
* [opaque pointer type] Pass GlobalAlias the actual pointer type rather than ↵David Blaikie2015-04-291-3/+1
| | | | | | | | | | | | | decomposing it into pointee type + address space Many of the callers already have the pointer type anyway, and for the couple of callers that don't it's pretty easy to call PointerType::get on the pointee type and address space. This avoids LLParser from using PointerType::getElementType when parsing GlobalAliases from IR. llvm-svn: 236160
* Move DIContext.h to common DebugInfo location.Zachary Turner2015-04-231-2/+3
| | | | | | | | | | This will enable us to create a PDBContext so as to expose some amount of debug info functionality through a common interace. Differential Revision: http://reviews.llvm.org/D9205 Reviewed by: Alexey Samsonov llvm-svn: 235612
* [RuntimeDyld][COFF] Add external symbol resolution support to RuntimeDyldCOFF.Lang Hames2015-04-221-14/+16
| | | | | | Patch by Andy Ayers. Thanks Andy! llvm-svn: 235554
* [Orc] Make the makeStub function propagate argument attributes onto the call toLang Hames2015-04-201-0/+1
| | | | | | | | | | | the function body. This is necessary for correctness when lazily compiling. Also, flesh out the Orc unit test infrastructure slightly, and add a unit test for this. llvm-svn: 235347
* [Orc] Use the 64-bit versions of FXSAVE/FXRSTOR for JIT reentry.Lang Hames2015-04-201-16/+16
| | | | llvm-svn: 235325
* Revert "[RuntimeDyldELF] Fold Placeholder into Addend"Pavel Labath2015-04-162-177/+187
| | | | | | This reverts commit cbbeac14f0ddca71f6d8ff91cd05522bd23908e5. llvm-svn: 235082
* Revert "[RuntimeDyldELF] Fix missing cases in Placeholder processing"Pavel Labath2015-04-161-3/+1
| | | | | | This reverts commit ec0a34f850eca0d97e0592236e0ac14083aa1c3d. llvm-svn: 235081
* [RuntimeDyldELF] Fix missing cases in Placeholder processingKeno Fischer2015-04-161-1/+3
| | | | | | | Try to appease the build bots. We should write rtdyld test cases for these to make them testible on other platforms. llvm-svn: 235070
* [RuntimeDyldELF] Fold Placeholder into AddendKeno Fischer2015-04-152-187/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This allows us to get rid of the original unrelocated object file after we're done processing relocations (but before applying them). MachO and COFF already do not require this (currently we have temporary hacks to prevent ownership from being released, but those are brittle and should be removed soon). The placeholder mechanism allowed the relocation resolver to look at original object file to obtain more information that are required to apply the relocations. This is usually necessary in two cases: - For relocations targetting sub-word memory locations, there may be pieces of the instruction at the target address which we should not override. - Some relocations on some platforms allow an extra addend to be encoded in their immediate fields. The problem is that in the second case the information cannot be recovered after the relocations have been applied once because they will have been overridden. In the first case we also need to be careful to not use any bits that aren't fixed and may have been overriden by applying a first relocation. In the past both have been fixed by just looking at original object file. This patch attempts to recover the information from the first by looking at the relocated object file, while the extra addend in the second case is read upon relocation processing and addend to the regular addend. I have tested this on X86. Other platforms represent my best understanding of how those relocations should work, but I may have missed something because I do not have access to those platforms. We will keep the ugly workarounds in place for a couple of days, so this commit can be reverted if it breaks the bots. Reviewers: petarj, t.p.northover, lhames Reviewed By: lhames Subscribers: aemerson, llvm-commits Differential Revision: http://reviews.llvm.org/D9028 llvm-svn: 235060
* [RuntimeDyld] Add casts to make delta computation 64-bit.Lang Hames2015-04-151-1/+2
| | | | | | | Hopefully this will fix the i686/msvc build failure described at: http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/803 llvm-svn: 234977
* [RuntimeDyld] Make sure we emit MachO __eh_frame and __gcc_except_tab sections,Lang Hames2015-04-151-11/+16
| | | | | | | | even if there are no references to them in the code. This allows exceptions thrown from JIT'd code to be caught by the JIT itself. llvm-svn: 234975
* [RuntimeDyld] Make SectionEntry's Name field a std::string.Lang Hames2015-04-141-1/+1
| | | | | | | StringRef is unsafe here, since SectionEntry instances can outlive the ObjectFile instances they are created from. llvm-svn: 234910
* [RuntimeDyldELF] Improve GOT supportKeno Fischer2015-04-145-114/+89
| | | | | | | | | | | | | | | | | | Summary: This is the first in a series of patches to eventually add support for TLS relocations to RuntimeDyld. This patch resolves an issue in the current GOT handling, where GOT entries would be reused between object files, which leads to the same situation that necessitates the GOT in the first place, i.e. that the 32-bit offset can not cover all of the address space. Thus this patch makes the GOT object-file-local. Unfortunately, this still isn't quite enough, because the MemoryManager does not yet guarantee that sections are allocated sufficiently close to each other, even if they belong to the same object file. To address this concern, this patch also adds a small API abstraction on top of the GOT allocation mechanism that will allow (temporarily, until the MemoryManager is improved) using the stub mechanism instead of allocating a different section. The actual switch from separate section to stub mechanism will be part of a follow-on commit, so that it can be easily reverted independently at the appropriate time. Test Plan: Includes a test case where the GOT of two object files is artificially forced to be apart by several GB. Reviewers: lhames Reviewed By: lhames Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8813 llvm-svn: 234839
* [Orc] During module partitioning, rename anonymous and asm-private globals.Lang Hames2015-04-121-2/+40
| | | | | | | If they're not (re)named, these globals will fail to resolve when the partitioned modules are linked. llvm-svn: 234707
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-116-7/+8
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* [Orc] Tidy up IndirectionUtils API a little, add some comments. NFC.Lang Hames2015-04-111-6/+15
| | | | llvm-svn: 234669
* Reduce dyn_cast<> to isa<> or cast<> where possible.Benjamin Kramer2015-04-101-8/+8
| | | | | | No functional change intended. llvm-svn: 234586
* [jitlistener] Remove unused codeBenjamin Kramer2015-04-083-73/+0
| | | | llvm-svn: 234404
* [RuntimeDyld] Always allocate at least 1 byte for object sections in the JIT toLang Hames2015-04-071-13/+16
| | | | | | | | | | | | ensure that section addresses are distinct. mapSectionAddress will fail if two sections are allocated the same address, which can happen if any section has zero size (since malloc(0) is implementation defined). Unfortunately I've been unable to repro this with a simple test case. Fixes <rdar://problem/20314015>. llvm-svn: 234299
* [Orc] Save all the x86-64 GPRs before re-entering the JIT.Lang Hames2015-04-071-6/+13
| | | | | | The re-entry code should work for all calling conventions. llvm-svn: 234298
* [Orc] Tidy up the assembly for the x86-64 resolver block.Lang Hames2015-04-061-44/+45
| | | | llvm-svn: 234138
* [Orc] Fix local-linkage handling in the CompileOnDemand layer.Lang Hames2015-04-021-2/+2
| | | | llvm-svn: 233895
* [Orc] Add support classes for inspecting and running C++ static ctor/dtors, andLang Hames2015-04-022-0/+103
| | | | | | | | | use these to add support for C++ static ctors/dtors to the Orc-lazy JIT in LLI. Replace the trivial_retval_1 regression test - the new 'hello' test is covering strictly more code. llvm-svn: 233885
* [ExecutionEngine] Fix MCJIT::addGlobalMapping.Lang Hames2015-03-311-58/+81
| | | | | | | | | | | | | | | | | | This patch fixes MCJIT::addGlobalMapping by changing the implementation of the ExecutionEngineState class. The new implementation maintains a bidirectional mapping between symbol names (std::strings) and addresses (uint64_ts), rather than a mapping between Value*s and void*s. This has fix has been made for backwards compatibility, however the strongly preferred way to resolve unknown symbols is by writing a custom RuntimeDyld::SymbolResolver (formerly RTDyldMemoryManager) and overriding the findSymbol method. The addGlobalMapping method is a hangover from the legacy JIT (which has was removed in 3.6), and may be deprecated in a future release as part of a clean-up of the ExecutionEngine interface. Patch by Murat Bolat. Thanks Murat! llvm-svn: 233747
* Remove more superfluous .str() and replace std::string concatenation with Twine.Yaron Keren2015-03-301-5/+4
| | | | | | Following r233392, http://llvm.org/viewvc/llvm-project?rev=233392&view=rev. llvm-svn: 233555
* [MCJIT] In debug memory dump output, don't truncate 64 bit addressesAlexei Starovoitov2015-03-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In dumpMemorySections a cast was too short, and in resolveRelocations a format string was too short. Test Plan: Enable debug build and run a program which invokes MCJIT::finalizeObject(). Saw valid input as below (highlighted addresses were previously truncated): ``` Parse relocations: Resolving relocations Section #0 **0x7f4c1337b000** ----- Contents of section socket1 before relocations ----- **0x00007f4c1337b000**: 18 01 00 00 01 01 01 0a 00 00 00 00 04 03 02 01 0x00007f4c1337b010: 7b 1a f8 ff 00 00 00 00 18 11 00 00 05 00 00 00 ``` Reviewers: lhames Reviewed By: lhames Subscribers: llvm-commits, ast Differential Revision: http://reviews.llvm.org/D8681 llvm-svn: 233512
* [MCJIT][Orc] Refactor RTDyldMemoryManager, weave RuntimeDyld::SymbolInfo throughLang Hames2015-03-3018-233/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MCJIT. This patch decouples the two responsibilities of the RTDyldMemoryManager class, memory management and symbol resolution, into two new classes: RuntimeDyld::MemoryManager and RuntimeDyld::SymbolResolver. The symbol resolution interface is modified slightly, from: uint64_t getSymbolAddress(const std::string &Name); to: RuntimeDyld::SymbolInfo findSymbol(const std::string &Name); The latter passes symbol flags along with symbol addresses, allowing RuntimeDyld and others to reason about non-strong/non-exported symbols. The memory management interface removes the following method: void notifyObjectLoaded(ExecutionEngine *EE, const object::ObjectFile &) {} as it is not related to memory management. (Note: Backwards compatibility *is* maintained for this method in MCJIT and OrcMCJITReplacement, see below). The RTDyldMemoryManager class remains in-tree for backwards compatibility. It inherits directly from RuntimeDyld::SymbolResolver, and indirectly from RuntimeDyld::MemoryManager via the new MCJITMemoryManager class, which just subclasses RuntimeDyld::MemoryManager and reintroduces the notifyObjectLoaded method for backwards compatibility). The EngineBuilder class retains the existing method: EngineBuilder& setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm); and includes two new methods: EngineBuilder& setMemoryManager(std::unique_ptr<MCJITMemoryManager> MM); EngineBuilder& setSymbolResolver(std::unique_ptr<RuntimeDyld::SymbolResolver> SR); Clients should use EITHER: A single call to setMCJITMemoryManager with an RTDyldMemoryManager. OR (exclusive) One call each to each of setMemoryManager and setSymbolResolver. This patch should be fully compatible with existing uses of RTDyldMemoryManager. If it is not it should be considered a bug, and the patch either fixed or reverted. If clients find the new API to be an improvement the goal will be to deprecate and eventually remove the RTDyldMemoryManager class in favor of the new classes. llvm-svn: 233509
* [Orc] Refactor JITCompileCallbackManagerBase and CompileOnDemandLayer to supportLang Hames2015-03-251-2/+2
| | | | | | | | target-independent callback management. This is a prerequisite for adding orc-based lazy-jitting to lli. llvm-svn: 233166
* [Orc] Move delta-handling for trampoline sizes into the resolver block.Lang Hames2015-03-241-0/+2
| | | | | | | This is the first step towards adding a target-independent callback handler API. llvm-svn: 233049
* Raising minimum required CMake version to 2.8.12.2.Chris Bieneman2015-03-231-1/+1
| | | | | | This commit is in reference to the llvm-dev thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/083672.html llvm-svn: 233008
* Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.Benjamin Kramer2015-03-231-0/+1
| | | | llvm-svn: 232998
* Fix uses of reserved identifiers starting with an underscore followed by an ↵David Blaikie2015-03-161-8/+8
| | | | | | | | | uppercase letter This covers essentially all of llvm's headers and libs. One or two weird cases I wasn't sure were worth/appropriate to fix. llvm-svn: 232394
* [Orc][MCJIT][RuntimeDyld] Re-apply r231726 and r231724 with fix suggested byLang Hames2015-03-115-57/+46
| | | | | | Dave Blaikie. Thanks Dave! llvm-svn: 231896
* Temporarily revert r231726 and r231724 as they're breaking the build.:Eric Christopher2015-03-105-46/+57
| | | | | | | | | | | | | | | | | | | Author: Lang Hames <lhames@gmail.com> Date: Mon Mar 9 23:51:09 2015 +0000 [Orc][MCJIT][RuntimeDyld] Add header that was accidentally left out of r231724. Author: Lang Hames <lhames@gmail.com> Date: Mon Mar 9 23:44:13 2015 +0000 [Orc][MCJIT][RuntimeDyld] Add symbol flags to symbols in RuntimeDyld. Thread the new types through MCJIT and Orc. In particular, add a 'weak' flag. When plumbed through RTDyldMemoryManager, this will allow us to distinguish between weak and strong definitions and find the right ones during symbol resolution. llvm-svn: 231731
* [Orc][MCJIT][RuntimeDyld] Add symbol flags to symbols in RuntimeDyld. Thread theLang Hames2015-03-095-57/+46
| | | | | | | | | | new types through MCJIT and Orc. In particular, add a 'weak' flag. When plumbed through RTDyldMemoryManager, this will allow us to distinguish between weak and strong definitions and find the right ones during symbol resolution. llvm-svn: 231724
* Simplify expressions involving boolean constants with clang-tidyDavid Blaikie2015-03-091-1/+1
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8154 llvm-svn: 231617
* Fix the autoconf buildDavid Majnemer2015-03-073-195/+160
| | | | | | | | lib/ExecutionEngine/Targets has no Makefile, causing the autoconf build to fail. Solve this by bringing the COFF implementation of RuntimeDyld in line like the Mach-O and ELF implementations. llvm-svn: 231579
* Fix unused variable/function warningsDavid Majnemer2015-03-073-10/+7
| | | | llvm-svn: 231576
OpenPOWER on IntegriCloud