Commit Graph

20281 Commits

Author SHA1 Message Date
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
a30ccb064b [LCG] Just move the allocator (now that we can) when moving a call
graph. This simplifies the custom move constructor operation to one of
walking the graph and updating the 'up' pointers to point to the new
location of the graph. Switch the nodes from a reference to a pointer
for the 'up' edge to facilitate this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206450 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 07:25:59 +00:00
Chandler Carruth
40f67f5764 [LCG] Remove the Module reference member which we weren't using for
anything and doesn't make sense if assigning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206449 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 07:22:19 +00:00
Chandler Carruth
d7eaf4f325 [Allocator] Make SpecificBumpPtrAllocator also movable and move
assignable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206448 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 07:08:56 +00:00
Justin Bogner
c30a52807f Support: Move OnDiskHashTable from clang to llvm
This introduces clang's Basic/OnDiskHashTable.h into llvm as
Support/OnDiskHashTable.h. I've taken the opportunity to add doxygen
comments and run the file through clang-format, but other than the
namespace changing from clang:: to llvm:: the API is identical.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206438 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 02:16:53 +00:00
Jim Grosbach
6c35f55692 [c++11] Tidy up AsmPrinter.cpp.
Range'ify loops and tidy up some by-reference handling. No functional
change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206422 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 22:38:02 +00:00
Jim Grosbach
3abd729d21 iterator_range for machine block terminators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206421 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 22:37:58 +00:00
Tom Stellard
57f45392e2 Added new functionality to LLVM C API to use DiagnosticInfo to handle errors
Patch by: Darren Powell

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 17:45:04 +00:00
Matheus Almeida
c308f165a0 [mips] Add initial support for NaN2008 in the back-end.
This is so that EF_MIPS_NAN2008 is set if we are using IEEE 754-2008
NaN encoding (-mnan=2008). This patch also adds support for parsing
'.nan legacy' and '.nan 2008' assembly directives. The handling of
these directives should match GAS' behaviour i.e., the last directive
in use sets the ELF header bit (EF_MIPS_NAN2008).

Differential Revision: http://reviews.llvm.org/D3346


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206396 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 15:48:55 +00:00
Chandler Carruth
ae8abf7896 [LCG] Stop playing fast and loose with reference members and assignment.
It doesn't work. I'm still cleaning up all the places where I blindly
followed this pattern. There are more to come in this code too.

As a benefit, this lets the default copy and move operations Just Work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206375 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 11:14:28 +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
Chandler Carruth
acb099472e [Allocator] Nuke to useless functions. The implicit ones are sufficient
here (obviously).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206369 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 09:21:29 +00:00
Craig Topper
5422dfb5b0 Convert SelectionDAG::getVTList to use ArrayRef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206357 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 06:10:51 +00:00
Chandler Carruth
d24010f61a [Allocator] Fold the two templated overloads into a single one with
a default argument. The allocator interface we're modeling doesn't
distinguish between array and non-array allocation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206327 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 21:51:14 +00:00
Chandler Carruth
00e4a827f5 [Allocator] Remove a really problematic overload. This is very confusing
because there is another (size_t, size_t) overload of Allocator, and the
only distinguishing factor is that one is a tempalte and the other
isn't. There was only one usage of this and that one was easily
converted to carry the alignment constraint in the type itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206325 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 21:36:02 +00:00
David Blaikie
2bbc5a7e2c Use unique_ptr to manage ownership of child Regions within llvm::Region
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206310 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 18:32:43 +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
Tim Northover
03eecdccff FastISel: constrain the RegClass of operands when emitting instructions.
ARM64 suffered multiple -verify-machineinstr failures (principally over the
xsp/xzr issue) because FastISel was completely ignoring which subset of the
general-purpose registers each instruction required.

More fixes are coming in ARM64 specific FastISel, but this should cover the
generic problems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206283 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 13:59:49 +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
47b284ce35 [Allocator] Pass the size to the deallocation function. This, on some
allocation libraries, may allow more efficient allocation and
deallocation. It at least makes the interface implementable by the JIT
memory manager.

However, this highlights problematic overloading between the void* and
the T* deallocation functions. I'm looking into a better way to do this,
but as it happens, it comes up rarely in the codebase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206265 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 08:59:52 +00:00
Chandler Carruth
d5b514ed23 [Allocator] Fix r206256 which got the enabling case backwards on these
overloads. This doesn't matter *that* much yet, but it will in
a subsequent patch. I had tested the original pattern, but not my
attempt to pacify MSVC. This at least appears to work. Still fixing the
rest of the fallout in the final patch that uses these overloads, but it
will follow shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206259 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 08:14:48 +00:00
Nick Lewycky
b6ecb4f8ab Fix broken build of llvm using clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 08:10:46 +00:00
Chandler Carruth
2c9a974b2b [Allocator] MSVC apparantly has broken SFINAE context handling of
'sizeof(T)' for T == void and produces a hard error. I cannot fathom why
this is OK. Oh well. switch to an explicit test for being the
(potentially qualified) void type, which is the only specific case I was
worried about. Hopefully this survives the libstdc++ build bots which
have limited type traits implementations...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206256 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 08:02:29 +00:00
Nick Lewycky
d63390cba1 Break PseudoSourceValue out of the Value hierarchy. It is now the root of its own tree containing FixedStackPseudoSourceValue (which you can use isa/dyn_cast on) and MipsCallEntry (which you can't). Anything that needs to use either a PseudoSourceValue* and Value* is strongly encouraged to use a MachinePointerInfo instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206255 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 07:22:52 +00:00
Craig Topper
095734c578 [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206254 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 07:20:03 +00:00
Nick Lewycky
9393eb354f Add a DenseMapInfo specialization for PointerUnion. In tree user to land shortly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206253 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 07:08:40 +00:00
Craig Topper
0b6cb7104b [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206252 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 06:32:26 +00:00
Chandler Carruth
eb19b8f58b [Allocator] Constrain the Deallocate templated overloads to only apply
to types which we can compute the size of. The comparison with zero
isn't actually interesting here, it's mostly about putting sizeof into
a sfinae context.

This is particular important for Deallocate as otherwise the void*
overload can quickly become ambiguous.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206251 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 06:29:04 +00:00
David Blaikie
3229c698e4 Use unique_ptr to manage ownership of GCFunctionInfos in GCStrategy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206249 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 06:07:26 +00:00
David Blaikie
9c94042083 Use unique_ptr for the result of Registry entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206248 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 05:53:26 +00:00
David Blaikie
5a21a893c0 Use unique_ptr to manage ownership of GCStrategy objects in GCMetadata
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206246 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 05:34:49 +00:00
David Blaikie
ff2bf1bb8d Use unique_ptr to own MCFunctions within MCModule.
MCModule's ctor had to be moved out of line so the definition of
MCFunction was available. (ctor requires the dtor of members (in case
the ctor throws) which required access to the dtor of MCFunction)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206244 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 05:15:19 +00:00
Craig Topper
570e52c6f1 [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 04:59:12 +00:00
David Blaikie
a8ae0ad11f Use std::unique_ptr to manage MCBasicBlocks in MCFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206242 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 04:56:29 +00:00
Lang Hames
508bd63046 [MC] Require an MCContext when constructing an MCDisassembler.
This patch re-introduces the MCContext member that was removed from
MCDisassembler in r206063, and requires that an MCContext be passed in at
MCDisassembler construction time. (Previously the MCContext member had been
initialized in an ad-hoc fashion after construction). The MCCContext member
can be used by MCDisassembler sub-classes to construct constant or
target-specific MCExprs.

This patch updates disassemblers for in-tree targets, and provides the
MCRegisterInfo instance that some disassemblers were using through the
MCContext (previously those backends were constructing their own
MCRegisterInfo instances).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206241 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 04:40:56 +00:00
Jim Grosbach
c17bcb8b34 Add iterator_range for MachineInstr defs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206238 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 02:14:06 +00:00
Chandler Carruth
159976c271 [Allocator] Add Deallocate support to the AllocatorBase CRTP class,
along with templated overloads much like we have for Allocate. These
will facilitate switching the Deallocate interface of all the Allocator
classes to accept the size by pre-filling it from the type size where we
can do so. I plan to convert several uses to the template variants in
subsequent patches prior to adding the Size parameter.

No functionality changed, WIP.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206230 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 00:47:47 +00:00
Chandler Carruth
75ba212653 [Allocator] Hack around the fact that GCC can't compile the
static_assert added in r206225. I'm looking into a proper fix, but
wanted the bots back.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206226 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 00:22:53 +00:00
Chandler Carruth
ebfe4d7fee [Allocator] Factor the Allocate template overloads into a base class
rather than defining them (differently!) in both allocators. This also
serves as a basis for documenting and even enforcing some of the
LLVM-style "allocator" concept methods which must exist with various
signatures.

I plan on extending and changing the signatures of these to further
simplify our allocator model in subsequent commits, so I wanted to
factor things as best as I could first. Notably, I'm working to add the
'Size' to the deallocation method of all allocators. This has several
implications not the least of which are faster deallocation times on
certain allocation libraries (tcmalloc). It also will allow the JIT
allocator to fully model the existing allocation interfaces and allow
sanitizer poisoning of deallocated regions. The list of advantages goes
on. =] But by factoring things first I'll be able to make this easier by
first introducing template helpers for the deallocation path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206225 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 00:19:41 +00:00
Chandler Carruth
1a77583742 [cleanup] Run clang-format over most of YAMLParser.h to fix a bunch of
small formatting inconsistencies with the rest of LLVM and even this
file. I looked at all the changes and they seemed like just better
formatting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206209 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 21:12:15 +00:00
James Molloy
1f1bced6e7 [ARM64] Add big endian target arm64_be.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206197 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 17:37:53 +00:00
James Molloy
555f97f2bc Teach llvm-lto to respect the given RelocModel.
Patch by Nick Tomlinson!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206177 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 13:54:16 +00:00
Chandler Carruth
1907f75445 [Allocator] Hoist the external helper function into a namespace scope
declaration. GCC 4.7 appears to get hopelessly confused by declaring
this function within a member function of a class template. Go figure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206152 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 06:42:56 +00:00
Chandler Carruth
273a62f9ac [cleanup] Normalize YAMLParser.h's doxygen markers with '\foo' instead
of '@foo'. The slash variant is prefered in LLVM and the file was
already using a mixture. =/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206151 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 06:22:03 +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
e20c45d2d8 Fix the compile from r206147 in release builds by moving a variable
declaration outside of #ifndef NDEBUG -- its used elsewhere. Sorry for
the noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206148 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 04:46:30 +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
Craig Topper
01b72784c9 Add back some typecasts I accidentally lost in r206142.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206143 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 01:11:34 +00:00
Craig Topper
4ba844388c [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 00:51:57 +00:00
Craig Topper
4266ae8067 [C++11] More 'nullptr' conversion or in some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206129 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-13 04:57:38 +00:00