Commit Graph

1600 Commits

Author SHA1 Message Date
Charles Davis 54c9eb6fff Now to chant the magical incantation that will exorcise the System library
from LLVM forever:

grep -lR "llvm/System" * | grep -v .svn | xargs sed -ie 's#llvm/System#llvm/Support#g'

llvm-svn: 120314
2010-11-29 19:44:50 +00:00
Michael J. Spencer 4d2e1501ad Missed a spot.
llvm-svn: 120301
2010-11-29 18:29:55 +00:00
Michael J. Spencer 447762da85 Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Jay Foad 3447fb01c0 PR5207: change APInt::doubleToBits() and APInt::floatToBits() to be
static methods that return a new APInt.

llvm-svn: 120261
2010-11-28 21:04:48 +00:00
Benjamin Kramer f2d08136bf Remove PIC16 remnants.
llvm-svn: 120223
2010-11-27 18:20:30 +00:00
Daniel Dunbar 65dc891942 raw_ostream::write_escaped: Add a UseHexEscapes argument.
llvm-svn: 120200
2010-11-27 07:59:50 +00:00
Michael J. Spencer f13f442b1a Fix Whitespace.
llvm-svn: 120166
2010-11-26 04:16:08 +00:00
Jakob Stoklund Olesen a12095d26d Move tree navigation to a new Path class that doesn't have to be a template.
The path also holds a reference to the root node, and that allows important
iterator accessors like start() and stop() to have no conditional code. (When
the compiler is clever enough to remove it.)

llvm-svn: 120165
2010-11-26 01:39:40 +00:00
Chris Lattner 6bf4e6d8b2 add a MemoryBuffer::getOpenFile method, which turns an open
file descriptor into a MemoryBuffer (and closes the FD).

llvm-svn: 120065
2010-11-23 22:20:27 +00:00
Chris Lattner 2dd97d2d60 Revert functionality doug added in r98575 that was never
documented and only used by some clang stuff I just removed.

llvm-svn: 120002
2010-11-23 06:09:51 +00:00
Rafael Espindola cf14a382ec Fix a use after free. Patch by Frits van Bommel.
llvm-svn: 119842
2010-11-19 21:14:29 +00:00
Jakob Stoklund Olesen 345945e355 Add ADT/IntervalMap.
This is a sorted interval map data structure for small keys and values with
automatic coalescing and bidirectional iteration over coalesced intervals.

Except for coalescing intervals, it provides similar functionality to std::map.
It is however much more compact for small keys and values, and hopefully faster
too.

The container object itself can hold the first few intervals without any
allocations, then it switches to a cache conscious B+-tree representation. A
recycling allocator can be shared between many containers, even between
containers holding different types.

The IntervalMap is initially intended to be used with SlotIndex intervals for:

- Backing store for LiveIntervalUnion that is smaller and faster than std::set.

- Backing store for LiveInterval with less overhead than std::vector for typical
  intervals and O(N log N) merging of large intervals. 99% of virtual registers
  need 4 entries or less and would benefit from the small object optimization.

- Backing store for LiveDebugVariable which doesn't exist yet, but will track
  debug variables during register allocation.

This is a work in progress. Missing items are:

- Performance metrics.
- erase().
- insert() shrinkage.
- clear().
- More performance metrics.
- Simplification and detemplatization.

llvm-svn: 119787
2010-11-19 04:47:19 +00:00
Jakob Stoklund Olesen 09770251f6 Revert "Add ADT/IntervalMap.", GCC doesn't like it.
This reverts r119772.

llvm-svn: 119773
2010-11-19 01:21:03 +00:00
Jakob Stoklund Olesen 6d89171dcc Add ADT/IntervalMap.
This is a sorted interval map data structure for small keys and values with
automatic coalescing and bidirectional iteration over coalesced intervals.

Except for coalescing intervals, it provides similar functionality to std::map.
It is however much more compact for small keys and values, and hopefully faster
too.

The container object itself can hold the first few intervals without any
allocations, then it switches to a cache conscious B+-tree representation. A
recycling allocator can be shared between many containers, even between
containers holding different types.

The IntervalMap is initially intended to be used with SlotIndex intervals for:

- Backing store for LiveIntervalUnion that is smaller and faster than std::set.

- Backing store for LiveInterval with less overhead than std::vector for typical
  intervals and O(N log N) merging of large intervals. 99% of virtual registers
  need 4 entries or less and would benefit from the small object optimization.

- Backing store for LiveDebugVariable which doesn't exist yet, but will track
  debug variables during register allocation.

This is a work in progress. Missing items are:

- Performance metrics.
- erase().
- insert() shrinkage.
- clear().
- More performance metrics.
- Simplification and detemplatization.

llvm-svn: 119772
2010-11-19 01:14:40 +00:00
Dale Johannesen 461e704a2c Aligned and unaligned copies of the same string
were not hashing to the same value.  Analysis
and patch by Frits van Bommel!

llvm-svn: 119770
2010-11-19 00:48:58 +00:00
Dan Gohman 5ed61fe6a1 Bounds-check APInt's operator[].
llvm-svn: 119708
2010-11-18 17:14:56 +00:00
Chris Lattner b0e36085c4 now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate the
cookie argument to the SourceMgr diagnostic stuff.  This cleanly separates
LLVMContext's inlineasm handler from the sourcemgr error handling 
definition, increasing type safety and cleaning things up.

llvm-svn: 119486
2010-11-17 08:13:01 +00:00
Daniel Dunbar 2ed3fe08e9 report_fatal_error: Simplify a possible ambiguity.
llvm-svn: 118972
2010-11-13 02:48:51 +00:00
Ted Kremenek 3e100cf582 Fix memory leak in StringRef::edit_distance(). 'Allocated' could be leaked on an early return.
llvm-svn: 118370
2010-11-07 06:09:02 +00:00
Daniel Dunbar f4d90ba9f5 CrashRecoveryContext: Add RunSafelyOnThread helper function.
llvm-svn: 118272
2010-11-05 07:19:09 +00:00
Mikhail Glushenkov b8211b80bc Rename FindExecutable to PrependMainExecutablePath.
Makes it more clear that it is just a path manipulation function.

llvm-svn: 118174
2010-11-03 16:14:16 +00:00
Dan Gohman 0baea2aa1b Print an error as one big string instead of breaking it up.
llvm-svn: 118130
2010-11-03 00:24:33 +00:00
Mikhail Glushenkov 4fb337560c Revert r118057, this is better fixed in appendSuffix itself.
llvm-svn: 118088
2010-11-02 22:18:28 +00:00
Dan Gohman 35b2013bf8 Don't append a dot on platforms which don't use exe suffixes.
llvm-svn: 118057
2010-11-02 20:49:48 +00:00
Mikhail Glushenkov 82ee8dad50 FindExecutable: remove the executability check.
This makes the behaviour of FindExecutable more consistent across platforms, but
I'm not very happy with the name...

llvm-svn: 118049
2010-11-02 20:32:46 +00:00
Dan Gohman e1db7f2005 Fix these error messages to be less confusing. These error
messages primarily indicate errors running the viewer, not
errors with the graph file itself.

llvm-svn: 117665
2010-10-29 17:03:40 +00:00
Mikhail Glushenkov fdba1308ee Remove an unnecessary check and an unnecessary temporary.
llvm-svn: 117583
2010-10-28 19:33:04 +00:00
Douglas Gregor 21afc3b012 Extend StringRef's edit-distance algorithm to permit an upper bound on the allowed edit distance
llvm-svn: 116867
2010-10-19 22:13:48 +00:00
NAKAMURA Takumi fe84f39adb lib/Support/raw_ostream.cpp: Fix Cygwin's build.
setmode is provided by io.h on Cygwin.

llvm-svn: 116784
2010-10-19 01:21:55 +00:00
Daniel Dunbar 418e7046f7 CrashRecoveryContext: Add missing return, so that the signal fires after we our
routine is off the stack. Otherwise we show up rather confusingly in the stack
trace.

llvm-svn: 116755
2010-10-18 21:55:18 +00:00
Oscar Fuentes 889c1e7d80 Build with RTTI and exceptions disabled. Only in GCC for now.
llvm-svn: 116682
2010-10-17 02:26:16 +00:00
Francois Pichet a3037c3abd Always use binary mode for output stream. This is important to prevent unwanted end of line conversion on Windows. Should not affect Unix where O_BINARY is not defined. This fix /clang/test/lexer/preamble.c XFAIL on WIN32.
llvm-svn: 116509
2010-10-14 20:30:58 +00:00
Chris Lattner b9681ad442 fix a bug I introduced, no idea how this didn't repro right.
llvm-svn: 116462
2010-10-14 00:30:00 +00:00
Chris Lattner 698661c741 add uadd_ov/usub_ov to apint, consolidate constant folding
logic to use the new APInt methods.  Among other things this
implements rdar://8501501 - llvm.smul.with.overflow.i32 should constant fold

which comes from "clang -ftrapv", originally brought to my attention from PR8221.

llvm-svn: 116457
2010-10-14 00:05:07 +00:00
Chris Lattner 2c819b0358 constify these methods.
llvm-svn: 116455
2010-10-13 23:54:10 +00:00
Chris Lattner 79bdd88fa4 add a few operations for signed operations that also
return an overflow flag.

llvm-svn: 116452
2010-10-13 23:46:33 +00:00
John Thompson f41f11c37e Unbreak cmake build.
llvm-svn: 116003
2010-10-07 23:12:15 +00:00
Dan Gohman 0df7ea4c24 Move tool_output_file into its own file.
llvm-svn: 115973
2010-10-07 20:32:40 +00:00
Dan Gohman 6547a50f49 After printing "Running 'Graphviz' program... " and running the
Graphviz program, print something with a newline, to avoid leaving
the line unfinished.

llvm-svn: 115620
2010-10-05 15:30:27 +00:00
Benjamin Kramer 90086abf2c Grow BumpPtrAllocator's slab size dynamically if we allocated many slabs. This
reduces the amount of malloc calls and may reduce memory overhead.

Some numbers:
ASTContext stats, clang -cc1 -disable-free -fsyntax-only Cocoa_h.m
without dynamic growth                          |  with dynamic growth
Number of memory regions: 3158                  |  Number of memory regions: 432
Bytes used: 12333185                            |  Bytes used: 12333185
Bytes allocated: 12935168                       |  Bytes allocated: 12800000
Bytes wasted: 601983 (includes alignment, etc)  |  Bytes wasted: 466815 (includes alignment, etc)

ASTContext stats, clang -cc1 -disable-free -fsyntax-only on clang's ASTReader.cpp
without dynamic growth                          |  with dynamic growth
Number of memory regions: 10987                 |  Number of memory regions: 551
Bytes used: 42910356                            |  Bytes used: 42910356
Bytes allocated: 45002752                       |  Bytes allocated: 44711936
Bytes wasted: 2092396 (includes alignment, etc) |  Bytes wasted: 1801580 (includes alignment, etc)

llvm-svn: 115151
2010-09-30 16:18:28 +00:00
Oscar Fuentes b4b12535e8 Removed a bunch of unnecessary target_link_libraries.
llvm-svn: 114999
2010-09-28 22:39:14 +00:00
Nick Lewycky 5154ee0bca Make ConstantRange::makeICmpRegion handle all the edge cases properly. This
also fixes PR8250.

llvm-svn: 114972
2010-09-28 18:18:36 +00:00
Benjamin Kramer c758311025 Push twines deeper into SourceMgr's error handling methods.
llvm-svn: 114847
2010-09-27 17:42:11 +00:00
Dan Gohman ca8ebc8de2 Delete an unused declaration.
llvm-svn: 114839
2010-09-27 16:54:49 +00:00
Dan Gohman a0da88931c Add support for viewing graphviz graphs with xdot.py.
llvm-svn: 114832
2010-09-27 16:28:34 +00:00
Duncan Sands 84a3bddfc3 Add better support for environment portion of triple. Original patch by
Cameron Esfahani, tweaked to use array_lengthof.

llvm-svn: 114073
2010-09-16 08:25:48 +00:00
Duncan Sands c8ba8d2085 Some versions of gcc still warn about "ignoring return value ... declared
with attribute warn_unused_result" here - suppress the warning harder.

llvm-svn: 114072
2010-09-16 08:20:49 +00:00
Nick Lewycky 4c82c6c6fe Create PTX backend. Patch by Che-Liang Chiou!
llvm-svn: 113235
2010-09-07 18:14:24 +00:00
Nick Lewycky ad48e01eef Add completely hokey binary-and and binary-or operations to ConstantRange and
teach LazyValueInfo to use them.

llvm-svn: 113196
2010-09-07 05:39:02 +00:00
Nick Lewycky a35462da3d Add a new isSignWrappedSet() method to ConstantRange.
Fix zeroExtend and signExtend to support empty sets, and to return the smallest
possible result set which contains the extension of each element in their
inputs. For example zext i8 [100, 10) to i16 is now [0, 256), not i16 [100, 10)
which contains 63446 members.

llvm-svn: 113187
2010-09-06 23:52:49 +00:00
Dan Gohman 2adf2f2714 Use the FindProgramByName fallback only with known absolute paths.
I wasn't able to convince myself that all GetMainExecutable
implementations always return absolute paths; this prevents
unexpected behavior in case they ever don't.

llvm-svn: 112888
2010-09-02 22:32:38 +00:00
John McCall 7f55c258c6 After some discussion with djg, teach SmallVector to grow from a zero
capacity and remove the workaround in SmallVector<T,0>.  There are some
theoretical benefits to a N->2N+1 growth policy anyway.

llvm-svn: 112870
2010-09-02 21:55:03 +00:00
NAKAMURA Takumi 4fa39acb53 llvm::FindExecutable(): Retrieve the name with suffix.exe, if available.
bugpoint uses it.

llvm-svn: 112803
2010-09-02 03:46:04 +00:00
Dan Gohman a2233f2801 Make tool_output_file's raw_ostream instance a member variable instead
of a base class.

This makes it possible to unregister the file from FilesToRemove when
the file is done. Also, this eliminates the need for
formatted_tool_output_file.

llvm-svn: 112706
2010-09-01 14:20:41 +00:00
Duncan Sands 1b6744a376 Remove a hack that tries to understand incorrect triples from the
Triple class constructor.  Only valid triples should now be used
inside LLVM - front-ends are now responsable for rejecting or
correcting invalid target triples.  The Triple::normalize method
can be used to straighten out funky triples provided by users.
Give this a whirl through the buildbots to see if I caught all
places where triples enter LLVM.

llvm-svn: 112470
2010-08-30 10:57:54 +00:00
Benjamin Kramer 9bf0380a54 StringRef::compare_numeric also differed from StringRef::compare for characters > 127.
llvm-svn: 112189
2010-08-26 15:25:35 +00:00
Benjamin Kramer b04d4af057 Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases.
llvm-svn: 112185
2010-08-26 14:21:08 +00:00
Dan Gohman 3d9ed28046 Use Bits.data() instead of &Bits[0].
llvm-svn: 111993
2010-08-24 23:16:53 +00:00
Benjamin Kramer 08fd2cf26a Avoid O(n*m) complexity in StringRef::find_first(_not)_of(StringRef).
- Cache used characters in a bitset to reduce memory overhead to just 32 bytes.
- On my core2 this code is faster except when the checked string was very short
  (smaller than the list of delimiters).

llvm-svn: 111817
2010-08-23 18:16:08 +00:00
Benjamin Kramer d3eb989f37 Update CMake build.
llvm-svn: 111669
2010-08-20 18:56:46 +00:00
Dan Gohman 12cbe696e4 Delete SlowOperationInformer, which is no longer used.
llvm-svn: 111661
2010-08-20 18:07:37 +00:00
Dan Gohman e9a469115c Make outs() close its file when its stream is destructed, so that
pending output errors are detected.

llvm-svn: 111643
2010-08-20 16:44:56 +00:00
Dan Gohman 443f2d6426 Delete raw_stdout_ostream and raw_stderr_ostream, which are unused
outside of outs() and errs() themselves, and they don't really
need custom classes.

llvm-svn: 111642
2010-08-20 16:39:41 +00:00
Dan Gohman 38adfdd100 Move raw_ostream's Error flag into raw_fd_ostream, as that's the only
class which is using it.

llvm-svn: 111639
2010-08-20 16:34:20 +00:00
Dan Gohman b87ad69350 Introduce a new tool_output_file class, which extends raw_ostream with
functionality that most command-line tools need: ensuring that the
output file gets deleted if the tool is interrupted or encounters an
error.

llvm-svn: 111595
2010-08-20 00:48:10 +00:00
Dale Johannesen 370c77c064 Do not assert when reading an exponent out of range.
llvm-svn: 111534
2010-08-19 17:58:35 +00:00
Dan Gohman c825ceefb4 Make raw_fd_ostream consider itself the owner of STDOUT_FILENO when
constructed with an output filename of "-". In particular, allow the
file descriptor to be closed, and close the file descriptor in the
destructor if it hasn't been explicitly closed already, to ensure
that any write errors are detected.

llvm-svn: 111436
2010-08-18 22:26:19 +00:00
Dan Gohman 3490ff4002 Tidy.
llvm-svn: 111432
2010-08-18 22:04:43 +00:00
Dan Gohman 44790e7aa7 Revert r111321. This doesn't fix a problem.
llvm-svn: 111339
2010-08-18 01:34:52 +00:00
Chris Lattner b91c903f46 stomp some more undefined behavior, PR7775.
llvm-svn: 111337
2010-08-18 00:33:47 +00:00
Chris Lattner 7aa9eb16fd include config.h to get config params, hopefully unbreaking mingw builder.
llvm-svn: 111325
2010-08-17 23:22:10 +00:00
Chris Lattner ce3b2c3f77 Fix the rest of rdar://8318441 which happens when a raw_fd_ostream
(e.g. errs()) fails in close() due to (e.g.) a broken pipe.  As
previously written, the had_error() flag would get set and then
the raw_ostream dtor would report a fatal error.  There is nothing
the client can do about this and we have no way to report the error,
so just eat it.

llvm-svn: 111321
2010-08-17 23:11:56 +00:00
Chris Lattner 6217082dc3 report_fatal_error can't use errs(), because errs() can call
into report_fatal_error.  Just blast the string to stderr with write(2)
and hope for the best!  Part of rdar://8318441

llvm-svn: 111320
2010-08-17 23:03:53 +00:00
Daniel Dunbar 09b0c78918 CrashRecovery: Clear the current context on the first crash, to avoid re-entering it if the cleanup code crashes.
llvm-svn: 111309
2010-08-17 22:32:39 +00:00
Daniel Dunbar b30266ed20 CrashRecovery: Add CrashRecoveryContext::GetCurrent(), so clients can find the active context from anywhere.
llvm-svn: 111308
2010-08-17 22:32:37 +00:00
Daniel Dunbar ff329942cd CrashRecovery: Make CrashRecoveryContext static methods thread safe.
llvm-svn: 111307
2010-08-17 22:32:34 +00:00
Jim Grosbach a927736604 remove trailing whitespace
llvm-svn: 111254
2010-08-17 17:37:22 +00:00
Dan Gohman 9c9ce53b29 Add hooks to FoldingSetTrait to allow specializations to provide
implementations of equality comparison and hash computation. This
can be used to optimize node lookup by avoiding creating lots of
temporary ID values just for hashing and comparison purposes.

llvm-svn: 111130
2010-08-16 15:30:39 +00:00
Dan Gohman 27c98e6303 Reverse the order of GetNodeProfile's arguments, for consistency
with FoldingSetTrait::Profile.

llvm-svn: 111127
2010-08-16 14:53:42 +00:00
Duncan Sands 501dff76ce Add a 'normalize' method to the Triple class, which takes a mucked up
target triple and straightens it out.  This does less than gcc's script
config.sub, for example it turns i386-mingw32 into i386--mingw32 not
i386-pc-mingw32, but it does a decent job of turning funky triples into
something that the rest of the Triple class can understand.  The plan
is to use this to canonicalize triple's when they are first provided
by users, and have the rest of LLVM only deal with canonical triples.
Once this is done the special case workarounds in the Triple constructor
can be removed, making the class more regular and easier to use.  The
comments and unittests for the Triple class are already adjusted in this
patch appropriately for this brave new world of increased uniformity.

llvm-svn: 110909
2010-08-12 11:31:39 +00:00
Nick Lewycky d385c22cf3 Clean up ConstantRange a bit:
- remove ashr which never worked.
 - fix lshr and shl and add tests.
 - remove dead function "intersect1Wrapped".
 - add a new sub method to subtract ranges, with test.

llvm-svn: 110861
2010-08-11 22:04:36 +00:00
Eric Christopher 87947f7729 Fix a couple of warnings.
llvm-svn: 110527
2010-08-08 00:00:34 +00:00
Benjamin Kramer a7d0ccfe7f Roll back my last two commits, valgrind complains.
llvm-svn: 110518
2010-08-07 13:27:41 +00:00
Benjamin Kramer 591a79fb2f Kill rarely used std::sort.
llvm-svn: 110516
2010-08-07 12:37:00 +00:00
Owen Anderson a5a3ff586f Remove layering violation.
llvm-svn: 110505
2010-08-07 06:01:13 +00:00
Owen Anderson 1a9078b862 Add an inverse() method to ConstantRange.
llvm-svn: 110504
2010-08-07 05:47:46 +00:00
Owen Anderson 07d0637000 Add a convenience constructor.
llvm-svn: 110493
2010-08-07 00:42:06 +00:00
Chris Lattner 3db3bb0032 avoid undef behavior on minint, fixing PR7783.
llvm-svn: 110114
2010-08-03 16:41:24 +00:00
Daniel Dunbar c90e82a7f1 Fix -Wmissing-field-initializers warnings.
llvm-svn: 109872
2010-07-30 17:49:04 +00:00
Daniel Dunbar 4a338e3dc4 CrashRecovery: Use ThreadLocal::erase() instead of set(0).
llvm-svn: 109752
2010-07-29 15:24:21 +00:00
Daniel Dunbar 9789f81eb4 Make sure to include config.h, to pickup LLVM_ON_WIN32.
llvm-svn: 109721
2010-07-29 01:52:04 +00:00
Daniel Dunbar af77e22b36 CrashRecoveryContext: Add a simple POSIX implementation.
- This works, but won't handle crashes on stack overflow, or signals delivered
   to a thread other than the one that crashed. The latter is particular annoying
   on Darwin, because SIGABRT tends to go to the main thread.

llvm-svn: 109717
2010-07-29 01:21:47 +00:00
Douglas Gregor b7b5a7dff0 Unbreak my CMake build, say you'll compile for me again...
llvm-svn: 109598
2010-07-28 17:17:46 +00:00
Daniel Dunbar 19a3b37441 Support: Add CrashRecoveryContext helper object.
- Designed as a simple wrapper to allow clients to attempt to catch crashes
   (memory errors, assertion violations, etc.) and do some kind of recovery.

 - Currently doesn't actually attempt to catch crashes.

llvm-svn: 109586
2010-07-28 15:40:20 +00:00
Benjamin Kramer 92d8998348 Don't pass StringRef by reference.
llvm-svn: 108366
2010-07-14 22:38:02 +00:00
Chris Lattner ca97c92eb4 add some triple for minix, patch by Kees van Reeuwijk from PR7582
llvm-svn: 107785
2010-07-07 15:52:27 +00:00
Duncan Sands 7b90966d4a Rather than giving SmallPtrSetImpl a member field SmallArray which is magically
replaced by a bigger array in SmallPtrSet (by overridding it), instead just use a
pointer to the start of the storage, and have SmallPtrSet pass in the value to use.
This has the disadvantage that SmallPtrSet becomes bigger by one pointer.  It has
the advantage that it no longer uses tricky C++ rules, and is clearly correct while
I'm not sure the previous version was.  This was inspired by g++-4.6 pointing out
that SmallPtrSetImpl was writing off the end of SmallArray, which it was.  Since
SmallArray is replaced with a bigger array in SmallPtrSet, the write was still to
valid memory.  But it was writing off the end of the declared array type - sounds
kind of dubious to me, like it sounded dubious to g++-4.6.  Maybe g++-4.6 is wrong
and this construct is perfectly valid and correctly compiled by all compilers, but
I think it is better to avoid the whole can of worms by avoiding this construct.

llvm-svn: 107285
2010-06-30 15:02:37 +00:00
Eric Christopher 7f103a2653 Fix thinko.
llvm-svn: 107042
2010-06-28 18:33:48 +00:00
Eric Christopher 51f2908328 Pull in the libCrashReporterClient.a information with a warning comment.
Remove library check and regenerate configure.

llvm-svn: 107028
2010-06-28 18:25:51 +00:00
Benjamin Kramer 58e6c2eded Rewrite MemoryBuffer::getSTDIN to use read(2) and a SmallVector buffer.
llvm-svn: 106856
2010-06-25 16:07:18 +00:00
Benjamin Kramer 948dd57945 Bring back the empty vector workaround I removed in r106839. Looks like MSVC needs it.
llvm-svn: 106841
2010-06-25 12:51:01 +00:00
Benjamin Kramer ce2a92220f Tweak MemoryBuffer to allocate the class itself, the name and possibly the
buffer in the same chunk of memory.

2 less mallocs for every uninitialized MemoryBuffer and 1 less malloc for every
MemoryBuffer pointing to a memory range translate into 20% less mallocs on
clang -cc1 -Eonly Cocoa_h.m.

llvm-svn: 106839
2010-06-25 11:50:40 +00:00
Dan Gohman b377e2828d Add overloads for getFile and getFileOrSTDIN which take a const char *
instead of a StringRef, avoiding the need to copy the string in the
common case.

llvm-svn: 106754
2010-06-24 16:25:50 +00:00
Eric Christopher e9c1bb6cb1 Look for and use a different darwin crash reporter library.
llvm-svn: 106576
2010-06-22 21:01:04 +00:00
Dan Gohman 2ceaa71bdb Add an explicit keyword.
llvm-svn: 106538
2010-06-22 13:53:29 +00:00
Benjamin Kramer bf5c3d42ba Use calloc instead of new/memset, it is more efficient when the set is very large.
llvm-svn: 106390
2010-06-19 17:00:31 +00:00
Dan Gohman 6e681a5fbe Give NamedRegionTimer an Enabled flag, allowing all its clients to
switch from this:

  if (TimePassesIsEnabled) {
    NamedRegionTimer T(Name, GroupName);
    do_something();
  } else {
    do_something(); // duplicate the code, this time without a timer!
  }

to this:

  {
    NamedRegionTimer T(Name, GroupName, TimePassesIsEnabled);
    do_something();
  }

llvm-svn: 106285
2010-06-18 15:56:31 +00:00
Jason Molenda dd6a4cabf6 Add the entire range of DW_OP_lit[0..31], DW_OP_reg[0..31], and
DW_OP_breg[0..31] to Dwarf.h.

Add "DW_" prefix to the llvm::dwarf::*String methods which did not
already have them in Dwarf.cpp.

llvm-svn: 106197
2010-06-17 01:23:24 +00:00
Daniel Dunbar e22295e8a6 fpcmp: Fix bug where fpcmp wouldn't early exit when files obviously differ and
no tolerance is set.

llvm-svn: 106033
2010-06-15 19:20:30 +00:00
Daniel Dunbar b645fa13a9 fpcmp: Fix a possible infinite loop when comparing something like:
1..19 ok
to
  1..20 o k
(yes, the odd space is necessary).

llvm-svn: 106032
2010-06-15 19:20:28 +00:00
Daniel Dunbar 5729f51410 Use const_iterator where appropriate.
llvm-svn: 105620
2010-06-08 17:21:57 +00:00
Daniel Dunbar f2363de7ad DeltaAlgorithm: Tweak split to split by first/second half instead of even/odd, since adjacent changes are more likely to be related.
llvm-svn: 105613
2010-06-08 16:21:26 +00:00
Daniel Dunbar 579ba2ac42 ADT: Add DAGDeltaAlgorithm, which is a DAG minimization algorithm built on top of the standard 'delta debugging' algorithm.
- This can give substantial speedups in the delta process for inputs we can construct dependency information for.

llvm-svn: 105612
2010-06-08 16:21:22 +00:00
Benjamin Kramer 4e36e5bb4c Use realloc instead of malloc+memcpy when growing a POD SmallVector. A smart
realloc implementation can try to expand the allocated memory block in-place,
avoiding the copy.

llvm-svn: 105605
2010-06-08 11:44:30 +00:00
Dan Gohman fb85820f9a Minor code simplification.
llvm-svn: 104959
2010-05-28 16:50:23 +00:00
Dan Gohman feaeb36edf Fix a redundant-return warning.
llvm-svn: 104958
2010-05-28 16:50:01 +00:00
Dan Gohman c36b1f35f0 Add basic error checking to MemoryBuffer::getSTDIN.
llvm-svn: 104855
2010-05-27 17:31:51 +00:00
Jakob Stoklund Olesen d1d7ed63ff Add StringRef::compare_numeric and use it to sort TableGen register records.
This means that our Registers are now ordered R7, R8, R9, R10, R12, ...
Not R1, R10, R11, R12, R2, R3, ...

llvm-svn: 104745
2010-05-26 21:47:28 +00:00
Daniel Dunbar c120ffe3f6 Fix __crashreport_info__ declaration.
llvm-svn: 104300
2010-05-20 23:50:19 +00:00
Dan Gohman 744c96dd48 Add a comment explaining why this code uses Append mode.
llvm-svn: 104095
2010-05-19 01:21:34 +00:00
Dan Gohman dea5310433 Usage of O_NONBLOCK in bjam is now confirmed as a bug and fixed upstream.
Update the comment.

llvm-svn: 104021
2010-05-18 15:25:14 +00:00
Chris Lattner 9e01b615a4 improve portability to systems that don't have round, patch by
Evzen Muller!

llvm-svn: 103877
2010-05-15 17:11:55 +00:00
Daniel Dunbar dac182450b Add new configure option, --disable-timestamps, intended to turn off anything which would mess up binary/object comparisons. Currently:
- Disables 'Built on ...' in 'foo --version'.
 - Disables timestamps from being embedded into .dir files.

llvm-svn: 103423
2010-05-10 20:11:56 +00:00
Daniel Dunbar 401d4c9341 Run interrupt routines as part of report_fatal_error, since we are failing
ungracefully.

llvm-svn: 103334
2010-05-08 02:10:36 +00:00
Dan Gohman d351116be0 Handle the case where open(2) or close(2) is interrupted by a signal when
automatic syscall restarting is disabled.

Also, fix the build on systems which don't define EWOULDBLOCK.

llvm-svn: 103158
2010-05-06 02:06:20 +00:00
Dan Gohman ef969f3539 Handle EWOULDBLOCK as EAGAIN. And add a comment explaining why
EAGAIN and EWOULDBLOCK are used here.

Also, handle the case where a write call is interrupted after
some data has already been written.

llvm-svn: 103153
2010-05-06 01:27:36 +00:00
Chris Lattner d7f69cb7ef Implement rdar://7415680 - Twine integer support lacks greatness
Microoptimize Twine's with unsigned and int to not pin their value to
the stack.  This saves stack space in common cases and allows mem2reg
in the caller.  A simple example is:

void foo(const Twine &);
void bar(int x) {
  foo("xyz: " + Twine(x));
}

Before:

__Z3bari:
	subq	$40, %rsp
	movl	%edi, 36(%rsp)
	leaq	L_.str3(%rip), %rax
	leaq	36(%rsp), %rcx
	leaq	8(%rsp), %rdi
	movq	%rax, 8(%rsp)
	movq	%rcx, 16(%rsp)
	movb	$3, 24(%rsp)
	movb	$7, 25(%rsp)
	callq	__Z3fooRKN4llvm5TwineE
	addq	$40, %rsp
	ret

After:

__Z3bari:
	subq	$24, %rsp
	leaq	L_.str3(%rip), %rax
	movq	%rax, (%rsp)
	movslq	%edi, %rax
	movq	%rax, 8(%rsp)
	movb	$3, 16(%rsp)
	movb	$7, 17(%rsp)
	leaq	(%rsp), %rdi
	callq	__Z3fooRKN4llvm5TwineE
	addq	$24, %rsp
	ret

It saves 16 bytes of stack and one instruction in this case.

llvm-svn: 103107
2010-05-05 18:40:33 +00:00
Benjamin Kramer ce84a2558c Try again if write(2) reports an recoverable error.
This should fix mysteriously crashing boost regression tests when stderr is
managed by bjam (PR7043).

llvm-svn: 103085
2010-05-05 15:17:47 +00:00
Devang Patel 561fa8490e Fix typo. add a test case.
llvm-svn: 101812
2010-04-19 20:31:39 +00:00
Devang Patel 6188093cca Add DW_AT_APPLE_omit_frame_ptr to encode -fomit-frame-pointer flag.
llvm-svn: 101805
2010-04-19 19:14:02 +00:00
Chris Lattner 1049e1ce1f reduce indentation
llvm-svn: 101692
2010-04-18 03:35:23 +00:00
Dan Gohman b29cda9b3c Fix a bunch of namespace polution.
llvm-svn: 101376
2010-04-15 17:08:50 +00:00
Benjamin Kramer 55cfaa37de BumpPtrAllocator::Reset() doesn't need to allocate anything. (Thanks, Jakob)
llvm-svn: 101138
2010-04-13 16:38:06 +00:00
Benjamin Kramer 5b0650bf6e Let BumpPtrAllocator lazily allocate the first slab.
We have some code in llvm and clang where a BumpPtrAllocator is declared in a
class but never used in the common case. Stop wasting memory there.

llvm-svn: 101130
2010-04-13 14:41:51 +00:00
Chris Lattner 33154c1fc6 Fix PR6826: GraphWriter delete the generated file before "dotty" load it,
patch by 'ether'.

llvm-svn: 101116
2010-04-13 04:35:39 +00:00
Chris Lattner c86cdc7d47 add minix support, patch by Kees van Reeuwijk! PR6797
llvm-svn: 100895
2010-04-09 20:45:04 +00:00
Chris Lattner 5c289f217b clean this up, fix std::min ambiguity on some platforms.
llvm-svn: 100894
2010-04-09 20:43:54 +00:00
Benjamin Kramer 53dd088b58 Various MSVC warning fixes about truncated 64 bit shifts and const pointers passed to free.
llvm-svn: 100767
2010-04-08 15:25:57 +00:00
Chris Lattner 59c5753174 rename llvm_install_error_handler -> install_fatal_error_handler
and friends.

llvm-svn: 100717
2010-04-07 23:12:29 +00:00
Chris Lattner 2104b8d36e rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Chris Lattner 97c4cb8947 enhance SMDiagnostic to also maintain a pointer to the SourceMgr.
Add a simplified constructor for clients that don't have locations
like "file not found" errors.

llvm-svn: 100538
2010-04-06 18:06:18 +00:00
Chris Lattner 654091391b give the SourceMgr object a cookie.
llvm-svn: 100504
2010-04-06 00:33:43 +00:00
Chris Lattner 3c799811c1 Give llvm::SourceMgr the ability to have a client-specified
diagnostic handler.

llvm-svn: 100503
2010-04-06 00:26:48 +00:00
Chris Lattner 0e45d24a4e stringref-ize the MemoryBuffer::get apis. This requires
a co-committed clang patch.

llvm-svn: 100485
2010-04-05 22:42:30 +00:00
Owen Anderson f93bdd1024 Push const through the regex engine. Fixes some of the warnings in PR6616.
llvm-svn: 100438
2010-04-05 17:50:20 +00:00
Benjamin Kramer 15630f8238 Remove accidental include and add a comment.
llvm-svn: 100107
2010-04-01 14:39:55 +00:00
Benjamin Kramer 10b0f3b314 Various improvements to MemoryBuffer::getFile:
- Use a RAII object to close the FD.
- Use sys::StrError instead of thread-unsafe strerror calls.
- Recover gracefully if read returns zero. This works around an issue on
  DragonFlyBSD where /dev/null has an st_size of 136 but we can't read 136 bytes
  from it.

llvm-svn: 100106
2010-04-01 14:35:22 +00:00
Benjamin Kramer 04c713dd45 Introduce SpecificBumpPtrAllocator, a wrapper for BumpPtrAllocator which allows
only a single type of object to be allocated. Use it to make VNInfo destruction
typesafe.

llvm-svn: 99919
2010-03-30 20:16:45 +00:00
Douglas Gregor 83fd0156a9 Introduce namespace-scope functions to enable LLVM statistics without
passing the command-line parameter "-stats" and to print the resulting
statistics without calling llvm_shutdown().

llvm-svn: 99893
2010-03-30 17:32:08 +00:00
Torok Edwin 8061bb141e Reapply r99881 with some fixes: only call destructor in releaseMemory!
llvm-svn: 99883
2010-03-30 11:17:48 +00:00
Torok Edwin a2d1dc42e1 Revert 99881, it brooke smooshlab's llvm-gcc-i386-darwin9.
llvm-svn: 99882
2010-03-30 10:25:08 +00:00
Torok Edwin ba6d13c0ea Introduce another Reset() method in BumpPtrAllocator that calls a destructor
on all objects it has allocated, if they are all of the same size and alignment.
Use this to destruct all VNInfos allocated in LiveIntervalAnalysis (PR6653).

valnos is not reliable for this purpose, as seen in r99400
(which still leaked, and sometimes caused double frees).

llvm-svn: 99881
2010-03-30 10:08:26 +00:00
Chris Lattner 39e56a05f7 stringref'ize Timer apis
llvm-svn: 99877
2010-03-30 05:34:02 +00:00
Chris Lattner 90fe73dc92 finally, maintain a global list of timer groups, allowing us to
implement TimerGroup::printAll, which prints and resets all active
timers.

llvm-svn: 99876
2010-03-30 05:27:58 +00:00
Chris Lattner 4cd6571fef add a new TimerGroup::print method, and refactor away the bogus
TimerGroup copy ctor and assignment operator.

llvm-svn: 99875
2010-03-30 05:20:02 +00:00
Chris Lattner 6cbd8d118e rename GetLibSupportInfoOutputFile -> CreateInfoOutputFile and
have it always return a new stream to simplify clients.

llvm-svn: 99874
2010-03-30 05:01:08 +00:00
Chris Lattner dcd68b7a65 if a timergroup is destroyed before its timers, print times.
llvm-svn: 99873
2010-03-30 04:58:26 +00:00
Chris Lattner 9a608d248e change TimerGroup to keep a linked list of active timers
instead of just a count of them, and refactor the guts of
report printing out of removeTimer into its own method.
Refactor addTimerToPrint away.

llvm-svn: 99872
2010-03-30 04:40:01 +00:00
Chris Lattner 707431cf26 reapply my timer rewrite with a change for PassManager to store
timers by pointer instead of by-value.

llvm-svn: 99871
2010-03-30 04:03:22 +00:00
Chris Lattner ec8ef9b643 revert r99862 which is causing FNT failures.
llvm-svn: 99870
2010-03-30 03:57:00 +00:00
Chris Lattner 57a0542397 fairly major rewrite of various timing related stuff.
llvm-svn: 99862
2010-03-30 02:38:19 +00:00
Chris Lattner dcd7f927bd move a function into a more logical place in the file
llvm-svn: 99842
2010-03-29 21:34:06 +00:00
Chris Lattner 09a4074869 remove support for per-time peak memory tracking, this
isn't used by anyone and is better exposed as a non-per-timer 
thing.  Also, stop including System/Mutex.h in Timer.h

llvm-svn: 99841
2010-03-29 21:28:41 +00:00
Chris Lattner b355db7877 various timer fixes: move operator= out of line,
eliminate the per-timer lock (timers should be 
externally locked if needed), the info-output-stream
can never be dbgs(), so drop the check.  Make some
stuff private.

llvm-svn: 99839
2010-03-29 21:24:52 +00:00
Chris Lattner 5092a6de8e s/.../.
llvm-svn: 99834
2010-03-29 20:40:19 +00:00
Chris Lattner fafa57a82a move code around and improve indentation, no functionality change.
llvm-svn: 99831
2010-03-29 20:35:01 +00:00
Chris Lattner 35a069b3a5 improve portability to minix, patch by
Kees van Reeuwijk for PR6704

llvm-svn: 99677
2010-03-26 23:54:15 +00:00
Dan Gohman b452d4e9e4 Fix minor style issues.
llvm-svn: 99414
2010-03-24 19:38:02 +00:00
Duncan Sands 8712da360b Fix comment typo.
llvm-svn: 99392
2010-03-24 09:05:14 +00:00
Dan Gohman 6556c8962c Add the ability to "intern" FoldingSetNodeID data into a
BumpPtrAllocator-allocated region to allow it to be stored in a more
compact form and to avoid the need for a non-trivial destructor call.

Use this new mechanism in ScalarEvolution instead of
FastFoldingSetNode to avoid leaking memory in the case where a
FoldingSetNodeID uses heap storage, and to reduce overall memory
usage.

llvm-svn: 98829
2010-03-18 16:16:38 +00:00
Douglas Gregor 6d7d7b5197 Extend MemoryBuffer::getFile() to take an optional "stat" structure
pointer. If given, the structure will be set with the stat information from
the file actually read.

llvm-svn: 98575
2010-03-15 20:32:14 +00:00
Chris Lattner 4c1e4db3ff make APFloat::toString be const.
llvm-svn: 97883
2010-03-06 19:20:13 +00:00
Chris Lattner 6783832ec2 add an assertion requested on llvmdev.
llvm-svn: 97769
2010-03-05 00:49:08 +00:00
John McCall c6dbe30e88 Don't potentially read past the end of the fill data when making a NaN from
an APInt.

llvm-svn: 97467
2010-03-01 18:38:45 +00:00
John McCall c12b133d00 Properly clear all the extra bits in a significand when making a NaN from an
APInt.  Be certain to set the integer bit in an x87 extended-precision
significand so that we don't accidentally make a pseudo-NaN.

llvm-svn: 97382
2010-02-28 12:49:50 +00:00
John McCall 512b650210 Add an override to StringRef::getAsInteger which parses into an APInt.
It gets its own implementation totally divorced from the (presumably
performance-sensitive) routines which parse into a uint64_t.

Add APInt::operator|=(uint64_t), which is situationally much better than
using a full APInt.

llvm-svn: 97381
2010-02-28 09:55:58 +00:00
John McCall dcb9a7ad3d Teach APFloat how to create both QNaNs and SNaNs and with arbitrary-width
payloads.  APFloat's internal folding routines always make QNaNs now,
instead of sometimes making QNaNs and sometimes SNaNs depending on the
type.

llvm-svn: 97364
2010-02-28 02:51:25 +00:00
John McCall b42cc681ba Make APFloat's string-parsing routines a bit safer against very large exponents.
llvm-svn: 97278
2010-02-26 22:20:41 +00:00
Benjamin Kramer 7f98b46dc1 Replace a temporary std::string with SmallString.
llvm-svn: 97259
2010-02-26 20:28:29 +00:00
Wesley Peck e4801e49c9 Adding the MicroBlaze backend.
The MicroBlaze is a highly configurable 32-bit soft-microprocessor for
use on Xilinx FPGAs. For more information see:
http://www.xilinx.com/tools/microblaze.htm
http://en.wikipedia.org/wiki/MicroBlaze

The current LLVM MicroBlaze backend generates assembly which can be
compiled using the an appropriate binutils assembler.

llvm-svn: 96969
2010-02-23 19:15:24 +00:00
Jeffrey Yasskin cc2e3d22df Fix viewCFG on Linux.
llvm-svn: 96834
2010-02-23 00:04:53 +00:00
Dan Gohman 30ff721f09 Fix various doxygen warnings.
llvm-svn: 96779
2010-02-22 04:10:52 +00:00
Duncan Sands 142b9edaf1 Refer to -help instead of --help since this is what tools themselves say.
Also, have tools output -help-hidden rather than refer to --help-hidden,
for consistency, and likewise adjust documentation.  This doesn't change
every mention of --help, only those which seemed clearly safe.

llvm-svn: 96578
2010-02-18 14:08:13 +00:00
Daniel Dunbar eb85711e43 Add Regex::sub, for doing regular expression substitution with backreferences.
llvm-svn: 96503
2010-02-17 20:08:42 +00:00
Chris Lattner 115158fa4f enhance raw_svector_ostream::write_impl to work with unbuffered streams,
which may call write_impl on things that are not the usual buffer.

llvm-svn: 96209
2010-02-15 02:18:26 +00:00
Chris Lattner f733d75892 make PadToColumn return the stream so you can use:
OS.PadToColumn(42) << "foo";

llvm-svn: 96208
2010-02-15 02:17:50 +00:00
Dan Gohman 4a618827de Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Chris Lattner 8228b11abc add support for the sparcv9-*-* target triple to turn on
64-bit sparc codegen.  Patch by Nathan Keynes!

llvm-svn: 95293
2010-02-04 06:34:01 +00:00
John McCall df951bddb8 Make APInt::countLeadingZerosSlowCase() treat the contents of padding bits
as undefined.  Fixes an assertion in APFloat::toString noticed by Dale.

llvm-svn: 95196
2010-02-03 03:42:44 +00:00
Benjamin Kramer ef14f80e95 Fix MSVC build.
llvm-svn: 94809
2010-01-29 15:19:06 +00:00
Benjamin Kramer b17c58674e Convert some users of ftostr to raw_ostream.
llvm-svn: 94808
2010-01-29 14:42:22 +00:00
Benjamin Kramer 6bee24ae9a Use llvm::format instead of ftostr (which just calls sprintf).
llvm-svn: 94807
2010-01-29 14:40:33 +00:00
Benjamin Kramer 29063eac23 Replace strcpy with memcpy when we have the length around anyway.
llvm-svn: 94746
2010-01-28 18:04:38 +00:00
Mikhail Glushenkov 76be2d1cca Make SMDiagnostic::Print a const method.
llvm-svn: 94672
2010-01-27 10:13:28 +00:00
Mikhail Glushenkov 84afae33a9 Trailing whitespace.
llvm-svn: 94671
2010-01-27 10:13:11 +00:00
Dan Gohman 3f8ed9e1ae Fix a typo that several people pointed out. Also, address the case of
wrapping that Duncan pointed out.

llvm-svn: 94547
2010-01-26 15:56:18 +00:00
Dan Gohman 5325efc5af Add a comment about a missed opportunity.
llvm-svn: 94507
2010-01-26 04:13:15 +00:00
Dan Gohman 837ada7692 Print empty and full sets specially.
llvm-svn: 94506
2010-01-26 04:12:55 +00:00
Chris Lattner 1386a88c95 Changes to fix buffering that I forgot to commit with previous patch.
llvm-svn: 94222
2010-01-22 21:16:10 +00:00
Chris Lattner 8fa0e35f97 add a new MCAsmStreamer::GetCommentOS method to simplify stuff
that doesn't want to use twines.

llvm-svn: 94199
2010-01-22 19:17:48 +00:00
Dan Gohman 7c6759094a Avoid printing a spurious semicolon when there is no filename.
llvm-svn: 94071
2010-01-21 10:13:27 +00:00
David Greene 35dca86659 Fix an infinite recursion problem. dbgs() should return errs() in
release mode.

llvm-svn: 94001
2010-01-20 15:27:19 +00:00
Benjamin Kramer 608fd2b606 Fix refacto reported by Nicolas Geoffray.
llvm-svn: 93723
2010-01-18 12:40:05 +00:00
Bill Wendling efda1e4f0f Temporarily revert r93581. It was causing failures in the ExecutionEngine tests
on the build bots.

llvm-svn: 93606
2010-01-16 01:06:58 +00:00
Ted Kremenek 12821816c6 BumpPtrAllocator: Have the DefaultSlabAllocator created at runtime, not initialization time. This removes one of the 'init_constructors' reported in <rdar://problem/7545356>.
llvm-svn: 93581
2010-01-15 23:29:34 +00:00
Benjamin Kramer 2e06b93f43 Introduce Twine::toStringRef, a variant of toVector which avoids the copy if the
twine can be represented as a single StringRef. Use the new methode to simplify
some twine users.

llvm-svn: 93317
2010-01-13 12:45:23 +00:00
Benjamin Kramer 93ad708a46 Remove unused string functions.
llvm-svn: 93183
2010-01-11 20:33:12 +00:00
Benjamin Kramer 6bf8240762 Add StrInStrNoCase, a StringRef version of CStrInCStrNoCase.
llvm-svn: 93174
2010-01-11 19:45:18 +00:00
Benjamin Kramer 0ef736fef2 Turns out llvm-gcc still uses SplitString with a vector. Add it back until I
have a fix.

llvm-svn: 93163
2010-01-11 18:44:35 +00:00
Benjamin Kramer c6fe3c3273 Reimplement getToken and SplitString as "StringRef helper functions"
- getToken is modeled after StringRef::split but it can split on multiple
  separator chars and skips leading seperators.
- SplitString is a StringRef::split variant for more than 2 elements with the
  same behaviour as getToken.

llvm-svn: 93161
2010-01-11 18:03:24 +00:00
Duncan Sands a230552b94 Suppress use of uninitialized variable warning.
llvm-svn: 93046
2010-01-09 08:30:33 +00:00
Douglas Gregor 47ed966813 More trivial optimizations to a function well outside the critical path
llvm-svn: 92896
2010-01-07 02:24:06 +00:00
Douglas Gregor 09470e6a4e Switch StringRef::edit_distance over to using raw pointers, since both
std::vector and llvm::SmallVector have annoying performance
tradeoffs. No, I don't expect this to matter, and now it won't.

llvm-svn: 92884
2010-01-07 00:51:54 +00:00
David Greene 9d24d0c3e6 Change errs() to dbgs().
llvm-svn: 92646
2010-01-05 01:29:03 +00:00
David Greene 649efc4656 Change errs() to dbgs().
llvm-svn: 92645
2010-01-05 01:28:58 +00:00
David Greene f32fcb4d31 Change errs() to dbgs().
llvm-svn: 92643
2010-01-05 01:28:52 +00:00
David Greene b28b1ed1a8 Change errs() to dbgs().
llvm-svn: 92642
2010-01-05 01:28:47 +00:00
David Greene 93a522baba Change errs() to dbgs().
llvm-svn: 92641
2010-01-05 01:28:43 +00:00
David Greene f92e6718bc Change errs() to dbgs().
llvm-svn: 92640
2010-01-05 01:28:40 +00:00
David Greene de7b353652 Change errs() to dbgs().
llvm-svn: 92638
2010-01-05 01:28:32 +00:00
David Greene 80604d5f09 Change errs() to dbgs().
llvm-svn: 92637
2010-01-05 01:28:29 +00:00
Douglas Gregor 5639af4eac Document the edit-distance algorithm used in StringRef, switch it over
to SmallVector, and add a unit test.

llvm-svn: 92340
2009-12-31 04:24:34 +00:00
Douglas Gregor 165882c240 Implement edit distance for StringRef
llvm-svn: 92309
2009-12-30 17:23:44 +00:00
Chris Lattner 93163c401e Do not crash when .ll printing metadata that smells like debug info, but isn't.
llvm-svn: 92268
2009-12-29 21:17:33 +00:00
Chris Lattner 0709a2790a fix indentation, fit in 80 cols.
llvm-svn: 92267
2009-12-29 21:09:57 +00:00
Chris Lattner 3b32672733 fix .cpp file to not wrap the entire file in namespace blocks.
llvm-svn: 92250
2009-12-29 07:28:33 +00:00
John McCall dd5044ac55 Implement support for converting to string at "natural precision", and fix some
major bugs in long-precision conversion.

llvm-svn: 92150
2009-12-24 23:18:09 +00:00
John McCall e6212ace38 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.

llvm-svn: 92130
2009-12-24 12:16:56 +00:00
John McCall 29b5c284ae 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.

llvm-svn: 92126
2009-12-24 08:56:26 +00:00
John McCall bd8d1e35a6 Set Remainder before Quotient in case Quotient and LHS alias. The new
order should be immune to such problems.

llvm-svn: 92124
2009-12-24 08:52:06 +00:00
David Greene b760d0cde9 Clarify how dbgs() operates.
llvm-svn: 92083
2009-12-23 23:23:15 +00:00
Chris Lattner bd7b13f07f sizeof(char) is always 1.
llvm-svn: 92079
2009-12-23 23:03:24 +00:00
Douglas Gregor 3ab9e5077f De-bork CMake build
llvm-svn: 92003
2009-12-23 17:03:46 +00:00
David Greene 64506db8e8 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.

llvm-svn: 92002
2009-12-23 16:39:06 +00:00
David Greene 7ffbb50edf 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.

llvm-svn: 92001
2009-12-23 16:08:15 +00:00
Chris Lattner dd3e9aaad3 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.

llvm-svn: 91740
2009-12-19 01:38:42 +00:00
Chris Lattner 4ea86c460a now that libsystem no longer uses SmallVector, we can move
SmallVectorBase::grow_pod out of line, finally satisfying PR3758.

llvm-svn: 91529
2009-12-16 08:44:24 +00:00
Dan Gohman fd5de58ec1 Micro-optimize these functions in the case where they are not inlined.
llvm-svn: 91316
2009-12-14 19:32:31 +00:00
Daniel Dunbar d333139411 DeltaAlgorithm: Add a virtual destructor and home.
llvm-svn: 90957
2009-12-09 07:19:48 +00:00
Daniel Dunbar c5b2ac4d97 Fix typo and add missing include.
llvm-svn: 90557
2009-12-04 08:17:07 +00:00
Dan Gohman 083f229ba2 Print a newline after the Args: line so that unrelated errs() output doesn't
end up on the same line.

llvm-svn: 90473
2009-12-03 19:03:18 +00:00
Daniel Dunbar ff53d4694c 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.

llvm-svn: 90447
2009-12-03 11:12:42 +00:00
Chris Lattner 0e3b78a6c2 return more useful error messages by using strerror to format errno
instead of returning an ambiguous reason.

llvm-svn: 90275
2009-12-01 22:51:41 +00:00
Douglas Gregor 7baad7365a Perform explicit instantiations in the proper namespace, since Clang diagnoses this ill-formity.
llvm-svn: 89846
2009-11-25 06:04:18 +00:00
Daniel Dunbar 5a308f5399 SourceMgr: Add ShowLine argument to PrintMessage, to allow suppressing the source line output.
llvm-svn: 89627
2009-11-22 22:08:00 +00:00
Mikhail Glushenkov 5551c207cd 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.

llvm-svn: 89463
2009-11-20 17:23:17 +00:00
Daniel Dunbar 956c1581fa Use StringRef::min instead of std::min.
llvm-svn: 89372
2009-11-19 18:53:18 +00:00
Mikhail Glushenkov 1d9f1fe7cc Trailing whitespace.
llvm-svn: 89364
2009-11-19 17:29:36 +00:00
Edward O'Callaghan ba993b8add Add PS3 Triple class, Credit to John Thompson.
llvm-svn: 89339
2009-11-19 11:59:00 +00:00
Viktor Kutuzov dafdd883bc Added getArchNameForAssembler method to the Triple class for which returns OS and Vendor independent target assembler arch.
llvm-svn: 89122
2009-11-17 18:48:27 +00:00