Commit Graph

223 Commits

Author SHA1 Message Date
Vasileios Kalintiris
add8f51c26 Fix the C-API MCJIT test for 32-bit big endian machines.
Avoid using unions for storing the return value from
LLVMGetGlobalValueAddress() and LLVMGetFunctionAddress() and accessing it as
a pointer through another pointer member. This causes problems on 32-bit big
endian machines since the pointer gets the higher part of the return value of
the aforementioned functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 15:36:04 +00:00
Peter Zotov
7bfc61dfe3 [C API] Expose LLVMGetGlobalValueAddress and LLVMGetFunctionAddress.
Patch by Ramkumar Ramachandra <artagnon@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224720 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22 18:53:11 +00:00
Lang Hames
5ab94e7135 [MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223183 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 00:51:19 +00:00
Lang Hames
950c6482c6 [MCJIT] Make repeat calls to MCJIT::getPointerToFunction for declarations safe.
MCJIT::getPointerForFunction adds the resulting address to the global mapping.
This should be done via updateGlobalMapping rather than addGlobalMapping, since
the latter asserts if a mapping already exists.

MCJIT::getPointerToFunction is actually deprecated - hopefully we can remove it
(or more likely re-task it) entirely soon. In the mean time it should at least
work as advertised.

<rdar://problem/18727946>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220444 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-22 23:18:42 +00:00
Argyrios Kyrtzidis
7fae208c11 Adds 'override' to overriding methods. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218815 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 21:00:44 +00:00
Lang Hames
e2ef4419a8 [MCJIT] Turn the getSymbolAddress free function created in r218626 into a static
member of RTDyldMemoryManager (and rename to getSymbolAddressInProcess).

The functionality this provides is very specific to RTDyldMemoryManager, so it
makes sense to keep it in that class to avoid accidental re-use.

No functional change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218741 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 04:11:13 +00:00
David Blaikie
03b4667e14 Unit test r218187, changing RTDyldMemoryManager::getSymbolAddress's behavior favor mangled lookup over unmangled lookup.
The contract of this function seems problematic (fallback in either
direction seems like it could produce bugs in one client or another),
but here's some tests for its current behavior, at least. See the
commit/review thread of r218187 for more discussion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218626 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-29 21:25:13 +00:00
NAKAMURA Takumi
a6c580e834 Rework r218304, "ExecutionEngineTests: Call llvm_shutdown() on exit for ManagedStatic introduced in r218151."
r218304 caused crash on msvc builder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218308 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-23 14:41:02 +00:00
NAKAMURA Takumi
0c5fa4797c ExecutionEngineTests: Call llvm_shutdown() on exit for ManagedStatic introduced in r218151.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218304 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-23 13:49:51 +00:00
Eric Christopher
d5dd8ce2a5 Reinstate "Nuke the old JIT."
Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

This reinstates commits r215111, 215115, 215116, 215117, 215136.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216982 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 22:28:02 +00:00
Rafael Espindola
1a7f705fba Return a std::unique_ptr when creating a new MemoryBuffer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216583 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 20:03:13 +00:00
Rafael Espindola
fb1af0a48a Pass a std::unique_ptr<MemoryBuffer>& to getLazyBitcodeModule.
By taking a reference we can do the ownership transfer in one place instead of
expecting every caller to do it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216492 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 22:00:09 +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
Hans Wennborg
06de8a10d2 BumpPtrAllocator: don't accept 0 for the alignment parameter
It seems unnecessary to have to use an extra branch to check for this special case.

http://reviews.llvm.org/D4945

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216036 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 23:35:33 +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
9b29ff99c0 Modernize the .ll parsing interface.
* Use StringRef instead of std::string&
* Return a std::unique_ptr<Module> instead of taking an optional module to write
  to (was not really used).
* Use current comment style.
* Use current naming convention.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215989 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 16:58:54 +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
c73a086233 Simplify memory ownership with std::unique_ptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215567 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 18:59:01 +00:00
Rafael Espindola
d6448b21bf Simplify ownership with std::unique_ptr. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215566 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 18:49:01 +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
Saleem Abdulrasool
f96cd1aeb5 ADT: remove MinGW32 and Cygwin OSType enum
Remove the MinGW32 and Cygwin types from the OSType enumeration.  These values
are represented via environments of Windows.  It is a source of confusion and
needlessly clutters the code.  The cost of doing this is that we must sink the
check for them into the normalization code path along with the spelling.

Addresses PR20592.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215303 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-09 23:12:20 +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
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
NAKAMURA Takumi
a84c1fb652 [CMake] Update libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212920 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 05:01:53 +00:00
Alp Toker
8dd8d5c2b2 Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211814 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 22:52:05 +00:00
Alp Toker
2559070422 Introduce a string_ostream string builder facilty
string_ostream is a safe and efficient string builder that combines opaque
stack storage with a built-in ostream interface.

small_string_ostream<bytes> additionally permits an explicit stack storage size
other than the default 128 bytes to be provided. Beyond that, storage is
transferred to the heap.

This convenient class can be used in most places an
std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair
would previously have been used, in order to guarantee consistent access
without byte truncation.

The patch also converts much of LLVM to use the new facility. These changes
include several probable bug fixes for truncated output, a programming error
that's no longer possible with the new interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211749 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 00:00:48 +00:00
Rafael Espindola
250305156a Remove the last uses of 'using std::error_code'
This finishes the transition to std::error_code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210877 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-13 03:20:08 +00:00
Rafael Espindola
5c792faa0e Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210835 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 21:46:39 +00:00
Craig Topper
b177041dfa [C++11] Use 'nullptr'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210442 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-08 22:29:17 +00:00
Alp Toker
11e082eb54 Fix build when no native target is enabled
The JITTests and MCJITTests unit test targets require a native arch with JIT
support, otherwise fail to link.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210411 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-08 02:45:56 +00:00
Juergen Ributzka
9bc1b73c9e Add C API for thread yielding callback.
Sometimes a LLVM compilation may take more time then a client would like to
wait for. The problem is that it is not possible to safely suspend the LLVM
thread from the outside. When the timing is bad it might be possible that the
LLVM thread holds a global mutex and this would block any progress in any other
thread.

This commit adds a new yield callback function that can be registered with a
context. LLVM will try to yield by calling this callback function, but there is
no guaranteed frequency. LLVM will only do so if it can guarantee that
suspending the thread won't block any forward progress in other LLVM contexts
in the same process.

Once the client receives the call back it can suspend the thread safely and
resume it at another time.

Related to <rdar://problem/16728690>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208945 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-16 02:33:15 +00:00
Juergen Ributzka
218bad2bc5 Revert "[PM] Add pass run listeners to the pass manager."
Revert the current implementation and C API. New implementation and C APIs are
in the works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208904 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15 17:49:20 +00:00
Rafael Espindola
b507e6601d Replace a virtual with an override.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208242 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 19:52:32 +00:00
Juergen Ributzka
4e0cc51d79 [PM] Add pass run listeners to the pass manager.
This commit provides the necessary C/C++ APIs and infastructure to enable fine-
grain progress report and safe suspension points after each pass in the pass
manager.

Clients can provide a callback function to the pass manager to call after each
pass. This can be used in a variety of ways (progress report, dumping of IR
between passes, safe suspension of threads, etc).

The run listener list is maintained in the LLVMContext, which allows a multi-
threaded client to be only informed for it's own thread. This of course assumes
that the client created a LLVMContext for each thread.

This fixes <rdar://problem/16728690>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207430 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-28 18:19:25 +00:00
Elena Demikhovsky
ec8891fdde Changes in IntelJITEventListener - By Arch Robinson
- take->release: LLVM has moved to C++11.  MockWrapper became an instance of unique_ptr.

   - method symbol_iterator::increment disappeared recently, in this revision:

     r200442 | rafael | 2014-01-29 20:49:50 -0600 (Wed, 29 Jan 2014) | 9 lines

Simplify the handling of iterators in ObjectFile.

None of the object file formats reported error on iterator increment. In
retrospect, that is not too surprising: no object format stores symbols or
sections in a linked list or other structure that requires chasing pointers.
As a consequence, all error checking can be done on begin() and end().

This reduces the text segment of bin/llvm-readobj in my machine from 521233 to
518526 bytes.

My change mimics the change that the revision made to lib/DebugInfo/DWARFContext.cpp .

    - const_cast: Shut up a warning from gcc.

I ran unittests/ExecutionEngine/JIT/Debug+Asserts/JITTests to make sure it worked.

- Arch



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205689 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-06 11:08:33 +00:00
Saleem Abdulrasool
442c61dd9a MCJIT: ensure that cygwin is identified properly
Cygwin is now a proper environment rather than an OS.  This updates the MCJIT
tests to avoid execution on Cygwin.  This fixes native cygwin tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205266 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 23:42:23 +00:00
NAKAMURA Takumi
2ab1641041 MultiJITTest.cpp: Tweak getPointerToNamedFunction() to be aware of also Windows x64.
In import thunk, jmp is:
  - On x86, 0xFF 0x25 [disp32].
  - On x64, 0xFF 0x25 [pcrel32].

See also my r144178.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203523 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 00:34:38 +00:00
Ahmed Charles
f4ccd11075 Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 05:51:42 +00:00
Chandler Carruth
f4ec8bfaec [Layering] Move DebugInfo.h into the IR library where its implementation
already lives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203046 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 00:46:21 +00:00
Chandler Carruth
7cf9764966 [Layering] Move DIBuilder.h into the IR library where its implementation
already lives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203038 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 00:22:06 +00:00
Ahmed Charles
1a6eca243f [C++11] Replace OwningPtr::take() with OwningPtr::release().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202957 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 10:19:29 +00:00
Chandler Carruth
1decd56b8d [cleanup] Re-sort all the includes with utils/sort_includes.py.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202811 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 10:07:28 +00:00
Renato Golin
8eb76420cd Disable old JIT unittests for AARch64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202127 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25 09:31:05 +00:00
Andrew Trick
e5f1c6d3da Disable an MCJIT test on older Darwins until we have a better interface.
See
<rdar://16149106> [MCJIT] provide a platform-independent way to communicate callee-save frame info.
<rdar://16149279> [MCJIT] get the host OS version from a runtime check, not a configure-time check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202082 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 21:37:30 +00:00
Filip Pizlo
b3cb707f93 This test was failing on non-X86-64 platforms because stackmaps only work on X86-64.
Disable it on non-X86-64 platforms and add a comment.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201838 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 03:17:31 +00:00
Filip Pizlo
23ffb3ea10 Stackmaps are used for OSR exits, which is a custom kind of unwinding. Hence, they
should not be marked nounwind.

Marking them nounwind caused crashes in the WebKit FTL JIT, because if we enable 
sufficient optimizations, LLVM starts eliding compact_unwind sections (or any unwind 
data for that matter), making deoptimization via stackmaps impossible.

This changes the stackmap intrinsic to be may-throw, adds a test for exactly the 
sympton that WebKit saw, and fixes TableGen to handle un-attributed intrinsics.

Thanks to atrick and philipreames for reviewing this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201826 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-20 23:57:31 +00:00
Lang Hames
76554f3418 Remove tautological test line (unsigneds are always >=0).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201451 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-15 00:45:14 +00:00
Lang Hames
81c7e1871f Fix misleading comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201279 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 00:31:14 +00:00
Lang Hames
04510e6c80 The new MCJIT C-API unit test is generating objects without constant data
sections, at least on MachO. Relax expectations to keep the bots green while I
investigate. 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201277 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 00:16:36 +00:00