Commit Graph

981 Commits

Author SHA1 Message Date
Reid Kleckner
75b1783b2b Add some flag exclusion tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186704 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-19 18:05:13 +00:00
Rafael Espindola
c9c9825c93 Add a unit test for checking that we respect the F_Binary flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186676 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-19 14:41:25 +00:00
Reid Kleckner
431b0a7646 [Support] Beef up and expose the response file parsing in llvm::cl
The plan is to use it for clang and lld.

Major behavior changes:
- We can now parse UTF-16 files that have a byte order mark.
- PR16209: Don't drop backslashes on the floor if they don't escape
  anything.

The actual parsing loop was based on code from Clang's driver.cpp,
although it's been rewritten to track its state with control flow rather
than state variables.

Reviewers: hans

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186587 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18 16:52:05 +00:00
Rafael Espindola
1c881d9d35 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186561 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18 03:29:51 +00:00
Rafael Espindola
60f18ad8a5 Fix a regression I introduced back in r178147.
We don't want cast and dyn_cast to work on temporaries. They don't extend
lifetime like a direct bind to a reference would, so they can introduce
hard to find bugs.

I added tests to make sure we don't regress this. Thanks to Eli Friedman for
noticing this and for his suggestions on how to test it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186559 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18 02:42:40 +00:00
Eli Friedman
763c066dca Handle '.' correctly in hex float literal parsing.
There were a couple of different loops that were not handling
'.' correctly in APFloat::convertFromHexadecimalString; these mistakes
could lead to assertion failures and incorrect rounding for overlong
hex float literals.

Fixes PR16643.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186539 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-17 22:17:29 +00:00
Rafael Espindola
c1b49b56d4 Add a wrapper for open.
This centralizes the handling of O_BINARY and opens the way for hiding more
differences (like how open behaves with directories).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 19:44:17 +00:00
Peter Collingbourne
71981ef040 Make SpecialCaseList match full strings, as documented, using anchors.
Differential Revision: http://llvm-reviews.chandlerc.com/D1149

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 17:56:07 +00:00
Reid Kleckner
06c847e83e [Support] Add a Unicode conversion wrapper from UTF16 to UTF8
This is to support parsing UTF16 response files in LLVM/lib/Option for
lld and clang.

Reviewers: hans

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186426 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 17:14:33 +00:00
NAKAMURA Takumi
334f8b9b37 unittests/Support: Add TimeValue.Win32FILETIME, corresponding to r186374.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186375 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 02:44:23 +00:00
NAKAMURA Takumi
e7f0393f6d Rename Support.TimeValue to TimeValue.time_t in unittests/Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186372 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 02:03:32 +00:00
Stephen Lin
60808c76b4 Convert Windows to Unix line endings, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186264 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 22:08:55 +00:00
Rafael Espindola
e39cad4b04 Attempt at fixing a mingw bot.
It is failing with

YAMLTest.cpp:38:   instantiated from here
YAMLTraits.h:226: error: 'llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping' is not a valid template argument for type 'void (*)(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' because function 'static void llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' has not external linkage

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186245 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 12:36:30 +00:00
Benjamin Kramer
459d7bf8f6 Sync SmallBitVector with BitVector. Add unit tests for the missing methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186123 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 21:59:16 +00:00
Peter Collingbourne
46e11c4c97 Implement categories for special case lists.
A special case list can now specify categories for specific globals,
which can be used to instruct an instrumentation pass to treat certain
functions or global variables in a specific way, such as by omitting
certain aspects of instrumentation while keeping others, or informing
the instrumentation pass that a specific uninstrumentable function
has certain semantics, thus allowing the pass to instrument callers
according to those semantics.

For example, AddressSanitizer now uses the "init" category instead of
global-init prefixes for globals whose initializers should not be
instrumented, but which in all other respects should be instrumented.

The motivating use case is DataFlowSanitizer, which will have a
number of different categories for uninstrumentable functions, such
as "functional" which specifies that a function has pure functional
semantics, or "discard" which indicates that a function's return
value should not be labelled.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185978 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 22:03:17 +00:00
Peter Collingbourne
c7087f8e42 Add some SpecialCaseList unit tests.
Differential Revision: http://llvm-reviews.chandlerc.com/D1091

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185977 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 22:03:12 +00:00
Sean Silva
845e196a52 Make BinaryRef output correctly in case of empty data.
Previously, it would simply output nothing, but it should output an
empty string `""`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185894 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 00:54:46 +00:00
Rafael Espindola
1cce797d32 We now always create files with the correct permissions. Simplify the interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185834 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 16:42:01 +00:00
Rafael Espindola
2c87a1705e Fix windows build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 22:32:33 +00:00
Rafael Espindola
1276b39613 Use sys::fs::createTemporaryFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185719 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 20:14:52 +00:00
Craig Topper
6227d5c690 Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-04 01:31:24 +00:00
David Blaikie
5186591cf5 Fix -Wsign-compare warning and remove windows-style line endings introduced by r185421
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185443 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 16:48:10 +00:00
Elena Demikhovsky
e5cb25f860 Fixed alignment of code sections in the JIT mode. Added a test to the JITMemoryManager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185421 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 12:24:22 +00:00
Michael Gottesman
b57770387a [APFloat] Ensure that we can properly parse strings that do not have null terminators.
rdar://14323230

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185397 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-01 23:54:08 +00:00
Matt Arsenault
76bf61fe07 Fix copypaste error in test.
Thename says it's an i32*, but it was actually creating another i8*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185239 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 23:24:10 +00:00
Daniel Malea
8bb9ec15c8 Replace UNIXy path with os-independent one in DebugIR unit test
- should resolve windows buildbot failure



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185232 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 22:17:57 +00:00
Jakob Stoklund Olesen
5d3257e37c Fix a bad overflow check pointed out by Ben.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185226 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:51:18 +00:00
Daniel Malea
9e638df937 Fix Windows/Darwin build error in DebugIR unit tests
- mistakenly used get_current_dir() linux function
- replaced with getcwd/_getcwd as appropriate for current platform



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185225 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:49:53 +00:00
Andrew Kaylor
40d8171e3e Revising the MCJIT ObjectCache interface to allow subclasses to avoid retaining references to returned objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185221 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:40:16 +00:00
Daniel Malea
5fa8186b8d 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185212 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 20:37:20 +00:00
Jakob Stoklund Olesen
d7648ff20f Add a division operator to BlockFrequency.
Allow a BlockFrequency to be divided by a non-zero BranchProbability
with saturating arithmetic. This will be used to compute the frequency
of a loop header given the probability of leaving the loop.

Our long division algorithm already saturates on overflow, so that was a
freebie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185184 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 18:23:42 +00:00
Rafael Espindola
08ddd12e44 Add a convenience createUniqueDirectory function.
There are a few valid situation where we care about the structure inside a
directory, but not about the directory itself. A simple example is for unit
testing directory traversal.

PathV1 had a function like this, add one to V2 and port existing users of the
created temp file and delete it hack to using it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185059 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 03:45:31 +00:00
Michael Gottesman
fb76ffd10b [APFloat] Added unittest for APFloat.divide that checks special cases, result categories, and result statuses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185050 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 00:42:00 +00:00
Michael Gottesman
bb77593765 Removed two logging printf statements from the APFloat tests... = /.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185045 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 00:00:45 +00:00
Michael Gottesman
2eda897c3c [APFloat] Added unittest for APFloat.multiply that checks special cases, result categories, and result status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 23:55:26 +00:00
Michael Gottesman
d7d88d969e [APFloat] Added unittest for APFloat.subtract that checks special cases, result categories, and result status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185043 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 23:55:23 +00:00
Michael Gottesman
a8f9364461 [APFloat] Removed debugging cruft that snuck in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184974 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 17:59:36 +00:00
Rafael Espindola
df0f525cc4 Remove unused includes.
llvm itself is now PathV1 clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184947 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 13:54:34 +00:00
Rafael Espindola
50188c1f42 Port GetMainExecutable over to PathV2.
I will remove the V1 version as soon as I change clang in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184914 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 05:01:35 +00:00
Michael Gottesman
567a1126fb [APFloat] Removed trailing whitespace from unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184715 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24 09:58:09 +00:00
Michael Gottesman
683069ffba [APFloat] Added a large unittest for APFloat.add that checks that special values are computed correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184714 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24 09:58:07 +00:00
Benjamin Kramer
b47aceaf06 Revert "BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability."
This reverts commit r184584. Breaks PPC selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184590 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 20:20:27 +00:00
Benjamin Kramer
93702a3b07 BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability.
Zero is used by BlockFrequencyInfo as a special "don't know" value. It also
causes a sink for frequencies as you can't ever get off a zero frequency with
more multiplies.

This recovers a 10% regression on MultiSource/Benchmarks/7zip. A zero frequency
was propagated into an inner loop causing excessive spilling.

PR16402.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184584 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 19:30:05 +00:00
Akira Hatanaka
deda39dbdf [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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184461 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 20:33:06 +00:00
Michael Gottesman
a1694e5784 [APFloat] Rename isIEEENormal => isNormal and remove old isNormal method.
The old isNormal is already functionally replaced by the method isFiniteNonZero
in r184350 and all references to said method were replaced in LLVM/clang in
r184356/134366.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184449 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:34:38 +00:00
Michael Gottesman
3781fbc29a [APFloat] Fix typo in test so we actually test if we handle denormals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:25:16 +00:00
Rafael Espindola
9aa3365426 Rename fs::GetUniqueID to fs::getUniqueID to match the style guide.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 15:06:35 +00:00
Michael Gottesman
4f71c1b2b9 [APFloat] Changed APFloat::isNormal => APFloat::isFiniteNonZero for all tests in unittests.
I forgot to to do this in r184356. The only references were in APFloatTest.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184366 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:53:45 +00:00
Aaron Ballman
4655485eb7 Modified the implementation of fs::GetUniqueID on Windows such that it actually finds a unique identifier for a file. Also adds unit tests for GetUniqueID.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184351 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:03:50 +00:00
Michael Gottesman
7032c883cd [APFloat] Added isFiniteNonZero predicate.
This is the first patch in a series of patches to rename isNormal =>
isFiniteNonZero and isIEEENormal => isNormal. In order to prevent careless
errors on my part the overall plan is:

1. Add the isFiniteNonZero predicate with tests. I can do this in a method
independent of isNormal. (This step is this patch).
2. Convert all references to isNormal with isFiniteNonZero. My plan is to
comment out isNormal locally and continually convert isNormal references =>
isFiniteNonZero until llvm/clang compiles.
3. Remove old isNormal and rename isIEEENormal to isNormal.
4. Look through all of said references from patch 2 and see if we can simplify
them by using the new isNormal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184350 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:00:17 +00:00
Bill Wendling
ae5758bac7 Add unit test to test a trivial verifier check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184338 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 19:26:44 +00:00
Rafael Espindola
675e0ac0bf Avoid using PathV1.h in Program.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183940 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-13 20:25:38 +00:00
Rafael Espindola
9f1d9fd196 Remove the program class.
It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just
those two functions and make Execute and Wait implementations details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183864 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 20:58:35 +00:00
Rafael Espindola
a11c3e2501 Move PathV2.h to Path.h
Most clients have already been moved from Path V1 to V2. The ones using V1
now include PathV1.h explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183801 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 22:21:28 +00:00
Aaron Ballman
0c79301807 sys::process::get_id() now returns the process ID instead of a process handle on Windows. Patch thanks to Kim Gräsman!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183621 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-08 20:29:03 +00:00
Benjamin Kramer
a77376dae1 BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183525 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 15:14:31 +00:00
Benjamin Kramer
597253da97 Optimize BitVector::all().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183521 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 14:14:38 +00:00
Michael Gottesman
b30718af1a IEEE-754R 5.7.2 General Operations is* operations (except for isCanonical).
Specifically the following work was done:

1. If the operation was not implemented, I implemented it.

2. If the operation was already implemented, I just moved its location
in the APFloat header into the IEEE-754R 5.7.2 section. If the name was
incorrect, I put in a comment giving the true IEEE-754R name.

Also unittests have been added for all of the functions which did not
already have a unittest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183179 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04 03:46:25 +00:00
Benjamin Kramer
44dbb749f0 Try to avoid "integer literal too big" warnings from older GCCs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-01 22:29:41 +00:00
Eric Christopher
769d24a60d Add support for adding the contents of a StringRef to the MD5 hash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183054 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 22:34:56 +00:00
Eric Christopher
cbb45aa123 Convert more unsigned char -> uint8_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183053 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 22:34:52 +00:00
Michael Gottesman
504e2da08c [APFloat] Added a unittest for APFloat::getZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183028 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 18:43:34 +00:00
Rafael Espindola
198f972077 Remove unused member.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182958 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 20:19:35 +00:00
Michael Gottesman
964722ca40 Implement IEEE-754R 2008 nextUp/nextDown functions in the guise of the function APFloat::next(bool nextDown).
rdar://13852078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182945 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 18:07:13 +00:00
Eric Christopher
12378d4872 Add a comment and some tests including the NULL byte.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182900 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 00:43:26 +00:00
Michael Gottesman
999c693694 Added a unittest for APFloat::getSmallestNormalized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182897 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 00:18:47 +00:00
Michael Gottesman
7d13d525bc Added code to the unittest for APFloat::getSmallest to double check that we consider the result to be denormal.
I additionally changed certain checks to use EXPECT_FALSE instead of a boolean
complement with EXPECT_TRUE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182896 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 00:18:44 +00:00
Michael Gottesman
3e8d356b81 Add a unittest for APFloat::getSmallest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182894 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29 23:58:29 +00:00
Michael Gottesman
a32edcfbc5 [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for use in APFloat IEEE-754R 2008 nextUp/nextDown function.
rdar://13852078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182801 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-28 19:50:20 +00:00
Eric Christopher
725e3d324b Add to testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182693 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 23:20:16 +00:00
Eric Christopher
f7306f224e 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182692 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 23:08:17 +00:00
Michael J. Spencer
3b77151a61 [Support] Remove Count{Leading,Trailing}Zeros_{32,64}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182690 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 22:58:37 +00:00
Michael J. Spencer
54c7482388 [Support][MathExtras] Fix literal type issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182679 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 22:19:05 +00:00
Michael J. Spencer
36fe3f2b56 [Support] Add type generic bit utilities to MathExtras.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182667 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 20:29:47 +00:00
Filip Pizlo
6cfed36338 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).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182448 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 02:46:43 +00:00
Filip Pizlo
1441bf7a41 Roll out r182407 and r182408 because they broke builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182409 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21 20:03:01 +00:00
Filip Pizlo
52755c472a 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).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182408 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21 20:00:56 +00:00
Ulrich Weigand
e3658a26b5 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182367 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21 10:30:59 +00:00
Bob Wilson
a4de3f2c85 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182233 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-20 06:13:09 +00:00
Renato Golin
4e4464bf74 SubArch support in MCJIT unittest
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182220 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-19 20:10:10 +00:00
Tim Northover
233a4d7124 AArch64: enable MCJIT unittests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182217 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-19 19:44:56 +00:00
David Tweed
abb38fe8de 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182085 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-17 10:01:46 +00:00
David Blaikie
453f4f0130 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181868 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-15 07:36:59 +00:00
Filip Pizlo
13a3cf1928 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181820 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-14 19:29:00 +00:00
Duncan Sands
8305acb200 Get the unittests compiling when building with cmake and the setting
-DLLVM_ENABLE_THREADS=false.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181788 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-14 13:29:16 +00:00
Shuxin Yang
4b6b53b0ce Fix a bug that APFloat::fusedMultiplyAdd() mistakenly evaluate "14.5f * -14.5f + 225.0f" to 225.0f.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181715 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-13 18:03:12 +00:00
Andrew Kaylor
50be71d182 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181614 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 17:58:41 +00:00
Rafael Espindola
e449654815 Remove exception handling support from the old JIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181354 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-07 20:53:59 +00:00
Andrew Trick
61e0172197 Implemented public interface for modifying registered (not positional or sink options) command line options at runtime.
Patch by Dan Liew!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 21:56:35 +00:00
Andrew Trick
b7ad33b719 Support command line option categories.
Patch by Dan Liew!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181253 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 21:56:23 +00:00
Ulrich Weigand
7207285e65 [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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181207 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 16:21:50 +00:00
Ulrich Weigand
1218bc4fe6 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181200 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 16:10:35 +00:00
Arnold Schwaighofer
46e7e6f39e Add missing PatternMatch.cpp to CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181147 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05 02:14:28 +00:00
Arnold Schwaighofer
e79d92c592 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181143 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05 01:54:46 +00:00
Filip Pizlo
0e1327e4aa 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180893 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-01 22:58:00 +00:00
Filip Pizlo
a4fa74e381 Wrap some lines to bring MCJITCAPITest into conformance with the 80 column limit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180839 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-01 06:46:59 +00:00
Reid Kleckner
2a83943855 Try to fix ProgramTest on FreeBSD
This seemed like the cleanest way to find the test executable.  Also fix
the file mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180770 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30 04:30:41 +00:00
Andrew Kaylor
d2755af8bd 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180720 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29 17:49:40 +00:00
Andrew Kaylor
1c489455ea Re-enabling MCJIT object caching with memory leak fixed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180575 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25 21:02:36 +00:00
Rafael Espindola
06fd5bf4ea Revert "Adding object caching support to MCJIT"
This reverts commit 07f0392313.

Looks like it broke the valgrind bot:

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180249 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25 03:47:41 +00:00