Commit Graph

2037 Commits

Author SHA1 Message Date
David Blaikie
8f4a49f41a Make StringSet::insert return pair<iterator, bool> like other self-associative containers
StringSet is still a bit dodgy in that it exposes the raw iterator of
the StringMap parent, which exposes the weird detail that StringSet
actually has a 'value'... but anyway, this is useful for a handful of
clients that want to reference the newly inserted/persistent string data
in the StringSet/Map/Entry/thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222302 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 02:56:00 +00:00
Rafael Espindola
28b45aa83e Use a memcpy so that type based alias analysis sees the change.
The other option would be to do something like

if (that.isSingleWord())
  VAL = that.VAL;
else
  pVal = that.pVal

This bug was causing 86TTI::getIntImmCost to be miscompiled in a LTO
bootstrap in stage2, causing the build of stage3 to fail.

LLVM is getting quiet good at exploiting this. Not sure if there is anything
a sanitizer could do to help

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222294 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 01:02:22 +00:00
Reid Kleckner
8083adcaca Revert "ADT: correctly report isMSVCEnvironment for windows itanium"
This reverts commit r222180.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222188 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 22:55:59 +00:00
Saleem Abdulrasool
2bd09db07f ADT: correctly report isMSVCEnvironment for windows itanium
The itanium environment on Windows uses MSVC and is a MSVC environment.  Report
this correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222180 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 22:13:26 +00:00
Rafael Espindola
dada992be7 Use size_type for operator[].
This matches std::vector and is more efficient as it avoids
truncations.

With this the text segment of opt goes from 19705442 bytes
to 19703930 bytes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221973 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 07:02:38 +00:00
David Blaikie
7987683c39 StringMap: Test and finish off supporting perfectly forwarded values in StringMap operations.
Followup to r221946.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221958 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 00:41:46 +00:00
Duncan P. N. Exon Smith
4dc6aa2c17 ADT: Use perfect forwarding in StringMapEntry::Create()
Now you can pass references into constructors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221946 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 23:23:02 +00:00
David Blaikie
64f62a02e0 Fix non-variadic function_ref cases to match r221753
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221763 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 03:28:57 +00:00
David Blaikie
d9078385de Ensure function_refs are copyable even from non-const references
A subtle bug was found where attempting to copy a non-const function_ref
lvalue would actually invoke the generic forwarding constructor (as it
was a closer match - being T& rather than the const T& of the implicit
copy constructor). In the particular case this lead to a dangling
function_ref member (since it had referenced the function_ref passed by
value to its ctor, rather than the outer function_ref that was still
alive)

SFINAE the converting constructor to not be considered if the copy
constructor is available and demonstrate that this causes the copy to
refer to the original functor, not to the function_ref it was copied
from. (without the code change, the test would fail as Y would be
referencing X and Y() would see the result of the mutation to X, ie: 2)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221753 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 02:06:08 +00:00
Michael Gottesman
86ec9c4081 Add MapVector::rbegin(), MapVector::rend() to completment MapVector::begin(), MapVector::end().
These just delegate to the underlying vector type in the MapVector.

Also just add in some sanity unittests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220687 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 17:20:53 +00:00
NAKAMURA Takumi
af628cc0b8 Prune CRLF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220678 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 12:37:26 +00:00
Lang Hames
63b14baf79 [ADT] Add a 'find_as' operation to DenseSet.
This operation is analogous to its counterpart in DenseMap: It allows lookup
via cheap-to-construct keys (provided that getHashValue and isEqual are
implemented for the cheap key-type in the DenseMapInfo specialization).

Thanks to Chandler for the review.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220168 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-19 19:36:33 +00:00
David Majnemer
dfe81adbce InstCombine: Don't miscompile (x lshr C1) udiv C2
We have a transform that changes:
  (x lshr C1) udiv C2
into:
  x udiv (C2 << C1)

However, it is unsafe to do so if C2 << C1 discards any of C2's bits.

This fixes PR21255.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219634 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-13 21:48:30 +00:00
Benjamin Kramer
5defae6504 APSInt: Simplify code to reduce the number of copies. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219586 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-12 15:36:31 +00:00
Chandler Carruth
082e667c15 [ADT] Add an (ADL-friendly) abs free function for APFloat that returns
by value having cleared the sign bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219485 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 08:27:22 +00:00
Matt Arsenault
c08f0e3743 Add minnum / maxnum to APFloat
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219475 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 05:21:32 +00:00
Chandler Carruth
f4ec6697b8 [ADT] Replace the logb implementation with the simpler and much closer
to what we actually want ilogb implementation. This makes everything
*much* easier to deal with and is actually what we want when using it
anyways.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219474 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 05:14:12 +00:00
Chandler Carruth
cb84b21243 [ADT] Add the scalbn function for APFloat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219473 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 04:54:30 +00:00
Chandler Carruth
9ea4dd2eed [ADT] Implement the 'logb' functionality for APFloat. This is necessary
to implement complex division in the constant folder of Clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219471 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 04:17:04 +00:00
Chandler Carruth
0ffdb31af0 [ADT] Add basic operator overloads for arithmetic to APFloat to make
code using it more readable.

Also add a copySign static function that works more like the standard
function by accepting the value and sign-carying value as arguments.

No interesting logic here, but tests added to cover the basic API
additions and make sure they do something plausible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219453 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-09 23:26:15 +00:00
David Blaikie
f616a4ba06 Reformat some stuff I missed in recent previous commits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219356 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-08 23:09:42 +00:00
David Blaikie
3f2f9695c5 Push DwarfDebug::constructScopeDIE down into DwarfCompileUnit
One of many steps to generalize subprogram emission to both the DWO and
non-DWO sections (to emit -gmlt-like data under fission). Once the
functions are pushed down into DwarfCompileUnit some of the data
structures will be pushed at least into DwarfFile so that they can be
unique per-file, allowing emission to both files independently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219345 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-08 22:20:02 +00:00
Kaelyn Takata
25cfb5cff5 Add size_t MapVector::erase(KeyT) similar to the one in std::map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219240 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-07 21:15:51 +00:00
Yaron Keren
30d433dcc2 Solve Visual C++ warning C4805 on getAsInteger<bool>.
Fix http://llvm.org/PR21158 by adding a cast to unsigned long long,
so the comparison would be between two unsigned long longs instead 
of bool and unsigned long long.

      if (getAsUnsignedInteger(*this, Radix, ULLVal) ||
          static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219065 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-04 19:58:30 +00:00
Alexander Musman
0cd2a891d8 Fix typo in comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218979 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-03 11:55:31 +00:00
Jordan Rose
771ac70aed Add an emplace(...) method to llvm::Optional<T>.
This can be used for in-place initialization of non-moveable types.
For compilers that don't support variadic templates, only up to four
arguments are supported. We can always add more, of course, but this
should be good enough until we move to a later MSVC that has full
support for variadic templates.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.
Reviewed by David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218732 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 02:12:35 +00:00
Aaron Ballman
7b2aaade87 Fixing the build for compilers which do not yet have support for constexpr functions, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218622 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-29 20:27:01 +00:00
Jordan Rose
88c0ed30da Add getValueOr to llvm::Optional<T>.
This takes a single argument convertible to T, and
- if the Optional has a value, returns the existing value,
- otherwise, constructs a T from the argument and returns that.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218618 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-29 18:56:08 +00:00
Jordan Rose
ede14e3e21 Add "typedef T value_type;" to llvm::Optional<T>.
Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218617 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-29 18:56:05 +00:00
Argyrios Kyrtzidis
72bffaafb4 [ADT/IntrusiveRefCntPtr] Give friend access to IntrusiveRefCntPtr<X> so the relevant move constructor can access 'Obj'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218295 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-23 06:06:43 +00:00
Matt Arsenault
55dd199bd3 Add hsail and amdil64 to Triple
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 19:52:11 +00:00
JF Bastien
5223ff81f5 Add support for le64.
Summary:
le64 is a generic little-endian 64-bit processor, mimicking le32.

Depends on D5318.

Test Plan: make check-all

Reviewers: dschuff

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12 17:54:17 +00:00
Matthew Gardiner
a1fddc5de2 Adding kalimba variants as Triple sub-architectures.
Reviewed in:

http://reviews.llvm.org/D5115



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217229 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 06:46:43 +00:00
Sanjay Patel
8bf2a84891 house cleaning: "Don’t duplicate function or class name at the beginning of the comment."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217069 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 20:08:51 +00:00
Nick Kledzik
23e2653009 Add missing const to StringRef.copy()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216811 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-30 02:29:49 +00:00
David Blaikie
3da7647d69 Add a trivial functor for use with unique_ptrs managing memory that needs to be freed rather than deleted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216790 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 22:05:31 +00:00
Craig Topper
95f7e2d2fd Add conversion constructor to convert ArrayRef<T*> to ArrayRef<const T*>. Reviewed with Chandler and David Blaikie.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216709 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 06:01:43 +00:00
Craig Topper
3512034554 Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216525 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 05:25:25 +00:00
Craig Topper
273fd11da9 Use range based for loops to avoid needing to re-mention SmallPtrSet size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216351 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-24 23:23:06 +00:00
Craig Topper
e88b796285 Remove custom implementations of max/min in StringRef that was originally added to work an old gcc bug. I believe its been fixed by now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216156 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 04:31:10 +00:00
Duncan P. N. Exon Smith
8c20a93bac ADT: Avoid using std::equal in ArrayRef::equals
MSVC's STL has a bug in `std::equal()`: it asserts on nullptr iterators,
causing a block revert in r215981.  This works around that by re-writing
`ArrayRef::equals()` to do the work itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215986 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 16:36:21 +00:00
Craig Topper
25fc910167 Prevent use of the implicit copy constructor on SmallPtrSetImpl. An accidental copy caused my SmallPtrSet->SmallPtrSetImpl conversion commit to fail the other day.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215971 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 06:57:14 +00:00
Rafael Espindola
1c9caced63 Delete support for AuroraUX.
auroraux.org is not resolving.

I will add this to the release notes as soon as I figure out where to put the
3.6 release notes :-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215645 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-14 15:15:09 +00:00
Benjamin Kramer
00e08fcaa0 Canonicalize header guards into a common format.
Add header guards to files that were missing guards. Remove #endif comments
as they don't seem common in LLVM (we can easily add them back if we decide
they're useful)

Changes made by clang-tidy with minor tweaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 16:26:38 +00:00
Reid Kleckner
151f8cef74 APInt: Make self-move-assignment a no-op to fix stage3 clang-cl
It's not clear what the semantics of a self-move should be.  The
consensus appears to be that a self-move should leave the object in a
moved-from state, which is what our existing move assignment operator
does.

However, the MSVC 2013 STL will perform self-moves in some cases.  In
particular, when doing a std::stable_sort of an already sorted APSInt
vector of an appropriate size, one of the merge steps will self-move
half of the elements.

We don't notice this when building with MSVC, because MSVC will not
synthesize the move assignment operator for APSInt.  Presumably MSVC
does this because APInt, the base class, has user-declared special
members that implicitly delete move special members.  Instead, MSVC
selects the copy-assign operator, which defends against self-assignment.
Clang, on the other hand, selects the move-assign operator, and we get
garbage APInts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215478 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 22:01:39 +00:00
Saleem Abdulrasool
f96cd1aeb5 ADT: remove MinGW32 and Cygwin OSType enum
Remove the MinGW32 and Cygwin types from the OSType enumeration.  These values
are represented via environments of Windows.  It is a source of confusion and
needlessly clutters the code.  The cost of doing this is that we must sink the
check for them into the normalization code path along with the spelling.

Addresses PR20592.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215303 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-09 23:12:20 +00:00
Andrew Trick
e85047ea0a Fix SmallDenseMap assignment operator.
Self assignment would lead to buckets of garbage, causing quadratic probing to hang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214790 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04 22:18:25 +00:00
Rafael Espindola
16c0d7e5f8 Delete dead code.
It was added 12 years ago, but never used (and in the case of sort, never
implemented).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214150 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29 00:38:55 +00:00
Chandler Carruth
8e704b16f1 [ADT] Add a remarkbly useful little helper routine to ArrayRef for
checking whether the ArrayRef is equal to an explicit list of arguments.

This is particularly easy to implement even without variadic templates
because ArrayRef happens to be homogeneously typed. As a consequence we
can use a "clever" wrapper type and default arguments to capture in
a single method many arguments as well as *how many* arguments the user
specified.

Thanks to Dave Blaikie for helping me pull together this little helper.
Suggestions for how to improve or generalize it are of course welcome.
I'll be using it immediately in my follow-up patch. =D

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214041 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-27 01:11:19 +00:00
Rafael Espindola
a5e6ff6f7e Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213963 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-25 19:06:39 +00:00
Tim Northover
9231148e69 AArch64: remove arm64 triple enumerator.
Having both Triple::arm64 and Triple::aarch64 is extremely confusing, and
invites bugs where only one is checked. In reality, the only legitimate
difference between the two (arm64 usually means iOS) is also present in the OS
part of the triple and that's what should be checked.

We still parse the "arm64" triple, just canonicalise it to Triple::aarch64, so
there aren't any LLVM-side test changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213743 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-23 12:32:47 +00:00
Daniel Sanders
a11bf68f6c Add MIPS Technologies to the vendors in llvm::Triple.
This is a prerequisite for checking for 'mti' and 'img' in a consistent way in
clang. Previously 'img' could use Triple::getVendor() but 'mti' could only use
Triple::getVendorName().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213381 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-18 14:28:19 +00:00
Renato Golin
03ac7db89d Refactor ARM subarchitecture parsing
Re-commit of a patch to rework the triple parsing on ARM to a more sane
model.

Patch by Gabor Ballabas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213367 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-18 12:00:48 +00:00
Duncan P. N. Exon Smith
c12ce2b661 ADT: Add MapVector::remove_if
Add a `MapVector::remove_if()` that erases items in bulk in linear time,
as opposed to quadratic time for repeated calls to `MapVector::erase()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213090 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-15 20:24:56 +00:00
Duncan P. N. Exon Smith
d9ebc5991b ADT: Fix MapVector::erase()
Actually update the changed indexes in the map portion of `MapVector`
when erasing from the middle.  Add a unit test that checks for this.

Note that `MapVector::erase()` is a linear time operation (it was and
still is).  I'll commit a new method in a moment called
`MapVector::remove_if()` that deletes multiple entries in linear time,
which should be slightly less painful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213084 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-15 18:32:30 +00:00
Duncan P. N. Exon Smith
9f865ed141 ADT: Add "end namespace" comment
This keeps clang-format from deleting the preceding newline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213082 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-15 18:06:56 +00:00
David Majnemer
74cb271d2b ADT: Surface LowerCase argument for utohexstr
The underlying function. utohex_buffer, already supports an argument for
deciding if the hex characters should be upper or lower case.  Expose an
identical argument for utohexstr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212991 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 21:56:54 +00:00
Argyrios Kyrtzidis
41a6ddb277 Move the API and implementation of clang::driver::getARMCPUForMArch() to llvm::Triple::getARMCPUForArch().
Suggested by Eric Christopher.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212846 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-11 21:44:54 +00:00
Eric Christopher
b5a006e88f Add the CSR company and the Kalimba DSP processor to Triple.
Patch by Matthew Gardiner with fixes by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212745 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-10 17:26:54 +00:00
Daniel Sanders
6a6556695e Add Imagination Technologies to the vendors in llvm::Triple
Summary: This is a pre-requisite for supporting the mips-img-linux-gnu triple in clang.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212626 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 16:03:10 +00:00
Renato Golin
aebcee661e Revert "Refactor ARM subarchitecture parsing"
This reverts commit 7b4a688246.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212521 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-08 10:06:16 +00:00
Renato Golin
7b4a688246 Refactor ARM subarchitecture parsing
According to a FIXME in ARMMCTargetDesc.cpp the ARM version parsing should be
in the Triple helper class.

Patch by: Gabor Ballabas

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212479 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-07 20:01:11 +00:00
Alp Toker
e45100f420 Remove IntrusiveRefCntPtr::getPtr() function
It was deprecated in r212366 and all uses have been switched to get().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212382 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-05 22:20:59 +00:00
David Majnemer
38dbb0292d ADT: Add a drop_back() helper to ArrayRef
The slice(N, M) interface is powerful but not concise when wanting to
drop a few elements off of an ArrayRef, fix this by adding a drop_back
method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212370 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-05 06:12:30 +00:00
Alp Toker
22b4918557 Deprecate IntrusiveRefCntPtr::getPtr() in favour of get()
This better aligns with other LLVM-specific and C++ standard library smart
pointer types.

In particular there are at least a few uses of intrusive refcounting in the
frontend where it's worth investigating std::shared_ptr as a more appropriate
alternative.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212366 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-05 03:03:21 +00:00
David Majnemer
c8a1169c93 IR: Add COMDATs to the IR
This new IR facility allows us to represent the object-file semantic of
a COMDAT group.

COMDATs allow us to tie together sections and make the inclusion of one
dependent on another. This is required to implement features like MS
ABI VFTables and optimizing away certain kinds of initialization in C++.

This functionality is only representable in COFF and ELF, Mach-O has no
similar mechanism.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211920 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-27 18:19:56 +00:00
David Blaikie
9dd6fee485 Recommit 211309 (StringMap::insert), reverted in 211328 due to issues with private, but non-deleted, move members.
Certain versions of GCC (~4.7) couldn't handle the SFINAE on access
control, but with "= delete" (hidden behind a macro for portability)
this issue is worked around/addressed.

Patch by Agustín Bergé

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211525 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 18:28:53 +00:00
Yaron Keren
729aa1dbd3 Code in LoopStrengthReduce.cpp depends on SmallBitVector::size() being size_t
and not unsigned.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211356 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 12:57:44 +00:00
Yaron Keren
212e2b9c8d Reverting size_type for the containers from size_type to unsigned.
Various places in LLVM assume that container size and count are unsigned
and do not use the container size_type. Therefore they break compilation
(or possibly executation) for LP64 systems where size_t is 64 bit while
unsigned is still 32 bit.

If we'll ever that many items in the container size_type could be made
size_t for a specific containers after reviweing its other uses.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211353 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 12:20:56 +00:00
Yaron Keren
7d5bff0d5a Attempting to fix the 64 bit bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211351 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 10:52:57 +00:00
Yaron Keren
ed4e8a839f The count() function for STL datatypes returns unsigned, even where it's
only 1/0 result like std::set. Some of the LLVM ADT already return unsigned
count(), while others still return bool count().

In continuation to r197879, this patch modifies DenseMap, DenseSet, 
ScopedHashTable, ValueMap:: count() to return size_type instead of bool,
1 instead of true and 0 instead of false.

size_type is typedef-ed locally within each class to size_t.

http://reviews.llvm.org/D4018

Reviewed by dblaikie.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211350 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 10:26:56 +00:00
Rafael Espindola
6fda71e05e Revert "Add StringMap::insert(pair) consistent with the standard associative container concept."
This reverts commit r211309.

It looks like it broke some bots:

http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/15563/steps/compile/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211328 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 00:23:03 +00:00
David Blaikie
4110a7ac7a Add StringMap::insert(pair) consistent with the standard associative container concept.
Patch by Agustín Bergé.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 20:08:56 +00:00
Oliver Stannard
591f9ee076 Emit DWARF info for all code section in an assembly file
Currently, when using llvm as an assembler, DWARF debug information is only
generated for the .text section. This patch modifies this so that DWARF info
is emitted for all executable sections.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211273 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 15:52:37 +00:00
Alp Toker
ba928e254e Remove OwningPtr.h and associated tests
llvm::OwningPtr is superseded by std::unique_ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211259 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 07:25:18 +00:00
Ed Maste
7ec69f6e10 ADT: correct typo in comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211196 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 18:08:55 +00:00
Manuel Klimek
cc3f31aec5 Add specialization of FoldingSetTrait for std::pair.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210990 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-15 14:42:25 +00:00
Artyom Skrobov
ab22d95481 Using llvm::sys::swapByteOrder() for the common case of byte-swapping a value in place
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210978 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-14 13:18:07 +00:00
Artyom Skrobov
9bb92cb537 Renaming SwapByteOrder() to getSwappedBytes()
The next commit will add swapByteOrder(), acting in-place



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210973 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-14 11:36:01 +00:00
Craig Topper
27be15cd36 Convert StringMapEntry::Create to use StringRef instead of start/end pointers. Simpliies all in tree call sites. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210638 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-11 05:35:56 +00:00
David Blaikie
78b4fd3a4b SmallVector: support resize(N) with move-only types
Unfortunately there's no way to elegantly do this with pre-canned
algorithms. Using a generating iterator doesn't work because you default
construct for each element, then move construct into the actual slot
(bad for copy but non-movable types, and a little unneeded overhead even
in the move-only case), so just write it out manually.

This solution isn't exception safe (if one of the element's ctors calls
we don't fall back, destroy the constructed elements, and throw on -
which std::uninitialized_fill does do) but SmallVector (and LLVM) isn't
exception safe anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210495 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-09 22:26:20 +00:00
David Blaikie
62dd118135 SmallVector: More movable improvements - don't copy elements to make space when inserting repeated elements.
Also split and improve tests a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210433 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-08 19:12:31 +00:00
David Blaikie
aa72ac7dad SmallVector: Move, don't copy, elements to make space for an insertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210432 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-08 19:12:28 +00:00
David Blaikie
9262e52075 Fix some more moving-from-moved-from objects issues in SmallVector
(& because it makes it easier to test, this also improves
correctness/performance slightly by moving the last element in an insert
operation, rather than copying it)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210429 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-08 16:55:13 +00:00
David Blaikie
e570687bd8 Ensure SmallVector::insert doesn't overwrite the last element in the range with the already-moved-from value
This would cause the last element in a range to be in a moved-from state
after an insert at a non-end position, losing that value entirely in the
process.

Side note: move_backward is subtle. It copies [A, B) to C-1 and down.
(the fact that it decrements both the second and third iterators before
the first movement is the subtle part... kind of surprising, anyway)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210426 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-08 16:00:02 +00:00
Saleem Abdulrasool
6c862ed02b ADT: introduce isWindowsItaniumEnvironment
Add an isWindowsItaniumEnvironment function to Triple to mirror the other
Windows environments.  This is simply a utility function to check if we are
targeting windows-itanium rather than windows-msvc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210383 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-06 22:46:18 +00:00
Rafael Espindola
45178b9d60 Implement one operator== with another.
Thanks for David Blaikie for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210107 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-03 15:06:22 +00:00
Rafael Espindola
e9b2cf3456 Add operator== and operator!= to compare with nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210100 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-03 13:26:18 +00:00
Rafael Espindola
dacea252b5 Remove the last unspecified_bool_type from llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210076 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-03 05:05:15 +00:00
Reid Kleckner
fa68048322 [ADT] Delete the Twine assignment operator
This makes it slightly harder to misuse Twines.  It is still possible to
refer to destroyed temporaries with the regular constructors, though.

Patch by Marco Alesiani!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209832 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 17:12:05 +00:00
Richard Smith
0e93fa9d16 Attempt to placate compilers that warn on casts between pointer-to-object and
pointer-to-function types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209490 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-23 01:22:46 +00:00
David Blaikie
ee8af3e2a0 Recommit r208506: DebugInfo: Include lexical scopes in inlined subroutines.
This was reverted in r208642 due to regressions surrounding file changes
within lexical scopes causing inlining information to be lost.

The issue was in LexicalScopes::getOrCreateInlinedScope, where I was
previously testing "isLexicalBlock" which is false for
"DILexicalBlockFile" (a scope used to represent changes in the current
file name) and assuming it was then a function (breaking out of the
inlined scope path and reaching for the parent non-inlined scopes). By
inverting the condition and testing for "isSubprogram" the correct
behavior is attained.

(also found some weirdness in Clang, see r208742 when reducing this test
case - the resulting test case doesn't apply with the Clang fix, but
I've added a more realistic test case to inline-scopes.ll which does
reproduce the issue and demonstrate the fix)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208748 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-14 01:08:28 +00:00
David Blaikie
47290de5db Revert "DebugInfo: Include lexical scopes in inlined subroutines."
This reverts commit r208506.

Some inlined subroutine scopes appear to be missing with this change.
Reverting while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208642 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-12 23:53:03 +00:00
David Blaikie
99ccb1fae7 DebugInfo: Include lexical scopes in inlined subroutines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208506 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-11 18:12:17 +00:00
David Blaikie
50f8a53856 Missed formatting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208362 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 21:53:33 +00:00
David Blaikie
2b94fa799b StringMap: Move assignment and move construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208361 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 21:52:29 +00:00
David Blaikie
06eb84e21a StringMap: Replace faux-copyability with faux-movability, which is sufficient.
This behavior was added to support StringMaps of StringMaps, default +
move construction are sufficient for this.

Real move construction support coming soon (& probably copy construction
too).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208360 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 21:52:26 +00:00
David Blaikie
b0439e6d6a StringMap support for move-only values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208359 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 21:52:23 +00:00
Ed Maste
9f0141da2c Add isOSFreeBSD triple test
For http://reviews.llvm.org/D3448


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 13:00:15 +00:00
Richard Smith
36ecb2ee9d Re-commit r208025, reverted in r208030, with a fix for a conformance issue
which GCC detects and Clang does not!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208033 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-06 01:44:26 +00:00