Commit Graph

1340 Commits

Author SHA1 Message Date
Chandler Carruth
63ed439ab5 [LCG] Switch the SCC's parent iterators to be value iterators rather
than pointer iterators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207086 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-24 07:48:18 +00:00
Chandler Carruth
beee61d3e6 [ADT] Add a generic iterator utility for adapting iterators much like
Boost's iterator_adaptor, and a specific adaptor which iterates over
pointees when wrapped around an iterator over pointers.

This is the result of a long discussion on IRC with Duncan Smith, Dave
Blaikie, Richard Smith, and myself. Essentially, I could use some subset
of the iterator facade facilities often used from Boost, and everyone
seemed interested in having the functionality in a reasonably generic
form. I've tried to strike a balance between the pragmatism and the
established Boost design. The primary differences are:

1) Delegating to the standard iterator interface names rather than
   special names that then make up a second iterator-like API.
2) Using the name 'pointee_iterator' which seems more clear than
   'indirect_iterator'. The whole business of calling the '*p' operation
   'pointer indirection' in the standard is ... quite confusing. And
   'dereference' is no better of a term for moving from a pointer to
   a reference.

Hoping Duncan, and others continue to provide comments on this until
we've got a nice, minimal abstraction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207069 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-24 03:31:23 +00:00
Chandler Carruth
9f2150c046 [LCG] Normalize the post-order SCC iterator to just iterate over the SCC
values rather than having pointers in weird places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207053 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 23:51:07 +00:00
Chandler Carruth
306d5ba092 [LCG] Switch the primary node iterator to be a *much* more normal C++
iterator, returning a Node by reference on dereference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207048 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 23:34:48 +00:00
Chandler Carruth
31d2477c68 [LCG] Switch the SCC lookup to be in terms of call graph nodes rather
than functions. So far, this access pattern is *much* more common. It
seems likely that any user of this interface is going to have nodes at
the point that they are querying the SCCs.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207045 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 23:12:06 +00:00
Chandler Carruth
e42618b4bc [LCG] Add the first round of mutation support to the lazy call graph.
This implements the core functionality necessary to remove an edge from
the call graph and correctly update both the basic graph and the SCC
structure. As part of that it has to run a tiny (in number of nodes)
Tarjan-style DFS walk of an SCC being mutated to compute newly formed
SCCs, etc.

This is *very rough* and a WIP. I have a bunch of FIXMEs for code
cleanup that will reduce the boilerplate in this change substantially.
I also have a bunch of simplifications to various parts of both
algorithms that I want to make, but first I'd like to have a more
holistic picture. Ideally, I'd also like more testing. I'll probably add
quite a few more unit tests as I go here to cover the various different
aspects and corner cases of removing edges from the graph.

Still, this is, so far, successfully updating the SCC graph in-place
without disrupting the identity established for the existing SCCs even
when we do challenging things like delete the critical edge that made an
SCC cycle at all and have to reform things as a tree of smaller SCCs.
Getting this to work is really critical for the new pass manager as it
is going to associate significant state with the SCC instance and needs
it to be stable. That is also the motivation behind the return of the
newly formed SCCs. Eventually, I'll wire this all the way up to the
public API so that the pass manager can use it to correctly re-enqueue
newly formed SCCs into a fresh postorder traversal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206968 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 11:03:03 +00:00
Chandler Carruth
b9619110af [LCG] Implement Tarjan's algorithm correctly this time. We have to walk
up the stack finishing the exploration of each entries children before
we're finished in addition to accounting for their low-links. Added
a unittest that really hammers home the need for this with interlocking
cycles that would each appear distinct otherwise and crash or compute
the wrong result. As part of this, nuke a stale fixme and bring the rest
of the implementation still more closely in line with the original
algorithm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206966 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 10:31:17 +00:00
Chandler Carruth
07c2241e45 [LCG] Add a unittest for the LazyCallGraph. I had a weak moment and
resisted this for too long. Just with the basic testing here I was able
to exercise the analysis in more detail and sift out both type signature
bugs in the API and a bug in the DFS numbering. All of these are fixed
here as well.

The unittests will be much more important for the mutation support where
it is necessary to craft minimal mutations and then inspect the state of
the graph. There is just no way to do that with a standard FileCheck
test. However, unittesting these kinds of analyses is really quite easy,
especially as they're designed with the new pass manager where there is
essentially no infrastructure required to rig up the core logic and
exercise it at an API level.

As a minor aside about the DFS numbering bug, the DFS numbering used in
LCG is a bit unusual. Rather than numbering from 0, we number from 1,
and use 0 as the sentinel "unvisited" state. Other implementations often
use '-1' for this, but I find it easier to deal with 0 and it shouldn't
make any real difference provided someone doesn't write silly bugs like
forgetting to actually initialize the DFS numbering. Oops. ;]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206954 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 08:08:49 +00:00
Quentin Colombet
43285b394e This reverts r206828 until David has time to figure out that is going on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206839 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-22 02:17:11 +00:00
David Blaikie
6d73b8016e Use unique_ptr to handle ownership of Value*s in Cloning unit tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206828 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 23:47:47 +00:00
Chandler Carruth
c95ce87c23 Make the User::value_op_iterator a random access iterator. I had written
this code ages ago and lost track of it. Seems worth doing though --
this thing can get called from places that would benefit from knowing
that std::distance is O(1). Also add a very fledgeling unittest for
Users and make sure various aspects of this seem to work reasonably.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206453 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 09:07:50 +00:00
Chandler Carruth
d66a3fe106 [Allocator] Make BumpPtrAllocator movable and move assignable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206372 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 10:48:27 +00:00
Duncan P. N. Exon Smith
32791b02fa verify-di: Implement DebugInfoVerifier
Implement DebugInfoVerifier, which steals verification relying on
DebugInfoFinder from Verifier.

  - Adds LegacyDebugInfoVerifierPassPass, a ModulePass which wraps
    DebugInfoVerifier.  Uses -verify-di command-line flag.

  - Change verifyModule() to invoke DebugInfoVerifier as well as
    Verifier.

  - Add a call to createDebugInfoVerifierPass() wherever there was a
    call to createVerifierPass().

This implementation as a module pass should sidestep efficiency issues,
allowing us to turn debug info verification back on.

<rdar://problem/15500563>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206300 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 16:27:38 +00:00
Chandler Carruth
b9a99d4593 [Allocator] Finally, finish nuking the redundant code that led me here
by removing the MallocSlabAllocator entirely and just using
MallocAllocator directly. This makes all off these allocators expose and
utilize the same core interface.

The only ugly part of this is that it exposes the fact that the JIT
allocator has no real handling of alignment, any more than the malloc
allocator does. =/ It would be nice to fix both of these to support
alignments, and then to leverage that in the BumpPtrAllocator to do less
over allocation in order to manually align pointers. But, that's another
patch for another day. This patch has no functional impact, it just
removes the somewhat meaningless wrapper around MallocAllocator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206267 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 09:44:09 +00:00
Chandler Carruth
17f9c2e35b [Allocator] Make the underlying allocator a template instead of an
abstract interface. The only user of this functionality is the JIT
memory manager and it is quite happy to have a custom type here. This
removes a virtual function call and a lot of unnecessary abstraction
from the common case where this is just a *very* thin vaneer around
a call to malloc.

Hopefully still no functionality changed here. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206149 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 05:11:27 +00:00
Chandler Carruth
cb7ead25c2 [Allocator] Switch the BumpPtrAllocator to use a vector of pointers to
slabs rather than embedding a singly linked list in the slabs
themselves. This has a few advantages:

- Better utilization of the slab's memory by not wasting 16-bytes at the
  front.
- Simpler allocation strategy by not having a struct packed at the
  front.
- Avoids paging every allocated slab in just to traverse them for
  deallocating or dumping stats.

The latter is the really nice part. Folks have complained from time to
time bitterly that tearing down a BumpPtrAllocator, even if it doesn't
run any destructors, pages in all of the memory allocated. Now it won't.
=]

Also resolves a FIXME with the scaling of the slab sizes. The scaling
now disregards specially sized slabs for allocations larger than the
threshold.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206147 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 03:55:11 +00:00
Benjamin Kramer
15c435a367 Retire llvm::array_endof in favor of non-member std::end.
While there make array_lengthof constexpr if we have support for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206112 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-12 16:15:53 +00:00
Benjamin Kramer
479151ab7f Move MDBuilder's methods out of line.
Making them inline was a historical accident, they're neither hot nor
templated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206109 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-12 14:26:59 +00:00
David Majnemer
878657074a YAMLIO: Allow scalars to dictate quotation rules
Introduce ScalarTraits::mustQuote which determines whether or not a
StringRef needs quoting before it is acceptable to output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205955 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-10 07:37:33 +00:00
David Majnemer
fb065a1669 Revert "Revert "YAMLIO: Encode ambiguous hex strings explicitly""
Don't quote octal compatible strings if they are only two wide, they
aren't ambiguous.

This reverts commit r205857 which reverted r205857.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205914 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-09 17:04:27 +00:00
Filipe Cabecinhas
c657a09ea6 Revert "YAMLIO: Encode ambiguous hex strings explicitly"
This reverts commit r205839.

It broke several tests in lld.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205857 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-09 14:35:17 +00:00
David Majnemer
7184f49f40 YAMLIO: Encode ambiguous hex strings explicitly
YAMLIO would turn a BinaryRef into the string 0000000004000000.
However, the leading zero causes parsers to interpret it as being an
octal number instead of a hexadecimal one.

Instead, escape such strings as needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205839 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-09 07:56:27 +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
David Blaikie
b4074c010b Simplify compression API by compressing into a SmallVector rather than a MemoryBuffer
This is the other half of r205676.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205677 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-05 21:53:04 +00:00
David Blaikie
b206103abc Simplify compression API by decompressing into a SmallVector rather than a MemoryBuffer
This avoids an extra copy during decompression and avoids the use of
MemoryBuffer which is a weirdly esoteric device that includes unrelated
concepts like "file name" (its rather generic name is a bit misleading).

Similar refactoring of zlib::compress coming up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205676 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-05 21:26:44 +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
Saleem Abdulrasool
bd5fac585e Support: generalise object type handling for Windows
This generalises the object file type parsing to all Windows environments.  This
is used by cygwin as well as MSVC environments for MCJIT.  This also makes the
triple more similar to Chandler's suggestion of a separate field for the object
file format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205219 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 16:34:41 +00:00
Chandler Carruth
368a977298 [Allocator] Lift the slab size and size threshold into template
parameters rather than runtime parameters.

There is only one user of these parameters and they are compile time for
that user. Making these compile time seems to better reflect their
intended usage as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205143 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-30 12:07:07 +00:00
Chandler Carruth
0331a894cd [Allocator] Simplify unittests by using the default size parameters in
more places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205141 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-30 11:36:32 +00:00
Tim Northover
e69ff5b01d ARM64: remove -m32/-m64 mapping with ARM.
This is causing the ARM build-bots to fail since they only include
the ARM backend and can't create an ARM64 target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205132 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-30 07:25:23 +00:00
Saleem Abdulrasool
b52cb5e0db Support: correct Windows normalisation
If the environment is unknown and no object file is provided, then assume an
"MSVC" environment, otherwise, set the environment to the object file format.

In the case that we have a known environment but a non-native file format for
Windows (COFF) which is used for MCJIT, then append the custom file format to
the triple as an additional component.

This fixes the MCJIT tests on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205130 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-30 07:19:31 +00:00
Tim Northover
7b837d8c75 ARM64: initial backend import
This adds a second implementation of the AArch64 architecture to LLVM,
accessible in parallel via the "arm64" triple. The plan over the
coming weeks & months is to merge the two into a single backend,
during which time thorough code review should naturally occur.

Everything will be easier with the target in-tree though, hence this
commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205090 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-29 10:18:08 +00:00
Saleem Abdulrasool
2ea701e67a Canonicalise Windows target triple spellings
Construct a uniform Windows target triple nomenclature which is congruent to the
Linux counterpart.  The old triples are normalised to the new canonical form.
This cleans up the long-standing issue of odd naming for various Windows
environments.

There are four different environments on Windows:

MSVC: The MS ABI, MSVCRT environment as defined by Microsoft
GNU: The MinGW32/MinGW32-W64 environment which uses MSVCRT and auxiliary libraries
Itanium: The MSVCRT environment + libc++ built with Itanium ABI
Cygnus: The Cygwin environment which uses custom libraries for everything

The following spellings are now written as:

i686-pc-win32 => i686-pc-windows-msvc
i686-pc-mingw32 => i686-pc-windows-gnu
i686-pc-cygwin => i686-pc-windows-cygnus

This should be sufficiently flexible to allow us to target other windows
environments in the future as necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204977 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 22:50:05 +00:00
NAKAMURA Takumi
c112990260 Untabify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204916 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 11:38:28 +00:00
NAKAMURA Takumi
2b8b9031f4 SmallVector<3> may be used here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204915 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 11:33:11 +00:00
NAKAMURA Takumi
da56c39758 IRTests/InstructionsTest.cpp: Avoid initializer list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204914 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 11:32:41 +00:00
Reid Kleckner
891835ae0f CloneFunction: Clone all attributes, including the CC
Summary:
Tested with a unit test because we don't appear to have any transforms
that use this other than ASan, I think.

Fixes PR17935.

Reviewers: nicholas

CC: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204866 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 22:26:35 +00:00
Eli Bendersky
d8f4993cc7 Add a unit test for Invoke iteration, similar to the one for Call
The tests are refactored to use the same fixture.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204860 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 21:46:24 +00:00
Eli Bendersky
927eb31eb4 Fix bot breakage in InstructionsTest.
Makes sure the Call dies before the Function



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204856 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 21:11:34 +00:00
Eli Bendersky
1003e8fbfa Fix problem with r204836
In CallInst, op_end() points at the callee, which we don't want to iterate over
when just iterating over arguments. Now take this into account when returning
a iterator_range from arg_operands. Similar reasoning for InvokeInst.

Also adds a unit test to verify this actually works as expected.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204851 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 20:41:15 +00:00
Rafael Espindola
2cf1cdfb4e Fix these tests on windows.
It is impossible to create a hard link to a non existing file, so create a
dummy file, create the link an delete the dummy file.

On windows one cannot remove the current directory, so chdir first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204719 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 13:19:03 +00:00
NAKAMURA Takumi
12da52f917 SupportTests.LockFileManagerTest: Add assertions for Win32.
- create_link doesn't work for nonexistent file.
  - remove cannot remove working directory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204579 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-23 23:55:57 +00:00
NAKAMURA Takumi
4696def45d Suppress SupportTests.LockFileManagerTest on win32 for investigating.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204533 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-22 00:27:17 +00:00
Argyrios Kyrtzidis
fb307be5af [Support] Make sure LockFileManager works correctly with relative paths.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204426 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 02:31:56 +00:00
Argyrios Kyrtzidis
2c8cd9a0ba [Support] Make sure sys::fs::remove can remove symbolic links and make sure LockFileManager can handle a symbolic link that points nowhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204422 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 01:25:37 +00:00
David Majnemer
8bd2799a2d Object: Don't double-escape empty hexdata
We would emit a pair of double quotes inside a pair of single quotes.
Just use a pair of single quotes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204312 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 06:28:52 +00:00
NAKAMURA Takumi
99ffa5c0f4 DebugIRTests: Fixup for r204130.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204132 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 09:58:28 +00:00
Alon Mishne
086494730d [C++11] Change DebugInfoFinder to use range-based loops
Also changes the iterators to return actual DI type over MDNode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204130 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 09:41:07 +00:00
Chandler Carruth
2d74092f5f [PM] As was pointed out in review, I need to define a custom swap in
order to use the single assignment. That's probably worth doing for
a lot of these types anyways as they may have non-trivial moves and so
getting copy elision in more places seems worthwhile.

I've tried to add some tests that actually catch this mistake, and one
of the types is now well tested but the others' tests still fail to
catch this. I'll keep working on tests, but this gets the core pattern
right.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203780 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 10:42:18 +00:00
Justin Bogner
e519c39eaa unittests: Fix -Werror build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203679 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 17:00:52 +00:00
Eli Bendersky
8a9f2fd7f5 Add parens around && clauses in a || to appease the compiler.
Otherwise gcc 4.8.2 generates a warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203671 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 16:14:53 +00:00
Alon Mishne
e74c0bf111 Cloning a function now also clones its debug metadata if 'ModuleLevelChanges' is true.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203662 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 14:42:51 +00:00
Saleem Abdulrasool
404a72729b support: add a utility function to normalise path separators
Add a utility function to convert the Windows path separator to Unix style path
separators.  This is used by a subsequent change in clang to enable the use of
Windows SDK headers on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203611 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 22:05:42 +00:00
Rafael Espindola
8acff70de1 Cleanup the interface for creating soft or hard links.
Before this patch the unix code for creating hardlinks was unused. The code
for creating symbolic links was implemented in lib/Support/LockFileManager.cpp
and the code for creating hard links in lib/Support/*/Path.inc.

The only use we have for these is in LockFileManager.cpp and it can use both
soft and hard links. Just have a create_link function that creates one or the
other depending on the platform.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203596 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 18:40:24 +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
NAKAMURA Takumi
804ff19273 ADT/PointerIntPairTest.cpp: Appease msc17.
- Use constructor instead of initializer list.
  - Disable ManyUnusedBits for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203436 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-10 02:33:17 +00:00
Chandler Carruth
1b497a9fc4 [PM] While I'm here, fix a few other clang-format issues. Pulls some
lines under 80-columns, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203434 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-10 02:12:14 +00:00
Chandler Carruth
f328eebf32 [C++11] Now that we have C++11 and I've replaced the use of this
horrible smart pointer by std::unique_ptr and strict move semantics, rip
this out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203392 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 11:51:11 +00:00
Chandler Carruth
15903b7dc5 [PM] Switch new pass manager from polymorphic_ptr to unique_ptr now that
it is available. Also make the move semantics sufficiently correct to
tolerate move-only passes, as the PassManagers *are* move-only passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203391 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 11:49:53 +00:00
Ahmed Charles
fee1963538 [C++11] Add llvm::make_unique, according to N3656.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203387 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 11:20:17 +00:00
David Blaikie
3e07f8a03d Revert "Clean up SmallString a bit"
This reverts commit r203374.

Ambiguities in assign... oh well. I'm just going to revert this and
probably not try to recommit it as it's not terribly important.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203375 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 06:22:58 +00:00
David Blaikie
ed8ba2e58e Clean up SmallString a bit
Move a common utility (assign(iter, iter)) into SmallVector (some of the
others could be moved there too, but this one seemed particularly
generic) and replace repetitions overrides with using directives.

And simplify SmallVector::assign(num, element) while I'm here rather
than thrashing these files (that cause everyone to rebuild) again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203374 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 06:17:01 +00:00
Ahmed Charles
783b2222f8 Fix 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203346 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-08 12:51:31 +00:00
Eli Bendersky
2195ed675a Fix EXPECT_* to not produce a compile warning.
EXPECT_TRUE/FALSE is also more idiomatic for booleans than EXPECT_EQ


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203284 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 21:04:24 +00:00
Jordan Rose
bc3b24269e [ADT] Update PointerIntPair to handle pointer types with more than 31 bits free.
Previously, the assertions in PointerIntPair would try to calculate the value
(1 << NumLowBitsAvailable); the inferred type here is 'int', so if there were
more than 31 bits available we'd get a shift overflow.

Also, add a rudimentary unit test file for PointerIntPair.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203273 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 19:19:56 +00:00
Benjamin Kramer
1dd31112ff [C++11] Now that the users are gone, rip out the duplicated traits from type_traits.h
Simplify the remaining ones a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203249 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 15:54:23 +00:00
Benjamin Kramer
c1dafe8dc3 [C++11] Replace LLVM-style type traits with C++11 standard ones.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203242 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 14:42:25 +00:00
Saleem Abdulrasool
4eb048a6f1 Support: split object format out of environment
This is a preliminary setup change to support a renaming of Windows target
triples.  Split the object file format information out of the environment into a
separate entity.  Unfortunately, file format was previously treated as an
environment with an unknown OS.  This is most obvious in the ARM subtarget where
the handling for macho on an arbitrary platform switches to AAPCS rather than
APCS (as per Apple's needs).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203160 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 20:47:11 +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
8a67f12a3d [Layering] Sink Linker.h into a Linker subdirectory to make it
consistent with every other sub-library header in LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203065 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 03:42:23 +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
Ben Langmuir
82d372e12b Fix an inconsistency in treatment of trailing / in path::const_iterator
When using a //net/ path, we were transforming the trailing / into a '.'
when the path was just the root path and we were iterating backwards.
Forwards iteration and other kinds of root path (C:\, /) were already
correct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202999 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 19:56:30 +00:00
Ahmed Charles
fbf6daaec6 [C++11] Add overloads for externally used OwningPtr functions.
This will allow external callers of these functions to switch over time
rather than forcing a breaking change all a once. These particular
functions were determined by building clang/lld/lldb.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202959 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 10:27:34 +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
Ahmed Charles
b6193185a0 [C++11] Add release() to OwningPtr.
This will make the transition to unique_ptr easier by allowing more
incremental changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202949 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 08:25:08 +00:00
Chandler Carruth
80a59df0e7 Hey, we can stop depending on the IR library from the Support unittests
now. ;] Tested on both a static and shared CMake build. Hopefully the
bots will agree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202844 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 12:56:38 +00:00
Chandler Carruth
8f124fe884 [Modules] Move the LeakDetector header into the IR library where the
source file had already been moved. Also move the unittest into the IR
unittest library.

This may seem an odd thing to put in the IR library but we only really
use this with instructions and it needs the LLVM context to work, so it
is intrinsically tied to the IR library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202842 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 12:46:06 +00:00
Chandler Carruth
19d764fb05 [Modules] Move the ConstantRange class into the IR library. This is
a bit surprising, as the class is almost entirely abstracted away from
any particular IR, however it encodes the comparsion predicates which
mutate ranges as ICmp predicate codes. This is reasonable as they're
used for both instructions and constants. Thus, it belongs in the IR
library with instructions and constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202838 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 12:24:34 +00:00
Chandler Carruth
ff956e7568 [Modules] Move the NoFolder into the IR library as it creates
instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202834 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 12:05:47 +00:00
Chandler Carruth
7225e27b4c [Modules] Move ValueMap to the IR library. While this class does not
directly care about the Value class (it is templated so that the key can
be any arbitrary Value subclass), it is in fact concretely tied to the
Value class through the ValueHandle's CallbackVH interface which relies
on the key type being some Value subclass to establish the value handle
chain.

Ironically, the unittest is already in the right library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202824 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 11:26:31 +00:00
Chandler Carruth
eb3d76da81 [Modules] Move ValueHandle into the IR library where Value itself lives.
Move the test for this class into the IR unittests as well.

This uncovers that ValueMap too is in the IR library. Ironically, the
unittest for ValueMap is useless in the Support library (honestly, so
was the ValueHandle test) and so it already lives in the IR unittests.
Mmmm, tasty layering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202821 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 11:17:44 +00:00
Chandler Carruth
df3d8e8b4d [Modules] Move the LLVM IR pattern match header into the IR library, it
obviously is coupled to the IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202818 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 11:08:18 +00:00
Chandler Carruth
876ac60880 [Modules] Move InstIterator out of the Support library, where it had no
business.

This header includes Function and BasicBlock and directly uses the
interfaces of both classes. It has to do with the IR, it even has that
in the name. =] Put it in the library it belongs to.

This is one step toward making LLVM's Support library survive a C++
modules bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202814 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 10:30:26 +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
Yaron Keren
b62b44ccc5 Cleaning up a bunch of pre-Visual C++ 2012 build hacks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202806 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 09:23:33 +00:00
Benjamin Kramer
3efb8b2c0f Give APInt move semantics.
The interaction between defaulted operators and move elision isn't
totally obvious, add a unit test so it doesn't break unintentionally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202662 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 20:56:28 +00:00
Chandler Carruth
fc6d7d6cf5 [C++11] Replace LLVM_STATIC_ASSERT with static_assert, we now have
access to it on all host toolchains.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202642 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 13:10:45 +00:00
Benjamin Kramer
d628f19f5d [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.
Remove the old functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202636 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 12:27:27 +00:00
Craig Topper
629b96cb4f Switch all uses of LLVM_OVERRIDE to just use 'override' directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202621 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 09:09:27 +00:00
Chandler Carruth
0a3eef53d7 [C++11] Switch all uses of the llvm_move macro to use std::move
directly, and remove the macro.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202612 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 04:08:41 +00:00
Chandler Carruth
80949c599f [C++11] Add support for OwningPtr<T> to be converted to and from
std::unique_ptr<T>.

Patch by Ahmed Charles!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202609 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 03:38:32 +00:00
Chandler Carruth
fd18fcb111 [C++11] Add unit tests for OwningPtr<T> in preparation for changes to make
it interoperate (minimally) with std::unique_ptr<T>. This is part of my
plan to migrate LLVM to use std::unique_ptr with a minimal impact on
out-of-tree code.

Patch by Ahmed Charles with some minor cleanups (and bool casts) by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202608 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 03:26:39 +00:00
Chandler Carruth
73bbab9d75 [C++11] Remove LLVM_HAS_CXX11_STDLIB now that it is just on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202587 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-01 10:57:19 +00:00
Chandler Carruth
bad2104d24 [C++11] Remove uses of LLVM_HAS_RVALUE_REFERENCES from the unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202583 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-01 09:36:06 +00:00
Rafael Espindola
fc6cc0edd6 With rpaths being set correctly, SHLIBPATH_VAR is not needed anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202510 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-28 16:16:51 +00:00
Rafael Espindola
128237d0c7 Correctly set rpath for unittests.
This lets us run the unittest from the command line without setting
LD_LIBRARY_PATH.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202509 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-28 16:11:03 +00:00
David Blaikie
3ae2abb11e Use the overloaded std::abs rather than C's abs(int) to address Clang's -Wabsolute-value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202286 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 19:12:28 +00:00
Duncan P. N. Exon Smith
e8aeccef15 fix crash in SmallDenseMap copy constructor
Prevent a crash in the SmallDenseMap copy constructor whenever the other
map is not in small mode.

<rdar://problem/14292693>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202206 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25 23:35:13 +00:00
Rafael Espindola
3f0a9af13b Fix resetting the DataLayout in a Module.
No tool does this currently, but as everything else in a module we should be
able to change its DataLayout.

Most of the fix is in DataLayout to make sure it can be reset properly.

The test uses Module::setDataLayout since the fact that we mutate a DataLayout
is an implementation detail. The module could hold a OwningPtr<DataLayout> and
the DataLayout itself could be immutable.

Thanks to Philip Reames for pushing me in the right direction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202198 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25 22:23:04 +00:00