Commit Graph

2467 Commits

Author SHA1 Message Date
Eric Christopher 85bd745e77 Convert more unsigned char -> uint8_t.
llvm-svn: 183053
2013-05-31 22:34:52 +00:00
Eric Christopher d0910436e7 Fix comment.
llvm-svn: 183052
2013-05-31 22:34:48 +00:00
Eric Christopher 606ecda4a1 Move "unsigned char" -> "uint8_t".
llvm-svn: 183051
2013-05-31 22:34:34 +00:00
Michael Gottesman 0c622ea8d3 Implement IEEE-754R 2008 nextUp/nextDown functions in the guise of the function APFloat::next(bool nextDown).
rdar://13852078

llvm-svn: 182945
2013-05-30 18:07:13 +00:00
Michael Gottesman 9d406f4ec7 [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for use in APFloat IEEE-754R 2008 nextUp/nextDown function.
rdar://13852078

llvm-svn: 182801
2013-05-28 19:50:20 +00:00
Eric Christopher fcee6f0abc ArrayRef-ize MD5 and clean up a few variable names.
Add a stringize method to make dumping a bit easier, and add a testcase
exercising a few different paths.

llvm-svn: 182692
2013-05-24 23:08:17 +00:00
Michael J. Spencer df1ecbd734 Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.
llvm-svn: 182680
2013-05-24 22:23:49 +00:00
Benjamin Kramer 534d3a4670 Remove the Copied parameter from MemoryObject::readBytes.
There was exactly one caller using this API right, the others were relying on
specific behavior of the default implementation. Since it's too hard to use it
right just remove it and standardize on the default behavior.

Defines away PR16132.

llvm-svn: 182636
2013-05-24 10:54:58 +00:00
Ahmed Bougacha aa79068157 MC: Disassembled CFG reconstruction.
This patch builds on some existing code to do CFG reconstruction from
a disassembled binary:
- MCModule represents the binary, and has a list of MCAtoms.
- MCAtom represents either disassembled instructions (MCTextAtom), or
  contiguous data (MCDataAtom), and covers a specific range of addresses.
- MCBasicBlock and MCFunction form the reconstructed CFG. An MCBB is
  backed by an MCTextAtom, and has the usual successors/predecessors.
- MCObjectDisassembler creates a module from an ObjectFile using a
  disassembler. It first builds an atom for each section. It can also
  construct the CFG, and this splits the text atoms into basic blocks.

MCModule and MCAtom were only sketched out; MCFunction and MCBB were
implemented under the experimental "-cfg" llvm-objdump -macho option.
This cleans them up for further use; llvm-objdump -d -cfg now generates
graphviz files for each function found in the binary.

In the future, MCObjectDisassembler may be the right place to do
"intelligent" disassembly: for example, handling constant islands is just
a matter of splitting the atom, using information that may be available
in the ObjectFile. Also, better initial atom formation than just using
sections is possible using symbols (and things like Mach-O's
function_starts load command).

This brings two minor regressions in llvm-objdump -macho -cfg:
- The printing of a relocation's referenced symbol.
- An annotation on loop BBs, i.e., which are their own successor.

Relocation printing is replaced by the MCSymbolizer; the basic CFG
annotation will be superseded by more related functionality.

llvm-svn: 182628
2013-05-24 01:07:04 +00:00
Eric Christopher db142d4e1e Add cmake bits for md5.
llvm-svn: 182349
2013-05-21 01:30:38 +00:00
Eric Christopher e1dc3c45e6 Add an md5 library derived from a public domain implementation for dwarf4
type signature computation.

llvm-svn: 182348
2013-05-21 01:28:35 +00:00
Bob Wilson 111b0b6da4 Remove declaration of __clear_cache for __APPLE__. <rdar://problem/13924072>
This fixes a bootstrapping problem with builds for Apple ARM targets.
Clang had the wrong prototype for __clear_cache with ARM targets.  Rafael
fixed that in clang svn r181784 and r181810, but without those changes,
we can't build this code for ARM because clang reports an error about the
declaration in Memory.inc not matching the builtin declaration. Some of our
buildbots need to use an older compiler that doesn't have the clang fix.
Since __clear_cache is never used here when __APPLE__ is defined, I'm just
conditionalizing the declaration to match that. I also moved the declaration
of sys_icache_invalidate inside the conditional for __APPLE__ while I was at
it.

llvm-svn: 182223
2013-05-19 20:33:51 +00:00
Tim Northover 77d0a4ac62 Invalidate instruction cache when setting memory to be executable.
lli's remote MCJIT code calls setExecutable just prior to running
code. In line with Darwin behaviour this seems to be the place to
invalidate any caches needed so that relocations can take effect
properly.

llvm-svn: 182213
2013-05-19 15:28:16 +00:00
Timur Iskhodzhanov 0588513e79 Fix build on Windows
llvm-svn: 181873
2013-05-15 09:00:30 +00:00
David Blaikie 041f1aa3e2 Use only explicit bool conversion operators
BitVector/SmallBitVector::reference::operator bool remain implicit since
they model more exactly a bool, rather than something else that can be
boolean tested.

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

One behavior change (YAMLParser) was made, though no test case is
included as I'm not sure how to reach that code path. Essentially any
comparison of llvm::yaml::document_iterators would be invalid if neither
iterator was at the end.

This helped uncover a couple of bugs in Clang - test cases provided for
those in a separate commit along with similar changes to `operator bool`
instances in Clang.

llvm-svn: 181868
2013-05-15 07:36:59 +00:00
Rafael Espindola e16befb5f6 Fix __clear_cache declaration.
This fixes the build with gcc in gnu++98 and gnu++11 mode.

llvm-svn: 181811
2013-05-14 18:06:14 +00:00
Jakob Stoklund Olesen abc3d23ccb Recognize sparc64 as an alias for sparcv9 triples.
Patch by Brad Smith!

llvm-svn: 181808
2013-05-14 17:47:27 +00:00
Rafael Espindola 17268dc192 Declare __clear_cache.
GCC declares __clear_cache in the gnu modes (-std=gnu++98,
-std=gnu++11), but not in the strict modes (-std=c++98, -std=c++11). This patch
declares it and therefore fixes the build when using one of the strict modes.

llvm-svn: 181785
2013-05-14 13:02:37 +00:00
Shuxin Yang bbddbacd2e Fix a bug that APFloat::fusedMultiplyAdd() mistakenly evaluate "14.5f * -14.5f + 225.0f" to 225.0f.
llvm-svn: 181715
2013-05-13 18:03:12 +00:00
Alexander Kornienko 72a196a159 Better output for long help strings for command-line options.
Summary:
This patch allows using \n inside long help strings for command-line
options, so that all lines are equally indented. This is not a perfect solution,
as we don't (and probably don't want to) know about terminal width, but it
allows to format long help strings somehow readable without manually padding
them with spaces. A motivating example is -help output from clang-format (source
code in tools/clang-format/ClangFormat.cpp, see cl options offset, length,
style, and dump-config).

Reviewers: atrick, alexfh

Reviewed By: alexfh

CC: llvm-commits, rafael

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

llvm-svn: 181608
2013-05-10 17:15:51 +00:00
Daniel Malea f83beab4bd Add line tracking support to FormattedStream
- previously formatted_raw_ostream tracked columns, now it tracks lines too
- used by (upcoming) DebugIR pass to know the line number to connect to each IR
  instruction

llvm-svn: 181463
2013-05-08 20:29:10 +00:00
Andrew Trick 7cb710d58c Implemented public interface for modifying registered (not positional or sink options) command line options at runtime.
Patch by Dan Liew!

llvm-svn: 181254
2013-05-06 21:56:35 +00:00
Andrew Trick 0537a98878 Support command line option categories.
Patch by Dan Liew!

llvm-svn: 181253
2013-05-06 21:56:23 +00:00
Dmitri Gribenko 3238fb7595 Add ArrayRef constructor from None, and do the cleanups that this constructor enables
Patch by Robert Wilhelm.

llvm-svn: 181138
2013-05-05 00:40:33 +00:00
Tim Northover 6c26b327ef AArch64: use __clear_cache under GCCish environments
AArch64 is going to need some kind of cache-invalidation in order to
successfully JIT since it has a weak memory-model. This is provided by
a __clear_cache builtin in libgcc, which acts very much like the
32-bit ARM equivalent (on platforms where it exists).

llvm-svn: 181129
2013-05-04 18:52:44 +00:00
Tim Northover fee13d1e11 Allow host triple to be correctly overridden in CMake builds
The intended semantics mirror autoconf, where the user is able to
specify a host triple, but if it's left to the build system then
"config.guess" is invoked for the default.

This also renames the LLVM_HOSTTRIPLE define to LLVM_HOST_TRIPLE to
fit in with the style of the surrounding defines.

llvm-svn: 181112
2013-05-04 07:36:23 +00:00
Ulrich Weigand 90c9abdd27 [SystemZ] Support System Z as host architecture
The llvm::sys::AddSignalHandler function (as well as related routines) in
lib/Support/Unix/Signals.inc currently registers a signal handler routine
via "sigaction".  When this handler is called due to a SIGSEGV, SIGILL or
similar signal, it will show a stack backtrace, deactivate the handler,
and then simply return to the operating system.  The intent is that the
OS will now retry execution at the same location as before, which ought
to again trigger the same error condition and cause the same signal to be
delivered again.  Since the hander is now deactivated, the OS will take
its default action (usually, terminate the program and possibly create
a core dump).

However, this method doesn't work reliably on System Z:  With certain
signals (namely SIGILL, SIGFPE, and SIGTRAP), the program counter stored
by the kernel on the signal stack frame (which is the location where
execution will resume) is not the instruction that triggered the fault,
but then instruction *after it*.  When the LLVM signal handler simply
returns to the kernel, execution will then resume at *that* address,
which will not trigger the problem again, but simply go on and execute
potentially unrelated code leading to random errors afterwards.

To fix this, the patch simply goes and re-raises the signal in question
directly from the handler instead of returning from it.  This is done
only on System Z and only for those signals that have this particular
problem.

llvm-svn: 181010
2013-05-03 12:22:11 +00:00
Richard Sandiford a238c5e08f [SystemZ] Add llvm::Triple::systemz
First step towards reinstating the SystemZ backend.  Tests will be
included in the main backend patch.

llvm-svn: 181007
2013-05-03 11:05:17 +00:00
Benjamin Kramer b44c4275d5 X86: Add target description for btver2; make autodetection logic aware of AVX.
llvm-svn: 181005
2013-05-03 10:20:08 +00:00
Aaron Ballman fd86e16dbd Fixes a buffer overrun where the allocated buffer wasn't large enough to accommodate the closing quote escape rules in some instances.
llvm-svn: 180836
2013-05-01 02:53:14 +00:00
Benjamin Kramer 83e2a44a13 Inline variable into the #ifdef block where it's used.
llvm-svn: 180688
2013-04-28 07:47:04 +00:00
Joerg Sonnenberger 447440907e Fix typo. Stupid me.
llvm-svn: 180686
2013-04-27 22:32:54 +00:00
Joerg Sonnenberger 66241831dc Only use cxxabi.h's demangler, if it is actually available.
llvm-svn: 180684
2013-04-27 22:12:32 +00:00
Aaron Ballman 31c0adc68c Testing for _XCR_XFEATURE_ENABLED_MASK instead of a specific MSVC version because some MSVC 2010 SP1 installations do not have the _xgetbv intrinsic. Patch thanks to Serge Pavlov!
llvm-svn: 180125
2013-04-23 17:38:44 +00:00
Alexey Samsonov fdcff04ad5 Fixup for r180094: properly use MSan interface functions
llvm-svn: 180103
2013-04-23 13:35:32 +00:00
Alexey Samsonov 0c9f1bfae5 Tell MSan that memory initialized by libz is valid
llvm-svn: 180094
2013-04-23 12:17:46 +00:00
Hans Wennborg 63761d4bc4 Add llvm_unreachable after fully covered switch to pacify GCC
llvm-svn: 180087
2013-04-23 10:12:16 +00:00
Alexey Samsonov 28acf056e1 Add more guards around zlib-dependent code
llvm-svn: 180084
2013-04-23 08:57:30 +00:00
Alexey Samsonov 2fb337e77a Add basic zlib support to LLVM. This would allow to use compression/uncompression in selected LLVM tools.
llvm-svn: 180083
2013-04-23 08:28:39 +00:00
Reid Kleckner 74679a93b2 [Support] Fix argv string escape bug on Windows
Summary:
This is http://llvm.org/PR15802.  Backslashes preceding double quotes in
arguments must be escaped.  The interesting bit is that all other
backslashes should *not* be escaped, because the un-escaping logic is
only triggered by the presence of a double quote character.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 180035
2013-04-22 19:03:55 +00:00
Craig Topper 7af39d7de0 Convert windows line endings to linux/unix line endings.
llvm-svn: 179995
2013-04-22 05:38:01 +00:00
Rafael Espindola 41cb64f4fa Make the host endianness check an integer constant expression.
I will remove the isBigEndianHost function once I update clang.

The ifdef logic is designed to
* not use configure/cmake to avoid breaking -arch i686 -arch ppc.
* default to little endian
* be as small as possible

It looks like sys/endian.h is the preferred header on most modern BSD systems,
but it is better to change this in a followup patch as machine/endian.h is
available on FreeBSD, OpenBSD, NetBSD and OS X.

llvm-svn: 179527
2013-04-15 14:44:24 +00:00
Rafael Espindola cd848c0866 Add a function to check if an argument list is too long.
This will be used in clang to decide if it should create an @file or not. It
will be tested on the clang side.

Patch by Nathan Froyd.

llvm-svn: 179285
2013-04-11 14:06:34 +00:00
Douglas Gregor 0cb6846090 <rdar://problem/13551789> Fix a race in the LockFileManager.
It's possible for the lock file to disappear and the owning process to
return before we're able to see the generated file. Spin for a little
while to see if it shows up before failing. 

llvm-svn: 178909
2013-04-05 20:53:57 +00:00
Douglas Gregor 6bd4d8cf72 <rdar://problem/13551789> Fix yet another race in unique_file.
If the directory that will contain the unique file doesn't exist when
we tried to create the file, but another process creates it before we
get a chance to try creating it, we would bail out rather than try to
create the unique file.

llvm-svn: 178908
2013-04-05 20:48:36 +00:00
Michael J. Spencer b8055cbc9d [Support][FileSystem] Fix identify_magic for big endian ELF.
llvm-svn: 178905
2013-04-05 20:10:04 +00:00
Reid Kleckner bd39f21336 [Support] Disable assertion dialogs from the MSVC debug CRT
Summary:
Sets a report hook that emulates pressing "retry" in the "abort, retry,
ignore" dialog box that _CrtDbgReport normally raises.  There are many
other ways to disable assertion reports, but this was the only way I
could find that still calls our exception handler.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 178880
2013-04-05 16:18:03 +00:00
Aaron Ballman 5e6d20524a Ensuring that both bits are set, and not just a combination of one or the other.
llvm-svn: 178674
2013-04-03 18:00:22 +00:00
Aaron Ballman edc03c660c Testing for Visual Studio 2010 SP1 or greater before calling the _xgetbv intrinsic. This also fixes a minor code formatting issue.
llvm-svn: 178666
2013-04-03 16:28:24 +00:00
Aaron Ballman 5f7c680fdc Second pass at addressing PR15351 by explicitly checking for AVX support
when getting the host processor information.  It emits a .byte sequence on GNUC compilers to work around lack of xgetbv support with older assemblers, and resolves a comment typo found in the previous patch.

llvm-svn: 178636
2013-04-03 12:25:06 +00:00
Aaron Ballman 9c0f0af54f Rolling back the AVX support patch due to breaking a gcc 4.6 build bot that doesn't understand the xgetbv instruction for some reason. Will revisit when time permits.
llvm-svn: 178614
2013-04-03 03:11:39 +00:00
Aaron Ballman 56be6ba5e4 Attempting to fix the build on older GCC versions.
llvm-svn: 178604
2013-04-03 01:39:37 +00:00
Aaron Ballman 6bc0dfc7bd This patch addresses PR15351 by explicitly checking for AVX support
when getting the host processor information.

llvm-svn: 178598
2013-04-03 00:33:32 +00:00
Benjamin Kramer a73cc5eead Put private class into an anonmyous namespace.
llvm-svn: 178420
2013-03-30 15:23:08 +00:00
Jean-Luc Duprat 89fe247094 SmallVector and SmallPtrSet allocations now power-of-two aligned.
This time tested on both OSX and Linux.

llvm-svn: 178377
2013-03-29 22:07:12 +00:00
Rafael Espindola de65751493 Revert "Fix allocations of SmallVector and SmallPtrSet so they are more prone to"
This reverts commit 617330909f0c26a3f2ab8601a029b9bdca48aa61.

It broke the bots:

/home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:150: PushPopTest
/home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:118: Failure
Value of: v[i].getValue()
  Actual: 0
Expected: value
Which is: 2

llvm-svn: 178334
2013-03-29 07:11:21 +00:00
Jean-Luc Duprat 67ce1472b4 Fix allocations of SmallVector and SmallPtrSet so they are more prone to
being power-of-two sized.

llvm-svn: 178332
2013-03-29 05:45:22 +00:00
Chad Rosier 7ce810cb84 Don't try to generate crash diagnostics if we had an I/O failure. It's very
likely the crash diagnostics generation will fail as well.
Part of rdar://13296693

llvm-svn: 178163
2013-03-27 18:30:00 +00:00
Chad Rosier 583b4d3961 Add a boolean parameter to the llvm::report_fatal_error() function to indicated
if crash diagnostics should be generated.  By default this is enabled.
Part of rdar://13296693

llvm-svn: 178161
2013-03-27 18:27:54 +00:00
Chad Rosier 654190a12d Add a boolean parameter to the ExecuteAndWait static function to indicated
if execution failed.  ExecuteAndWait returns -1 upon an execution failure, but
checking the return value isn't sufficient because the wait command may
return -1 as well.  This new parameter is to be used by the clang driver in a
subsequent commit.
Part of rdar://13362359

llvm-svn: 178087
2013-03-26 23:35:00 +00:00
Nick Lewycky 8d9716265e Add missing file to cmake build.
llvm-svn: 177963
2013-03-26 01:29:15 +00:00
Nick Lewycky 4e06def851 Add a new watchdog timer interface. The interface does not permit handling timeouts, so
it's only really useful if you're going to crash anyways. Use it in the pretty stack trace
printer to kill the compiler if we hang while printing the stack trace.

llvm-svn: 177962
2013-03-26 01:27:52 +00:00
Chandler Carruth 0a9875abfe Revert r177543: Add timing of the IR parsing code with a new
-time-ir-parsing flag

This breaks the layering of the Support library. We can't add an
implementation side to IRReader because it refers directly to entities
only accessible as part of the IR, AsmParser, and BitcodeReader
libraries. It can only be used in a context where all of those libraries
will be available.

We'll need to find some other way to get this functionality, and
hopefully solve the long-standing layering problem of IRReader.h...

llvm-svn: 177695
2013-03-22 02:20:34 +00:00
Douglas Gregor a86ddf0411 <rdar://problem/13477190> On Darwin, use DARWIN_USER_TEMP_DIR or DARWIN_USER_CACHE_DIR for the system temporary directory.
The DARWIN_USER_TEMP_DIR and DARWIN_USER_CACHE_DIR configuration
settings are more idiomatic for Darwin than the TMPDIR environment
variable.

llvm-svn: 177669
2013-03-21 21:46:10 +00:00
Jakub Staszak 773be0ce1f Use pre-inc, pre-dec when possible.
They are generally faster (at least not slower) than post-inc, post-dec.

llvm-svn: 177608
2013-03-20 23:56:19 +00:00
Eli Bendersky 83b359d4c8 Add timing of the IR parsing code with a new -time-ir-parsing flag
llvm-svn: 177543
2013-03-20 17:00:25 +00:00
Hao Liu be99cc3a3e Fix AsmPrinter crashes with assertion. Bug 15318 in Bugzilla
llvm-svn: 177472
2013-03-20 01:46:36 +00:00
Michael J. Spencer d932d41190 [Support][Path][Windows] Fix dangling else. Don't call CloseHandle when CloseFD is false.
llvm-svn: 177175
2013-03-15 19:25:47 +00:00
Akira Hatanaka 7239a6003f Android uses cacheflush(long start, long end, long flags) for MIPS.
Patch by Stephen Hines.

llvm-svn: 177101
2013-03-14 19:01:00 +00:00
Michael J. Spencer 42ad29fa05 [Support] Fix lifetime of file descriptors when using MemoryBuffer.
Clients of MemoryBuffer::getOpenFile expect it not to take ownership of the file
descriptor passed in. So don't.

llvm-svn: 176995
2013-03-14 00:20:10 +00:00
Matt Beaumont-Gay a182be8a91 Don't crash if write_impl() leaves less buffer space available than expected.
This was tickled by a Clang diagnostic; Clang test case to follow.

llvm-svn: 176911
2013-03-12 23:55:24 +00:00
Michael J. Spencer 20a11b2534 [Support][Path] Don't inf loop if creating the parent directory fails.
Patch by Paul Robinson.

llvm-svn: 176908
2013-03-12 22:32:39 +00:00
Michael J. Spencer 2343a74aeb [Support][MemoryBuffer] Use sys::fs::mapped_file_region instead of sys::Path::MapInFilePages.
This gives us memory mapped file I/O on Windows.

llvm-svn: 176886
2013-03-12 19:28:19 +00:00
Craig Topper fa9888fce7 Remove an unused member variable from HelpPrinter. Move another member variable to be a local variable in the only method that uses it.
llvm-svn: 176778
2013-03-09 23:29:37 +00:00
Jan Wen Voung 7857a64909 Disable statistics on Release builds and move tests that depend on -stats.
Summary:
Statistics are still available in Release+Asserts (any +Asserts builds),
and stats can also be turned on with LLVM_ENABLE_STATS.

Move some of the FastISel stats that were moved under DEBUG()
back out of DEBUG(), since stats are disabled across the board now.

Many tests depend on grepping "-stats" output.  Move those into
a orig_dir/Stats/. so that they can be marked as unsupported
when building without statistics.

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

llvm-svn: 176733
2013-03-08 22:56:31 +00:00
Argyrios Kyrtzidis db4443f7af In llvm::MemoryBuffer::getFile() remove an unnecessary stat call check.
The sys::fs::is_directory() check is unnecessary because, if the filename is
a directory, the function will fail anyway with the same error code returned.
Remove the check to avoid an unnecessary stat call.

Someone needs to review on windows and see if the check is necessary there or not.

llvm-svn: 176386
2013-03-01 22:48:51 +00:00
Argyrios Kyrtzidis eed2dc5769 [PathV2] In llvm::sys::fs::unique_file, make sure it doesn't fall into an infinite loop by constantly trying
to create the parent path.

This can happen if the path is a relative filename and the current directory was removed.
Thanks to Daniel D. for the hint in fixing it.

llvm-svn: 176226
2013-02-28 00:38:19 +00:00
Roman Divacky fd666e9e3c Add support for autodetection of ADM bdver2.
llvm-svn: 176130
2013-02-26 22:41:01 +00:00
Eli Bendersky 705085da37 Previously, parsing capability of the .debug_frame section was added
to lib/DebugInfo, with dumping in llvm-dwarfdump. This patch adds
initial ability to parse and dump CFA instructions contained in
entries.

To keep it manageable, the patch omits some more advanced capabilities
(accounted in TODOs):

* Parsing of instructions with BLOCK arguments (expression lists)
* Dumping of actual instruction arguments (currently only names are
dumped). This is quite tricky since the dumper has to effectively
"interpret" the instructions.

llvm-svn: 175820
2013-02-21 22:53:19 +00:00
David Blaikie ef04593de1 Provide a "None" value for convenience when using Optional<T>()
This implementation of NoneType/None does have some holes but I haven't
found one that doesn't - open to improvement.

llvm-svn: 175696
2013-02-21 00:27:28 +00:00
Pedro Artigas 0c09481d6b as the allocator is reset zero out the number of bytes allocated, this was just
missed before but probably what was intended.

llvm-svn: 175687
2013-02-20 23:30:56 +00:00
Erik Verbruggen ef40cdd95b Fix accidental concatenation for "outputuntil" in the -debug-buffer-size option description.
llvm-svn: 175682
2013-02-20 22:33:46 +00:00
Dan Gohman f857cd7518 Rewrite comments.
llvm-svn: 175651
2013-02-20 19:28:46 +00:00
Krzysztof Parzyszek 12ba711f35 Add comment in Memory.inc explaining r175646.
llvm-svn: 175650
2013-02-20 19:25:09 +00:00
Dan Gohman 5cdb345883 SIGQUIT is a "kill" signal, rather than an "int" signal, in this context.
llvm-svn: 175648
2013-02-20 19:15:01 +00:00
Krzysztof Parzyszek 798679e140 On PowerPC, the cache-flush instructions dcbf and icbi are treated as
loads. On FreeBSD, add PROT_READ page protection flag before flushing
cache.

llvm-svn: 175646
2013-02-20 18:24:30 +00:00
Jakub Staszak 6605c604b9 Move part of APInt implementation from header to cpp file. These methods
require call cpp file anyway, so we wouldn't gain anything by keeping them
inline.

llvm-svn: 175579
2013-02-20 00:17:42 +00:00
Dan Gohman 3e1729484f Update a portability kludge to keep it in sync with changes in the code
which uses it. This is not ideal, but it ought to at least restore the
behavior to what it was before.

llvm-svn: 175571
2013-02-19 22:38:58 +00:00
Dan Gohman 782609e146 Whitelist files and block devices instead of blacklisting fifos and
character devices.

llvm-svn: 175549
2013-02-19 19:36:55 +00:00
Dan Gohman 22954dbb7e Don't trust st_size of a character device. This fixes using
/dev/stdin as an input when stdin is connected to a tty, for example.

No test, because it's difficult to write a reasonably portable test
for this. /dev/stdin isn't a character device when stdin is redirected
from a file or connected to a pipe.

llvm-svn: 175542
2013-02-19 18:57:53 +00:00
Alexey Samsonov f940f0c417 Fix initialization-order bug in llvm::Support::TimeValue. TimeValue::now() is explicitly called during module initialization of lib/Support/Process.cpp. It reads the field of global object PosixZeroTime, which is not guaranteed to be initialized at this point. Found by AddressSanitizer with -fsanitize=init-order option.
llvm-svn: 175509
2013-02-19 11:35:39 +00:00
Benjamin Kramer 6ecb1e78a9 Make helpers static. Add missing include so LLVMInitializeObjCARCOpts gets C linkage.
llvm-svn: 175264
2013-02-15 12:30:38 +00:00
Evgeniy Stepanov a5b58f9b3b Workaround an MSan false positive.
llvm-svn: 175156
2013-02-14 12:18:32 +00:00
Guy Benyei 83c74e9fad Add static cast to unsigned char whenever a character classification function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration.
llvm-svn: 175006
2013-02-12 21:21:59 +00:00
Evgeniy Stepanov 1f5a71492d More MSan/ASan annotations.
This change lets us bootstrap LLVM/Clang under ASan and MSan. It contains
fixes for 2 issues:

- X86JIT reads return address from stack, which MSan does not know is
  initialized.
- bugpoint tests run binaries with RLIMIT_AS. This does not work with certain
  Sanitizers.

We are no longer including config.h in Compiler.h with this change.

llvm-svn: 174306
2013-02-04 07:03:24 +00:00
Tim Northover e0e3aefdd3 Add AArch64 as an experimental target.
This patch adds support for AArch64 (ARM's 64-bit architecture) to
LLVM in the "experimental" category. Currently, it won't be built
unless requested explicitly.

This initial commit should have support for:
    + Assembly of all scalar (i.e. non-NEON, non-Crypto) instructions
      (except the late addition CRC instructions).
    + CodeGen features required for C++03 and C99.
    + Compilation for the "small" memory model: code+static data <
      4GB.
    + Absolute and position-independent code.
    + GNU-style (i.e. "__thread") TLS.
    + Debugging information.

The principal omission, currently, is performance tuning.

This patch excludes the NEON support also reviewed due to an outbreak of
batshit insanity in our legal department. That will be committed soon bringing
the changes to precisely what has been approved.

Further reviews would be gratefully received.

llvm-svn: 174054
2013-01-31 12:12:40 +00:00
Evgeniy Stepanov 130fdcd225 Annotate BumpPtrAllocator for MemorySanitizer.
This change adds MemorySanitizer annotations to BumpPtrAllocator to
improve report quality.

llvm-svn: 174051
2013-01-31 09:58:59 +00:00
Dmitri Gribenko b311f4e84a Move UTF conversion routines from clang/lib/Basic to llvm/lib/Support
This is required to use them in TableGen.

llvm-svn: 173923
2013-01-30 12:05:05 +00:00
Edwin Vane 44338e00f8 Fix gcc/printf/ISO C++ warning
Remove the use of the 't' length modifier to avoid a gcc warning. Based
on usage, 32 bits of precision is good enough for printing a stack
offset for a stack trace.

't' length modifier isn't in C++03 but it *is* in C++11. Added a FIXME
to reintroduce once LLVM makes the switch to C++11.

Reviewer: gribozavr
llvm-svn: 173711
2013-01-28 19:34:42 +00:00
Benjamin Kramer b361adbb64 APFloat: Make sure that we get a well-formed x87 NaN when converting from a smaller type.
Fixes PR15054.

llvm-svn: 173459
2013-01-25 17:01:00 +00:00
Andrew Trick b36388a1cb ScheduleDAG: colorize the DOT graph and improve formatting.
llvm-svn: 173431
2013-01-25 07:45:25 +00:00
Eli Bendersky 0893e1079d Initial patch for x32 ABI support.
Add the x32 environment kind to the triple, and separate the concept of
pointer size and callee save stack slot size, since they're not equal
on x32.

llvm-svn: 173175
2013-01-22 18:02:49 +00:00
Tim Northover 29178a348a Make APFloat constructor require explicit semantics.
Previously we tried to infer it from the bit width size, with an added
IsIEEE argument for the PPC/IEEE 128-bit case, which had a default
value. This default value allowed bugs to creep in, where it was
inappropriate.

llvm-svn: 173138
2013-01-22 09:46:31 +00:00
Jordan Rose e1f76583dd Add llvm::hexDigitValue to convert single characters to hex.
This is duplicated in a couple places in the codebase. Adopt this in APFloat.

llvm-svn: 172851
2013-01-18 21:45:30 +00:00
Peter Collingbourne a51c6ed608 Introduce llvm::sys::getProcessTriple() function.
In r143502, we renamed getHostTriple() to getDefaultTargetTriple()
as part of work to allow the user to supply a different default
target triple at configure time.  This change also affected the JIT.
However, it is inappropriate to use the default target triple in the
JIT in most circumstances because this will not necessarily match
the current architecture used by the process, leading to illegal
instruction and other such errors at run time.

Introduce the getProcessTriple() function for use in the JIT and
its clients, and cause the JIT to use it.  On architectures with a
single bitness, the host and process triples are identical.  On other
architectures, the host triple represents the architecture of the
host CPU, while the process triple represents the architecture used
by the host CPU to interpret machine code within the current process.
For example, when executing 32-bit code on a 64-bit Linux machine,
the host triple may be 'x86_64-unknown-linux-gnu', while the process
triple may be 'i386-unknown-linux-gnu'.

This fixes JIT for the 32-on-64-bit (and vice versa) build on non-Apple
platforms.

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

llvm-svn: 172627
2013-01-16 17:27:22 +00:00
Timur Iskhodzhanov 6c704ebbf1 Revert r171829 "Split changeset_ty using iterators instead of loops" as it breaks the VS2008 build
llvm-svn: 172411
2013-01-14 14:13:06 +00:00
Dmitri Gribenko 226fea5bd6 Remove redundant 'llvm::' qualifications
llvm-svn: 172358
2013-01-13 16:01:15 +00:00
Jordan Rose ceb1dbb41f SMDiagnostic: don't emit ranges if there are /any/ multibyte characters.
Right now, only OS X has a way to determine the column width of a string
(PR14910). Until we have a good way to deal with this, we just won't
print carets, source ranges, or fixits for SMDiagnostic if the source line
has multibyte characters in it.

llvm-svn: 172164
2013-01-11 02:37:55 +00:00
Jordan Rose efd8f80ed5 Add basic fix-its to SMDiagnostic.
Like Clang's FixItHint, SMFixIt represents an insertion, replacement, or
removal of source text. One or more fix-its can be emitted as part of
a diagnostic, and will be printed below the source range line to show the
user how they can fix their code.

Currently, the only client of SMFixIt is clang-tblgen; thus, the tests for
this behavior live in clang/test/TableGen/tg-fixits.td. If/when SMFixIt is
adopted within LLVM itself, those tests should be moved to the LLVM suite.

llvm-svn: 172086
2013-01-10 18:50:15 +00:00
Douglas Gregor 056eafd420 Fix a race condition in the lock-file manager: once the lock file is
gone, check for the actual file we care about.

llvm-svn: 172033
2013-01-10 02:01:35 +00:00
Douglas Gregor 95585ab6a4 Fix a race condition in llvm::sys::path::unique_file: when we end up
failing to create the unique file because the path doesn't exist,
don't fail if someone else manages to create the path before we do.

llvm-svn: 172032
2013-01-10 01:58:46 +00:00
Argyrios Kyrtzidis eb9ae76864 Move the internal PrintStackTrace function that is used for llvm::sys::PrintStackTraceOnErrorSignal(),
into a new function llvm::sys::PrintStackTrace, so that it's available to clients for logging purposes.

llvm-svn: 171989
2013-01-09 19:42:40 +00:00
Nick Kledzik 0dcef84b13 Fix memory leak in YAML I/O.
Stop using BumpPtrAllocator for HNodes because
they have fields (vector, map) which require HNode 
destructors to be run.

llvm-svn: 171896
2013-01-08 21:04:44 +00:00
Eric Christopher 72a529566c Remove the llvm-local DW_TAG_vector_type tag and add a test to
make sure that vector types do work.

llvm-svn: 171833
2013-01-08 01:53:52 +00:00
Lenny Maiorani fc5496823c Split changeset_ty using iterators instead of loops.
llvm-svn: 171829
2013-01-08 01:08:52 +00:00
Eric Christopher 9948d5eb6f Remove what appears to be a dead llvm-specific debug tag.
llvm-svn: 171821
2013-01-08 00:16:33 +00:00
Jordan Rose e8f1eaea8a Change SMRange to be half-open (exclusive end) instead of closed (inclusive)
This is necessary not only for representing empty ranges, but for handling
multibyte characters in the input. (If the end pointer in a range refers to
a multibyte character, should it point to the beginning or the end of the
character in a char array?) Some of the code in the asm parsers was already
assuming this anyway.

llvm-svn: 171765
2013-01-07 19:00:49 +00:00
Shuxin Yang 4fb504fec1 Implement APFloat::isDenormal()
llvm-svn: 171764
2013-01-07 18:59:35 +00:00
Chandler Carruth b5429f43b8 Eric thought that Darwin was right to use -1 consistently rather than
leaving this undefined, and despite the sentence in the standard that
seems to require it, I'll cede the point and assume its a bug in the
wording. Other parts of POSIX regularly allow for things to be -1
instead of undefined, this should too. Makes things more consistent too.

This should have to real impact for folks though.

llvm-svn: 171574
2013-01-05 00:42:50 +00:00
Chandler Carruth 2aaec89fd0 Try to suppress the use of clock_gettime on Darwin which apparantly
defines _POSIX_CPUTIME but doesn't support the clock_* functions.

I don't test the value of _POSIX_CPUTIME because the spec merely says
that if it is defined, the CPU-specific timers are available, whereas it
says that _POSIX_TIMERS must be defined and defined to a value greater
than zero. However, this may not work, as the POSIX spec clearly states:

  "If the symbolic constant _POSIX_CPUTIME is defined, then the symbolic
  constant _POSIX_TIMERS shall also be defined by the implementation to
  have the value 200112L."

If this doesn't work, I'll add more hacks for Darwin.

llvm-svn: 171565
2013-01-05 00:11:21 +00:00
Chandler Carruth b79a7aa541 Fix an obvious typo spotted by Reid Kleckner, and breaking windows builds.
llvm-svn: 171559
2013-01-04 23:46:04 +00:00
Chandler Carruth ef7f968e09 Add time getters to the process interface for requesting the elapsed
wall time, user time, and system time since a process started.

For walltime, we currently use TimeValue's interface and a global
initializer to compute a close approximation of total process runtime.

For user time, this adds support for an somewhat more precise timing
mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock
selected.

For system time, we have to do a full getrusage call to extract the
system time from the OS. This is expensive but unavoidable.

In passing, clean up the implementation of the old APIs and fix some
latent bugs in the Windows code. This might have manifested on Windows
ARM systems or other systems with strange 64-bit integer behavior.

The old API for this both user time and system time simultaneously from
a single getrusage call. While this results in fewer system calls, it
also results in a lower precision user time and if only user time is
desired, it introduces a higher overhead. It may be worthwhile to switch
some of the pass timers to not track system time and directly track user
and wall time. The old API also tracked walltime in a confusing way --
it just set it to the current walltime rather than providing any measure
of wall time since the process started the way buth user and system time
are tracked. The new API is more consistent here.

The plan is to eventually implement these methods for a *child* process
by using the wait3(2) system call to populate an rusage struct
representing the whole subprocess execution. That way, after waiting on
a child process its stats will become accurate and cheap to query.

llvm-svn: 171551
2013-01-04 23:19:55 +00:00
Nick Kledzik 11964f2a8f Fix how YAML I/O detects flow sequences.
Update test case to verify flow sequence is
written as a flow sequence.

llvm-svn: 171514
2013-01-04 19:32:00 +00:00
Chandler Carruth 9fb823bbd4 Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

llvm-svn: 171366
2013-01-02 11:36:10 +00:00
Chandler Carruth be81023d74 Resort the #include lines in include/... and lib/... with the
utils/sort_includes.py script.

Most of these are updating the new R600 target and fixing up a few
regressions that have creeped in since the last time I sorted the
includes.

llvm-svn: 171362
2013-01-02 10:22:59 +00:00
Chandler Carruth 76fbeef95a Remove an unused method on Program.
I'm simplifying this interface as much as I can before merging it with
the new process interface.

llvm-svn: 171334
2012-12-31 23:44:47 +00:00
Chandler Carruth db8842f9f3 Remove an unused method on the Program class.
llvm-svn: 171332
2012-12-31 23:38:28 +00:00
Chandler Carruth acd64becb1 Go ahead and get rid of the old page size interface and convert all the
users over to the new one. No sense maintaining this "compatibility"
layer it seems.

llvm-svn: 171331
2012-12-31 23:31:56 +00:00
Chandler Carruth 15dcad9e36 Flesh out a page size accessor in the new API.
Implement the old API in terms of the new one. This simplifies the
implementation on Windows which can now re-use the self_process's once
initialization.

llvm-svn: 171330
2012-12-31 23:23:35 +00:00
Chandler Carruth b12634bf80 Remove an unused function in the old Process interface.
llvm-svn: 171327
2012-12-31 22:17:59 +00:00
Chandler Carruth 5473dfb099 Switch this code to a more idiomatic double using namespace directive.
Fix a truly odd namespace qualifier that was flat out wrong in the
process. The fully qualified namespace would have been
llvm::sys::TimeValue, llvm::TimeValue makes no sense.

llvm-svn: 171292
2012-12-31 11:45:20 +00:00
Chandler Carruth 304de3c424 Delete a cut/paste-o from r171290. Very sorry about the noise.
llvm-svn: 171291
2012-12-31 11:40:04 +00:00
Chandler Carruth 5412246d8b Suppress a MSVC warning complaining about the code working as intended.
llvm-svn: 171290
2012-12-31 11:39:02 +00:00
Chandler Carruth 97683aa2fa Begin sketching out the process interface.
The coding style used here is not LLVM's style because this is modeled
after a Boost interface and thus done in the style of a candidate C++
standard library interface. I'll probably end up proposing it as
a standard C++ library if it proves to be reasonably portable and
useful.

This is just the most basic parts of the interface -- getting the
process ID out of it. However, it helps sketch out some of the boiler
plate such as the base class, derived class, shared code, and static
factory function. It also introduces a unittest so that I can
incrementally ensure this stuff works.

However, I've not even compiled this code for Windows yet. I'll try to
fix any Windows fallout from the bots, and if I can't fix it I'll revert
and get someone on Windows to help out. There isn't a lot more that is
mandatory, so soon I'll switch to just stubbing out the Windows side and
get Michael Spencer to help with implementation as he can test it
directly.

llvm-svn: 171289
2012-12-31 11:17:50 +00:00
Nick Lewycky d192517cf3 Fix whitespace. No functionality change.
llvm-svn: 171051
2012-12-25 06:13:25 +00:00
Richard Smith 045e4f1365 Don't call back() on an empty SmallVector. Found by -fsanitize=enum!
llvm-svn: 170968
2012-12-22 00:15:13 +00:00
Roman Divacky a229186a82 Remove duplicate includes.
llvm-svn: 170902
2012-12-21 17:06:44 +00:00
Bill Wendling 3d7b0b8ac7 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170502
2012-12-19 07:18:57 +00:00
Hao Liu 10be3b20f1 Define getHostCPUFeatures for ARM Linux platform
llvm-svn: 170085
2012-12-13 02:40:20 +00:00
Benjamin Kramer 36b0f12474 YAMLIO: Remove all of the template instantiation hacks, I don't see why they're necessary and it breaks linking of the unit tests.
Also comes with a clang-format run on the cpp file, it had major style violations.

llvm-svn: 170036
2012-12-12 22:40:02 +00:00
Nick Kledzik f54b15a86d Fix calls to getAsSignedInteger() to use long long - not int64_t
llvm-svn: 170030
2012-12-12 21:42:49 +00:00
Benjamin Kramer cbe058412a Fix the build on case sensitive file systems.
llvm-svn: 170021
2012-12-12 20:55:44 +00:00
Nick Kledzik f60a9279ea Initial implementation of a utility for converting native data
structures to and from YAML using traits.  The first client will
be the test suite of lld.  The documentation will show up at:

   http://llvm.org/docs/YamlIO.html

llvm-svn: 170019
2012-12-12 20:46:15 +00:00
Eli Bendersky abe546368b Make NaCl naming consistent. The triple OSType is called NaCl and is represented
textually as NativeClient. Also added a link to the native client project for
readers unfamiliar with it.

A Clang patch will follow shortly.

llvm-svn: 169291
2012-12-04 18:37:26 +00:00
Chandler Carruth 802d755533 Sort includes for all of the .h files under the 'lib' tree. These were
missed in the first pass because the script didn't yet handle include
guards.

Note that the script is now able to handle all of these headers without
manual edits. =]

llvm-svn: 169224
2012-12-04 07:12:27 +00:00
Chandler Carruth dd7ca93abc Add a comment about the requirement that the Windows.h header be last.
This comment has the dual effect of blocking reorderings with the
sort_include script.

llvm-svn: 169221
2012-12-04 07:04:57 +00:00
Michael J. Spencer 7fe24f5744 [Support] Make FileOutputBuffer work on Windows.
llvm-svn: 169167
2012-12-03 22:09:52 +00:00
Michael J. Spencer 20abb2027f [Support][FileSystem] Fix open mode in resize_file on Windows.
llvm-svn: 169166
2012-12-03 22:09:31 +00:00
Michael J. Spencer 1ad8dff4bf Revert the header sort on this file.
"Windows.h" includes <Windows.h> which defines a bunch of stuff it shouldn't
(even with all the restriction macros). We have no control over this file, so
make it's scope as small as possible.

llvm-svn: 169165
2012-12-03 22:07:00 +00:00
Chandler Carruth ed0881b2a6 Use the new script to sort the includes of every file under lib.
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

llvm-svn: 169131
2012-12-03 16:50:05 +00:00
Eric Christopher c7e43fffc5 Add support for fission attributes/forms/operations -> string.
llvm-svn: 169056
2012-11-30 23:20:43 +00:00
Alexey Samsonov 2b431d97aa Fix a bug in APFloat.cpp: declare APFloat after fltSemantics it
uses. APFloat::convert() takes the pointer to the fltSemantics
variable, which is later accessed it in ~APFloat() desctructor.
That is, semantics must still be alive at the moment we delete
APFloat.

Found by experimental AddressSanitizer use-after-scope checker.

llvm-svn: 169047
2012-11-30 22:27:54 +00:00
Chandler Carruth f12e3a67db Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES.
Rationale:
1) This was the name in the comment block. ;]
2) It matches Clang's __has_feature naming convention.
3) It matches other compiler-feature-test conventions.

Sorry for the noise. =]

I've also switch the comment block to use a \brief tag and not duplicate
the name.

llvm-svn: 168996
2012-11-30 11:45:22 +00:00
Eli Bendersky 10f22d7054 Add backreference matching capabilities to Support/Regex, with
appropriate unit tests. This change in itself is not expected to
affect any functionality at this point, but it will serve as a
stepping stone to improve FileCheck's variable matching capabilities.

Luckily, our regex implementation already supports backreferences,
although a bit of hacking is required to enable it. It supports both
Basic Regular Expressions (BREs) and Extended Regular Expressions
(EREs), without supporting backrefs for EREs, following POSIX strictly
in this respect. And EREs is what we actually use (rightly). This is
contrary to many implementations (including the default on Linux) of
POSIX regexes, that do allow backrefs in EREs.

Adding backref support to our EREs is a very simple change in the
regcomp parsing code. I fail to think of significant cases where it
would clash with existing things, and can bring more versatility to
the regexes we write. There's always the danger of a backref in a
specially crafted regex causing exponential matching times, but since
we mainly use them for testing purposes I don't think it's a big
problem. [it can also be placed behind a flag specific to FileCheck,
if needed].

For more details, see:

* http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-November/055840.html
* http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121126/156878.html

llvm-svn: 168802
2012-11-28 19:00:02 +00:00
Sean Silva aba8270dba Allow using MemoryBuffers with yaml::Stream directly.
The rationale is to get YAML filenames in diagnostics from
yaml::Stream::printError -- currently the filename is hard-coded as
"YAML" because there's no buffer information available.

Patch by Kim Gräsman!

llvm-svn: 168341
2012-11-19 23:21:47 +00:00
Chris Lattner 54129458e8 move irrelevant attribution.
llvm-svn: 168182
2012-11-16 18:58:23 +00:00
Daniel Dunbar 61d59f2959 PathV2: Fix a possible infinite loop.
- The code could infinite loop trying to create unique files, if the directory
   containing the unique file exists, but open() calls on non-existent files in
   the path return ENOENT. This is true on the /dev/fd filesystem, for example.

 - Will add a clang side test case for this.

llvm-svn: 168081
2012-11-15 20:24:52 +00:00
Guy Benyei a4d31a33b5 Add support for SPIR64 target - the 64bit counterpart of SPIR.
The new OpenCL SPIR extension spec will define separate SPIR for 32 and 64 bit architectures.

llvm-svn: 168036
2012-11-15 10:35:47 +00:00
Eric Christopher 950d8703b1 Remove the CellSPU port.
Approved by Chris Lattner.

llvm-svn: 167984
2012-11-14 22:09:20 +00:00
Chad Rosier 379574fd20 Revert 167755/167760. We don't want to emit crash diagnostics on command-line syntax errors.
llvm-svn: 167849
2012-11-13 16:42:19 +00:00
Chad Rosier 2b2b38d336 Revert r167620; this can be implemented using an existing CL option.
llvm-svn: 167755
2012-11-12 21:32:44 +00:00
Benjamin Kramer 08be41adbf Drop the limitation to IEEE floating point types from the fdiv of pow2 -> fmul transform.
This is safe for x87 long doubles and ppc double doubles too.

llvm-svn: 167582
2012-11-08 13:58:10 +00:00
Daniel Dunbar e2d25c2731 MemoryBuffer: Windows doesn't define S_IFIFO.
llvm-svn: 167467
2012-11-06 17:08:09 +00:00
Daniel Dunbar 43a172d935 MemoryBuffer: Support reading named pipes in getFile().
- We only support this when the client didn't claim to know the file size.

llvm-svn: 167407
2012-11-05 21:55:40 +00:00
Rafael Espindola 2f92f61098 XLC supports the same atomic functions as GCC, use them.
Patch by Kai.

llvm-svn: 167309
2012-11-02 20:54:45 +00:00
Michael J. Spencer be6f003275 [Support] Fix StrError on Windows to actually return the error string...
llvm-svn: 167191
2012-11-01 00:34:09 +00:00
Rafael Espindola 27783bc9c1 Remove Triple::getArchTypeForDarwinArchName. I lives on the clang driver now.
llvm-svn: 167157
2012-10-31 18:52:25 +00:00
James Molloy 3ebe7a5a5b Add support for Cortex-A15 host recognition.
No testcase, as this is only testable on a C-A15 board.

llvm-svn: 167108
2012-10-31 09:07:37 +00:00
Ulrich Weigand 908c936fa9 APFloat cleanup: Remove now unused "arithmeticOK" logic.
llvm-svn: 166954
2012-10-29 18:18:44 +00:00
Ulrich Weigand e1d62f9c0a APFloat cleanup: Remove now unused fields "sign2" and "exponent2".
llvm-svn: 166952
2012-10-29 18:17:42 +00:00
Ulrich Weigand d9f7e259aa Implement arithmetic on APFloat with PPCDoubleDouble semantics by
treating it as if it were an IEEE floating-point type with 106-bit
mantissa.

This makes compile-time arithmetic on "long double" for PowerPC
in clang (in particular parsing of floating point constants)
work, and fixes all "long double" related failures in the test
suite.

llvm-svn: 166951
2012-10-29 18:09:01 +00:00
Joerg Sonnenberger 7dcded6b11 Don't explicitly require RTTI and EH.
llvm-svn: 166772
2012-10-26 12:15:29 +00:00
Daniel Dunbar 511479ddb4 Support: Don't remove special files on signals.
- Similar to Path::eraseFromDisk(), we don't want LLVM to remove things like
   /dev/null, even if it has the permission.

llvm-svn: 166105
2012-10-17 16:30:54 +00:00
Duncan Sands d5772de0eb Add powerpc-ibm-aix to Triple. Patch by Kai.
llvm-svn: 165792
2012-10-12 11:08:57 +00:00
Sean Silva c399c753d9 Revert r165652: "Remove unnecessary RTTI from the build."
... Apparently the RTTI is still necessary for some reason.

llvm-svn: 165654
2012-10-10 20:50:36 +00:00
Sean Silva 9b72524e54 Remove unnecessary RTTI from the build.
llvm-svn: 165652
2012-10-10 20:27:20 +00:00
Rafael Espindola be5613c0a7 Enable response files in all tools. Patch by Liu, Yaxun (Sam). I have simplified
the test.

llvm-svn: 165535
2012-10-09 19:52:10 +00:00
Nick Kledzik 35c79da3f8 Improve overflow detection in StringRef::getAsUnsignedInteger().
llvm-svn: 165038
2012-10-02 20:01:48 +00:00
Andrew Kaylor feb805fcf2 Support for generating ELF objects on Windows.
This adds 'elf' as a recognized target triple environment value and overrides the default generated object format on Windows platforms if that value is present.  This patch also enables MCJIT tests on Windows using the new environment value.

llvm-svn: 165030
2012-10-02 18:38:34 +00:00
Micah Villmow 48c8ddc039 Add in support for SPIR to LLVM core. This adds a new target and two new calling conventions.
llvm-svn: 164948
2012-10-01 17:01:31 +00:00
Dmitri Gribenko 91c06da5f1 Replace the use of strncpy() and sprintf() with std::string and LLVM streams.
Patch by Martinez, Javier E.

llvm-svn: 164822
2012-09-28 14:15:28 +00:00
Benjamin Kramer 5651cbdc13 Make backtraces work again with both the configure and cmake build.
llvm-svn: 164817
2012-09-28 10:10:46 +00:00
Sylvestre Ledru 91ce36c986 Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767
llvm-svn: 164768
2012-09-27 10:14:43 +00:00
Sylvestre Ledru 721cffd53a Fix a typo 'iff' => 'if'
llvm-svn: 164767
2012-09-27 09:59:43 +00:00
Benjamin Kramer 9d6063ab55 Add support for detecting some corei7-class Xeons.
llvm-svn: 164714
2012-09-26 18:21:47 +00:00
Benjamin Kramer 8fb58f6bf0 YAMLParser: Fix invalid reads when encountering incorrectly quoted scalar.
Fixes PR12632.

llvm-svn: 164701
2012-09-26 15:52:15 +00:00
Benjamin Kramer c38fab2013 APFloat::roundToIntegral: Special values don't keep the exponent value up to date, don't rely on it.
Add a couple of unit tests for special floats. Fixes 13929, found by MemorySanitizer.

llvm-svn: 164698
2012-09-26 14:06:58 +00:00
Sylvestre Ledru 12c44e57f5 The assumption that /proc/self/exe always exists is incorrect.
For example, under a Linux chroot, /proc/ might not be mounted.
Therefor, we test if this file exist. If it is the case, use it (the current
behavior). Otherwise, we fall back to the detection used by *BSD.

The issue has been reported initially on the Debian bug tracker:
http://bugs.debian.org/674588

llvm-svn: 164676
2012-09-26 08:30:35 +00:00
Nico Weber eada11bb13 Fix a -Wparentheses warning in the mingw build
llvm-svn: 164587
2012-09-25 05:24:16 +00:00
Craig Topper 3186c01fec Add LLVM_OVERRIDE to methods that override their base classes.
llvm-svn: 164471
2012-09-23 02:12:10 +00:00
Eric Christopher 9fafe07da0 Add an --enable-backtraces option to configure to determine
whether or not we want to print out backtrace information. Useful
for libraries that don't need backtrace information on a crash.

rdar://11844710

llvm-svn: 164426
2012-09-21 23:03:29 +00:00
Andrew Kaylor 1f66100755 This patch adds memory support functions which will later be used to implement section-specific protection handling in MCJIT.
llvm-svn: 164249
2012-09-19 20:46:12 +00:00
Craig Topper a60c0f1163 Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.
llvm-svn: 163974
2012-09-15 17:09:36 +00:00
Dmitri Gribenko 5485acd440 Fix Doxygen issues:
* wrap code blocks in \code ... \endcode;
* refer to parameter names in paragraphs correctly (\arg is not what most
  people want -- it starts a new paragraph);
* use \param instead of \arg to document parameters in order to be consistent
  with the rest of the codebase.

llvm-svn: 163902
2012-09-14 14:57:36 +00:00
Roman Divacky fd69009419 Add support for AMD Geode.
llvm-svn: 163710
2012-09-12 14:36:02 +00:00
Chandler Carruth a699b6a44c Add support for finding cacheflush on OpenBSD/mips64 platforms.
Patch by Brad Smith!

llvm-svn: 163584
2012-09-11 01:17:24 +00:00
Ted Kremenek 0b3e805e4b Add operator< for FoldingSetNodeID.
llvm-svn: 163454
2012-09-08 04:25:29 +00:00
NAKAMURA Takumi ffa157177e Whitespace.
llvm-svn: 163289
2012-09-06 03:02:56 +00:00
NAKAMURA Takumi 8a54d812c5 Unix/Signals.inc: Fix a typo. Thanks to Dani Berg!
llvm-svn: 163288
2012-09-06 03:01:43 +00:00
Evgeniy Stepanov c439a42649 Fix Android build of gtest and lib/Support.
llvm-svn: 163131
2012-09-04 09:14:45 +00:00
Logan Chien 9ab55b8d59 Rename ANDROIDEABI to Android.
Most of the code guarded with ANDROIDEABI are not
ARM-specific, and having no relation with arm-eabi.
Thus, it will be more natural to call this
environment "Android" instead of "ANDROIDEABI".

Note: We are not using ANDROID because several projects
are using "-DANDROID" as the conditional compilation
flag.

llvm-svn: 163087
2012-09-02 09:29:46 +00:00
Benjamin Kramer ffa24e0438 Add some __builtin_expect magic to StringMap.
Tombstones and full hash collisions are rare, mark the "empty"
and "no collision" paths as likely. The bug in simplifycfg
that prevented the hints from being picked during selfhost
up was fixed recently :)

llvm-svn: 162874
2012-08-29 22:57:04 +00:00
Benjamin Kramer bd7f8d0260 Replace the BUILTIN_EXPECT macro with a less horrible LLVM_LIKELY/LLVM_UNLIKELY interface.
llvm-svn: 162873
2012-08-29 22:57:00 +00:00
Hal Finkel b5d177e5b0 Add the Freescale vendor to Triple.
Adds the vendor 'fsl' (used by Freescale SDK) to Triple. This will allow
clang support for Freescale cross-compile configurations.

Patch by Tobias von Koch.

llvm-svn: 162726
2012-08-28 02:10:30 +00:00
Richard Smith 228e6d4cf3 Fix integer undefined behavior due to signed left shift overflow in LLVM.
Reviewed offline by chandlerc.

llvm-svn: 162623
2012-08-24 23:29:28 +00:00
Richard Smith 156d92037a Fix undefined behavior (signed integer overflow) when Clang parses a hexfloat with an enormous exponent. Caught by an existing unit test + -ftrapv.
llvm-svn: 162505
2012-08-24 00:01:19 +00:00
Richard Smith 24f09cc82d Reduce alignment of SmallVector<T> to the required amount, rather than forcing 16-byte alignment. This fixes misaligned SmallVector accesses via ExtractValueInst's SmallVector data member.
llvm-svn: 162331
2012-08-22 00:11:07 +00:00
Benjamin Kramer 1b07ab51e4 DataExtractor: Fix integer truncation issues in LEB128 extraction.
llvm-svn: 162201
2012-08-20 10:52:11 +00:00
Michael J. Spencer 1d2d12deb1 Properly test the LLVM_USE_RVALUE_REFERENCES macro.
llvm-svn: 161978
2012-08-15 19:16:27 +00:00
Michael J. Spencer ef2284fbad [PathV2] Add mapped_file_region. Implementation for Windows and POSIX.
llvm-svn: 161976
2012-08-15 19:05:47 +00:00
Owen Anderson 352dfff447 Fix another roundToIntegral bug where very large values could become infinity. Problem and solution identified by Steve Canon.
llvm-svn: 161969
2012-08-15 18:28:45 +00:00
Owen Anderson be7e297b6d Fix typo in comment.
llvm-svn: 161956
2012-08-15 16:42:53 +00:00
Owen Anderson 1ff74b0d2d Fix a problem with APFloat::roundToIntegral where it would return incorrect results for negative inputs to trunc. Add unit tests to verify this behavior.
llvm-svn: 161929
2012-08-15 05:39:46 +00:00
Owen Anderson 0b35722533 Fix the construction of the magic constant for roundToIntegral to be 64-bit safe. Fixes c-torture/execute/990826-0.c
llvm-svn: 161885
2012-08-14 18:51:15 +00:00
Owen Anderson a40319b7f1 Add a roundToIntegral method to APFloat, which can be parameterized over various rounding modes. Use this to implement SelectionDAG constant folding of FFLOOR, FCEIL, and FTRUNC.
llvm-svn: 161807
2012-08-13 23:32:49 +00:00
Joerg Sonnenberger c0697304c9 stdcxx's cstdio doesn't include stdio.h, but the code using PathV2.inc
includes both. Deal with feof and ferror potentially being macros.

llvm-svn: 161658
2012-08-10 10:56:09 +00:00
Eric Christopher 22738d00a3 Add support for the OpenBSD for Bitrig.
Patch by David Hill.

llvm-svn: 161344
2012-08-06 20:52:18 +00:00
Nick Kledzik 5fce8c4ffe Initial commit of new FileOutputBuffer support class.
Since the llvm::sys::fs::map_file_pages() support function it relies on
is not yet implemented on Windows, the unit tests for FileOutputBuffer 
are currently conditionalized to run only on unix.

llvm-svn: 161099
2012-08-01 02:29:50 +00:00
Chad Rosier bd9f2ba4d6 Typos.
llvm-svn: 160897
2012-07-27 21:41:59 +00:00
Chad Rosier 7c427c40cb Make comments in Debug.cpp and Debug.h consistent. Rename SetCurrentDebugType;
Function names should be camel case, and start with a lower case letter.  No
functional change intended.

llvm-svn: 160813
2012-07-26 20:38:52 +00:00
David Blaikie 70fdf72a48 Don't add null characters to the end of the APFloat string buffer.
Report/patch inspiration by Olaf Krzikalla.

llvm-svn: 160744
2012-07-25 18:04:24 +00:00
Nuno Lopes eb9d2755b2 make ConstantRange::zeroExtend() optimal
llvm-svn: 160643
2012-07-23 20:33:29 +00:00
Benjamin Kramer 5be8f60126 Remove unused private member variables uncovered by the recent changes to clang's -Wunused-private-field.
llvm-svn: 160583
2012-07-20 22:05:57 +00:00
Benjamin Kramer dfaa0f3a81 Try to unbreak the windows build.
llvm-svn: 160567
2012-07-20 19:49:33 +00:00
Daniel Dunbar c8b8c49d6f SourceMgr: Use has_colors() instead of just is_displayed() before trying to use
color.

llvm-svn: 160559
2012-07-20 18:29:44 +00:00
Daniel Dunbar 04b4583c9b raw_ostream: Add a has_colors() method.
llvm-svn: 160558
2012-07-20 18:29:41 +00:00
Daniel Dunbar 712de82154 Process: Add sys::Process::FileDescriptorHasColors().
llvm-svn: 160557
2012-07-20 18:29:38 +00:00
Preston Gurd 8e082688a1 Adds the family codes for the Midview Atom processors so that the
Atom buildbot will auto-detect Atom.

llvm-svn: 160521
2012-07-19 19:05:37 +00:00
Nuno Lopes c14776d406 reimplement truncate() to make it optimal.
It is optimal at least up to 7 bits (I've tested all such cases)
This change to truncate() allows a little simplification to the multiplication code,
and it also makes multiplication optimal :)

llvm-svn: 160512
2012-07-19 16:27:45 +00:00
Bill Wendling 318f03f56f Remove tabs.
llvm-svn: 160479
2012-07-19 00:15:11 +00:00
Bill Wendling 2b07965042 Remove tabs.
llvm-svn: 160476
2012-07-19 00:06:06 +00:00
Preston Gurd f0a48ec8f1 This patch fixes 8 out of 20 unexpected failures in "make check"
when run on an Intel Atom processor. The failures have arisen due
to changes elsewhere in the trunk over the past 8 weeks or so.

These failures were not detected by the Atom buildbot because the
CPU on the Atom buildbot was not being detected as an Atom CPU.
The fix for this problem is in Host.cpp and X86Subtarget.cpp, but
shall remain commented out until the current set of Atom test failures
are fixed.

Patch by Andy Zhang and Tyler Nowicki!

llvm-svn: 160451
2012-07-18 20:49:17 +00:00
Nuno Lopes 216d571af7 simplify getSetSize() per Duncan's comments
llvm-svn: 160368
2012-07-17 15:43:59 +00:00
Nuno Lopes 986cc181b0 teach ConstantRange that zero times X is always zero
llvm-svn: 160317
2012-07-16 20:47:16 +00:00
Nuno Lopes 99504c577c make ConstantRange::getSetSize() properly compute the size of wrapped and full sets.
Make it always return APInts with the same bitwidth for the same ConstantRange bitwidth to simply clients

llvm-svn: 160294
2012-07-16 18:08:12 +00:00
Galina Kistanova 7da6578291 Fixed few warnings.
llvm-svn: 160142
2012-07-12 20:45:36 +00:00
Argyrios Kyrtzidis f141156e6c In MemoryBuffer::getOpenFile() don't verify that the mmap'ed
file buffer is null-terminated.

If the file is smaller than we thought, mmap will not allow dereferencing
past the pages that are enough to cover the actual file size,
even though we asked for a larger address range.

rdar://11612916

llvm-svn: 160075
2012-07-11 20:59:20 +00:00
Benjamin Kramer 3aab6a86a2 PR13326: Fix a subtle edge case in the udiv -> magic multiply generator.
This caused 6 of 65k possible 8 bit udivs to be wrong.

llvm-svn: 160058
2012-07-11 18:31:59 +00:00
Benjamin Kramer ae3c300625 Enable automatic GCC<->LLVM intrinsic translation for mips.
llvm-svn: 159367
2012-06-28 19:09:53 +00:00
Nuno Lopes 5020db2a8c add ConstantRange::difference (to perform set difference/relative complement)
llvm-svn: 159352
2012-06-28 16:10:13 +00:00
Nuno Lopes ebb0c94e1b fix a off-by-one bug in intersectWith(), and add a bunch of tests
llvm-svn: 159319
2012-06-28 00:59:33 +00:00
Benjamin Kramer efe4028693 Implement getHostCPUName for ARM/linux. This will be used to implement -march=native in clang.
The cpuid registers are only available in privileged mode so we don't have
an OS-independent way of implementing this. ARM doesn't provide a list of
processor IDs so the list is somewhat incomplete.

llvm-svn: 159228
2012-06-26 21:36:32 +00:00
Argyrios Kyrtzidis 46785f9461 Fix ThreadLocalImpl::getInstance for --disable-threads.
PR13114.

llvm-svn: 159210
2012-06-26 17:13:58 +00:00
Meador Inge fc2fb711e8 PR13013: ELF Type identification fails for MSB type ELF files.
Fix 'sys::IdentifyFileType' to work with big and little endian byte orderings
when reading the ELF object file type.

Initial patch by Stefan Hepp.

llvm-svn: 159138
2012-06-25 14:48:43 +00:00
NAKAMURA Takumi 38f4c93837 llvm/lib/Support/Errno.cpp: [Win32] Fix usage of strerror_s().
FYI, two arguments of strerror_s() is provided in C++ on msvc.

llvm-svn: 159103
2012-06-24 03:51:04 +00:00
Kaelyn Uhrain 4cb2e2dc63 Remove an "else" that snuck in after a "return" ;)
llvm-svn: 158844
2012-06-20 20:38:36 +00:00
Kaelyn Uhrain 23fb5c3e93 Check that a file is not a directory before reading it into a MemoryBuffer.
llvm-svn: 158841
2012-06-20 20:21:33 +00:00
Francois Pichet 5dc987a3d1 Unbreak the MSVC build: add return to unimplemented functions.
llvm-svn: 158788
2012-06-20 04:08:49 +00:00
Nick Kledzik 18497e9242 Add permissions(), map_file_pages(), and unmap_file_pages() to llvm::sys::fs and add unit test. Unix is implemented. Windows side needs to be implemented.
llvm-svn: 158770
2012-06-20 00:28:54 +00:00
Kaelyn Uhrain 2212f807c7 Don't assert when given an empty range.
llvm::RawMemoryObject handles empty ranges just fine, and the assert can
be triggered in the wild by e.g. invoking clang with a file that
included an empty pre-compiled header file when clang has been built
with assertions enabled. Without assertions enabled, clang will properly
report that the empty file is not a valid PCH.

llvm-svn: 158769
2012-06-20 00:16:40 +00:00
Chandler Carruth 198422a475 Fix PR13148, an inf-loop in StringMap.
StringMap suffered from the same bug as DenseMap: when you explicitly
construct it with a small number of buckets, you can arrange for the
tombstone-based growth path to be followed when the number of buckets
was less than '8'. In that case, even with a full map, it would compare
'0' as not less than '0', and refuse to grow the table, leading to
inf-loops trying to find an empty bucket on the next insertion. The fix
is very simple: use '<=' as the comparison. The same fix was applied to
DenseMap as well during its recent refactoring.

Thanks to Alex Bolz for the great report and test case. =]

llvm-svn: 158725
2012-06-19 17:40:35 +00:00
Michael J. Spencer 96ebd91d6c [Support/PathV2] Fix out of bounds access in identify_magic when the file is empty.
llvm-svn: 158704
2012-06-19 05:29:57 +00:00
Chandler Carruth 52de271da1 Don't call 'FilesToRemove[0]' when the vector is empty, even to compute
the address of it. Found by a checking STL implementation used on
a dragonegg builder. Sorry about this one. =/

llvm-svn: 158582
2012-06-16 00:44:07 +00:00
Chandler Carruth e6196eba0d Harden the Unix signals code to be more async signal safe.
This is likely only the tip of the ice berg, but this particular bug
caused any double-free on a glibc system to turn into a deadlock! It is
not generally safe to either allocate or release heap memory from within
the signal handler. The 'pop_back()' in RemoveFilesToRemove was deleting
memory and causing the deadlock. What's worse, eraseFromDisk in PathV1
has lots of allocation and deallocation paths. We even passed 'true' in
a place that would have caused the *signal handler* to try to run the
'system' system call and shell out to 'rm -rf'. That was never going to
work...

This patch switches the file removal to use a vector of strings so that
the exact text needed for the 'unlink' system call can be stored there.
It switches the loop to be a boring indexed loop, and directly calls
unlink without looking at the error. It also works quite hard to ensure
that calling 'c_str()' is safe, by ensuring that the non-signal-handling
code path that manipulates the vector always leaves it in a state where
every element has already had 'c_str()' called at least once.

I dunno exactly how overkill this is, but it fixes the
deadlock-on-double free issue, and seems likely to prevent any other
issues from sneaking up.

Sorry for not having a test case, but I *really* don't know how to test
signal handling code easily....

llvm-svn: 158580
2012-06-16 00:09:41 +00:00
Argyrios Kyrtzidis 444fd42634 Fix building ThreadLocal.cpp with --disable-threads.
llvm-svn: 158405
2012-06-13 16:30:06 +00:00
Hal Finkel f1cc96ab50 Fixes for PPC host detection and features.
POWER4 is a 64-bit CPU (better matched to the 970).
The g3 is really the 750 (no altivec), the g4+ is the 74xx (not the 750).

Patch by Andreas Tobler.

llvm-svn: 158363
2012-06-12 16:39:23 +00:00
Hal Finkel 59b0ee8a56 Reapply r158337, this time properly protect Darwin/PPC host CPU use with __ppc__.
Original commit message:
Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName().

Both the new Linux functionality and the old Darwin functions have been moved.
This change also allows this information to be queried directly by clang and
other frontends (clang, for example, will now have real -mcpu=native support).

llvm-svn: 158349
2012-06-12 03:03:13 +00:00
Argyrios Kyrtzidis c6dc4d75fd Satisfy C++ aliasing rules, per suggestion by Chandler.
llvm-svn: 158346
2012-06-12 01:06:16 +00:00
Jakob Stoklund Olesen f8f128606c Revert r158337 "Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName()."
This commit broke most of the PowerPC unit tests when running on
Intel/Apple.

llvm-svn: 158345
2012-06-12 00:58:40 +00:00
Argyrios Kyrtzidis 8d19c86c9a For llvm::sys::ThreadLocalImpl instead of malloc'ing the platform-specific
thread local data, embed them in the class using a uint64_t and make sure
we get compiler errors if there's a platform where this is not big enough.

This makes ThreadLocal more safe for using it in conjunction with CrashRecoveryContext.

Related to crash in rdar://11434201.

llvm-svn: 158342
2012-06-12 00:21:31 +00:00
Hal Finkel 23c699e497 Move PPC host-CPU detection logic from PPCSubtarget into sys::getHostCPUName().
Both the new Linux functionality and the old Darwin functions have been moved.
This change also allows this information to be queried directly by clang and
other frontends (clang, for example, will now have real -mcpu=native support).

llvm-svn: 158337
2012-06-11 23:14:31 +00:00
Aaron Ballman 36a978cca2 Disabling a spurious deprecation warning about using PathV1 from within the PathV1 implementation file.
llvm-svn: 158274
2012-06-09 13:59:29 +00:00
Aaron Ballman 503bbff367 Fixing a typo in the comments.
llvm-svn: 158273
2012-06-09 13:46:36 +00:00
Dmitri Gribenko dbeafa773a Convert comments to proper Doxygen comments.
llvm-svn: 158248
2012-06-09 00:01:45 +00:00
Chad Rosier 3d464d8068 Fix a crash in APInt::lshr when shiftAmt > BitWidth.
Patch by James Benton <jbenton@vmware.com>.

llvm-svn: 158213
2012-06-08 18:04:52 +00:00
Benjamin Kramer 172f80849f Use access(2) instead of stat(2) to check if a file exists.
Apart from being slightly cheaper, this fixes a real bug that hits 32 bit
linux systems. When passing a file larger than 2G to be linked (which isn't
that uncommon with large projects such as WebKit), clang's driver checks
if the file exists but the file size doesn't fit in an off_t and stat(2)
fails with EOVERFLOW. Clang then says that the file doesn't exist instead
of passing it to the linker.

llvm-svn: 157891
2012-06-02 16:28:09 +00:00
NAKAMURA Takumi b030e8a5c8 Path::GetTemporaryDirectory(): Add an assertion if TempDirectory is alive, to check when someone would remove the tempdir.
llvm-svn: 157529
2012-05-27 13:02:04 +00:00
Justin Holewinski 907f7606f2 Remove the PTX back-end and all of its artifacts (triple, etc.)
This back-end was deprecated in favor of the NVPTX back-end.

NV_CONTRIB

llvm-svn: 157417
2012-05-24 21:38:21 +00:00
Patrik Hägglund 26dcb95dfc Fix -Wcovered-switch-default warning.
llvm-svn: 157381
2012-05-24 07:51:46 +00:00
Nuno Lopes 63afc08ca7 fix corner case in ConstantRange::intersectWith().
this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass

llvm-svn: 157032
2012-05-18 00:14:36 +00:00
Michael J. Spencer c10948d02b [Support/YAMLParser] Use rtrim on plain scalars.
llvm-svn: 156787
2012-05-14 22:43:34 +00:00
Michael J. Spencer 93303819ac [Support/StringRef] Add find_last_not_of and {r,l,}trim.
llvm-svn: 156652
2012-05-11 22:08:50 +00:00
Eric Christopher b6148ed72c Allow unique_file to take a mode for file permissions, but default
to user only read/write.

Part of rdar://11325849

llvm-svn: 156591
2012-05-11 00:07:44 +00:00
Chad Rosier 9d7b1cee39 Set the default iOS version to 3.0.
llvm-svn: 156492
2012-05-09 18:23:00 +00:00
Bob Wilson 8d4e2fab63 Use the cpuid 64 bit flag to pick the default CPU name for an unknown model.
For the Family 6 switch in sys::getHostCPUName, an unrecognized model was
reported as "i686".  That's a really bad default since it means that new
CPUs will be treated as if they can only use 32-bit code.  This just looks
at the cpuid extended feature flag for 64 bit support, and if that is set,
it uses a default x86-64 cpu.  Similar logic is already used for the Family
15 code.  <rdar://problem/11314502>

llvm-svn: 156486
2012-05-09 17:47:03 +00:00
Chad Rosier 2778cbc880 Don't return true on a function with a void return type.
llvm-svn: 156484
2012-05-09 17:38:47 +00:00
Chad Rosier d84eaac673 Add Triple::getiOSVersion.
This new function provides a way to get the iOS version number from ios triples.
Part of rdar://11409204

llvm-svn: 156483
2012-05-09 17:23:48 +00:00
Kevin Enderby fe3d005ca5 Fix it so llvm-objdump -arch does accept x86 and x86-64 as valid arch names.
PR12731.  Patch by Meador Inge!

llvm-svn: 156444
2012-05-08 23:38:45 +00:00
Daniel Dunbar 5f1c956eb0 [Support] Fix sys::GetRandomNumber() to always use a high quality seed.
llvm-svn: 156414
2012-05-08 20:38:00 +00:00
NAKAMURA Takumi 3b7f995b75 Windows/PathV2.inc: Retry rename() for (maximum) 2 seconds.
Files might be opend by system scanners (eg. file indexer, virus scanner, &c).

llvm-svn: 156380
2012-05-08 14:31:46 +00:00
Matt Beaumont-Gay a1b3b007f3 Don't assume size_t is unsigned long long.
Fixes a -Woverflow warning from gcc when building for 32-bit platforms.

llvm-svn: 156313
2012-05-07 18:12:42 +00:00
Chris Lattner 854f366a1f make SourceMgr tolerate empty SMLoc()'s better.
llvm-svn: 156260
2012-05-06 16:20:49 +00:00
NAKAMURA Takumi 7bec74112d Unix/Process.inc: Give more useful random seed to srand. Workaround for PR12743.
llvm-svn: 156252
2012-05-06 08:24:24 +00:00
NAKAMURA Takumi 54acb28882 Support/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp to Unix/Process.inc.
FIXME: GetRandomNumber() is not implemented in Win32.
llvm-svn: 156251
2012-05-06 08:24:18 +00:00
Chris Lattner 9322ba824c reapply my patch, with a fix for an off-by-one error. Turned out to be a lot
of work for a drive-by fix :)

llvm-svn: 156246
2012-05-05 22:17:32 +00:00
Chris Lattner 64f65d33df revert my patches, which are causing problems.
llvm-svn: 156245
2012-05-05 22:11:04 +00:00
Chris Lattner cd60bc491e refactor some code to expose column numbers more and make diagnostic printing slightly more efficient.
llvm-svn: 156243
2012-05-05 21:39:51 +00:00
Daniel Dunbar d5f82d92f3 [Support] Add missing include.
llvm-svn: 156240
2012-05-05 16:49:11 +00:00
Daniel Dunbar 58ed0c6c09 [Support] Fix up comments.
llvm-svn: 156239
2012-05-05 16:39:22 +00:00
Daniel Dunbar 3f0fa19bc4 [Support] Rewrite sys::fs::unique_file to not be stupid with /dev/urandom.
- Just use sys::Process::GetRandomNumber instead of having two poor
   implementations.
 - This is ~70 times (!) faster on my OS X machine.

llvm-svn: 156238
2012-05-05 16:36:24 +00:00
Daniel Dunbar b57ddd4e29 [Support] Add sys::Process::GetRandomNumber().
- Primitive API, but we rarely have need for random numbers.

llvm-svn: 156237
2012-05-05 16:36:20 +00:00
Justin Holewinski ae556d3ef7 This patch adds a new NVPTX back-end to LLVM which supports code generation for NVIDIA PTX 3.0. This back-end will (eventually) replace the current PTX back-end, while maintaining compatibility with it.
The new target machines are:

nvptx (old ptx32) => 32-bit PTX
nvptx64 (old ptx64) => 64-bit PTX

The sources are based on the internal NVIDIA NVPTX back-end, and
contain more functionality than the current PTX back-end currently
provides.

NV_CONTRIB

llvm-svn: 156196
2012-05-04 20:18:50 +00:00
Preston Gurd c0b976c42a Change the Intel Atom detection code to recognize
Lincroft and Medfield.

llvm-svn: 156025
2012-05-02 21:38:46 +00:00
Benjamin Kramer 84b857e4e6 YAMLParser: get rid of global ctors & dtors.
llvm-svn: 155907
2012-05-01 10:19:59 +00:00
Michael J. Spencer 6033113e35 [Support/YAMLParser] Fix ASan found bugs.
llvm-svn: 155735
2012-04-27 21:12:20 +00:00
Michael J. Spencer a6c2c29152 [Support/YAML] Properly fix unitialized variable warning by inserting a
'REPLACEMENT CHARACTER' (U+FFFD) when getAsInteger fails.

llvm-svn: 155653
2012-04-26 19:27:11 +00:00
Evan Cheng 7fd160700f Add a missing cpu subtype.
llvm-svn: 155402
2012-04-23 22:41:39 +00:00
Michael J. Spencer 04b795bc1d [Support/Unix] Unconditionally include time.h.
When building LLVM on Linux with libc++ with CMake TIME_WITH_SYS_TIME is
undefined, and HAVE_SYS_TIME_H is defined. This ends up including
sys/time.h but not time.h. Unix/TimeValue.inc requires time.h for asctime_r
and localtime. libstdc++ seems to include time.h anyway, but libc++ does
not.

Fix this by always including time.h

llvm-svn: 155382
2012-04-23 19:00:27 +00:00
Sylvestre Ledru 3099f4bda8 Conflict with st_dev/st_ino identifiers under Debian GNU/Hurd
The problem is that the struct file_status on UNIX systems has two
members called st_dev and st_ino; those are also members of the
struct stat, and they are reserved identifiers which can also be
provided as #define (and this is the case for st_dev on Hurd).
The solution (attached) is to rename them, for example adding a
"fs_" prefix (= file status) to them.

Patch by Pino Toscano

llvm-svn: 155354
2012-04-23 16:37:23 +00:00
Chris Lattner 5e14666149 Don't die with an assertion if the Result bitwidth is already correct. This
fixes an assert reading "1239123123123123" when the result is already 64-bit.

llvm-svn: 155329
2012-04-23 00:27:54 +00:00
Bill Wendling f9774c3253 Remove some potential warnings about variables used uninitialized.
llvm-svn: 155307
2012-04-22 07:23:04 +00:00
Chris Lattner 0a1bafed7b No need for "else if" after a return. Autosense "0o123" as octal in
StringRef::getAsInteger

llvm-svn: 155298
2012-04-21 22:03:05 +00:00
Nuno Lopes e568efbc4d move Signals to .rodata
llvm-svn: 155283
2012-04-21 14:45:37 +00:00
Benjamin Kramer 0aa0d3d633 YAMLParser: silence warning about tautological comparison on unsigned-char platforms.
No functionality change.

llvm-svn: 155280
2012-04-21 10:51:42 +00:00
Benjamin Kramer bb73d19794 SourceMgr: Colorize diagnostics.
Same color scheme as clang uses. The colors are only enabled if the output is a tty.

llvm-svn: 155035
2012-04-18 19:04:15 +00:00
Benjamin Kramer 94988cb34c SmallPtrSet: Reuse DenseMapInfo's pointer hash function instead of inventing a bad one ourselves.
DenseMap's hash function uses slightly more entropy and reduces hash collisions
significantly.  I also experimented with Hashing.h, but it didn't gave a lot of
improvement while being much more expensive to compute.

llvm-svn: 154996
2012-04-18 10:37:32 +00:00
Seth Cantrell 3d013bccfa fix error check in assert
llvm-svn: 154971
2012-04-18 00:40:23 +00:00
David Blaikie 1b5d8d46fb C++ has newlines at the end of files (including include files).
llvm-svn: 154962
2012-04-17 23:46:51 +00:00
Seth Cantrell 75dbcb8bdd platform support for counting column widths and checking isprint
llvm-svn: 154944
2012-04-17 20:03:03 +00:00
Manuel Klimek 1f8918f69d Goodbye, JSONParser...
llvm-svn: 154930
2012-04-17 17:21:17 +00:00
Benjamin Kramer 13d16f3bf3 Reapply 'Add reverseColor to raw_ostream'.
To be used in printing unprintable source in clang diagnostics.
Patch by Seth Cantrell, with a minor fix for mingw by me.

llvm-svn: 154805
2012-04-16 08:56:50 +00:00
Argyrios Kyrtzidis 64104f16d4 Revert r154800 which breaks windows builders.
llvm-svn: 154802
2012-04-16 07:59:39 +00:00
Argyrios Kyrtzidis d17db2e0ee Add reverseColor to raw_ostream.
To be used in printing unprintable source in clang diagnostics.
Patch by Seth Cantrell!

llvm-svn: 154800
2012-04-16 07:07:38 +00:00
Sylvestre Ledru 14ada94682 Fix the build under Debian GNU/Hurd.
Thanks to Pino Toscano for the patch

llvm-svn: 154500
2012-04-11 15:35:36 +00:00
Benjamin Kramer 63057a5ff0 FoldingSet: Push the hash through FoldingSetTraits::Equals, so clients can use it.
llvm-svn: 154496
2012-04-11 14:06:47 +00:00
Argyrios Kyrtzidis ef909265e8 In MemoryBuffer::getOpenFile() make sure that the buffer is null-terminated if
the caller requested a null-terminated one.

When mapping the file there could be a racing issue that resulted in the file being larger
than the FileSize passed by the caller. We already have an assertion
for this in MemoryBuffer::init() but have a runtime guarantee that
the buffer will be null-terminated, so do a copy that adds a null-terminator.

Protects against crash of rdar://11161822.

llvm-svn: 154082
2012-04-05 04:23:56 +00:00
Benjamin Kramer a1355d17ca Move yaml::Stream's dtor out of line so it can see Scanner's dtor.
llvm-svn: 154004
2012-04-04 08:53:34 +00:00
Michael J. Spencer afc0d6a36f Sorry about that. MSVC seems to accept just about any random string you give it ;/
llvm-svn: 153979
2012-04-03 23:36:44 +00:00
Michael J. Spencer 22120c47a7 Add YAML parser to Support.
llvm-svn: 153977
2012-04-03 23:09:22 +00:00
Hal Finkel f208af02a4 Add triple support for the IBM BG/P and BG/Q supercomputers.
llvm-svn: 153882
2012-04-02 18:31:33 +00:00
Eric Christopher c13fd6d1e1 Lowercase the tag name to match the rest of dwarf.
llvm-svn: 153691
2012-03-29 21:35:05 +00:00
Anton Korobeynikov 4547077a2b Fix GetMainExecutable on kFreeBSD.
Patch by Sylvestre Ledru!

llvm-svn: 153435
2012-03-26 12:05:51 +00:00
Jean-Daniel Dupas a573b22015 Fix null to integer conversion warnings.
llvm-svn: 153395
2012-03-24 22:17:50 +00:00
Michael J. Spencer 39fb408fd3 [PathV2]: Fix bug in create_directories which caused infinite recursion on
som inputs.

Bug found and fix proposed by Kal Conley!

llvm-svn: 153225
2012-03-21 23:09:14 +00:00
Benjamin Kramer 78b505b065 Move APInt::operator[] inline.
llvm-svn: 152692
2012-03-14 00:38:15 +00:00
Benjamin Kramer 4c6a918cda Move APInt::operator! inline, it's small and fuses well with surrounding code when inlined.
llvm-svn: 152688
2012-03-14 00:01:35 +00:00
Argyrios Kyrtzidis 3dc531ef44 Add a sanity check in MemoryBuffer::getOpenFile() to make sure we don't hang
if the passed in FileSize is inaccurate.

rdar://11034179

llvm-svn: 152662
2012-03-13 20:18:42 +00:00
Benjamin Kramer 3870bc4805 Inline a trivial helper function.
llvm-svn: 152577
2012-03-12 21:18:53 +00:00
Duncan Sands 79d793e768 Don't cast away constant qualifier.
llvm-svn: 152553
2012-03-12 10:51:06 +00:00
Benjamin Kramer 0f90695e31 Replace a hand-coded leading one counting loop with the magic from MathExtras.h.
llvm-svn: 152545
2012-03-11 19:32:35 +00:00
Michael J. Spencer cfa95f66a1 Make StringRef::getAsInteger work with all integer types. Before this change
it would fail with {,u}int64_t on x86-64 Linux.

This also removes code duplication.

llvm-svn: 152517
2012-03-10 23:02:54 +00:00
Anton Korobeynikov f32638d77c Add support for r600 (AMD GPUs HD2XXX - HD6XXX) target triplet.
Patch by Tom Stellard!

llvm-svn: 152400
2012-03-09 10:09:36 +00:00
Benjamin Kramer 3bc40c5fee Silence unused function warning when graphviz is not available.
llvm-svn: 152346
2012-03-08 22:15:23 +00:00
Duncan Sands d8e918be4c Revert commit 152300 (ddunbar) since it still seems to be breaking
buildbots.  Original commit message:

[ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline, reapplied
with a fix for the longstanding over-read of 32-bit pointer values.

llvm-svn: 152304
2012-03-08 09:32:21 +00:00
Daniel Dunbar 544637937a [ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline, reapplied
with a fix for the longstanding over-read of 32-bit pointer values.

llvm-svn: 152300
2012-03-08 07:42:18 +00:00
Daniel Dunbar 5ecfd7fd12 Revert r152288, "[ADT] Change the trivial FoldingSetNodeID::Add* methods to be
inline.", which is breaking the bots in a way I don't understand.

llvm-svn: 152295
2012-03-08 04:17:15 +00:00
Daniel Dunbar faa48ebbba [ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline.
llvm-svn: 152288
2012-03-08 02:52:00 +00:00
Benjamin Kramer 22842f89e4 Copy the right amount of elements.
llvm-svn: 152254
2012-03-07 22:48:42 +00:00
Benjamin Kramer 6e8d4b8eb4 SmallPtrSet: Copy all the elements when swapping, not just numelements.
This fixes a build failure in webkit. Copying all elements shouldn't be
necessary, I'll look out for a better fix soon.

llvm-svn: 152252
2012-03-07 22:33:21 +00:00
Andrew Trick edbb3b2231 Added -view-background to avoid waiting for each GraphViz invocation.
GV and XDOT paths are untested but should work the same.

llvm-svn: 152179
2012-03-07 00:18:27 +00:00
Benjamin Kramer e1c34e9f43 SmallPtrSet: Provide a more efficient implementation of swap than the default triple-copy std::swap.
This currently assumes that both sets have the same SmallSize to keep the implementation simple,
a limitation that can be lifted if someone cares.

llvm-svn: 152143
2012-03-06 20:40:02 +00:00
Chandler Carruth 71bd7d1e54 Replace the hashing functions on APInt and APFloat with overloads of the
new hash_value infrastructure, and replace their implementations using
hash_combine. This removes a complete copy of Jenkin's lookup3 hash
function (which is both significantly slower and lower quality than the
one implemented in hash_combine) along with a somewhat scary xor-only
hash function.

Now that APInt and APFloat can be passed directly to hash_combine,
simplify the rest of the LLVMContextImpl hashing to use the new
infrastructure.

llvm-svn: 152004
2012-03-04 12:02:57 +00:00
Chandler Carruth ca99ad3f0d Add generic support for hashing StringRef objects using the new hashing library.
llvm-svn: 152003
2012-03-04 10:55:27 +00:00
Chandler Carruth 93cffd2fb5 Switch FoldingSet over to the new hashing infrastructure. We might want
to do more invasive refactoring here to get FoldingSet to use size_t or
even hash_code directly, but for now this is a good first step to remove
Yet Another Hashing Algorithm from LLVM.

llvm-svn: 151859
2012-03-01 23:18:44 +00:00
Benjamin Kramer f7e02a0cab BumpPtrAllocator: Make sure threshold cannot be initialized with a value smaller than the slab size.
This replaces r151834 with a simpler fix.

llvm-svn: 151842
2012-03-01 22:10:16 +00:00
Argyrios Kyrtzidis 16558f4d3b If BumpPtrAllocator is requested to allocate a size that exceeds the slab size,
increase the slab size.

llvm-svn: 151834
2012-03-01 20:36:32 +00:00
Chandler Carruth 34085df4e8 Add the source file with trivial definitions in it that was missing from
r151822, sorry sorry. =[

We need 'git svn nothave' or some such...

llvm-svn: 151824
2012-03-01 18:58:59 +00:00
Chandler Carruth 1d03a3b6b1 Rewrite LLVM's generalized support library for hashing to follow the API
of the proposed standard hashing interfaces (N3333), and to use
a modified and tuned version of the CityHash algorithm.

Some of the highlights of this change:
 -- Significantly higher quality hashing algorithm with very well
    distributed results, and extremely few collisions. Should be close to
    a checksum for up to 64-bit keys. Very little clustering or clumping of
    hash codes, to better distribute load on probed hash tables.
 -- Built-in support for reserved values.
 -- Simplified API that composes cleanly with other C++ idioms and APIs.
 -- Better scaling performance as keys grow. This is the fastest
    algorithm I've found and measured for moderately sized keys (such as
    show up in some of the uniquing and folding use cases)
 -- Support for enabling per-execution seeds to prevent table ordering
    or other artifacts of hashing algorithms to impact the output of
    LLVM. The seeding would make each run different and highlight these
    problems during bootstrap.

This implementation was tested extensively using the SMHasher test
suite, and pased with flying colors, doing better than the original
CityHash algorithm even.

I've included a unittest, although it is somewhat minimal at the moment.
I've also added (or refactored into the proper location) type traits
necessary to implement this, and converted users of GeneralHash over.

My only immediate concerns with this implementation is the performance
of hashing small keys. I've already started working to improve this, and
will continue to do so. Currently, the only algorithms faster produce
lower quality results, but it is likely there is a better compromise
than the current one.

Many thanks to Jeffrey Yasskin who did most of the work on the N3333
paper, pair-programmed some of this code, and reviewed much of it. Many
thanks also go to Geoff Pike Pike and Jyrki Alakuijala, the original
authors of CityHash on which this is heavily based, and Austin Appleby
who created MurmurHash and the SMHasher test suite.

Also thanks to Nadav, Tobias, Howard, Jay, Nick, Ahmed, and Duncan for
all of the review comments! If there are further comments or concerns,
please let me know and I'll jump on 'em.

llvm-svn: 151822
2012-03-01 18:55:25 +00:00
Derek Schuff 56b662ce0f Make MemoryObject accessor members const again
llvm-svn: 151687
2012-02-29 01:09:06 +00:00
Daniel Dunbar 39ea458b73 Support/PathV2: Fix namespace qualifier in make_absolute(), for Win32.
llvm-svn: 151685
2012-02-29 00:46:46 +00:00