Commit Graph

1301 Commits

Author SHA1 Message Date
Douglas Gregor
441c8b4ad1 Implement edit distance for StringRef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92309 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-30 17:23:44 +00:00
Chris Lattner
837eda93ee Do not crash when .ll printing metadata that smells like debug info, but isn't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 21:17:33 +00:00
Chris Lattner
480decf1a2 fix indentation, fit in 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92267 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 21:09:57 +00:00
Chris Lattner
7f29dfd75c fix .cpp file to not wrap the entire file in namespace blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 07:28:33 +00:00
John McCall
6a09affdf6 Implement support for converting to string at "natural precision", and fix some
major bugs in long-precision conversion.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 23:18:09 +00:00
John McCall
003a09c68d Substantially optimize APFloat::toString() by doing a single large divide to
cut the significand down to the desired precision *before* entering the
core divmod loop.  Makes the overall algorithm logarithmic in the exponent.

There's still a lot of room for improvement here, but this gets the
performance back down to acceptable-for-diagnostics levels, even for
long doubles.
negligible, even on long doubles.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92130 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 12:16:56 +00:00
John McCall
00e65de9d8 Add accessors for the largest-magnitude, smallest-magnitude, and
smallest-normalized-magnitude values in a given FP semantics.
Provide an APFloat-to-string conversion which I am quite ready to admit could
be much more efficient.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92126 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 08:56:26 +00:00
John McCall
d73bf5987a Set Remainder before Quotient in case Quotient and LHS alias. The new
order should be immune to such problems.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92124 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 08:52:06 +00:00
David Greene
037764227e Clarify how dbgs() operates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92083 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 23:23:15 +00:00
Chris Lattner
62dc896bc4 sizeof(char) is always 1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 23:03:24 +00:00
Douglas Gregor
734d236aaf De-bork CMake build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92003 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 17:03:46 +00:00
David Greene
b5d568cc70 Provide dbgs(), a circular-buffering debug output stream. By default it
simply passes output to errs().  If -debug-buffer-size=N is set N > 0,
dbgs() buffers its output until program termination and dumps the last N
characters sent to it.  This is handy when debugging very large inputs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 16:39:06 +00:00
David Greene
e59011e7d9 Add circular_raw_ostream, which buffers its output in a circular queue
and outputs it when explicitly flushed.  The intent is to use it in
situations such as debug output logging where a signal handler can take
care of flushing the buffer at program termination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92001 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 16:08:15 +00:00
Chris Lattner
cd0129f5a6 Make some methods const. The only interesting change here is that
it changes raw_fd_ostream::preferred_buffer_size to return zero on
a scary stat failure instead of setting the stream to an error state.
This method really should not mutate the stream.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-19 01:38:42 +00:00
Chris Lattner
b3649db102 now that libsystem no longer uses SmallVector, we can move
SmallVectorBase::grow_pod out of line, finally satisfying PR3758.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91529 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 08:44:24 +00:00
Dan Gohman
a4f8ecd85d Micro-optimize these functions in the case where they are not inlined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 19:32:31 +00:00
Daniel Dunbar
022840e960 DeltaAlgorithm: Add a virtual destructor and home.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 07:19:48 +00:00
Daniel Dunbar
83563b24ce Fix typo and add missing include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 08:17:07 +00:00
Dan Gohman
018402d30c Print a newline after the Args: line so that unrelated errs() output doesn't
end up on the same line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 19:03:18 +00:00
Daniel Dunbar
a6d5e40e25 Add an implementation of the delta debugging algorithm.
- This is a pretty slow / memory intensive implementation, and I will likely
   change it to an iterative model, but it works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 11:12:42 +00:00
Chris Lattner
6e1f16d522 return more useful error messages by using strerror to format errno
instead of returning an ambiguous reason.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 22:51:41 +00:00
Douglas Gregor
b3587cfb3b Perform explicit instantiations in the proper namespace, since Clang diagnoses this ill-formity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 06:04:18 +00:00
Daniel Dunbar
4153982375 SourceMgr: Add ShowLine argument to PrintMessage, to allow suppressing the source line output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89627 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 22:08:00 +00:00
Mikhail Glushenkov
37628e0098 Move the handling of CommaSeparated options into ProvideOption.
Makes '--comma-separated val1,val2' mean the same thing as
'--comma-separated=val1,val2' (that is, 'val1' and 'val2' are not lumped
together as 'val1,val2'). Also declutters the main loop a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 17:23:17 +00:00
Daniel Dunbar
58ce7acb4f Use StringRef::min instead of std::min.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 18:53:18 +00:00
Mikhail Glushenkov
eeebecfcb4 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 17:29:36 +00:00
Edward O'Callaghan
cc9fa81fe1 Add PS3 Triple class, Credit to John Thompson.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 11:59:00 +00:00
Viktor Kutuzov
51cdac02c4 Added getArchNameForAssembler method to the Triple class for which returns OS and Vendor independent target assembler arch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89122 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 18:48:27 +00:00
Benjamin Kramer
110e7bb25c Revert CPU detection code to return "generic" instead of an empty string in case
of failure. The x86 target didn't like empty cpu names and broke x86 tests on
non-x86 buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 17:57:04 +00:00
Owen Anderson
252e574924 Fix a race condition in the Timer class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 07:06:10 +00:00
Edward O'Callaghan
e0fb75d586 Add PSP OS Target to Triple, Credit to Bruno Cardoso Lopes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 10:18:17 +00:00
Daniel Dunbar
ba43e0785b Report the detected host CPU in --version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 21:36:07 +00:00
Rafael Espindola
20fd4ec8c5 Distinguish "a," from "a". The first one splits into "a" + "" and the second one into
"a" + 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 04:55:09 +00:00
Rafael Espindola
c78c0c99a0 Switch to smallvector. Also fix issue with using unsigend for MaxSplit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87068 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 02:18:25 +00:00
Rafael Espindola
5ccac24726 Add a new split method to StringRef that puts the substrings in a vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 01:24:40 +00:00
Benjamin Kramer
05872ea804 Add compare_lower and equals_lower methods to StringRef. Switch all users of
StringsEqualNoCase (from StringExtras.h) to it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:36:59 +00:00
Nuno Lopes
4459145c2c fix crash in my previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 15:10:33 +00:00
Nuno Lopes
34e992da38 implement shl, ashr, and lshr methods. shl is not fully implemented as it is quite tricky.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 14:53:53 +00:00
Sandeep Patel
bf177ee6fd Show command-line args and features passed into backend in debug output. Approved by Evan Cheng.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86797 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 03:23:46 +00:00
Daniel Dunbar
64066bd8b5 Add From arguments to StringRef search functions, and tweak doxyments.
Also, add unittests for find_first_of and find_first_not_of.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:28:53 +00:00
Daniel Dunbar
d65267ee62 Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.
Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:43:58 +00:00
Nuno Lopes
95a3be0ba4 add zextOrTrunc and sextOrTrunc methods, that are similar to the ones in APInt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86549 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 15:36:28 +00:00
Xerxes Ranby
5aa638d8f7 Make lib/Support/Debug.cpp SetCurrentDebugType implementation part of llvm namespace to match function declaration in Debug.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86544 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 14:50:34 +00:00
Mikhail Glushenkov
c11e84d3e7 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 06:33:12 +00:00
Daniel Dunbar
2928c83b01 Pass StringRef by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 10:58:06 +00:00
Duncan Sands
7127b13342 A value is only assigned to errno if NumRead equals -1, so do
not reason based on errno if NumRead has a different value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 20:50:23 +00:00
Duncan Sands
954cb43c80 Make this code more robust by not thinking we are making progress
if zero bytes were read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 19:10:22 +00:00
Chris Lattner
70197a3a04 add a new 'SetCurrentDebugType' API (requested by Andrew Haley for JIT
stuff) to programmatically control the current debug flavor.  While 
I'm at it, doxygenate Debug.h and clean it up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85395 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 15:32:19 +00:00
Evan Cheng
c5a75523ef Remove getIEEEFloatParts and getIEEEDoubleParts. They are not needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 01:08:17 +00:00
Evan Cheng
99ebfa5f6c Add new APFloat methods that return sign, exp, and mantissa of ieee float and double values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 21:35:42 +00:00
Chandler Carruth
8b67f774e9 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 01:35:46 +00:00
Dale Johannesen
a223aed126 Commit fixes for half precision I noted in review, so
they don't get lost; I don't think the originator has
write access.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 04:02:51 +00:00
Daniel Dunbar
9bd34602fb Move UnescapeString to a static function for its sole client; its inefficient and broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:43:42 +00:00
Daniel Dunbar
ca107c5c18 Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:43:29 +00:00
Daniel Dunbar
522b113a75 Add raw_ostream::write_escaped, for writing escaped strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:43:08 +00:00
Daniel Dunbar
4dee7fd2c2 Move StringMap's string has function into StringExtras.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84344 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 18:21:06 +00:00
Chris Lattner
cc4287a374 Add half precision floating point support (float16) to APFloat,
patch by Peter Johnson! (PR5195)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 02:13:51 +00:00
Chris Lattner
a43fc3452b add haiku support, patch by Paul Davey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84238 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 02:06:30 +00:00
Jeffrey Yasskin
0b22873adc r83391 was completely broken since Twines keep references to their inputs, and
some of the inputs were temporaries.  Here's a real fix for the miscompilation.
Thanks to sabre for pointing out the problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83417 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 21:45:26 +00:00
Nicolas Geoffray
35b305863a Bugfix for the CommaSeparated option. The original code was adding the whole
string at the end of the list, instead of the last comma-separated string.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 19:55:53 +00:00
Jeffrey Yasskin
6cf4963cdc Fix PR5112, a miscompilation on gcc-4.0.3. Patch by Collin Winter!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83391 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 17:25:50 +00:00
Torok Edwin
d7830d595d Avoid using mutex locks if not in multithreaded mode by using a SmartScopedMutex
in RegisterStatistic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 11:08:03 +00:00
Chris Lattner
81f46d9ce1 remove support for "NoSub" from regex. It seems like a minor optimization
and makes the API more annoying.  Add a Regex::getNumMatches() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 21:27:04 +00:00
Chris Lattner
528700863a add and document regex support for FileCheck. You can now do stuff like:
; CHECK: movl {{%e[a-z][xi]}}, %eax

or whatever.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82717 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 21:47:32 +00:00
Chris Lattner
ad78500712 wrap long lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 21:44:20 +00:00
Chris Lattner
48ba9ff3c4 tidy up, fix a memory leak in Regex::isValid
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 20:15:51 +00:00
Chris Lattner
63e944b05e reapply r82348 with a fix, thanks Jeffrey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82683 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 05:38:36 +00:00
Jeffrey Yasskin
1d75d3a8ae Roll back r82348, which introduced an infinite loop in ParseCStringVector() that
a trivial unittest would have caught.  This revision also adds the trivial
unittest.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 01:14:07 +00:00
Daniel Dunbar
27dba671c3 Switch FoldingSet::AddString to StringRef based API.
- This also fixes a dereference of std::string::end, which makes MSVC unhappy and was causing all the static analyzer clang tests to fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82517 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:34:53 +00:00
Daniel Dunbar
77696bebbc Workaround what I believe is an MSVC bug where it emits a definition for a
static const class member into each translation unit, with external linkage???
 - If someone understands this issue better, please clue me in, I haven't
   consulted the standard yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82516 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:34:40 +00:00
Chris Lattner
6441e547cc simplify as daniel suggests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 22:56:43 +00:00
Chris Lattner
fd40d038b3 tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 07:16:54 +00:00
Chris Lattner
1908aea3a6 smallvectorize getExtraOptionNames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 06:21:43 +00:00
Chris Lattner
49b301c40a minor cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 06:18:38 +00:00
Chris Lattner
bc2d9d3de5 strength reduce further StringRef-> const char*, saving another 620 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:53:47 +00:00
Chris Lattner
043b8b5bb2 switch an std::string to StringRef, shaving 400 bytes off CommandLine.o
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:48:01 +00:00
Chris Lattner
0fd48b1f1c the switch from std::map -> StringMap caused --help output to be in
non-sorted order, restore the sort.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:37:24 +00:00
Chris Lattner
d0062c6e7c eliminate the duplicate detection loop, moving it into the loop that populates the Opts vector in the first place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82367 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:22:52 +00:00
Chris Lattner
081bcb0d41 Eliminate a masochistic "algorithm" loop, shrinking CommandLine.o from 71524->70700 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:18:28 +00:00
Chris Lattner
b40b7e3faf don't use count + insert, just do insert + failure. Also, instead of deleting from
the middle of a vector, swap the last element in and pop_back.  Also saves 330 bytes :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:15:12 +00:00
Chris Lattner
67aead68be switch to SmallPtrSet instead of std::set, saving 1K from the
release-asserts .o file (72900->71856).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:12:14 +00:00
Chris Lattner
14aae60b69 change an std::sort to an array_pod_sort call, shrinking CommandLine.o by 9%.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:06:23 +00:00
Chris Lattner
b168737a74 Several changes together in a murky mess:
1. Change some "\n" -> '\n'.
2. eliminte some std::string's by using raw_ostream::indent.
3. move a bunch of code out of the main arg parser routine into
   a new static HandlePrefixedOrGroupedOption function.
4. Greatly simplify the implementation of getOptionPred, and make
   it avoid splitting prefix options at = when that doesn't match
   a non-prefix option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:03:30 +00:00
Daniel Dunbar
256db9bf9d Fix refacto, this code was expecting to stride past the argument prefix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82360 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 04:03:41 +00:00
Daniel Dunbar
a279bc3da5 Tabs -> spaces, and remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 02:20:51 +00:00
Chris Lattner
8a7a05814c convert argname to StringRef, simplifying LookupOption.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 02:02:24 +00:00
Chris Lattner
4e247ec495 convert 'Value' to StringRef which makes it easier to
maintain the "null is unspecified, empty is empty" semantics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:53:12 +00:00
Chris Lattner
341620b276 Change CommaSeparated processing to do it with StringRef instead of temporary std::strings.
This requires StringRef'izing ProvideOption which I also did.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:49:31 +00:00
Chris Lattner
b7b71a37a1 rewrite ParseCStringVector in terms of stringref.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82348 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:33:46 +00:00
Chris Lattner
05a32c8ab1 move a couple non-trivial methods out of line, add new
find_first_of/find_first_of methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:22:16 +00:00
Chris Lattner
fb2674d0de coding style cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:11:23 +00:00
Chris Lattner
99c5c7b7df convert a bunch more stuff to use StringRef. The ArgName arguments are now
stringref because they may not be nul terminated.  For options like -Lfoo
this now avoids a O(n)  temporary std::strings where N is the length of 
the string after -L.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82345 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 00:40:49 +00:00
Chris Lattner
ba11229f52 avoid a bunch of malloc thrashing for PositinoalVals by eliminating
a std::vector and a bunch of std::string temporaries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 00:07:40 +00:00
Chris Lattner
970e7dff5b Avoid some temporary strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 23:59:02 +00:00
Chris Lattner
63c6b7dc67 add some more overloads of StringRef::getAsInteger for
common and useful integer types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82338 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 23:58:48 +00:00
Chris Lattner
cea1438cf5 provide a "strtoull" operation that works on StringRef's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 19:47:14 +00:00
Chris Lattner
a460beb5cd convert a bunch of std::strings to use StringRef. This should eliminate
a massive number of temporary strings created when parsing a command line.
More still left to eliminate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 18:55:05 +00:00
Benjamin Kramer
461c87655b Try to speed up the slowest parts of the CommandLine library
- Replace std::map<std::string with StringMap
- Eliminate unnecessary std::string copies
- ~10% speed-up for clang's testsuite on my machine (debug build)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82312 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 10:01:45 +00:00
Chris Lattner
d7bd78e36e add a version of the APFloat constructor that initializes to 0.0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 01:08:43 +00:00
Daniel Dunbar
e65512809a Add StringRef::{rfind, rsplit}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 22:38:48 +00:00
Daniel Dunbar
c8213b7827 Drop the raw_ostream required buffer size to 1.
- As best I can tell, we have eliminated all the code which used to require a
   larger buffer size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 20:31:46 +00:00
Ted Kremenek
4dbd074145 Update CMake files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 21:49:45 +00:00
Dan Gohman
ec080467f5 Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn't
working. To support this, add an is_displayed() function to raw_ostream,
and generalize Process::StandardOutIsDisplayed and friends in order to
support it.

Also, call RemoveFileOnSignal before creating a file instead of after, so
that the file isn't left behind if the program is interrupted between when
the file is created and RemoveFileOnSignal is called.

While here, add a -S to llvm-extract and port it to IRReader so that it
supports assembly input.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 20:46:33 +00:00
Chris Lattner
2a1744f553 canonicalize namespace gymnastics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81402 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 23:46:42 +00:00
Daniel Dunbar
ed6878842b Add comment re: clang dependency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81393 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 23:01:25 +00:00
Sean Callanan
251ef612a8 Added an abstract superclass, MCDisassembler, for
all disassemblers.

Modified the MemoryObject to support 64-bit address
spaces, regardless of the LLVM process's address
width.

Modified the Target class to allow extraction of a
MCDisassembler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81392 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 22:49:13 +00:00
Evan Cheng
c48edbb2fd Make sure the memory range is writable before memset'ing it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81308 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 01:45:24 +00:00
Daniel Dunbar
baf9b56230 Add Triple::getArchTypeForDarwinArchName, which converts a "Darwin" architecture
name (e.g. "ppc") to the appropriate constant.

Also, StringRefize additional Triple constructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 23:32:51 +00:00
Daniel Dunbar
0247656d0a Improve JIT error message for users crazy enough to use -march with JIT, and
mention -version in messages about missing targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 23:32:35 +00:00
Daniel Dunbar
ee7110f047 Fix may-be-used-uninitialized warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 16:14:54 +00:00
Duncan Sands
0268790ba4 Avoid warnings if assertions are off.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 19:28:38 +00:00
Duncan Sands
c2d98bc0d6 Remove some not-really-used variables, as warned
about by icc (#593, partial).  Patch by Erick Tryzelaar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 12:41:19 +00:00
Benjamin Kramer
8b3594afdb More MSVC warning fixes:
1. DUPMAX is defined in regcomp.c, no need to redefine it in regutils.
2. MSVC doesn't like snprintf, use _snprintf instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 12:26:28 +00:00
Benjamin Kramer
5b7c3567a1 Remove splint hints to silence warnings from ICC and MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81108 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 09:29:39 +00:00
Duncan Sands
b7c5bdf843 Remove some unused variables and methods warned about by
icc (#177, partial).  Patch by Erick Tryzelaar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 08:33:48 +00:00
Daniel Dunbar
6552478ee7 Show derived host triple in --version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80855 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 23:52:38 +00:00
Ted Kremenek
eed51b04e3 Update CMake files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 17:01:02 +00:00
Richard Osborne
768f1dd48f Add triple parsing support for XCore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80629 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 21:51:36 +00:00
Daniel Dunbar
12420d3a64 Fix some possible-use-of-uninitialized warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80515 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 21:13:58 +00:00
Torok Edwin
ce0c81e7dd Add regular expression matching support, based on OpenBSD regexec()/regcomp()
implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80493 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 08:24:09 +00:00
Dan Gohman
baa26395cc Make LLVM command-line tools overwrite their output files without -f.
This is conventional command-line tool behavior. -f now just means
"enable binary output on terminals".

Add a -f option to llvm-extract and llvm-link, for consistency.

Remove F_Force from raw_fd_ostream and enable overwriting and
truncating by default. Introduce an F_Excl flag to permit users to
enable a failure when the file already exists. This flag is
currently unused.

Update Makefiles and documentation accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 15:34:52 +00:00
Oscar Fuentes
2e193f80eb CMake: updated list of source files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 00:02:29 +00:00
Daniel Dunbar
688b55b436 Add llvm::Triple::getArchTypePrefix for getting the intrinsic prefix for an
identifier architecture.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79906 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 09:53:06 +00:00
Dan Gohman
cb1308b74a Correctly account for the Spaces array nul terminator. Thanks Chris!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 04:43:38 +00:00
Dan Gohman
61ee100b97 raw_ostream::indent is used for PadToColumn which often prints more
than 16 spaces. Make the Spaces array wide enough to handle common cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 04:13:01 +00:00
Chris Lattner
32e1eef631 split raw_os_ostream out to its own header and implementation file. This
means that raw_ostream no longer has to #include <iosfwd>.  Nothing in llvm
should use raw_os_ostream.h, but llvm-gcc and some unit tests do.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 04:02:06 +00:00
Chris Lattner
23132b188b prune the #includes in raw_ostream.h by moving a
member out of line. ftostr is not particularly speedy,
so that method is presumably not perf sensitive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 03:52:50 +00:00
Dan Gohman
2d5e3acd2a Unbreak the build for HAVE_GV platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 03:23:12 +00:00
Oscar Fuentes
e029305bb0 CMake: Updated library dependencies and list of source files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 23:59:15 +00:00
Chris Lattner
91021d3390 remove the dead std::ostream APInt inserter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 23:11:28 +00:00
Chris Lattner
40ef79d5e2 fix some problems with my last patch which happen when one of
(HAVE_GV && (HAVE_DOT || HAVE_FDP || HAVE_NEATO || \
                   HAVE_TWOPI || HAVE_CIRCO))
are true.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 22:53:53 +00:00
Chris Lattner
74382b7c69 Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.

This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
   for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
   clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
   instead.
4. Weans llvm-db off <iostream>

sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 22:45:37 +00:00
Chris Lattner
28fb7c4a9a llvm/Support/Streams.h is now dead, zap it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79865 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 21:50:26 +00:00
Chris Lattner
b683ea4712 eliminate the ostream version of CheckBitcodeOutputToConsole,
change the raw_ostream one to take the raw_ostream byref instead
of byptr.  Prune #includes, eliminate a use of Streams.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 21:36:09 +00:00
Daniel Dunbar
9441cfe488 Fix off-by-one in llvm::Format::print.
- This also shortens the Format.h implementation, and uses the print buffer
   fully (it was wasting a character).

 - This manifested as llvm-test failures, because one side effect was that
   raw_ostream would write garbage '\x00' values into the output stream if it
   happened that the string was at the end of the buffer. This meant that grep
   would report 'Binary file matches', which meant the silly pattern matching
   llvm-test eventually does would fail. Cute. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 20:31:39 +00:00
Chris Lattner
ca179340ce clean up #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 18:09:02 +00:00
Benjamin Kramer
cfa6ec92e6 Kill off more cerr/cout uses and prune includes a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79852 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 11:37:21 +00:00
Benjamin Kramer
d227a3fb1a Remove uses of Streams.h from CommandLine.cpp, fix some whitespace and other minor tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 10:01:13 +00:00
Benjamin Kramer
ae60324d46 Fix windows build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79845 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 08:57:52 +00:00
Daniel Dunbar
43ed267db3 Fix some refactos for iostream changes (in -Asserts mode).
- The world needs better C++ refactoring tools, can I get an Amen!?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 08:50:52 +00:00
Chris Lattner
d9ea85ab01 remove some uses of llvm/Support/Streams.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79842 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 08:43:55 +00:00
Chris Lattner
103289e938 convert LoopInfo.h and GraphWriter.h to use raw_ostream
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79836 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 07:19:13 +00:00
Chris Lattner
a36b81d64f eliminate DOUT and make Debug.h not include Streams.h anymore, woo!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 07:05:39 +00:00
Chris Lattner
45cfe545ec Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 06:03:38 +00:00
Chris Lattner
17e9edc4a7 Change raw_fd_ostream to take flags as an optional bitmask
instead of as two bools.  Use this to add a F_Append flag
which has the obvious behavior.

Other unrelated changes conflated into this patch:

1. REmove EH stuff from llvm-dis and llvm-as, the try blocks
   are dead.
2. Simplify the filename inference code in llvm-as/llvm-dis,
   because raw_fd_ostream does the right thing with '-'.
3. Switch machine verifier to use raw_ostream instead of ostream
   (Which is the thing that needed append in the first place).




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 02:51:22 +00:00
Chris Lattner
de51ded2fa switch formattedstream to use raw_ostream::indent. This eliminates
the weird MAX_COLUMN_PAD limitation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-22 23:16:09 +00:00
Chris Lattner
c5a227ddd1 add a raw_ostream::indent method, to be used like:
OS.indent(i) << "whatever";

people seem to like indenting things ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-22 23:10:29 +00:00
Anton Korobeynikov
4755e9955b Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79688 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 23:09:47 +00:00
Anton Korobeynikov
7e844f128e Implement APInt <-> APFloat conversion for IEEE 128-bit floats.
This fixes PR2555

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79677 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 22:10:30 +00:00
Erick Tryzelaar
56c39eb232 Clean up the APInt function getDigit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 06:48:37 +00:00