Commit Graph

1657 Commits

Author SHA1 Message Date
Lang Hames
95141f9379 [MCJIT] Replace a C-style cast in RuntimeDyldImpl.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216568 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 17:48:07 +00:00
Lang Hames
644e3c077c [MCJIT] More endianness fixes for RuntimeDyldMachO.
http://llvm.org/PR20640



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216567 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 17:41:06 +00:00
Rafael Espindola
af07403c3e Give ExecutionEngine of top level buffers.
Long term the idea if for the engine to not own the buffers, but for now
this is consistent with the rest of the API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216484 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 21:04:04 +00:00
Benjamin Kramer
083c9de5a0 Silence unused function warning in Release builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216458 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 14:22:05 +00:00
Dylan Noblesmith
759a71a1fa ExecutionEngine: address review comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216427 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 02:03:28 +00:00
Lang Hames
9fe621a69e [MCJIT][SystemZ] Use a simpler expression for indirect relocation offsets.
The expressions 'Reloc.Addend - Addend' and 'Reloc.Offset' should always be
equal in this context. The latter is prefered - we want to remove the
RelocationValueRef::Addend field in the future.





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216418 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 23:33:48 +00:00
Lang Hames
476f2435f5 [MCJIT] Dump section memory both before and after relocations are applied.
Also switch section memory dump format from 8 to 16 columns.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216413 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 22:19:14 +00:00
Lang Hames
f9526ac188 [MCJIT] Make RuntimeDyld dump section contents in -debug mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216400 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 18:37:38 +00:00
Dylan Noblesmith
1e321bba6e ExecutionEngine: unique_ptr-ify
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216362 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 00:58:18 +00:00
Dylan Noblesmith
444aa2d525 EE/JIT: unique_ptr-ify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216361 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 00:58:15 +00:00
Craig Topper
273fd11da9 Use range based for loops to avoid needing to re-mention SmallPtrSet size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216351 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-24 23:23:06 +00:00
Dylan Noblesmith
389f13012f Support: add llvm::unique_lock
Based on the STL class of the same name, it guards a mutex
while also allowing it to be unlocked conditionally before
destruction.

This eliminates the last naked usages of mutexes in LLVM and
clang.

It also uncovered and fixed a bug in callExternalFunction()
when compiled without USE_LIBFFI, where the mutex would never
be unlocked if the end of the function was reached.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216338 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-23 23:07:14 +00:00
Dylan Noblesmith
d930a30833 Support: make LLVM Mutexes STL-compatible
Use lock/unlock() convention instead of acquire/release().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216336 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-23 22:49:22 +00:00
Rafael Espindola
8d1b742f7f Remove dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216201 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 18:11:21 +00:00
Elena Demikhovsky
6623af7892 IntelJITEventListener updates to fix breaks by recent changes to EngineBuilder and DIContext.
By Arch Robison.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216159 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 07:01:55 +00:00
Lang Hames
3414e45ffa [MCJIT] Allow '$' characters in symbol names in RuntimeDyldChecker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216017 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 20:04:45 +00:00
Rafael Espindola
548f2b6e8f Don't own the buffer in object::Binary.
Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries
(like Archive) and we had to create dummy buffers just to handle that. It is
also a bad fit for IRObjectFile where the Module wants to own the buffer too.

Keeping this ownership would make supporting IR inside native objects
particularly painful.

This patch focuses in lib/Object. If something elsewhere used to own an Binary,
now it also owns a MemoryBuffer.

This patch introduces a few new types.

* MemoryBufferRef. This is just a pair of StringRefs for the data and name.
  This is to MemoryBuffer as StringRef is to std::string.
* OwningBinary. A combination of Binary and a MemoryBuffer. This is needed
  for convenience functions that take a filename and return both the
  buffer and the Binary using that buffer.

The C api now uses OwningBinary to avoid any change in semantics. I will start
a new thread to see if we want to change it and how.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216002 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 18:44:46 +00:00
Rafael Espindola
3f4ed32b43 Make it explicit that ExecutionEngine takes ownership of the modules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215967 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 04:04:25 +00:00
Rafael Espindola
f359f7ef8c Use a range loop. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215948 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-18 23:15:59 +00:00
Lang Hames
08f77a9f42 [MCJIT] Respect target endianness in RuntimeDyldMachO and RuntimeDyldChecker.
This patch may address some of the issues described in http://llvm.org/PR20640.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215938 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-18 21:43:16 +00:00
Rafael Espindola
6de46b5183 Use copy initialization to initialize std::unique_ptr.
Thanks to David Blaikie for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215867 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-17 23:38:08 +00:00
Lang Hames
e8d6e37938 [MCJIT] Support DisableSymbolSearching and InstallLazyFunctionCreator in MCJIT.
Patch by Anthony Pesch. Thanks Anthony!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215613 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-14 02:38:20 +00:00
Benjamin Kramer
00e08fcaa0 Canonicalize header guards into a common format.
Add header guards to files that were missing guards. Remove #endif comments
as they don't seem common in LLVM (we can easily add them back if we decide
they're useful)

Changes made by clang-tidy with minor tweaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 16:26:38 +00:00
Lang Hames
e5885cab3e [MCJIT] Simplify immediate decoding code in the RuntimeDyldMachO hierarchy.
Cleanup only: no functional change.

This patch makes RuntimeDyldMachO targets directly responsible for decoding
immediates, rather than letting them implement catch a callback from generic
code. Since this is a very target specific operation, it makes sense to let the
target-specific code drive it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215255 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 23:12:22 +00:00
Eric Christopher
aa5b9c0f6f 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215154 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 22:02:54 +00:00
Lang Hames
362510890f [MCJIT] Replace a c-style cast with reinterpret_cast + static_cast.
C-style casts (and reinterpret_casts) result in implementation defined
values when a pointer is cast to a larger integer type. On some platforms
this was leading to bogus address computations in RuntimeDyldMachOAArch64.

This should fix http://llvm.org/PR20501.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215143 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 20:41:57 +00:00
Rafael Espindola
7b232e2bb6 fix configure+make build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215116 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 14:38:49 +00:00
Rafael Espindola
875710a2fd 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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215111 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 14:21:18 +00:00
Eric Christopher
9f85dccfc6 Remove the TargetMachine forwards for TargetSubtargetInfo based
information and update all callers. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214781 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04 21:25:23 +00:00
Lang Hames
354ed5f15e [MCJIT] Fix an overly-aggressive check in RuntimeDyldMachOARM.
This should fix the MachO_ARM_PIC_relocations.s test failures on some 32-bit
testers.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214613 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-02 03:00:49 +00:00
Rafael Espindola
748566982e Include Archive.h
MSVC was complaining about Archive being an incomplete type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214542 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 19:28:15 +00:00
Rafael Espindola
db11712170 Move virtual method out of line.
Should fix the MSVC build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214539 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 18:49:24 +00:00
Rafael Espindola
6312816b42 Replace comment about ownership with std::unique_ptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214533 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 18:09:32 +00:00
Rafael Espindola
af30da42f9 Use range loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214530 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 18:04:14 +00:00
Rafael Espindola
9aa0b5e11e Remove some calls to std::move.
Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get
a reference to it.

Thanks to David Blaikie for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214516 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 14:31:55 +00:00
Rafael Espindola
79002da926 Use std::unique_ptr to make the ownership explicit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214377 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-31 03:12:45 +00:00
Rafael Espindola
fa003d07fd Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214370 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-31 01:14:09 +00:00
Lang Hames
1febfa28a4 [MCJIT] Fix the ARM BR24 relocation in RuntimeDyldMachO.
We now (1) correctly decode the branch immediate, (2) modify the immediate to
corretly treat it as PC-rel, and (3) properly populate the stub entry.
Previously we had been doing each of these wrong.

<rdar://problem/17750739>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214285 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-30 03:35:05 +00:00
Lang Hames
41364b7d54 [MCJIT] Add options to llvm-rtdyld to describe a phony target address space for
use in -verify mode.

This patch adds three hidden command line options to llvm-rtdyld:

 -target-addr-start <start-addr> : Specify the start of the virtual address
                                   space on the phony target.

 -target-addr-end   <end-addr>   : Specify the end of the virtual address space
                                   on the phony target.

 -target-section-sep <sep>       : Specify the separation (in bytes) between the
                                   end of one section and the start of the next.

These options automatically default to sane values for the target platform. In
particular, they allow narrow (e.g. 32-bit, 16-bit) targets to be tested from
wider (e.g. 64-bit, 32-bit) hosts without overflowing pointers.

The section separation option defaults to zero, but can be set to a large number
(e.g. 1 << 32) to force large separations between sections in order to
stress-test large-code-model code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214255 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29 23:43:13 +00:00
Lang Hames
2531afb330 [MCJIT] Make sure we print the full 64-bit result of exprs in RuntimeDyldChecker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214227 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29 21:38:20 +00:00
Lang Hames
fbfb01496b [MCJIT] Make the RuntimeDyldChecker stub_addr builtin use file names rather than
full paths for its first argument.

This allows us to remove the annoying sed lines in the test cases, and write
direct references to file names in stub_addr calls (rather than <filename>
placeholders).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214211 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29 20:40:37 +00:00
Juergen Ributzka
6277ad6748 [RuntimeDyld][AArch64] Make encode/decodeAddend also work on big-endian hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214205 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29 19:57:15 +00:00
Juergen Ributzka
26dd3e6531 [RuntimeDyld][AArch64] Make encode/decodeAddend more typesafe by using the relocation enum type. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214204 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29 19:57:11 +00:00
Rafael Espindola
6e1b8585bc Remove dead code.
Every user has been switched to using EngineBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213871 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 16:02:28 +00:00
Saleem Abdulrasool
58ba15dbe6 ExecutionEngine: remove a stray semicolon
Detected via GCC 4.8 [-Wpedantic].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213776 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-23 18:09:28 +00:00
Tim Northover
9231148e69 AArch64: remove arm64 triple enumerator.
Having both Triple::arm64 and Triple::aarch64 is extremely confusing, and
invites bugs where only one is checked. In reality, the only legitimate
difference between the two (arm64 usually means iOS) is also present in the OS
part of the triple and that's what should be checked.

We still parse the "arm64" triple, just canonicalise it to Triple::aarch64, so
there aren't any LLVM-side test changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213743 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-23 12:32:47 +00:00
NAKAMURA Takumi
a63fc16e5f RuntimeDyldMachOAArch64.h: Fix a warning. [-Wunused-variable]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213710 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-23 00:17:44 +00:00
Lang Hames
8c3156eb82 [MCJIT] Make stub_addr functionality in RuntimeDyldChecker work in release mode.
There's no reason to restrict this particular piece of RuntimeDyldChecker
functionality to +Asserts builds.

This should fix failures in MachO_x86-64_PIC_relocations.s on release bots.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213708 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-22 23:50:51 +00:00
Lang Hames
f072ab78ee [MCJIT] Teach RuntimeDyldChecker to handle underscores at the start of symbols.
RuntimeDyldChecker had been testing isalpha(Expr[0]) to recognise symbol tokens,
and throwing unrecognized token errors when it hit symbols with leading
underscores. This fixes that.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213706 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-22 23:17:21 +00:00
Lang Hames
fa8abbd9be [MCJIT] Improve stub_addr file-not-found diagnostic to help track down a
buildbot failure.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213701 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-22 23:07:52 +00:00