1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

3096 Commits

Author SHA1 Message Date
Rui Ueyama
3a28731f9f Support: Use llvm::COFF::BigObjMagic
Use llvm::COFF::BigObjMagic insetad of the string literal.
Also checks the version number.

llvm-svn: 217633
2014-09-11 22:34:32 +00:00
Rui Ueyama
b2048c498d Support: improve identify_magic to recognize COFF bigobj
identify_magic recognized a COFF bigobj as an import library file.
This patch fixes that.

llvm-svn: 217627
2014-09-11 21:09:57 +00:00
Rafael Espindola
832c8a58f2 Misc cleanups to the FileSytem api.
The main difference is the removal of

std::error_code exists(const Twine &path, bool &result);

It was an horribly redundant interface since a file not existing is also a valid
error_code. Now we have an access function that returns just an error_code. This
is the only function that has to be implemented for Unix and Windows. The
functions can_write, exists and can_execute an now just wrappers.

One still has to be very careful using these function to avoid introducing
race conditions (Time of check to time of use).

llvm-svn: 217625
2014-09-11 20:30:02 +00:00
Sanjay Patel
a0d0d4091d typo
llvm-svn: 217597
2014-09-11 15:41:01 +00:00
Ed Maste
97aff9f17f Use armv6k default for FreeBSD/ARM
Patch by Andrew Turner.

llvm-svn: 217454
2014-09-09 17:47:24 +00:00
Nick Lewycky
820d92269f Check whether the iterator p == the end iterator before trying to dereference it. This is a speculative fix for a failure found on the valgrind buildbot triggered by a clang test.
llvm-svn: 217295
2014-09-06 01:16:42 +00:00
Alexey Samsonov
9d03489b53 Fix right shift by 64 bits detected on CXX/lex/lex.literal/lex.ext/p4.cpp
test case on UBSan bootstrap bot.

This fixes the last failure of "check-clang" in UBSan bootstrap bot.

llvm-svn: 217294
2014-09-06 00:41:19 +00:00
Frederic Riss
7f2a6aeb9c Reapply "[dwarfdump] Add missing DW_LANG_Mips_Assembler case to LanguageString()"
This commit was reverted in r217183, but is OK to go in again now that its dependency is commited (as of r217186).

llvm-svn: 217231
2014-09-05 07:21:40 +00:00
Matthew Gardiner
4d01158d7c Removed white-space
llvm-svn: 217230
2014-09-05 07:17:15 +00:00
Matthew Gardiner
84251a24a7 Adding kalimba variants as Triple sub-architectures.
Reviewed in:

http://reviews.llvm.org/D5115

llvm-svn: 217229
2014-09-05 06:46:43 +00:00
Frederic Riss
f08f2cafec [ dwarfdump ] Add symbolic dump of known DWARF attribute values.
Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 217186
2014-09-04 19:39:20 +00:00
Frederic Riss
951e5b654a Revert "[dwarfdump] Add missing DW_LANG_Mips_Assembler case to LanguageString()"
This reverts commit 93c7e6161e1adbd2c7ac81fa081823183035cb64.

This commit got approved first, but was dependant on another one going in (The one pretty printing attribute values). I'll reapply when the other one is in.

llvm-svn: 217183
2014-09-04 18:55:46 +00:00
Frederic Riss
29626708ae [dwarfdump] Add missing DW_LANG_Mips_Assembler case to LanguageString()
Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 217182
2014-09-04 18:40:23 +00:00
Rafael Espindola
cb6d6ffe1e Add writeFileWithSystemEncoding to LibLLVMSuppor.
This patch adds to LLVMSupport the capability of writing files with
international characters encoded in the current system encoding. This
is relevant for Windows, where we can either use UTF16 or the current
code page (the legacy Windows international characters). On UNIX, the
file is always saved in UTF8.

This will be used in a patch for clang to thoroughly support response
files creation when calling other tools, addressing PR15171. On
Windows, to correctly support internationalization, we need the
ability to write response files both in UTF16 or the current code
page, depending on the tool we will call. GCC for mingw, for instance,
requires files to be encoded in the current code page. MSVC tools
requires files to be encoded in UTF16.

Patch by Rafael Auler!

llvm-svn: 217068
2014-09-03 20:02:00 +00:00
Chris Bieneman
cc1b741a66 Removing static initializer from Debug.cpp by converting to a ManagedStatic.
This is part of our larger effort to remove static initializers from LLVM libraries.

Reviewed by: chandlerc

llvm-svn: 217053
2014-09-03 17:50:14 +00:00
Chris Bieneman
8e3b8a2da4 Cleaning up remaining static initializers in Signals.inc
llvm-svn: 216996
2014-09-02 23:48:13 +00:00
David Blaikie
697c9919bc unique_ptrify the result of SpecialCaseList::create
llvm-svn: 216925
2014-09-02 18:13:54 +00:00
David Blaikie
07f73331e4 unique_ptrify FileOutputBuffer::FileOutputBuffer
llvm-svn: 216921
2014-09-02 17:49:23 +00:00
Andrea Di Biagio
ef361be676 Revert: [APFloat] Fixed a bug in method 'fusedMultiplyAdd'.
This reverts revision 216913; the new test added at revision 216913
caused regression failures on a couple of buildbots.

llvm-svn: 216914
2014-09-02 17:22:49 +00:00
Andrea Di Biagio
2b24c712b1 [APFloat] Fixed a bug in method 'fusedMultiplyAdd'.
When folding a fused multiply-add builtin call, make sure that we propagate the
correct result in the case where the addend is zero, and the two other operands
are finite non-zero.

Example:
  define double @test() {
    %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0.0)
    ret double %1
  }

Before this patch, the instruction simplifier wrongly folded the builtin call
in function @test to constant 'double 7.0'.
With this patch, method 'fusedMultiplyAdd' correctly evaluates the multiply and
propagates the expected result (i.e. 56.0).

Added test fold-builtin-fma.ll with the reproducible from PR20832 plus extra
test cases to verify the behavior of method 'fusedMultiplyAdd' in the presence
of NaN/Inf operands.

This fixes PR20832.

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

llvm-svn: 216913
2014-09-02 16:44:56 +00:00
Craig Topper
7332ae0502 Fix some cases where StringRef was being passed by const reference. Remove const from some other StringRefs since its implicitly const already.
llvm-svn: 216820
2014-08-30 16:48:02 +00:00
Chris Bieneman
a4f3f61361 Cleaning up static initializers in Signals.inc
Reviewed by: Chandlerc

llvm-svn: 216704
2014-08-29 01:05:16 +00:00
Chris Bieneman
0f6163d2ae Cleaning up static initializers in TimeValue.
Code reviewed by Chandlerc

llvm-svn: 216703
2014-08-29 01:05:12 +00:00
Rafael Espindola
edb6051959 Return a std::unique_ptr when creating a new MemoryBuffer.
llvm-svn: 216583
2014-08-27 20:03:13 +00:00
Rafael Espindola
01d03dcba4 yaml::Stream doesn't need to take ownership of the buffer.
In fact, most users were already using the StringRef version.

llvm-svn: 216575
2014-08-27 19:03:22 +00:00
Zachary Turner
a302d24004 Revert "Limit the symbol search in DynamicLibrary to the module that was opened."
This reverts commit r216563, which breaks lli's dynamic symbol resolution.

llvm-svn: 216569
2014-08-27 17:51:43 +00:00
Zachary Turner
aefdb6a076 Limit the symbol search in DynamicLibrary to the module that was opened.
Differential Revision: http://reviews.llvm.org/D5030

Reviewed By: Reid Kleckner, Rafael Espindola

llvm-svn: 216563
2014-08-27 17:06:22 +00:00
Benjamin Kramer
7c4796a444 Add an explicit cast to pacify implicit boolean conversion warnings.
llvm-svn: 216539
2014-08-27 11:47:52 +00:00
Craig Topper
43cee2f5fc Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216525
2014-08-27 05:25:25 +00:00
Rafael Espindola
225cf75bef Pass a MemoryBufferRef when we can avoid taking ownership.
The attached patch simplifies a few interfaces that don't need to take
ownership of a buffer.

For example, both parseAssembly and parseBitcodeFile will parse the
entire buffer before returning. There is no need to take ownership.

Using a MemoryBufferRef makes it obvious in the type signature that
there is no ownership transfer.

llvm-svn: 216488
2014-08-26 21:49:01 +00:00
Rafael Espindola
8cbf70d62d Merge TempDir and system_temp_directory.
We had two functions for finding the temp or cache directory. Each had a
different set of smarts about OS specific APIs.

With this patch system_temp_directory becomes the only way to do it.

llvm-svn: 216460
2014-08-26 14:47:52 +00:00
Dylan Noblesmith
1af83d4c81 Revert "Support/APFloat: unique_ptr-ify temp arrays"
This reverts commit rr216359.

llvm-svn: 216429
2014-08-26 02:03:33 +00:00
Dylan Noblesmith
36c670b2b8 Revert "Support/Path: remove raw delete"
This reverts commit r216360.

llvm-svn: 216428
2014-08-26 02:03:30 +00:00
Rafael Espindola
557df13e6d Fix bug in llvm::sys::argumentsFitWithinSystemLimits().
This patch fixes a subtle bug in the UNIX implementation of
llvm::sys::argumentsFitWithinSystemLimits() regarding the misuse of a static
variable. This bug causes our cached number that stores the system command line
maximum length to be halved after each call to the function. With a sufficient
number of calls to this function, it will eventually report any given command
line string to be over system limits.

Patch by Rafael Auler.

llvm-svn: 216415
2014-08-25 22:53:21 +00:00
Rafael Espindola
edb75ea26d Refactor argument serialization logic when executing process. NFC.
This patch refactors the argument serialization logic used in the Execute
function, used to launch new Windows processes. There is a critical step that
joins char** arguments into a single string, building the command line used to
launch the new process, and the readability of this code is improved if this
part is refactored in its own helper function.

Patch by Rafael Auler!

llvm-svn: 216411
2014-08-25 22:15:06 +00:00
Rafael Espindola
1d5713d9bf Modernize raw_fd_ostream's constructor a bit.
Take a StringRef instead of a "const char *".
Take a "std::error_code &" instead of a "std::string &" for error.

A create static method would be even better, but this patch is already a bit too
big.

llvm-svn: 216393
2014-08-25 18:16:47 +00:00
Dylan Noblesmith
9fd2309049 Support/Path: remove raw delete
llvm-svn: 216360
2014-08-25 00:58:13 +00:00
Dylan Noblesmith
f82bc070e5 Support/APFloat: unique_ptr-ify temp arrays
llvm-svn: 216359
2014-08-25 00:58:10 +00:00
Dylan Noblesmith
b48c4cfa2d Support: add llvm::unique_lock
Based on the STL class of the same name, it guards a mutex
while also allowing it to be unlocked conditionally before
destruction.

This eliminates the last naked usages of mutexes in LLVM and
clang.

It also uncovered and fixed a bug in callExternalFunction()
when compiled without USE_LIBFFI, where the mutex would never
be unlocked if the end of the function was reached.

llvm-svn: 216338
2014-08-23 23:07:14 +00:00
Dylan Noblesmith
2c2c44a12f Support: make LLVM Mutexes STL-compatible
Use lock/unlock() convention instead of acquire/release().

llvm-svn: 216336
2014-08-23 22:49:22 +00:00
Dylan Noblesmith
1ec1360c75 Support/Unix: use ScopedLock wherever possible
Only one function remains a bit too complicated
for a simple mutex guard. No functionality change.

llvm-svn: 216335
2014-08-23 22:49:17 +00:00
Reid Kleckner
6ab28bce46 Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind
This patch contains the LLVM side of the fix of PR17239.

This bug that happens because the /link (clang-cl.exe argument) is
marked as "consume all remaining arguments". However, when inside a
response file, /link should only consume all remaining arguments inside
the response file where it is located, not the entire command line after
expansion.

My patch will change the semantics of the RemainingArgsClass kind to
always consume only until the end of the response file when the option
originally came from a response file. There are only two options in this
class: dash dash (--) and /link.

Reviewed By: rnk

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

Patch by Rafael Auler!

llvm-svn: 216280
2014-08-22 19:29:17 +00:00
David Blaikie
7a58463dea Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr
llvm-svn: 216223
2014-08-21 20:44:56 +00:00
Craig Topper
c80a14ad2f 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.
llvm-svn: 216156
2014-08-21 04:31:10 +00:00
Alexey Samsonov
73266a6708 Fix undefined behavior (left shift by 64 bits) in ScaledNumber::toString().
This bug is reported by UBSan.

llvm-svn: 216116
2014-08-20 18:30:07 +00:00
Craig Topper
baef4556f6 Fix an off by 1 bug that prevented SmallPtrSet from using all of its 'small' capacity. Then fix the early return in the move constructor that prevented 'small' moves from clearing the NumElements in the moved from object. The directed test missed this because it was always testing large moves due to the off by 1 bug.
llvm-svn: 216044
2014-08-20 04:41:36 +00:00
Rafael Espindola
08aa78de63 Don't own the buffer in object::Binary.
Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries
(like Archive) and we had to create dummy buffers just to handle that. It is
also a bad fit for IRObjectFile where the Module wants to own the buffer too.

Keeping this ownership would make supporting IR inside native objects
particularly painful.

This patch focuses in lib/Object. If something elsewhere used to own an Binary,
now it also owns a MemoryBuffer.

This patch introduces a few new types.

* MemoryBufferRef. This is just a pair of StringRefs for the data and name.
  This is to MemoryBuffer as StringRef is to std::string.
* OwningBinary. A combination of Binary and a MemoryBuffer. This is needed
  for convenience functions that take a filename and return both the
  buffer and the Binary using that buffer.

The C api now uses OwningBinary to avoid any change in semantics. I will start
a new thread to see if we want to change it and how.

llvm-svn: 216002
2014-08-19 18:44:46 +00:00
Rafael Espindola
0f0b067a94 Convert an ownership comment with std::uinque_ptr.
llvm-svn: 215855
2014-08-17 22:20:33 +00:00
Sean Silva
3e323f9026 Revert "[Support] Promote cl::StringSaver to a separate utility"
This reverts commit r215784 / 3f8a26f6fe16cc76c98ab21db2c600bd7defbbaa.

LLD has 3 StringSaver's, one of which takes a lock when saving the
string... Need to investigate more closely.

llvm-svn: 215790
2014-08-15 23:39:01 +00:00
Sean Silva
4650d2b2ad [Support] Promote cl::StringSaver to a separate utility
This class is generally useful.

In breaking it out, the primary change is that it has been made
non-virtual. It seems like being abstract led to there being 3 different
(2 in llvm + 1 in clang) concrete implementations which disagreed about
the ownership of the saved strings (see the manual call to free() in the
unittest StrDupSaver; yes this is different from the CommandLine.cpp
StrDupSaver which owns the stored strings; which is different from
Clang's StringSetSaver which just holds a reference to a
std::set<std::string> which owns the strings).

I've identified 2 other places in the
codebase that are open-coding this pattern:

  memcpy(Alloc.Allocate<char>(strlen(S)+1), S, strlen(S)+1)

I'll be switching them over. They are
* llvm::sys::Process::GetArgumentVector
* The StringAllocator member of YAMLIO's Input class
This also will allow simplifying Clang's driver.cpp quite a bit.

Let me know if there are any other places that could benefit from
StringSaver. I'm also thinking of adding a saveStringRef member for
getting a stable StringRef.

llvm-svn: 215784
2014-08-15 23:18:33 +00:00
Rafael Espindola
1b2eb4e486 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 :-)

llvm-svn: 215645
2014-08-14 15:15:09 +00:00
Benjamin Kramer
da144ed5a2 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.

llvm-svn: 215558
2014-08-13 16:26:38 +00:00
Saleem Abdulrasool
92b98299b9 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.

llvm-svn: 215303
2014-08-09 23:12:20 +00:00
Eric Christopher
638a0643ee Fix typo.
llvm-svn: 215266
2014-08-09 00:26:27 +00:00
Rafael Espindola
1c0c1cec43 Fix the windows build.
Sorry for the noise.

llvm-svn: 215249
2014-08-08 22:09:31 +00:00
Eric Christopher
ca5efa5bef Reword comment slightly.
llvm-svn: 215248
2014-08-08 22:09:00 +00:00
Rafael Espindola
d326af1d4b Remove dead code. Fixes pr20544.
llvm-svn: 215243
2014-08-08 21:35:52 +00:00
Rafael Espindola
d5eb943fe5 Convert from Windows to Unix paths in sys::path::native.
Part of pr20544. Test to follow in a second.

llvm-svn: 215241
2014-08-08 21:29:34 +00:00
Rafael Espindola
0c2eeeddf1 Fix bug 20125 - clang-format segfaults on bad config.
The problem was in unchecked dyn_cast inside of Input::createHNodes.
Patch by Roman Kashitsyn!

llvm-svn: 215205
2014-08-08 13:58:00 +00:00
Richard Smith
930ab2538a Remove Support/IncludeFile.h and its only user. This is actively harmful, since
it breaks the modules builds (where CallGraph.h can be quite reasonably
transitively included by an unimported portion of a module, and CallGraph.cpp
not linked in), and appears to have been entirely redundant since PR780 was
fixed back in 2008.

If this breaks anything, please revert; I have only tested this with a single
configuration, and it's possible that this is still somehow fixing something
(though I doubt it, since no other similar file uses this mechanism any more).

llvm-svn: 215142
2014-08-07 20:41:17 +00:00
Yaron Keren
baaa4b7845 getNewMemBuffer memsets the buffer to zeros,
the caller don't have to initialize it.

llvm-svn: 214994
2014-08-06 20:59:09 +00:00
Justin Bogner
cb125e9a3e Path: Stop claiming path::const_iterator is bidirectional
path::const_iterator claims that it's a bidirectional iterator, but it
doesn't satisfy all of the contracts for a bidirectional iterator.
For example, n3376 24.2.5 p6 says "If a and b are both dereferenceable,
then a == b if and only if *a and *b are bound to the same object",
but this doesn't work with how we stash and recreate Components.

This means that our use of reverse_iterator on this type is invalid
and leads to many of the valgrind errors we're hitting, as explained
by Tilmann Scheller here:

    http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140728/228654.html

Instead, we admit that path::const_iterator is only an input_iterator,
and implement a second input_iterator for path::reverse_iterator (by
changing const_iterator::operator-- to reverse_iterator::operator++).
All of the uses of this just traverse once over the path in one
direction or the other anyway.

llvm-svn: 214737
2014-08-04 17:36:41 +00:00
NAKAMURA Takumi
9474954f12 MemoryBuffer: Don't use mmap when FileSize is multiple of 4k on Cygwin.
On Cygwin, getpagesize() returns 64k(AllocationGranularity).

In r214580, the size of X86GenInstrInfo.inc became 1499136.

FIXME: We should reorganize again getPageSize() on Win32.
MapFile allocates address along AllocationGranularity but view is mapped by physical page.

llvm-svn: 214681
2014-08-04 01:43:37 +00:00
Rafael Espindola
19e7ab14ac Remove some calls to std::move.
Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get
a reference to it.

Thanks to David Blaikie for the suggestion.

llvm-svn: 214516
2014-08-01 14:31:55 +00:00
Rafael Espindola
227e62db29 Remove dead code.
llvm-svn: 213963
2014-07-25 19:06:39 +00:00
Hans Wennborg
70dd8bb7a1 Windows: Don't wildcard expand /? or -?
Even if there's a file called c:\a, we want /? to be preserved as
an option, not expanded to a filename.

llvm-svn: 213894
2014-07-24 21:09:45 +00:00
Tim Northover
c357579164 AArch64: remove "arm64_be" support in favour of "aarch64_be".
There really is no arm64_be: it was a useful fiction to test big-endian support
while both backends existed in parallel, but now the only platform that uses
the name (iOS) doesn't have a big-endian variant, let alone one called
"arm64_be".

llvm-svn: 213748
2014-07-23 12:58:11 +00:00
Tim Northover
3e8fd62854 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.

llvm-svn: 213743
2014-07-23 12:32:47 +00:00
David Blaikie
939901ec68 Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"
It's also possible to just write "= nullptr", but there's some question
of whether that's as readable, so I leave it up to authors to pick which
they prefer for now. If we want to discuss standardizing on one or the
other, we can do that at some point in the future.

llvm-svn: 213438
2014-07-19 01:05:11 +00:00
Daniel Sanders
b7f4e6b616 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().

llvm-svn: 213381
2014-07-18 14:28:19 +00:00
Renato Golin
05cd608eea 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.

llvm-svn: 213367
2014-07-18 12:00:48 +00:00
Alp Toker
1bfa029bc4 Drop the udis86 wrapper from llvm::sys
This optional dependency on the udis86 library was added some time back to aid
JIT development, but doesn't make much sense to link into LLVM binaries these
days.

llvm-svn: 213300
2014-07-17 20:05:29 +00:00
Hans Wennborg
ebf51704c5 Typo: exists -> exits
llvm-svn: 213290
2014-07-17 18:33:44 +00:00
Yi Kong
d5d6470070 Fix the prefix for arm64 triple
Triple.cpp still returns "arm64" as prefix for arm64 triple, causing Clang not
being able to select the correct GCCBuiltin IR.

This patch changes the value to correct prefix "aarch64". Regression test will
be added in the coming patch.

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

llvm-svn: 213240
2014-07-17 09:43:27 +00:00
Hans Wennborg
46aad38a9b Perform wildcard expansion in Process::GetArgumentVector on Windows (PR17098)
On Windows, wildcard expansion isn't performed by the shell, but left to the
program itself. The common way to do this is to link with setargv.obj, which
performs the expansion on argc/argv before main is entered. However, we don't
use argv in Clang on Windows, but instead call GetCommandLineW so we can handle
unicode arguments. This means we have to do wildcard expansion ourselves.

A test case will be added on the Clang side.

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

llvm-svn: 213114
2014-07-16 00:52:11 +00:00
Alp Toker
f8f97e88e9 Fix a -Wunused-local-typedefs warning
llvm-svn: 213002
2014-07-14 22:46:45 +00:00
Justin Bogner
b01116e438 Support: Use a range-based for
llvm-svn: 212973
2014-07-14 19:24:13 +00:00
Argyrios Kyrtzidis
5daccdf69f Move the API and implementation of clang::driver::getARMCPUForMArch() to llvm::Triple::getARMCPUForArch().
Suggested by Eric Christopher.

llvm-svn: 212846
2014-07-11 21:44:54 +00:00
Alp Toker
043f69cb8d Simplify the raw_svector_ostream tweak from r212816
The memcpy() and overlap helps didn't help much with timings, so clean up the change.

The difference at this point is that we now leave growth of the storage buffer
up to SmallVector's implementation:

 -   OS.reserve(OS.capacity() * 2);
 +   OS.reserve(OS.size() + 64);

llvm-svn: 212837
2014-07-11 18:23:08 +00:00
Alp Toker
0d0baf0938 raw_svector_ostream: grow and reserve atomically
Including the scratch buffer size in the initial reservation eliminates the
subsequent malloc+move operation and offers a healthier constant growth with
less memory wastage.

When doing this, take care to avoid invalidating the source buffer.

llvm-svn: 212816
2014-07-11 14:02:04 +00:00
Eric Christopher
a7f273741e Add the CSR company and the Kalimba DSP processor to Triple.
Patch by Matthew Gardiner with fixes by me.

llvm-svn: 212745
2014-07-10 17:26:54 +00:00
Peter Collingbourne
2bc51dcbef Remove move assignment operator to appease older GCCs.
llvm-svn: 212682
2014-07-10 04:39:40 +00:00
Peter Collingbourne
0ccbe0740d Explicitly define move constructor and move assignment operator to appease MSVC.
llvm-svn: 212679
2014-07-10 04:29:06 +00:00
Peter Collingbourne
e5f0c51843 SpecialCaseList: use std::unique_ptr.
llvm-svn: 212678
2014-07-10 03:55:02 +00:00
Alexey Samsonov
bea2f2e5d8 Decouple llvm::SpecialCaseList text representation and its LLVM IR semantics.
Turn llvm::SpecialCaseList into a simple class that parses text files in
a specified format and knows nothing about LLVM IR. Move this class into
LLVMSupport library. Implement two users of this class:
  * DFSanABIList in DFSan instrumentation pass.
  * SanitizerBlacklist in Clang CodeGen library.
The latter will be modified to use actual source-level information from frontend
(source file names) instead of unstable LLVM IR things (LLVM Module identifier).

Remove dependency edge from ClangCodeGen/ClangDriver to LLVMTransformUtils.

No functionality change.

llvm-svn: 212643
2014-07-09 19:40:08 +00:00
Daniel Sanders
37f35e2a7f 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

llvm-svn: 212626
2014-07-09 16:03:10 +00:00
Dmitri Gribenko
42b37ff173 SourceMgr: consistently use 'unsigned' for the memory buffer ID type
llvm-svn: 212595
2014-07-09 08:30:15 +00:00
Benjamin Kramer
0ad234df3b Fix some Twine locals.
Two of those are use after frees. Found by clang-tidy, fixed by me.

llvm-svn: 212537
2014-07-08 14:55:06 +00:00
Renato Golin
74bbc07d65 Revert "Refactor ARM subarchitecture parsing"
This reverts commit 7b4a6882467e7fef4516a0cbc418cbfce0fc6f6d.

llvm-svn: 212521
2014-07-08 10:06:16 +00:00
Renato Golin
659d34425a 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

llvm-svn: 212479
2014-07-07 20:01:11 +00:00
Rafael Espindola
858b9e1423 Update the MemoryBuffer API to use ErrorOr.
llvm-svn: 212405
2014-07-06 17:43:13 +00:00
Alp Toker
0ca11b2493 SourceMgr: make valid buffer IDs start from one
Use 0 for the invalid buffer instead of -1/~0 and switch to unsigned
representation to enable more idiomatic usage.

Also introduce a trivial SourceMgr::getMainFileID() instead of hard-coding 0/1
to identify the main file.

llvm-svn: 212398
2014-07-06 10:33:31 +00:00
Alp Toker
a199bb8891 Remove obsolete function TargetRegistry::getClosestTargetForJIT()
This was kept around "for compatibility through 2.6" in 2009 and is not used or
tested.

llvm-svn: 212095
2014-07-01 10:47:13 +00:00
Ehsan Akhgari
1f75365ec9 Refactor the code in clang to find a file in a PATH like environment variable into a helper function
llvm-svn: 212057
2014-06-30 19:54:20 +00:00
Alp Toker
000fb20af5 Fix 'platform-specific' hyphenations
llvm-svn: 212056
2014-06-30 18:57:16 +00:00
Alp Toker
b76b963413 Build fix for systems without futimes/futimens
Some versions of Android don't have futimes/futimens and this code wasn't
updated during the recent errc refactoring.

Patch by Luqman Aden!

llvm-svn: 212055
2014-06-30 18:57:04 +00:00
Julien Lerouge
5dbf44035a lldb can interrupt waitpid, so EINTR shouldn't be an error. This fixes the case
where there is no timeout. In the case where there is a timeout though, the
code is still wrong since it doesn't check that the alarm really went off.

Without this patch, I cannot debug a program that forks itself using
sys::ExecuteAndWait with lldb.

llvm-svn: 211918
2014-06-27 18:02:54 +00:00
Chandler Carruth
35b7259047 Re-apply r211287: Remove support for LLVM runtime multi-threading.
I'll fix the problems in libclang and other projects in ways that don't
require <mutex> until we sort out the cygwin situation.

llvm-svn: 211900
2014-06-27 15:13:01 +00:00
Alp Toker
97022b0c1f Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754.

llvm-svn: 211814
2014-06-26 22:52:05 +00:00
Will Schmidt
f6e2b6e4f5 Add support for ppc64/power8 as a host
llvm-svn: 211781
2014-06-26 13:37:03 +00:00
Alp Toker
fd9ead3b6f Introduce a string_ostream string builder facilty
string_ostream is a safe and efficient string builder that combines opaque
stack storage with a built-in ostream interface.

small_string_ostream<bytes> additionally permits an explicit stack storage size
other than the default 128 bytes to be provided. Beyond that, storage is
transferred to the heap.

This convenient class can be used in most places an
std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair
would previously have been used, in order to guarantee consistent access
without byte truncation.

The patch also converts much of LLVM to use the new facility. These changes
include several probable bug fixes for truncated output, a programming error
that's no longer possible with the new interface.

llvm-svn: 211749
2014-06-26 00:00:48 +00:00
Argyrios Kyrtzidis
2cce248daa For CrashRecoveryContext::RunSafelyOnThread, propagate Darwin's PRIO_DARWIN_BG to the new thread if it is
set on the calling thread.

This allows libclang's indexing threads to propagate their priority to the clang module building threads.

rdar://17459872

llvm-svn: 211747
2014-06-25 23:54:50 +00:00
JF Bastien
80d81f27d3 Random Number Generator (llvm)
Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers.
The current implementation uses C++11 facilities and is therefore not cryptographically secure.

The RNG is salted with the text of the current command line invocation.
In addition, a user may specify a seed (reproducible builds).

In clang, the seed can be set via

-frandom-seed=X
In the back end, the seed can be set via

-rng-seed=X
This is the llvm part of the patch.
clang part: D3391

URL: http://reviews.llvm.org/D3390
Author: yln

I'm landing this for the second time, it broke Windows bots the first time around.

llvm-svn: 211705
2014-06-25 15:21:42 +00:00
Rafael Espindola
6eca6c6b38 Don't leak a file descriptor.
llvm-svn: 211699
2014-06-25 14:35:59 +00:00
Logan Chien
b6044edb18 Code cleanup.
llvm-svn: 211697
2014-06-25 13:46:17 +00:00
Alp Toker
af677c39a3 Use SourceMgr::getMemoryBuffer() in a couple of places
Cleanup only.

llvm-svn: 211656
2014-06-25 00:41:15 +00:00
Daniel Sanders
714cdca034 Revert: r211588 - [mips] Use __clear_cache builtin instead of cacheflush() in Unix Memory::InvalidateInstructionCache()
Buildbot reports a test failure on the llvm-mips-linux builder and blames r211588.
Although it doesn't appear in the blamelist, it seems it could also be r211587
(because it's committed to compiler-rt?) since they were tested together.

Reverting the most likely suspect (r211588) to confirm one way or the other.

llvm-svn: 211594
2014-06-24 13:53:56 +00:00
NAKAMURA Takumi
5859670717 Revert r211287, "Remove support for LLVM runtime multi-threading."
libclang still requires it on cygming, lack of incomplete <mutex>.

llvm-svn: 211592
2014-06-24 13:36:31 +00:00
Daniel Sanders
845944003c [mips] Use __clear_cache builtin instead of cacheflush() in Unix Memory::InvalidateInstructionCache()
MIPS64 Android bionic has removed cacheflush(). Use __clear_cache() instead for 32-bit and 64-bit MIPS

Patch by Duane Sand <Duane.Sand@imgtec.com>

llvm-svn: 211588
2014-06-24 12:26:49 +00:00
Duncan P. N. Exon Smith
2b829a7a79 Support: Move class ScaledNumber
ScaledNumber has been cleaned up enough to pull out of BFI now.  Still
work to do there (tests for shifting, bloated printing code, etc.), but
it seems clean enough for its new home.

llvm-svn: 211562
2014-06-24 00:38:09 +00:00
David Blaikie
a2e836b256 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é

llvm-svn: 211525
2014-06-23 18:28:53 +00:00
Duncan P. N. Exon Smith
ef178c4288 Support: Extract ScaledNumbers::compare()
llvm-svn: 211507
2014-06-23 17:47:40 +00:00
Zachary Turner
a6805811e7 Fix the MinGW builder. Apparently std::call_once and
std::recursive_mutex are not available on MinGW and breaks the
builder.  Revert to using a function local static and sys::Mutex
just to get the tree green until we figure out a better solution.

llvm-svn: 211424
2014-06-21 00:24:51 +00:00
Duncan P. N. Exon Smith
db0cbc8b8a Support: Write ScaledNumber::getQuotient() and getProduct()
llvm-svn: 211409
2014-06-20 21:47:47 +00:00
Hans Wennborg
7e14613d1d Fix .cpp files claiming to be header files
llvm-svn: 211334
2014-06-20 01:36:00 +00:00
Rafael Espindola
b39185a826 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

llvm-svn: 211328
2014-06-20 00:23:03 +00:00
David Blaikie
f14625fbd8 Add StringMap::insert(pair) consistent with the standard associative container concept.
Patch by Agustín Bergé.

llvm-svn: 211309
2014-06-19 20:08:56 +00:00
Justin Bogner
29837f308d Support: Add llvm::sys::fs::copy_file
A function to copy one file's contents to another.

llvm-svn: 211302
2014-06-19 19:35:39 +00:00
David Blaikie
fc988e1b73 Remove use of removed function, llvm_stop_multithreading
llvm-svn: 211291
2014-06-19 18:26:28 +00:00
Zachary Turner
9a5ecb8c07 Remove support for LLVM runtime multi-threading.
After a number of previous small iterations, the functions
llvm_start_multithreaded() and llvm_stop_multithreaded() have
been reduced essentially to no-ops.  This change removes them
entirely.

Reviewed by: rnk, dblaikie

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

llvm-svn: 211287
2014-06-19 18:18:23 +00:00
Zachary Turner
f2125306e7 Kill the LLVM global lock.
This patch removes the LLVM global lock, and updates all existing
users of the global lock to use their own mutex.    None of the
existing users of the global lock were protecting code that was
mutually exclusive with any of the other users of the global
lock, so its purpose was not being met.

Reviewed by: rnk

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

llvm-svn: 211277
2014-06-19 16:17:42 +00:00
Alp Toker
ea88c60f1e CommandLine: bail out when options get multiply registered
These errors are strictly unrecoverable and indicate serious issues such as
conflicting option names or an incorrectly linked LLVM distribution.

With this change, the errors actually get detected so tests don't pass
silently.

llvm-svn: 211260
2014-06-19 07:25:25 +00:00
JF Bastien
eeb435cbd7 Revert "Random Number Generator (llvm)"
This reverts commit cccba093090d127e0b6d17473b14c264c14c5259.

It causes build breakage.

llvm-svn: 211146
2014-06-18 06:33:23 +00:00
JF Bastien
54487ef242 Random Number Generator (llvm)
Summary:
Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers.
The current implementation uses C++11 facilities and is therefore not cryptographically secure.

The RNG is salted with the text of the current command line invocation.
In addition, a user may specify a seed (reproducible builds).

In clang, the seed can be set via
  -frandom-seed=X
In the back end, the seed can be set via
  -rng-seed=X

This is the llvm part of the patch.
clang part: D3391

Reviewers: ahomescu, rinon, nicholas, jfb

Reviewed By: jfb

Subscribers: jfb, perl

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

llvm-svn: 211145
2014-06-18 06:23:25 +00:00
Rafael Espindola
f0d707413f Merge lib/Support/WindowsError.cpp into ib/Support/ErrorHandling.cpp.
The OSX ranlib warns on files with no symbols, and lib/Support/WindowsError.cpp
was empty when building on non-windows.

llvm-svn: 211118
2014-06-17 18:06:45 +00:00
Justin Bogner
39a1f6a6f5 Support: Inject LLVM_VERSION_INFO into the Support library
Mimic r116632 in passing LLVM_VERSION_INFO from the Makefile build
system to the build. This improves the -version output of tools that
use llvm::cl under the configure+make system.

llvm-svn: 211091
2014-06-17 06:52:47 +00:00
Justin Bogner
af73db376f tools: Add a space between package version and LLVM_VERSION_INFO
This reads a little strangely. Add a space to clean it up.

llvm-svn: 211090
2014-06-17 06:52:41 +00:00
Jordan Rose
8b6500a316 Add an overload for SourceMgr::PrintMessage that takes an existing diagnostic.
llvm-svn: 211087
2014-06-17 02:15:40 +00:00
Jordan Rose
4dea0cb948 Modernize doc comments for SourceMgr.
No functionality change.

llvm-svn: 211086
2014-06-17 02:15:36 +00:00
Zachary Turner
c472800bde Revert r211066, 211067, 211068, 211069, 211070.
These were committed accidentally from the wrong branch before having
a review sign-off.

llvm-svn: 211072
2014-06-16 22:49:41 +00:00
Zachary Turner
aa7770ba44 Kill the LLVM global lock.
llvm-svn: 211069
2014-06-16 22:40:42 +00:00
Zachary Turner
3ae7ddbd11 Remove some code churn.
llvm-svn: 211068
2014-06-16 22:40:29 +00:00
Zachary Turner
c24bca926c Remove some more code out into a separate CL.
llvm-svn: 211067
2014-06-16 22:40:17 +00:00
Zachary Turner
f62557d74d Users of the llvm global mutex must now acquire it manually.
This allows the mutex to be acquired in a guarded, RAII fashion.

llvm-svn: 211066
2014-06-16 22:39:38 +00:00
Dmitri Gribenko
bb418ed93d Support/ConvertUTF: restore compatibility with MSVC, which only implements C89
llvm-svn: 211016
2014-06-16 11:22:33 +00:00
Dmitri Gribenko
4b5fc58221 Support/ConvertUTF: implement U+FFFD insertion according to the recommendation
given in the Unicode spec

That is, replace every maximal subpart of an ill-formed subsequence with one
U+FFFD.

llvm-svn: 211015
2014-06-16 11:09:46 +00:00
Artyom Skrobov
8e686bd8fe Using llvm::sys::swapByteOrder() for the common case of byte-swapping a value in place
llvm-svn: 210978
2014-06-14 13:18:07 +00:00
Artyom Skrobov
9d70ea6c1e Renaming SwapByteOrder() to getSwappedBytes()
The next commit will add swapByteOrder(), acting in-place

llvm-svn: 210973
2014-06-14 11:36:01 +00:00
Zachary Turner
517f9bc6b9 Make the error-handling functions thread-safe.
Prior to this change, error handling functions must be installed
and removed only inside of an llvm_[start/stop]_multithreading
pair.  This change allows error handling functions to be installed
any time, and from any thread.

Reviewed by: chandlerc

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

llvm-svn: 210937
2014-06-13 21:20:44 +00:00
Rafael Espindola
0df15fc77a Finishing touch for the std::error_code transition.
While std::error_code itself seems to work OK in all platforms, there
are few annoying differences with regards to the std::errc enumeration.

This patch adds a simple llvm enumeration, which will hopefully avoid build
breakages in other platforms and surprises as we get more uses of
std::error_code.

llvm-svn: 210920
2014-06-13 17:20:48 +00:00
Rafael Espindola
251ce700f0 Fix build on windows.
llvm-svn: 210873
2014-06-13 02:36:09 +00:00
Rafael Espindola
98710599c1 Remove 'using std::errro_code' from lib.
llvm-svn: 210871
2014-06-13 02:24:39 +00:00
Rafael Espindola
a507565994 Try to fix the windows build.
llvm-svn: 210837
2014-06-12 21:53:57 +00:00
Rafael Espindola
e0e308ff6d Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.

llvm-svn: 210835
2014-06-12 21:46:39 +00:00
Rafael Espindola
122d35a996 Trying to fix the windows build.
llvm-svn: 210805
2014-06-12 17:49:35 +00:00
Rafael Espindola
38dc624425 Remove system_error.h.
This is a minimal change to remove the header. I will remove the occurrences
of "using std::error_code" in a followup patch.

llvm-svn: 210803
2014-06-12 17:38:55 +00:00
Artyom Skrobov
ae8e1228ab adding re-include guards into lib/Support/reg*.h
llvm-svn: 210794
2014-06-12 16:07:56 +00:00
Rafael Espindola
53875ad05c Replace llvm::error_code with std::error_code.
llvm-svn: 210783
2014-06-12 14:11:22 +00:00
Rafael Espindola
d004f0c75f Don't import make_error_code into the llvm namespace.
llvm-svn: 210772
2014-06-12 11:58:49 +00:00
Rafael Espindola
3e0ad43a91 Prefix generic_category with std::.
Sorry I missed these before.

llvm-svn: 210740
2014-06-12 02:52:22 +00:00
Rafael Espindola
6c13f4b607 Don't put generic_category in the llvm namespace.
llvm-svn: 210737
2014-06-12 02:00:39 +00:00
Rafael Espindola
13df6cab71 Used mapWindowsError. I missed these in the initial transition.
llvm-svn: 210729
2014-06-12 01:25:33 +00:00
Rafael Espindola
1fd39ed8cc Try to fix the mingw build.
* MingW needs mapWindowsError.
* MingW is missing some entries in std::errc, but we don't use them.

llvm-svn: 210725
2014-06-12 00:24:39 +00:00
Rafael Espindola
f72719e3d6 Implement get_magic with generic tools and inline it.
llvm-svn: 210716
2014-06-11 22:53:00 +00:00
Rafael Espindola
d2cec42a1a Remove unused has_magic.
This will allow inlining get_magic, which should in turn fix one of the mingw
build problems after the switch to std::error_code.

llvm-svn: 210712
2014-06-11 21:53:22 +00:00
Rafael Espindola
cb080681ac Use std::error_code instead of llvm::error_code.
The idea of this patch is to turn llvm/Support/system_error.h into a
transitional header that just brings in the erorr_code api to the llvm
namespace. I will remove it shortly afterwards.

The cases where the general idea needed some tweaking:

* std::errc is a namespace in msvc, so we cannot use "using std::errc". I could
add an #ifdef, but there were not that many uses, so I just added std:: to
them in this patch.

* Template specialization had to be moved to the std namespace in this
patch set already.

* The msvc implementation of default_error_condition doesn't seem to
provide the same transformations as we need. Not too surprising since
the standard doesn't actually say what "equivalent" means. I fixed the
problem by keeping our old mapping and using it at error_code
construction time.

Despite these shortcomings I think this is still a good thing. Some reasons:

* The different implementations of system_error might improve over time.
* It removes 925 lines of code from llvm already.
* It removes 6313 bytes from the text segment of the clang binary when
it is built with gcc and 2816 bytes when building with clang and
libstdc++.

llvm-svn: 210687
2014-06-11 19:05:50 +00:00
Craig Topper
f86daf85d1 Convert StringMapEntry::Create to use StringRef instead of start/end pointers. Simpliies all in tree call sites. No functional change.
llvm-svn: 210638
2014-06-11 05:35:56 +00:00
Rafael Espindola
3b26d41d16 Uses generic_category instead of system_category.
Some c++ libraries (libstdc++ at least) don't seem to map to the generic
category in in the system_category's default_error_condition.

llvm-svn: 210635
2014-06-11 04:34:41 +00:00
Rafael Espindola
f6b299cd11 Remove windows_error.
MSVC doesn't seem to provide any is_error_code_enum enumeration for the
windows errors.

Fortunately very few places in llvm have to handle raw windows errors, so
we can just construct the corresponding error_code directly.

llvm-svn: 210631
2014-06-11 03:58:34 +00:00
Rafael Espindola
c056dd8e2e There is no posix_category in std, use generic_category.
llvm-svn: 210630
2014-06-11 03:49:13 +00:00
Zachary Turner
7f9340d9e1 Revert "Remove support for runtime multi-threading."
This reverts revision r210600.

llvm-svn: 210603
2014-06-10 23:15:43 +00:00
Zachary Turner
e87a554529 Remove support for runtime multi-threading.
This patch removes the functions llvm_start_multithreaded() and
llvm_stop_multithreaded(), and changes llvm_is_multithreaded()
to return a constant value based on the value of the compile-time
definition LLVM_ENABLE_THREADS.

Previously, it was possible to have compile-time support for
threads on, and runtime support for threads off, in which case
certain mutexes were not allocated or ever acquired.  Now, if the
build is created with threads enabled, mutexes are always acquired.

A test before/after patch of compiling a very large TU showed no
noticeable performance impact of this change.

Reviewers: rnk

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

llvm-svn: 210600
2014-06-10 23:01:20 +00:00
Rafael Espindola
80bf4067ff Mark a few functions noexcept.
This reduces the difference between std::error_code and llvm::error_code.

llvm-svn: 210591
2014-06-10 21:26:47 +00:00
Zachary Turner
da98615b9e Test commit, wraps some lines to fit in 80 columns.
llvm-svn: 210551
2014-06-10 18:03:04 +00:00
Stephen Canon
f8d21c729a APFloat: x - NaN needs to flip the signbit of NaN when x is a number.
Because we don't have a separate negate( ) function, 0 - NaN does double-duty as the IEEE-754 negate( ) operation, which (unlike most FP ops) *does* attach semantic meaning to the signbit of NaN.

llvm-svn: 210428
2014-06-08 16:53:31 +00:00
Alp Toker
1f616b12e7 GraphWriter: try gv before xdg-open
Avoid changing behaviour for everyone who's used to the traditional ghostview
UI, especially since it knows how to stay in the foreground unlike xdg-open.

Amendment to r210147.

llvm-svn: 210148
2014-06-04 04:11:12 +00:00
Alp Toker
99172da33d GraphWriter: support the XDG open utility
This runs a suitable viewer on Unix desktop environments specified by
Freedesktop.org (GNOME, KDE, Linux distributions etc.)

llvm-svn: 210147
2014-06-04 03:57:44 +00:00
Alp Toker
7425836c09 Process::GetRandomNumber(): fix insecure RNG
This could have generated non-random output under error conditions in release
builds.

llvm-svn: 210065
2014-06-03 03:01:03 +00:00
Alp Toker
844b48e479 Silence -Wreturn-type warning
llvm-svn: 210005
2014-06-02 04:34:10 +00:00
Alp Toker
eb71f96959 GraphWriter: tweak the program fallback order
Amend r210001 to use the classic fallback order behaviour if the requested
graphing program isn't found.

llvm-svn: 210003
2014-06-02 04:14:23 +00:00
Alp Toker
83f29343d8 GraphWriter: detect graph viewer programs at runtime
Replace the crufty build-time configure checks for program paths with
equivalent runtime logic.

This lets users install graphing tools as needed without having to reconfigure
and rebuild LLVM, while eliminating a long chain of inappropriate compile
dependencies that included GUI programs and the windowing system.

Additional features:

 * Support the OS X 'open' command to view graphs generated by any of the
   Graphviz utilities. This is an alternative to the Graphviz OS X UI which is
   no longer available on Mountain Lion.

 * Produce informative log output upon failure to indicate which programs can
   be installed to view graphs.

Ping me if this doesn't work for your particular environment.

llvm-svn: 210001
2014-06-02 01:40:04 +00:00
Saleem Abdulrasool
d2570c483b Support: add Windows ARM EH data structures
Introduce the support structures necessary to deal with the Windows ARM EH data.
These definitions are extremely aggressive about assertions to aid future use
for generation of the entries and subsequent decoding.

The names for the various fields are meant to reflect the names used by the
Visual Studio toolchain to aid communication.

Due to the complexity in reading a few of the values, there are a couple of
additional utility functions to decode the information.

In general, there are two ways to encode the unwinding information:
- packed, which places the data inline into the
  _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY structure.
- unpacked, which places the data into auxiliary structures placed into the
  .xdata section.

The set of structures allow reading of data in either encoding, with the minor
caveat that epilogue scopes need to be decoded manually by constructing the
structure from the data returned by the RuntimeFunction structure.

These definitions are meant for read-only access at the current point as the
first use of them will be to decode the exception information.

llvm-svn: 209998
2014-06-02 01:17:49 +00:00
Alp Toker
e8634eb077 Fix typos
llvm-svn: 209982
2014-05-31 21:26:28 +00:00
Simon Atanasyan
96f205e49a [yaml2obj] Add new command line option -docnum.
Input YAML file might contain multiple object file definitions.
New option `-docnum` allows to specify an ordinal number (starting from 1)
of definition used for an object file generation.

Patch reviewed by Sean Silva.

llvm-svn: 209967
2014-05-31 04:51:07 +00:00
Rafael Espindola
54f41582c2 Fix windows build.
llvm-svn: 209961
2014-05-31 03:26:57 +00:00
Rafael Espindola
a46bdb6d4d There is no std::errc::success, remove the llvm one.
llvm-svn: 209960
2014-05-31 03:21:04 +00:00
Rafael Espindola
11e569dd23 Turn errc and windows_error into enum classes.
llvm-svn: 209957
2014-05-31 02:29:28 +00:00
Rafael Espindola
c86cc04638 Use error_code() instead of error_code::succes()
There is no std::error_code::success, so this removes much of the noise
in transitioning to std::error_code.

llvm-svn: 209952
2014-05-31 01:37:45 +00:00
Peter Collingbourne
edf9cd861d Fix the behavior of ExecuteAndWait with a non-zero timeout.
llvm-svn: 209951
2014-05-31 01:36:02 +00:00
Rafael Espindola
0ba7b750ea delete dead code.
llvm-svn: 209938
2014-05-31 00:10:47 +00:00
Bradley Smith
ff8ddaa911 Fixup sys::getHostCPUFeatures crypto names so it doesn't clash with kernel headers
llvm-svn: 209506
2014-05-23 10:14:13 +00:00
Bradley Smith
71322920b1 Extend sys::getHostCPUFeatures to work on AArch64 platforms
llvm-svn: 209420
2014-05-22 11:44:34 +00:00
Eric Christopher
262770bdee Clean up language and grammar.
Based on a patch by jfcaron3@gmail.com!
PR19806

llvm-svn: 209216
2014-05-20 17:11:11 +00:00
Alp Toker
458db09b36 MemoryBuffer: Use GetNativeSystemInfo()
Removes old 4096 byte workaround. This functionality has been available since
Windows XP.

llvm-svn: 209137
2014-05-19 16:13:28 +00:00
Craig Topper
cbd5e36c2e Remove last uses of OwningPtr from llvm. As far as I can tell these method versions are not used by lldb, lld, or clang.
llvm-svn: 209103
2014-05-18 21:55:38 +00:00
Yaron Keren
a414154d8e Fix hardcoded slash to native path seperator which was exposed from llvm::sys::path.
http://reviews.llvm.org/D3687

llvm-svn: 208980
2014-05-16 13:16:30 +00:00
Alp Toker
ece806e295 MemoryBuffer: don't force mmap when stat fails
Fix error handling introduced in r127426 that could result in MemoryBuffers not
having null termination.

llvm-svn: 208396
2014-05-09 08:57:32 +00:00
Alp Toker
0c76c7e110 MemoryBuffer: remove unusued definitions
These were made redundant back in r186560.

llvm-svn: 208395
2014-05-09 08:57:06 +00:00
Argyrios Kyrtzidis
e529889ad4 [Support/MemoryBuffer] Remove the assertion that the file size did not shrink.
This can happen in practice with the user changing files and we can recover from it.

llvm-svn: 208143
2014-05-06 23:30:56 +00:00
Richard Smith
55381ccf0a Re-commit r208025, reverted in r208030, with a fix for a conformance issue
which GCC detects and Clang does not!

llvm-svn: 208033
2014-05-06 01:44:26 +00:00
Richard Smith
b38145eb67 Revert r208025, which made buildbots unhappy for unknown reasons.
llvm-svn: 208030
2014-05-06 01:26:00 +00:00
Argyrios Kyrtzidis
99abb688e5 [Support/MemoryBuffer] Rename IsVolatile -> IsVolatileSize and add a comment about the use case for the new parameter.
llvm-svn: 208026
2014-05-06 01:03:52 +00:00
Richard Smith
e9d2d57a7c Add llvm::function_ref (and a couple of uses of it), representing a type-erased reference to a callable object.
llvm-svn: 208025
2014-05-06 01:01:29 +00:00
Reid Kleckner
30c9a2d02a Include intrin.h before windows.h as a workaround for the x64 self-host
On x64, windows.h doesn't include intrin.h for intrinsics.  It just
declares them in the global namespace and uses them, expecting the
compiler to lower it as a builtin.  We basically need to do this in
clang, eventually.

llvm-svn: 208023
2014-05-06 00:57:33 +00:00
Argyrios Kyrtzidis
4c9d588352 [Support/MemoryBuffer] Move the IsVolatile check inside shouldUseMmap() and make sure to zero-initialize the rest
of the buffer if we unexpectedly reach end-of-file while reading.

llvm-svn: 208021
2014-05-06 00:51:45 +00:00
Argyrios Kyrtzidis
81db8ad5a3 [Support/MemoryBuffer] Introduce a boolean parameter (false by default) 'IsVolatile' for the open file functions.
This provides a hint that the file may be changing often so mmap is avoided.

llvm-svn: 208007
2014-05-05 21:55:51 +00:00
Kaelyn Takata
5b23e5bb46 Select bdver2 instead of bdver1 if TBM support is present on models < 0x10.
Tested that the right -target-cpu is set in the clang -cc1 command line
when running "clang -march=native -E -v - </dev/null" on both an FX-8150
and an FX-8350. Both are family 15h; the FX-8150 (Bulldozer processor)
reports a model number of 1, and the FX-8350 (Piledriver processor)
reports a model number of 2.

llvm-svn: 207973
2014-05-05 16:32:10 +00:00
Benjamin Kramer
b0e4e7faba Add a description for AMD's bdver4 (aka Excavator).
This is just bdver3 + AVX2 + BMI2.

llvm-svn: 207847
2014-05-02 15:47:07 +00:00
Benjamin Kramer
4f8fb8ff6c raw_ostream: Forward declare OpenFlags and include FileSystem.h only where necessary.
llvm-svn: 207593
2014-04-29 23:26:49 +00:00
Duncan P. N. Exon Smith
4098e101ab BranchProb: Simplify printing code
llvm-svn: 207559
2014-04-29 17:07:42 +00:00
Duncan P. N. Exon Smith
c69dc1873d blockfreq: Defer to BranchProbability::scale() (again)
Change `BlockFrequency` to defer to `BranchProbability::scale()` and
`BranchProbability::scaleByInverse()`.

This removes `BlockFrequency::scale()` from its API (and drops the
ability to see the remainder), but the only user was the unit tests.  If
some code in the future needs an API that exposes the remainder, we can
add something to `BranchProbability`, but I find that unlikely.

llvm-svn: 207550
2014-04-29 16:31:29 +00:00
Duncan P. N. Exon Smith
6272612edf Support: remove unnecessary namespace
llvm-svn: 207545
2014-04-29 16:15:39 +00:00
Duncan P. N. Exon Smith
795a469331 Support: Add BranchProbability::scale() and ::scaleByInverse()
Add API to `BranchProbability` for scaling big integers.  Next job is to
rip the logic out of `BlockMass` and `BlockFrequency`.

llvm-svn: 207544
2014-04-29 16:15:35 +00:00
Craig Topper
b663bffa27 [C++] Use 'nullptr'.
llvm-svn: 207394
2014-04-28 04:05:08 +00:00
Chandler Carruth
d64474b10f Use raw_ostream and Format.h on Windows so that we don't have to roll
our own portability system to cope without snprintf.

llvm-svn: 207389
2014-04-28 01:57:46 +00:00
Chandler Carruth
c4a558290b Update the Windows TimeValue formatting to match the new formatting on
Unix-like OSes.

llvm-svn: 207388
2014-04-28 01:24:35 +00:00
Chandler Carruth
f3676d26ee Teach the pass manager's execution dump to print the current time before
each line. This is particularly nice for tracking which run of
a particular pass over a particular function was slow.

This also required making the TimeValue string much more useful. First,
there is a standard format for writing out a date and time. Let's use
that rather than strings that would have to be parsed. Second, actually
output the nanosecond resolution that timevalue claims to have.

This is proving useful working on PR19499, so I figured it would be
generally useful to commit.

llvm-svn: 207385
2014-04-27 23:59:25 +00:00
NAKAMURA Takumi
dd0e1d3175 cl::ParseCommandLineOptions(): Use StringRef to receive sys::path::filename() instead of std::string.
llvm-svn: 206990
2014-04-23 14:51:23 +00:00
Chandler Carruth
5442ebf19c [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
definition below all of the header #include lines, lib/Support edition.

llvm-svn: 206847
2014-04-22 03:07:47 +00:00
Chandler Carruth
5038051a3d [Modules] Followup to r206822 to add a DEBUG_TYPE which is used on ARM
and PPC, but not x86.

llvm-svn: 206830
2014-04-21 23:58:10 +00:00
Chandler Carruth
15c7b91ac2 [Modules] Make Support/Debug.h modular. This requires it to not change
behavior based on other files defining DEBUG_TYPE, which means it cannot
define DEBUG_TYPE at all. This is actually better IMO as it forces folks
to define relevant DEBUG_TYPEs for their files. However, it requires all
files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't
already. I've updated all such files in LLVM and will do the same for
other upstream projects.

This still leaves one important change in how LLVM uses the DEBUG_TYPE
macro going forward: we need to only define the macro *after* header
files have been #include-ed. Previously, this wasn't possible because
Debug.h required the macro to be pre-defined. This commit removes that.
By defining DEBUG_TYPE after the includes two things are fixed:

- Header files that need to provide a DEBUG_TYPE for some inline code
  can do so by defining the macro before their inline code and undef-ing
  it afterward so the macro does not escape.

- We no longer have rampant ODR violations due to including headers with
  different DEBUG_TYPE definitions. This may be mostly an academic
  violation today, but with modules these types of violations are easy
  to check for and potentially very relevant.

Where necessary to suppor headers with DEBUG_TYPE, I have moved the
definitions below the includes in this commit. I plan to move the rest
of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big
enough.

The comments in Debug.h, which were hilariously out of date already,
have been updated to reflect the recommended practice going forward.

llvm-svn: 206822
2014-04-21 22:55:11 +00:00
David Blaikie
d2e576d088 ManagedStatic is never built with a null constructor, remove support for it.
llvm-svn: 206492
2014-04-17 20:30:35 +00:00
Craig Topper
c2260fc0ab [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
llvm-svn: 206252
2014-04-15 06:32:26 +00:00
James Molloy
db53ec7e4f [ARM64] Add big endian target arm64_be.
llvm-svn: 206197
2014-04-14 17:37:53 +00:00
Chandler Carruth
feba5396be [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.

llvm-svn: 206152
2014-04-14 06:42:56 +00:00
Chandler Carruth
0ecbcadf5d [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. =]

llvm-svn: 206149
2014-04-14 05:11:27 +00:00
Chandler Carruth
27e852b6ee [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.

llvm-svn: 206147
2014-04-14 03:55:11 +00:00
Benjamin Kramer
f6c0615b06 Retire llvm::array_endof in favor of non-member std::end.
While there make array_lengthof constexpr if we have support for it.

llvm-svn: 206112
2014-04-12 16:15:53 +00:00
David Majnemer
60de53a3e4 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.

llvm-svn: 205955
2014-04-10 07:37:33 +00:00
Simon Atanasyan
fdc9dc7bfb Use range-based for loops. No functionality change.
llvm-svn: 205953
2014-04-10 06:02:49 +00:00
David Majnemer
38564aab17 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.

llvm-svn: 205914
2014-04-09 17:04:27 +00:00
Filipe Cabecinhas
ee5a23fda4 Revert "YAMLIO: Encode ambiguous hex strings explicitly"
This reverts commit r205839.

It broke several tests in lld.

llvm-svn: 205857
2014-04-09 14:35:17 +00:00
David Majnemer
c51365b164 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.

llvm-svn: 205839
2014-04-09 07:56:27 +00:00
Craig Topper
52173239da [C++11] Replace some comparisons with 'nullptr' with simple boolean checks to reduce verbosity.
llvm-svn: 205829
2014-04-09 04:20:00 +00:00
Craig Topper
ee78063a54 [C++11] Make use of 'nullptr' in the Support library.
llvm-svn: 205697
2014-04-07 04:17:22 +00:00
Argyrios Kyrtzidis
239746d5db [Support] Modify LockFileManager::waitForUnlock() to return info about how the lock was released.
llvm-svn: 205683
2014-04-06 03:19:31 +00:00
David Blaikie
bbd3350377 Simplify compression API by compressing into a SmallVector rather than a MemoryBuffer
This is the other half of r205676.

llvm-svn: 205677
2014-04-05 21:53:04 +00:00
David Blaikie
20021670e1 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.

llvm-svn: 205676
2014-04-05 21:26:44 +00:00
Saleem Abdulrasool
db61071b5a 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.

llvm-svn: 205219
2014-03-31 16:34:41 +00:00
Chandler Carruth
a46b65cb1f [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.

llvm-svn: 205143
2014-03-30 12:07:07 +00:00
Chandler Carruth
d14cbcc2fb Don't mark the declarations of the TSan annotation functions as weak.
That causes references to them to be weak references which can collapse
to null if no definition is provided. We call these functions
unconditionally, so a definition *must* be provided. Make the
definitions provided in the .cpp file weak by re-declaring them as weak
just prior to defining them. This should keep compilers which cannot
attach the weak attribute to the definition happy while actually
resolving the symbols correctly during the link.

You might ask yourself upon reading this commit log: how did *any* of
this work before? Well, fun story. It turns out we have some code in
Support (BumpPtrAllocator) which both uses virtual dispatch and has
out-of-line vtables used by that virtual dispatch. If you move the
virtual dispatch into its header in *just* the right way, the optimizer
gets to devirtualize, and remove all references to the vtable. Then the
sad part: the references to this one vtable were the only strong symbol
uses in the support library for llvm-tblgen AFAICT. At least, after
doing something just like this, these symbols stopped getting their weak
definition and random calls to them would segfault instead.

Yay software.

llvm-svn: 205137
2014-03-30 11:20:25 +00:00
Tim Northover
15a133dcd6 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.

llvm-svn: 205132
2014-03-30 07:25:23 +00:00
Saleem Abdulrasool
e7827c151a 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.

llvm-svn: 205130
2014-03-30 07:19:31 +00:00
Saleem Abdulrasool
960aa13461 Support: normalize the default triple on Unix
This will fix cross-compiling buildbots (e.g. cygwin).  This is in the same vein
as SVN r205070.  Apply this to fix the cross-compiling scenario, even though the
preferred solution is to update the build system to normalize the embedded
triple rather than perform this at runtime every time.  This is meant to tide us
over until that approach is fleshed out and applied.

llvm-svn: 205120
2014-03-30 03:22:37 +00:00
Tim Northover
2f13163a84 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.

llvm-svn: 205090
2014-03-29 10:18:08 +00:00
Saleem Abdulrasool
b1a54393dd Windows: canonicalise the default windows triple
Canonicalise the default triple that is used on Windows.  This should hopefully
fix the MSVC buildbots.

llvm-svn: 205070
2014-03-29 01:08:53 +00:00
Christian Pirker
487402828a Add ARM big endian Target (armeb, thumbeb)
Reviewed at http://llvm-reviews.chandlerc.com/D3095

llvm-svn: 205007
2014-03-28 14:35:30 +00:00
Chandler Carruth
c769006334 [Allocator Cleanup] Move generic pointer alignment helper out of an
out-of-line private static method and into the collection of inline
alignment helpers in MathExtras.h.

llvm-svn: 204995
2014-03-28 09:08:14 +00:00
Chandler Carruth
9cd355c3b2 [Allocator Cleanup] Make the growth of the "slab" size of the
BumpPtrAllocator significantly less strange by making it a simple
function of the number of slabs allocated rather than by making it
a recurrance. I *think* the previous behavior was essentially that the
size of the slabs would be doubled after the first 128 were allocated,
and then doubled again each time 64 more were allocated, but only if
every allocation packed perfectly into the slab size. If not, the wasted
space wouldn't be counted toward increasing the size, but allocations
over the size threshold *would*. And since the allocations over the size
threshold might be much larger than the slab size, this could have
somewhat surprising consequences where we rapidly grow the slab size.

This currently requires adding state to the allocator to track the
number of slabs currently allocated, but that isn't too bad. I'm
planning further changes to the allocator that will make this state fall
out even more naturally.

It still doesn't fully decouple the growth rate from the allocations
which are over the size threshold. That fix is coming later.

This specific fix will allow making the entire thing into a more
stateless device and lifting the parameters into template parameters
rather than runtime parameters.

llvm-svn: 204993
2014-03-28 08:53:25 +00:00
Saleem Abdulrasool
d42d60171a 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.

llvm-svn: 204977
2014-03-27 22:50:05 +00:00
Yaron Keren
6478416f74 Disable Visual C++ warning 4722 about aborting a destructor,
it has no value for us.

llvm-svn: 204704
2014-03-25 08:42:49 +00:00
Nuno Lopes
79d18a66ec remove a bunch of unused private methods
found with a smarter version of -Wunused-member-function that I'm playwing with.
Appologies in advance if I removed someone's WIP code.

 include/llvm/CodeGen/MachineSSAUpdater.h            |    1 
 include/llvm/IR/DebugInfo.h                         |    3 
 lib/CodeGen/MachineSSAUpdater.cpp                   |   10 --
 lib/CodeGen/PostRASchedulerList.cpp                 |    1 
 lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp    |   10 --
 lib/IR/DebugInfo.cpp                                |   12 --
 lib/MC/MCAsmStreamer.cpp                            |    2 
 lib/Support/YAMLParser.cpp                          |   39 ---------
 lib/TableGen/TGParser.cpp                           |   16 ---
 lib/TableGen/TGParser.h                             |    1 
 lib/Target/AArch64/AArch64TargetTransformInfo.cpp   |    9 --
 lib/Target/ARM/ARMCodeEmitter.cpp                   |   12 --
 lib/Target/ARM/ARMFastISel.cpp                      |   84 --------------------
 lib/Target/Mips/MipsCodeEmitter.cpp                 |   11 --
 lib/Target/Mips/MipsConstantIslandPass.cpp          |   12 --
 lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp              |   21 -----
 lib/Target/NVPTX/NVPTXISelDAGToDAG.h                |    2 
 lib/Target/PowerPC/PPCFastISel.cpp                  |    1 
 lib/Transforms/Instrumentation/AddressSanitizer.cpp |    2 
 lib/Transforms/Instrumentation/BoundsChecking.cpp   |    2 
 lib/Transforms/Instrumentation/MemorySanitizer.cpp  |    1 
 lib/Transforms/Scalar/LoopIdiomRecognize.cpp        |    8 -
 lib/Transforms/Scalar/SCCP.cpp                      |    1 
 utils/TableGen/CodeEmitterGen.cpp                   |    2 
 24 files changed, 2 insertions(+), 261 deletions(-)

llvm-svn: 204560
2014-03-23 17:09:26 +00:00
Argyrios Kyrtzidis
20ab4e365b [Support] Follow up to r204426, for LockFileManager, make the given path absolute so relative paths are properly handled in both Windows and Unix.
llvm-svn: 204520
2014-03-21 21:45:07 +00:00
Argyrios Kyrtzidis
bcc47f3612 [Support] Make sure LockFileManager works correctly with relative paths.
llvm-svn: 204426
2014-03-21 02:31:56 +00:00
Argyrios Kyrtzidis
01f7e30c52 [Support] Make sure sys::fs::remove can remove symbolic links and make sure LockFileManager can handle a symbolic link that points nowhere.
llvm-svn: 204422
2014-03-21 01:25:37 +00:00
Rafael Espindola
27241df819 Remove dead and incorrect code.
is_symlink was always false since it was using stat instead of lstat.

llvm-svn: 204361
2014-03-20 17:39:04 +00:00
Saleem Abdulrasool
e1749d42be Support: add support to identify WinCOFF/ARM objects
Add the Windows COFF ARM object file magic.  This enables the LLVM tools to
interact with COFF object files for Windows on ARM.

llvm-svn: 203761
2014-03-13 07:02:35 +00:00
Saleem Abdulrasool
0064454d1b 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.

llvm-svn: 203611
2014-03-11 22:05:42 +00:00
Rafael Espindola
fe9037915e 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.

llvm-svn: 203596
2014-03-11 18:40:24 +00:00
Craig Topper
813f30aa7e [C++11] Remove 'virtual' keyword from methods marked with 'override' keyword.
llvm-svn: 203442
2014-03-10 03:53:12 +00:00
Bob Wilson
c6be80dd79 Fix inconsistent whitespace.
llvm-svn: 203423
2014-03-09 23:17:28 +00:00
Benjamin Kramer
aaa10dc26a [C++11] Revert uses of lambdas with array_pod_sort.
Looks like GCC implements the lambda->function pointer conversion differently.

llvm-svn: 203294
2014-03-07 21:52:38 +00:00
Benjamin Kramer
f042a6ba0a [C++11] Convert sort predicates into lambdas.
No functionality change.

llvm-svn: 203288
2014-03-07 21:35:39 +00:00
Argyrios Kyrtzidis
5995978627 [Support/LockFileManager] Re-apply r203137 and r203138 but use symbolic links only on unix.
Reid Kleckner pointed out that we can't use symbolic links on Windows.

llvm-svn: 203162
2014-03-06 20:53:58 +00:00
Saleem Abdulrasool
95baea0ae3 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).

llvm-svn: 203160
2014-03-06 20:47:11 +00:00
Reid Kleckner
ac8bdd52a6 Revert create_symbolic_link and both depending changes
This reverts commits r203136, r203137, and r203138.

This code doesn't build on Windows.  Even on Vista+, Windows requires
elevated privileges to create a symlink.  Therefore we can't use
symlinks in the compiler.  We'll have to find another approach.

llvm-svn: 203143
2014-03-06 19:07:35 +00:00
Argyrios Kyrtzidis
02c8344289 [Support/LockFileManager] Make the LockFileManager more robust against races.
There was a race where:
- The LockFileManager tries to own the lock file and fails.
- The other owner then releases and removes the lock file.
- The LockFileManager tries to read the owner info from the lock file but fails now.

In such a case have LockFileManager try to get ownership again, instead of error'ing out.

llvm-svn: 203138
2014-03-06 17:37:10 +00:00
Argyrios Kyrtzidis
109d0095e7 [Support/LockFileManager] Use symbolic link for the lock file.
Hard links do not work on SMB network directories, and it causes us to fail
to build clang module files if the module cache is in such a directory.
rdar://15944959

llvm-svn: 203137
2014-03-06 17:37:04 +00:00
Argyrios Kyrtzidis
22dfe498cd [Support/FileSystem] Introduce llvm::sys::fs::create_symbolic_link().
llvm-svn: 203136
2014-03-06 17:36:46 +00:00
Ahmed Charles
2878961906 Add <cstddef> for use of std::ptrdiff_t.
llvm-svn: 203086
2014-03-06 06:13:54 +00:00
Ahmed Charles
09c5cffd68 Fix break by qualifying ptrdiff_t with std::.
llvm-svn: 203084
2014-03-06 06:05:26 +00:00
Ahmed Charles
52ce0c101e 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.

llvm-svn: 203083
2014-03-06 05:51:42 +00:00
Ben Langmuir
e1c9edcf79 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.

llvm-svn: 202999
2014-03-05 19:56:30 +00:00
Ahmed Charles
afa05d8aeb [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.

llvm-svn: 202959
2014-03-05 10:27:34 +00:00
Ahmed Charles
4a96a15754 [C++11] Replace OwningPtr::take() with OwningPtr::release().
llvm-svn: 202957
2014-03-05 10:19:29 +00:00
Ahmed Charles
b597077d38 Remove unnecessary variables.
Found self-hosting clang-cl on windows. :)

llvm-svn: 202935
2014-03-05 05:04:00 +00:00
Richard Smith
ef4019bc68 Remove dependence on std::function.
llvm-svn: 202902
2014-03-04 22:13:07 +00:00
Richard Smith
9fdbb897e9 Add support for arbitrary functors to CrashRecoveryContext.
llvm-svn: 202895
2014-03-04 21:48:49 +00:00
Benjamin Kramer
662a42200f APFloat: Add a move ctor and operator=
llvm-svn: 202883
2014-03-04 20:26:51 +00:00
Chandler Carruth
436597fe00 [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.

llvm-svn: 202838
2014-03-04 12:24:34 +00:00
Craig Topper
a2684f4ad1 [C+11] Add 'override' keyword to methods in the support library.
llvm-svn: 202791
2014-03-04 06:24:11 +00:00
Benjamin Kramer
6748fa3a23 Revert "[C++11] Replace LLVM atomics with std::atomic."
Breaks the MSVC build.
DataStream.cpp(44): error C2552: 'llvm::Statistic::Value' : non-aggregates cannot be initialized with initializer list

llvm-svn: 202731
2014-03-03 18:02:34 +00:00
Benjamin Kramer
d55423bf4c [C++11] Replace LLVM atomics with std::atomic.
With C++11 we finally have a standardized way to specify atomic operations. Use
them to replace the existing custom implemention. Sadly the translation is not
entirely trivial as std::atomic allows more fine-grained control over the
atomicity. I tried to preserve the old semantics as well as possible.

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

llvm-svn: 202730
2014-03-03 17:53:30 +00:00
Benjamin Kramer
3ac154a395 [C++11] Replace llvm::tie with std::tie.
The old implementation is no longer needed in C++11.

llvm-svn: 202644
2014-03-02 13:30:33 +00:00
Chandler Carruth
6e284b6c8f [C++11] Replace LLVM_STATIC_ASSERT with static_assert, we now have
access to it on all host toolchains.

llvm-svn: 202642
2014-03-02 13:10:45 +00:00
Craig Topper
b0056a4ca7 Switch all uses of LLVM_OVERRIDE to just use 'override' directly.
llvm-svn: 202621
2014-03-02 09:09:27 +00:00
Chandler Carruth
db906c8499 [C++11] Switch all uses of the llvm_move macro to use std::move
directly, and remove the macro.

llvm-svn: 202612
2014-03-02 04:08:41 +00:00
Benjamin Kramer
803ba41365 Now that we have C++11, turn simple functors into lambdas and remove a ton of boilerplate.
No intended functionality change.

llvm-svn: 202588
2014-03-01 11:47:00 +00:00
Chandler Carruth
df9f7f4aec [C++11] Remove the R-value reference #if usage from the ADT and Support
libraries. It is now always 1 in LLVM builds.

llvm-svn: 202580
2014-03-01 09:27:28 +00:00
Mark Seaborn
83fd697a96 Fix RWMutex to be thread-safe when pthread_rwlock is not available
lib/Support/RWMutex.cpp contains an implementation of RWMutex that
uses pthread_rwlock, but when pthread_rwlock is not available (such as
under NaCl, when using newlib), it silently falls back to using the
no-op definition in lib/Support/Unix/RWMutex.inc, which is not
thread-safe.

Fix this case to be thread-safe by using a normal mutex.

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

llvm-svn: 202570
2014-03-01 04:30:32 +00:00
Justin Bogner
56a8b49ffd CommandLine: Exit successfully for -version and -help
Tools that use the CommandLine library currently exit with an error
when invoked with -version or -help. This is unusual and non-standard,
so we'll fix them to exit successfully instead.

I don't expect that anyone relies on the current behaviour, so this
should be a fairly safe change.

llvm-svn: 202530
2014-02-28 19:08:01 +00:00
Alexander Kornienko
4ec82215fc Re-apply r200853, which should not crash after Clang plugins were converted to loadable modules in r201256.
llvm-svn: 202404
2014-02-27 14:47:37 +00:00
Ben Langmuir
6633cebb29 Revert "Use StringRef in raw_fd_ostream constructor"
This reverts commit r202225, which may cause a performance regression.

llvm-svn: 202338
2014-02-27 02:09:10 +00:00
Eric Christopher
1b1ce405c8 Remove unnecessary llvm:: qualification.
llvm-svn: 202316
2014-02-26 23:27:16 +00:00
NAKAMURA Takumi
c90c7cc416 [CMake] BUILD_SHARED_LIBS: Fixup for r202261: Give PULIC to system_libs in LLVMSupport.
llvm-svn: 202263
2014-02-26 12:18:55 +00:00
NAKAMURA Takumi
7442e7c058 [CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase opportunity for parallel build.
target_link_libraries(INTERFACE) doesn't bring inter-target dependencies in add_library,
although final targets have dependencies to whole dependent libraries.
It makes most libraries can be built in parallel.

target_link_libraries(PRIVATE) is used to shaared library.
Each dependent library is linked to the target.so, and its user will not see its grandchildren.
For example,

  - libclang.so has sufficient libclang*.a(s).
  - c-index-test requires just only libclang.so.

FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing.
llvm-svn: 202241
2014-02-26 06:53:16 +00:00
Ben Langmuir
bcef7bd317 Use StringRef in raw_fd_ostream constructor
llvm-svn: 202225
2014-02-26 03:21:00 +00:00
Rafael Espindola
d89ca7eab7 Replace the F_Binary flag with a F_Text one.
After this I will set the default back to F_None. The advantage is that
before this patch forgetting to set F_Binary would corrupt a file on windows.
Forgetting to set F_Text produces one that cannot be read in notepad, which
is a better failure mode :-)

llvm-svn: 202052
2014-02-24 18:20:12 +00:00
Christian Pirker
1c907c9022 Add AArch64 big endian Target (aarch64_be)
llvm-svn: 202024
2014-02-24 11:34:50 +00:00
Rafael Espindola
02877b8373 Share a createUniqueEntity implementation between unix and windows.
The only extra bit of functionality that had to be exposed for this be be
implemented in Path.cpp is opening a file in rw mode.

llvm-svn: 202005
2014-02-24 03:07:41 +00:00
Rafael Espindola
8ca486865e Delete dead code.
llvm-svn: 202001
2014-02-24 01:07:38 +00:00
Rafael Espindola
900c898665 Use static instead of an anonymous namespace.
llvm-svn: 201983
2014-02-23 15:16:03 +00:00
Rafael Espindola
65a11242a7 Simplify remove, create_directory and create_directories.
Before this patch they would take an boolean argument to say if the path
already existed. This was redundant with the returned error_code which is able
to represent that. This allowed for callers to incorrectly check only the
existed flag instead of first checking the error code.

Instead, pass in a boolean flag to say if the previous (non-)existence should be
an error or not.

Callers of the of the old simple versions are not affected. They still ignore
the previous (non-)existence as they did before.

llvm-svn: 201979
2014-02-23 13:56:14 +00:00
Rafael Espindola
15c86f7c1d Use simpler form of llvm::sys::fs::remove.
llvm-svn: 201975
2014-02-23 13:37:37 +00:00
NAKAMURA Takumi
ac921a3563 Simplify linking to system libraries
The LLVMSupport library implementation consolidates all dependencies on
system libraries.  Move the logic gathering system libraries out of
'cmake/modules/LLVM-Config.cmake' and into 'lib/Support/CMakeLists.txt'.
Use the target_link_libraries() command there to tell CMake about the
link dependencies of the LLVMSupport implementation.  CMake will
automatically propagate this to all targets that link LLVMSupport
directly or indirectly.

We still need to build knowledge of system library dependencies into
'llvm-config'.  Store the list of libraries needed in a property on
LLVMSupport and teach 'tools/llvm-config/CMakeLists.txt' to retrieve it
from there.

Drop all calls to 'link_system_libs' and 'get_system_libs' from our
CMake code.  Replace their implementations with a warning that explains
the calls are no longer necessary.  Also drop from 'LLVMConfig.cmake'
the HAVE_* and related variables that were published there only to allow
'get_system_libs' to run outside our build process.

Contributed by Brad King.

llvm-svn: 201969
2014-02-23 06:27:04 +00:00
Logan Chien
6d8c685e44 Don't inline get[S|U]LEB128Size() until they are proved to be hot.
llvm-svn: 201939
2014-02-22 15:39:39 +00:00
Michael J. Spencer
56a120aa9d [Support] Correctly handle zero length inputs to UTF conversion functions on Windows.
llvm-svn: 201811
2014-02-20 20:46:23 +00:00
Rafael Espindola
83453b6625 Use mkdir instead of stat+mkdir.
This is an optimistic version of create_diretories: it tries to create the
directory first and looks at the parent only if that fails.

Running strace on "mkdir -p" shows that it is pessimistic, calling mkdir on
every element of the path. We could implement that if needed.

In any case, with both strategies there is no reason to call stat, just check
the return of mkdir.

llvm-svn: 201347
2014-02-13 16:58:19 +00:00
Rafael Espindola
709dbafdc3 Remove dead code.
llvm-svn: 201327
2014-02-13 13:45:45 +00:00
Rafael Espindola
248ced2efa Use simpler version of sys::fs::exists when possible.
llvm-svn: 201289
2014-02-13 04:00:35 +00:00