Commit Graph

155 Commits

Author SHA1 Message Date
Rafael Espindola 05b5a46ed8 Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."
This reverts commit r187248. It broke many bots.

llvm-svn: 187254
2013-07-26 22:13:57 +00:00
Bill Schmidt 419f7c2345 [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.
Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for
all PowerPC targets, whether 32- or 64-bit.  They will both implicitly
define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not
for 32-bit targets.  We cannot be sure that all other possible
compilers used to compile Clang/LLVM define both __ppc__ and
__powerpc__, for example, so it is best to check for both when relying
on either inside the Clang/LLVM code base.

This patch makes sure we always check for both variants.  In addition,
it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp.
(At least one of __ppc__ and __powerpc__ should always be defined when
compiling for a PowerPC target, no matter which compiler is used, so
testing for them is unnecessary.)

There are some places in the compiler that check for other variants,
like __POWERPC__ and _POWER, and I have left those in place.  There is
no need to add them elsewhere.  This seems to be in Apple-specific
code, and I won't take a chance on breaking it.

There is no intended change in behavior; thus, no test cases are
added.

llvm-svn: 187248
2013-07-26 21:39:15 +00:00
Akira Hatanaka 2e2362462f [mips] Use pristine object file while processing relocations.
Similar to ARM change r182800, dynamic linker will read bits/addends from
    the original object rather than from the object that might have been patched
    previously. For the purpose of relocations for MCJIT stubs on MIPS, we
    internally use otherwise unused MIPS relocations.
    
    The change also enables MCJIT unit tests for MIPS (EL/BE), and the following
    two tests now pass:
    
    - MCJITTest.return_global and
    - MCJITTest.multiple_functions.
    
    These issues have been tracked as Bug 16250.

    Patch by Petar Jovanovic.

llvm-svn: 187019
2013-07-24 01:58:40 +00:00
Stephen Lin 552c915e84 Convert Windows to Unix line endings, no functionality change.
llvm-svn: 186264
2013-07-13 22:08:55 +00:00
Craig Topper af0dea1347 Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
llvm-svn: 185606
2013-07-04 01:31:24 +00:00
David Blaikie 68a62d67f3 Fix -Wsign-compare warning and remove windows-style line endings introduced by r185421
llvm-svn: 185443
2013-07-02 16:48:10 +00:00
Elena Demikhovsky e4fd5ed056 Fixed alignment of code sections in the JIT mode. Added a test to the JITMemoryManager.
llvm-svn: 185421
2013-07-02 12:24:22 +00:00
Andrew Kaylor b595f53069 Revising the MCJIT ObjectCache interface to allow subclasses to avoid retaining references to returned objects
llvm-svn: 185221
2013-06-28 21:40:16 +00:00
Daniel Malea 4146b0404e Adding tests for DebugIR pass
- lit tests verify that each line of input LLVM IR gets a !dbg node and a
  corresponding entry of metadata that contains the line number 
- unit tests verify that DebugIR works as advertised in the interface
- refactored some useful IR generation functionality from the MCJIT unit tests
  so it can be reused

llvm-svn: 185212
2013-06-28 20:37:20 +00:00
Akira Hatanaka f47db38a01 [mips] Remove Triple:mips from SupportedArchs in MCJIT unittests
MIPS does not handle multiple relocations correctly, so two tests from the
unittests are expected to fail. These are:
 - MCJITTest.return_global and
 - MCJITTest.multiple_functions.

Until the multiple relocations are fixed, XFAIL the MCJIT unittests for
MIPS. This issue is tracked as Bug 16250.

Patch by Petar Jovanovic.

llvm-svn: 184461
2013-06-20 20:33:06 +00:00
Rafael Espindola 753dd09e23 Remove unused member.
llvm-svn: 182958
2013-05-30 20:19:35 +00:00
Filip Pizlo 3fdbaff3b9 Expose the RTDyldMemoryManager through the C API. This allows clients of
the C API to provide their own way of allocating JIT memory (both code 
and data) and finalizing memory permissions (page protections, cache 
flush).

llvm-svn: 182448
2013-05-22 02:46:43 +00:00
Filip Pizlo 5aefb1339c Roll out r182407 and r182408 because they broke builds.
llvm-svn: 182409
2013-05-21 20:03:01 +00:00
Filip Pizlo e1e3f7cc01 Expose the RTDyldMemoryManager through the C API. This allows clients of
the C API to provide their own way of allocating JIT memory (both code 
and data) and finalizing memory permissions (page protections, cache 
flush).

llvm-svn: 182408
2013-05-21 20:00:56 +00:00
Ulrich Weigand 7c81c7c66b Alternative fix for problem addressed in r182233
Revision r182233 partially reverted the change in r181200 to simplify
JIT unif test #ifdefs, because that change caused a link error on some
host operating systems where the export list requires the following
symbols to be defined:

 JITTest_AvailableExternallyFunction
 JITTest_AvailableExternallyGlobal

As discussed on the list, the commit reverts r182233 (and re-installs
the full r181200 change), and instead fixes the link problem by moving
those two symbols to the top of the file and unconditionally defining
them.

llvm-svn: 182367
2013-05-21 10:30:59 +00:00
Bob Wilson 29699c6365 Partially revert change in r181200 that tried to simplify JIT unit test #ifdefs.
The export list for this test requires the following symbols to be available:
  JITTest_AvailableExternallyFunction
  JITTest_AvailableExternallyGlobal
The change in r181200 commented them out, which caused the test to fail to
link, at least on Darwin. I have only reverted the change for arm, since I
can't test the other targets and since it sounds like that change was fixing
real problems for those other targets. It should be possible to rearrange the
code to keep those definitions outside the #ifdefs, but that should be done by
someone who can reproduce the problems that r181200 was trying to fix.

llvm-svn: 182233
2013-05-20 06:13:09 +00:00
Renato Golin cf6979d896 SubArch support in MCJIT unittest
llvm-svn: 182220
2013-05-19 20:10:10 +00:00
Tim Northover c17f3f75c5 AArch64: enable MCJIT unittests
llvm-svn: 182217
2013-05-19 19:44:56 +00:00
David Tweed 2e7efedd39 Minor changes to the MCJITTest unittests to use the correct API for finalizing
the JIT object (including XFAIL an ARM test that now needs fixing). Also renames
internal function for consistency.

llvm-svn: 182085
2013-05-17 10:01:46 +00:00
David Blaikie 041f1aa3e2 Use only explicit bool conversion operators
BitVector/SmallBitVector::reference::operator bool remain implicit since
they model more exactly a bool, rather than something else that can be
boolean tested.

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

One behavior change (YAMLParser) was made, though no test case is
included as I'm not sure how to reach that code path. Essentially any
comparison of llvm::yaml::document_iterators would be invalid if neither
iterator was at the end.

This helped uncover a couple of bugs in Clang - test cases provided for
those in a separate commit along with similar changes to `operator bool`
instances in Clang.

llvm-svn: 181868
2013-05-15 07:36:59 +00:00
Filip Pizlo 9bc53e8467 SectionMemoryManager shouldn't be a JITMemoryManager. Previously, the
EngineBuilder interface required a JITMemoryManager even if it was being used 
to construct an MCJIT. But the MCJIT actually wants a RTDyldMemoryManager. 
Consequently, the SectionMemoryManager, which is meant for MCJIT, derived 
from the JITMemoryManager and then stubbed out a bunch of JITMemoryManager 
methods that weren't relevant to the MCJIT.

This patch fixes the situation: it teaches the EngineBuilder that 
RTDyldMemoryManager is a supertype of JITMemoryManager, and that it's 
appropriate to pass a RTDyldMemoryManager instead of a JITMemoryManager if 
we're using the MCJIT. This allows us to remove the stub methods from 
SectionMemoryManager, and make SectionMemoryManager a direct subtype of 
RTDyldMemoryManager.

llvm-svn: 181820
2013-05-14 19:29:00 +00:00
Andrew Kaylor b3a25fa580 Fix MCJITCAPITest.cpp unit test on Windows.
MCJIT on Windows requires an explicit target triple with "-elf" appended to generate objects in ELF format.  The common test framework was setting up this triple, but it wasn't passed to the C API in the test.

llvm-svn: 181614
2013-05-10 17:58:41 +00:00
Rafael Espindola 9a383405a7 Remove exception handling support from the old JIT.
llvm-svn: 181354
2013-05-07 20:53:59 +00:00
Ulrich Weigand 80435baa14 [SystemZ] Set up JIT/MCJIT test cases
This patch adds the necessary configuration bits and #ifdef's to set up
the JIT/MCJIT test cases for SystemZ.  Like other recent targets, we do
fully support MCJIT, but do not support the old JIT at all.  Set up the
lit config files accordingly, and disable old-JIT unit tests.

Patch by Richard Sandiford.

llvm-svn: 181207
2013-05-06 16:21:50 +00:00
Ulrich Weigand f1c3004528 Simplify JIT unit test #ifdefs
Several platforms need to disable all old-JIT unit tests, since they only
support the new MCJIT.  This currently done via #ifdef'ing out those tests
in the ExecutionEngine/JIT/*.cpp files.  As those #ifdef's have grown
historically, we now have a number of repeated directives which -in total-
cover nearly the whole file, but leave a couple of helper functions out.
When building the tests with clang itself, those helper functions now
cause spurious "unused function" warnings.

To fix those warnings, and also to remove the duplicate #ifdef conditions
and make it easier to disable the tests for a new target, this patch
consolidates the #ifdefs into a single one per file, which covers all
the tests including all helper routines.

Tested on PowerPC and SystemZ.

llvm-svn: 181200
2013-05-06 16:10:35 +00:00
Filip Pizlo 85e0d2731b This exposes more MCJIT options via the C API:
CodeModel: It's now possible to create an MCJIT instance with any CodeModel you like.  Previously it was only possible to 
create an MCJIT that used CodeModel::JITDefault.

EnableFastISel: It's now possible to turn on the fast instruction selector.

The CodeModel option required some trickery.  The problem is that previously, we were ensuring future binary compatibility in 
the MCJITCompilerOptions by mandating that the user bzero's the options struct and passes the sizeof() that he saw; the 
bindings then bzero the remaining bits.  This works great but assumes that the bitwise zero equivalent of any field is a 
sensible default value.

But this is not the case for LLVMCodeModel, or its internal equivalent, llvm::CodeModel::Model.  In both of those, the default 
for a JIT is CodeModel::JITDefault (or LLVMCodeModelJITDefault), which is not bitwise zero.

Hence this change introduces LLVMInitializeMCJITCompilerOptions(), which will initialize the user's options struct with
defaults. The user will use this in the same way that they would have previously used memset() or bzero(). MCJITCAPITest.cpp
illustrates the change, as does the comment in ExecutionEngine.h.

llvm-svn: 180893
2013-05-01 22:58:00 +00:00
Filip Pizlo 547ea91b1d Wrap some lines to bring MCJITCAPITest into conformance with the 80 column limit.
llvm-svn: 180839
2013-05-01 06:46:59 +00:00
Andrew Kaylor 31be5eff33 Exposing MCJIT through C API
Re-submitting with fix for OCaml dependency problems (removing dependency on SectionMemoryManager when it isn't used).

Patch by Fili Pizlo

llvm-svn: 180720
2013-04-29 17:49:40 +00:00
Andrew Kaylor ced4e8ff6e Re-enabling MCJIT object caching with memory leak fixed
llvm-svn: 180575
2013-04-25 21:02:36 +00:00
Rafael Espindola 72780ed996 Revert "Adding object caching support to MCJIT"
This reverts commit 07f03923137a91e3cca5d7fc075a22f8c9baf33a.

Looks like it broke the valgrind bot:

http://lab.llvm.org:8011/builders/llvm-x86_64-linux-vg_leak/builds/649

llvm-svn: 180249
2013-04-25 03:47:41 +00:00
Rafael Espindola 837448bc19 Revert "Exposing MCJIT through C API"
This reverts commit 8c31b298149ca3c3f2bbd9e8aa9a01c4d91f3d74.

It looks like this commit broke some bots:

http://lab.llvm.org:8011/builders/llvm-ppc64-linux2/builds/5209

llvm-svn: 180248
2013-04-25 03:19:12 +00:00
Andrew Kaylor ee1e45796e Exposing MCJIT through C API
Patch by Filip Pizlo

llvm-svn: 180229
2013-04-24 23:33:53 +00:00
Andrew Kaylor 41c9f1150c Fixing cmake build for MCJIT unit tests
llvm-svn: 180150
2013-04-23 21:46:56 +00:00
Andrew Kaylor 1d2d8e0e84 Adding object caching support to MCJIT
llvm-svn: 180146
2013-04-23 21:26:38 +00:00
Jyotsna Verma b1180dc6d9 Enable JIT/MCJIT unit tests for targets with JIT support.
Change unittests/ExecutionEngine/Makefile to include Makefile.config before
TARGET_HAS_JIT flag is checked.

Fixes bug: http://llvm.org/bugs/show_bug.cgi?id=15669

llvm-svn: 178871
2013-04-05 14:26:16 +00:00
Rafael Espindola 5a2af525ab Explicitly add -Wl,--export-all-symbols on mingw/cygwin.
Looks like cmake on windows is not expanding ENABLE_EXPORTS to
-Wl,--export-all-symbols on mingw or cygwin, so add this back.

llvm-svn: 178730
2013-04-04 01:19:55 +00:00
Rafael Espindola 76f92277ca Don't export symbols in every binary on linux.
On freebsd this makes sure that symbols are exported on the binaries that need
them. The net result is that we should get symbols in the binaries that need
them on every platform.

On linux x86-64 this reduces the size of the bin directory from 262MB to 250MB.

Patch by Stephen Checkoway.

llvm-svn: 178725
2013-04-04 01:01:32 +00:00
Jyotsna Verma 8542abd762 Disable JIT/MCJIT tests in unittests/ExecutionEngine for the targets that don't support JIT.
llvm-svn: 178221
2013-03-28 03:38:29 +00:00
Andrew Kaylor 6d8776a514 Add support for source and line information to IntelJITEventListener for object emitted by MCJIT.
llvm-svn: 173712
2013-01-28 19:52:37 +00:00
Peter Collingbourne a51c6ed608 Introduce llvm::sys::getProcessTriple() function.
In r143502, we renamed getHostTriple() to getDefaultTargetTriple()
as part of work to allow the user to supply a different default
target triple at configure time.  This change also affected the JIT.
However, it is inappropriate to use the default target triple in the
JIT in most circumstances because this will not necessarily match
the current architecture used by the process, leading to illegal
instruction and other such errors at run time.

Introduce the getProcessTriple() function for use in the JIT and
its clients, and cause the JIT to use it.  On architectures with a
single bitness, the host and process triples are identical.  On other
architectures, the host triple represents the architecture of the
host CPU, while the process triple represents the architecture used
by the host CPU to interpret machine code within the current process.
For example, when executing 32-bit code on a 64-bit Linux machine,
the host triple may be 'x86_64-unknown-linux-gnu', while the process
triple may be 'i386-unknown-linux-gnu'.

This fixes JIT for the 32-on-64-bit (and vice versa) build on non-Apple
platforms.

Differential Revision: http://llvm-reviews.chandlerc.com/D254

llvm-svn: 172627
2013-01-16 17:27:22 +00:00
Eli Bendersky 738fbca845 Fix bug in exception table allocation (PR13678)
Patch by Michael Muller.

llvm-svn: 172214
2013-01-11 16:33:30 +00:00
Chandler Carruth 9fb823bbd4 Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

llvm-svn: 171366
2013-01-02 11:36:10 +00:00
Chandler Carruth 130cec21b9 Sort the #include lines for unittest/...
llvm-svn: 169250
2012-12-04 10:23:08 +00:00
Andrew Kaylor ab5ba51a6e Moving SectionMemoryManager into RuntimeDyld and adding unit tests for it.
The SectionMemoryManager now supports (and requires) applying section-specific page permissions.  Clients using this memory manager must call either MCJIT::finalizeObject() or SectionMemoryManager::applyPermissions() before executing JITed code.

See r168718 for changes from the previous implementation.

llvm-svn: 168721
2012-11-27 19:42:02 +00:00
Andrew Kaylor 3e0f1fb7b2 Implementing page permission setting in MCJIT unit test SectionMemoryManager.cpp
This commit is primarily here for the revision history.  I'm about to move the SectionMemoryManager into the RuntimeDyld library, but I wanted to check the changes in here so people could see the differences in the updated implementation.

llvm-svn: 168718
2012-11-27 19:00:17 +00:00
Andrew Kaylor a342cb9613 Interface changes to allow RuntimeDyld memory managers to set memory permissions after an object has been loaded.
llvm-svn: 168114
2012-11-15 23:50:01 +00:00
Amara Emerson 72b86293cb MCJIT unit test: add calls to ensure that instruction caches are properly invalidated before code execution.
llvm-svn: 167146
2012-10-31 17:44:16 +00:00
Amara Emerson eb7fb84a3e Port lli bug fix from r166920 to MCJIT unit test.
llvm-svn: 167145
2012-10-31 17:41:51 +00:00
Amara Emerson f270b82181 Commit access test.
llvm-svn: 167144
2012-10-31 17:35:12 +00:00
Ulrich Weigand 1caa6f9575 Disable all old-JIT unit tests on PowerPC.
These tests were all failing since the old JIT doesn't work
for PowerPC (any more), and there are no plans to attempt to
fix it again (instead, work focuses on MCJIT).

llvm-svn: 167133
2012-10-31 16:18:02 +00:00