Commit Graph

1058 Commits

Author SHA1 Message Date
Dan Gohman 61a8796ddb 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.

llvm-svn: 79990
2009-08-25 15:34:52 +00:00
Oscar Fuentes a5ff9e354a CMake: updated list of source files.
llvm-svn: 79959
2009-08-25 00:02:29 +00:00
Daniel Dunbar b8dc4ea2c4 Add llvm::Triple::getArchTypePrefix for getting the intrinsic prefix for an
identifier architecture.

llvm-svn: 79906
2009-08-24 09:53:06 +00:00
Dan Gohman c9fa051f85 Correctly account for the Spaces array nul terminator. Thanks Chris!
llvm-svn: 79894
2009-08-24 04:43:38 +00:00
Dan Gohman f88f52e3b9 raw_ostream::indent is used for PadToColumn which often prints more
than 16 spaces. Make the Spaces array wide enough to handle common cases.

llvm-svn: 79890
2009-08-24 04:13:01 +00:00
Chris Lattner 0ffe0e096d 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.

llvm-svn: 79886
2009-08-24 04:02:06 +00:00
Chris Lattner 06fa176862 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.

llvm-svn: 79885
2009-08-24 03:52:50 +00:00
Dan Gohman a53c35d8d0 Unbreak the build for HAVE_GV platforms.
llvm-svn: 79883
2009-08-24 03:23:12 +00:00
Oscar Fuentes 94e470504f CMake: Updated library dependencies and list of source files.
llvm-svn: 79876
2009-08-23 23:59:15 +00:00
Chris Lattner 96cffa63a2 remove the dead std::ostream APInt inserter
llvm-svn: 79875
2009-08-23 23:11:28 +00:00
Chris Lattner 486fcad4a8 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.

llvm-svn: 79872
2009-08-23 22:53:53 +00:00
Chris Lattner c521f54198 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.

llvm-svn: 79869
2009-08-23 22:45:37 +00:00
Chris Lattner 1518c64a23 llvm/Support/Streams.h is now dead, zap it.
llvm-svn: 79865
2009-08-23 21:50:26 +00:00
Chris Lattner b9f25f9e19 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

llvm-svn: 79863
2009-08-23 21:36:09 +00:00
Daniel Dunbar 47a309c5ca 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. :)

llvm-svn: 79862
2009-08-23 20:31:39 +00:00
Chris Lattner 36b3caf9c0 clean up #includes.
llvm-svn: 79857
2009-08-23 18:09:02 +00:00
Benjamin Kramer 1a25d733f9 Kill off more cerr/cout uses and prune includes a bit.
llvm-svn: 79852
2009-08-23 11:37:21 +00:00
Benjamin Kramer c9aa480832 Remove uses of Streams.h from CommandLine.cpp, fix some whitespace and other minor tweaks.
llvm-svn: 79847
2009-08-23 10:01:13 +00:00
Benjamin Kramer b451afb5f2 Fix windows build.
llvm-svn: 79845
2009-08-23 08:57:52 +00:00
Daniel Dunbar 34ee203337 Fix some refactos for iostream changes (in -Asserts mode).
- The world needs better C++ refactoring tools, can I get an Amen!?

llvm-svn: 79843
2009-08-23 08:50:52 +00:00
Chris Lattner 471ba48cb9 remove some uses of llvm/Support/Streams.h
llvm-svn: 79842
2009-08-23 08:43:55 +00:00
Chris Lattner 4883d90396 convert LoopInfo.h and GraphWriter.h to use raw_ostream
llvm-svn: 79836
2009-08-23 07:19:13 +00:00
Chris Lattner 7e3cfe35ff eliminate DOUT and make Debug.h not include Streams.h anymore, woo!
llvm-svn: 79835
2009-08-23 07:05:39 +00:00
Chris Lattner 1362602eb2 Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.

llvm-svn: 79830
2009-08-23 06:03:38 +00:00
Chris Lattner 9e6f1f160a 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).

llvm-svn: 79807
2009-08-23 02:51:22 +00:00
Chris Lattner ba4bd50a80 switch formattedstream to use raw_ostream::indent. This eliminates
the weird MAX_COLUMN_PAD limitation.

llvm-svn: 79785
2009-08-22 23:16:09 +00:00
Chris Lattner e6db2c338b add a raw_ostream::indent method, to be used like:
OS.indent(i) << "whatever";

people seem to like indenting things ;-)

llvm-svn: 79784
2009-08-22 23:10:29 +00:00
Anton Korobeynikov 876955cbb0 Fix typo.
llvm-svn: 79688
2009-08-21 23:09:47 +00:00
Anton Korobeynikov 13e8c7ef20 Implement APInt <-> APFloat conversion for IEEE 128-bit floats.
This fixes PR2555

llvm-svn: 79677
2009-08-21 22:10:30 +00:00
Erick Tryzelaar 6096409238 Clean up the APInt function getDigit.
llvm-svn: 79602
2009-08-21 06:48:37 +00:00
Eric Christopher 43a1decc8c Update error messages for '+'. Fix grammar and make the two
negative checks resemble each other.

llvm-svn: 79595
2009-08-21 04:10:31 +00:00
Eric Christopher 820256bc99 Fix trailing whitespace and 80-col violation.
llvm-svn: 79594
2009-08-21 04:06:45 +00:00
Erick Tryzelaar dadb1571b7 Fix bug with APInt::getBitsNeeded with for base 10 numbers 0-9.
llvm-svn: 79593
2009-08-21 03:15:28 +00:00
Erick Tryzelaar 1264bcb4de Allow '+' to appear in APInt strings, and add more unit tests.
llvm-svn: 79592
2009-08-21 03:15:14 +00:00
Erick Tryzelaar da666c801c Add support for including '+' in APFloat strings, more asserts,
and many new unit tests.

llvm-svn: 79574
2009-08-20 23:30:43 +00:00
Dan Gohman e392e6236d Add a comment explaining why llvm_unreachable_internal doesn't call
the ErrorHandler callback.

llvm-svn: 79541
2009-08-20 17:15:19 +00:00
Daniel Dunbar bf5998edfb Fix two APFloat bugs in converting hexadecimal constants.
llvm-svn: 79540
2009-08-20 17:12:33 +00:00
Eli Friedman 28c7bbf515 Add triple parsing support for TCE.
llvm-svn: 79461
2009-08-19 20:46:03 +00:00
Daniel Dunbar 8b0b11582d Switch to SmallString::str from SmallString::c_str, and remove
SmallString::c_str.

llvm-svn: 79456
2009-08-19 20:07:03 +00:00
Daniel Dunbar e813cbaa21 Change raw_svector_ostream to reserve the input buffer if necessary, Ted was
right.
 - This class turns out to be much more convenient to use if we do this; clients
   can make sure the buffer is always big enough if they care (since our current
   idiom tends to be to use a SmallString<256> for the input to this we should
   generally be avoiding an unnecessary malloc).

Also, add a convenience raw_svector_ostream::str method which flushes the buffer
and returns a StringRef for the vector contents.

llvm-svn: 79446
2009-08-19 18:40:58 +00:00
Daniel Dunbar ea579e3d29 Switch Twine::str() to use toVector(), which is now efficient.
llvm-svn: 79437
2009-08-19 18:09:47 +00:00
Daniel Dunbar b090bf4626 Switch raw_svector_ostream to use the vector as the ostream buffer.
- This avoids unnecessary malloc/free overhead in the common case, and
   unnecessary copying from the ostream buffer into the output vector.

llvm-svn: 79434
2009-08-19 17:54:29 +00:00
Daniel Dunbar 465de3e2be Speculatively revert r79375, which may be breaking bootstrap, although in a
rather obscure way (the other candidate is r79377).

llvm-svn: 79426
2009-08-19 16:25:25 +00:00
Daniel Dunbar 0cf168635e raw_ostream: Simplify write(unsigned char) to match write(const char*, unsigned).
llvm-svn: 79386
2009-08-19 00:23:39 +00:00
Daniel Dunbar 835da36ee9 raw_ostream: Remove pointless redefinitions of tell().
- The base class implementation is correct.

llvm-svn: 79385
2009-08-19 00:14:25 +00:00
Daniel Dunbar 317a6cd010 raw_ostream: Add the capability for subclasses to manually install an external
buffer.

llvm-svn: 79382
2009-08-18 23:42:36 +00:00
Daniel Dunbar 17a6fd2299 raw_ostream: Reduce FormattedStream's reliance on raw_ostream's implementation.
- Kill off begin(), end(), and iterator. It isn't clear what these
   mean. Instead provide getBufferStart(), which can be used with
   GetNumBytesInBuffer to the same effect.

 - Update ComputeColumn to take arguments for the buffer to scan, this
   simplifies the implementation of write_impl substantially.

 - This should also fix possible problems with the scanning pointer pointing
   outside of the current raw_ostream buffer.

llvm-svn: 79379
2009-08-18 23:36:04 +00:00
Daniel Dunbar bc96fe7246 Speed up raw_ostream::<<(unsigned long long) for 32-bit systems by doing most
div/mods in 32-bits.

llvm-svn: 79375
2009-08-18 22:24:00 +00:00
Dan Gohman 23f90c1d3a Fix a bug in raw_ostream::write(char) introduced by the change to
allow underlying stream classes to decline buffering. After
calling SetBuffered(), re-check whether the stream is Unbuffered
in order to handle the case where the underlying stream has
declined buffering.

llvm-svn: 79362
2009-08-18 20:09:59 +00:00
Daniel Dunbar d882f4b6ff Revert r78924, disabling buffering defeats all the fast paths in raw_ostream.
llvm-svn: 79361
2009-08-18 20:07:36 +00:00