Commit Graph

864 Commits

Author SHA1 Message Date
Michael Gottesman 63e6d21c72 Add a unittest for APFloat::getSmallest.
llvm-svn: 182894
2013-05-29 23:58:29 +00:00
Michael Gottesman 9d406f4ec7 [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for use in APFloat IEEE-754R 2008 nextUp/nextDown function.
rdar://13852078

llvm-svn: 182801
2013-05-28 19:50:20 +00:00
Eric Christopher ba63e07f3a Add to testsuite.
llvm-svn: 182693
2013-05-24 23:20:16 +00:00
Eric Christopher fcee6f0abc ArrayRef-ize MD5 and clean up a few variable names.
Add a stringize method to make dumping a bit easier, and add a testcase
exercising a few different paths.

llvm-svn: 182692
2013-05-24 23:08:17 +00:00
Michael J. Spencer a8db3f6fa7 [Support] Remove Count{Leading,Trailing}Zeros_{32,64}.
llvm-svn: 182690
2013-05-24 22:58:37 +00:00
Michael J. Spencer 795ecd2c43 [Support][MathExtras] Fix literal type issues.
llvm-svn: 182679
2013-05-24 22:19:05 +00:00
Michael J. Spencer eb91eac9fb [Support] Add type generic bit utilities to MathExtras.h
llvm-svn: 182667
2013-05-24 20:29:47 +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
Duncan Sands b33790d898 Get the unittests compiling when building with cmake and the setting
-DLLVM_ENABLE_THREADS=false.

llvm-svn: 181788
2013-05-14 13:29:16 +00:00
Shuxin Yang bbddbacd2e Fix a bug that APFloat::fusedMultiplyAdd() mistakenly evaluate "14.5f * -14.5f + 225.0f" to 225.0f.
llvm-svn: 181715
2013-05-13 18:03:12 +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
Andrew Trick 7cb710d58c Implemented public interface for modifying registered (not positional or sink options) command line options at runtime.
Patch by Dan Liew!

llvm-svn: 181254
2013-05-06 21:56:35 +00:00
Andrew Trick 0537a98878 Support command line option categories.
Patch by Dan Liew!

llvm-svn: 181253
2013-05-06 21:56:23 +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
Arnold Schwaighofer eb4f2d63e9 Add missing PatternMatch.cpp to CMakeLists.txt
llvm-svn: 181147
2013-05-05 02:14:28 +00:00
Arnold Schwaighofer e972d03f64 PatternMatch: Matcher for (un)ordered floating point min/max
Add support for matching 'ordered' and 'unordered' floating point min/max
constructs.

In LLVM we can express min/max functions as a combination of compare and select.
We have support for matching such constructs for integers but not for floating
point. In floating point math there is no total order because of the presence of
'NaN'. Therefore, we have to be careful to preserve the original fcmp semantics
when interpreting floating point compare select combinations as a minimum or
maximum function. The resulting 'ordered/unordered' floating point maximum
function has to select the same value as the select/fcmp combination it is based
on.

 ordered_max(x,y)   = max(x,y) iff x and y are not NaN, y otherwise
 unordered_max(x,y) = max(x,y) iff x and y are not NaN, x otherwise
 ordered_min(x,y)   = min(x,y) iff x and y are not NaN, y otherwise
 unordered_min(x,y) = min(x,y) iff x and y are not NaN, x otherwise

This matches the behavior of the underlying select(fcmp(olt/ult/.., L, R), L, R)
construct.

Any code using this predicate has to preserve this semantics.

A follow-up patch will use this to implement floating point min/max reductions
in the vectorizer.

radar://13723044

llvm-svn: 181143
2013-05-05 01:54:46 +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
Reid Kleckner 95012aaa93 Try to fix ProgramTest on FreeBSD
This seemed like the cleanest way to find the test executable.  Also fix
the file mode.

llvm-svn: 180770
2013-04-30 04:30:41 +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
Reid Kleckner 206ddd0734 Don't forward declare environ on Windows
That seems to interact poorly with the environ and _environ macros
defined in MSVC's <stdlib.h>.

Also remove the incorrect comment about _NSGetEnviron().

llvm-svn: 180200
2013-04-24 17:50:30 +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
Reid Kleckner de0c26046d Un-revert the environ copy in ProgramTest after fixing it on OS X
This was r180041 and r180046, which was reverted in r180066.
Re-committing this should fix the dragonegg bootstrap, which I presume
needs LD_LIBRARY_PATH to be propagated to the child.

Tested on Linux, Windows, and Mac OS 10.6.

llvm-svn: 180099
2013-04-23 13:15:51 +00:00
Alexey Samsonov 28acf056e1 Add more guards around zlib-dependent code
llvm-svn: 180084
2013-04-23 08:57:30 +00:00
Alexey Samsonov 2fb337e77a Add basic zlib support to LLVM. This would allow to use compression/uncompression in selected LLVM tools.
llvm-svn: 180083
2013-04-23 08:28:39 +00:00
Michael Gottesman 6718a3b67d Revert "Add a missing reference on a std::vector<> out param"
Revert "[Support] Propagate the environment into the test child process"

This reverts commit r180046.
This reverts commit r180041.

These have broken buildbots for ~3 hours:

http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/763

llvm-svn: 180066
2013-04-22 22:51:55 +00:00
Reid Kleckner 7ff21d934e Add a missing reference on a std::vector<> out param
Pointed out by Eli.  The test passes for me either way, so I missed
this.

llvm-svn: 180046
2013-04-22 20:58:09 +00:00
Reid Kleckner 21a8c2f361 [Support] Propagate the environment into the test child process
Should fix the dragonegg bootstrap builder, which reasonably needs
LD_LIBRARY_PATH to be set.

llvm-svn: 180041
2013-04-22 20:23:41 +00:00
Reid Kleckner 74679a93b2 [Support] Fix argv string escape bug on Windows
Summary:
This is http://llvm.org/PR15802.  Backslashes preceding double quotes in
arguments must be escaped.  The interesting bit is that all other
backslashes should *not* be escaped, because the un-escaping logic is
only triggered by the presence of a double quote character.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 180035
2013-04-22 19:03:55 +00:00
Alexey Samsonov 045c6c5b40 Create a stub for DWARF parser unittests
Moves one DWARF-specific header to include/llvm/DebugInfo from lib/.
Add a short unittest for r179095.

llvm-svn: 179678
2013-04-17 08:29:02 +00:00
Benjamin Kramer eee73f5fcf Fix a disconcerting bug in Value::isUsedInBasicBlock, which gave wrong answers for blocks larger than 3 instrs.
Also add a unit test. PR15727.

llvm-svn: 179370
2013-04-12 08:33:11 +00:00
Joey Gouly 51f6fb9a18 Delete the functions F1 and F2 to appease the valgrind bot.
llvm-svn: 179239
2013-04-10 23:21:26 +00:00
Joey Gouly 81259294be Change CloneFunctionInto to always clone Argument attributes induvidually,
rather than checking if the source and destination have the same number of
arguments and copying the attributes over directly.

llvm-svn: 179169
2013-04-10 10:37:38 +00:00
Michael J. Spencer b8055cbc9d [Support][FileSystem] Fix identify_magic for big endian ELF.
llvm-svn: 178905
2013-04-05 20:10:04 +00:00