Commit Graph

1058 Commits

Author SHA1 Message Date
Duncan Sands 0de39b42ff Add support for AuroraUX. Patch by evocallaghan.
llvm-svn: 73766
2009-06-19 14:40:01 +00:00
Ted Kremenek 81ef65d491 Update CMake files to account for new location of Threading.cpp.
llvm-svn: 73708
2009-06-18 17:47:09 +00:00
Owen Anderson 7d42b95b6c Move Threading.[h|cpp] from Support to System.
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson 993e4261d0 Add newline at end of file.
llvm-svn: 73551
2009-06-16 20:53:09 +00:00
Douglas Gregor c791c37633 Add Threading.cpp to the CMake project files
llvm-svn: 73516
2009-06-16 17:45:38 +00:00
Owen Anderson 4cb4b6191a Split the thread-related APIs out into their own file, and add a few more
calls for convenience.

llvm-svn: 73512
2009-06-16 17:33:51 +00:00
Torok Edwin 9b5a47fc3c Add support for outputting ANSI colors to raw_fd_ostream.
llvm-svn: 72854
2009-06-04 07:09:50 +00:00
Mike Stump 799bf5855e Add support for letting the client choose different flavors of NaNs. Testcase to be
added in clang.

llvm-svn: 72606
2009-05-30 03:49:43 +00:00
Bill Wendling 09f17a8479 Untabification.
llvm-svn: 72604
2009-05-30 01:09:53 +00:00
Douglas Gregor bbcf90f936 Minor fix for CMake build system
llvm-svn: 72480
2009-05-27 16:52:17 +00:00
Daniel Dunbar e3384c4f2e Add llvm::triple constructor from arch, vendor, os strings, and recognize
DragonFly OS type.

llvm-svn: 72242
2009-05-22 02:24:11 +00:00
Evan Cheng db338f3f41 80 column violation.
llvm-svn: 72235
2009-05-21 23:47:47 +00:00
Owen Anderson e147774b05 Have llvm_start_multithreaded return a bool indicating whether multithreaded
initialization succeeded or not, rather than just asserting.

llvm-svn: 72182
2009-05-20 21:03:06 +00:00
Owen Anderson b9a4a57699 Add llvm_start_multithreaded(), which starts up the LLVM internals in thread-safe mode. Provide double-check locking
initialization of ManagedStatic's when running in thread-safe mode.

llvm-svn: 72151
2009-05-20 00:39:20 +00:00
Eli Friedman a97f07f22d Tweak MemoryBuffer::getSTDIN so that it returns after the first EOF.
It doesn't matter for piped input, but it's annoying when typing at the 
console.

llvm-svn: 71998
2009-05-18 08:44:04 +00:00
Mike Stump 0e78566e02 Add dumping support for DW_AT_APPLE_isa and DW_AT_APPLE_block.
Radar 6867696

llvm-svn: 71750
2009-05-14 00:03:51 +00:00
Mike Stump 889285d467 Fix whitespacing (space after switch).
llvm-svn: 71738
2009-05-13 23:23:20 +00:00
Jay Foad fe0c648fee Move helper functions for optimizing division by constant into the APInt
class.

llvm-svn: 70488
2009-04-30 10:15:35 +00:00
Bill Wendling db59fda319 Add support for a character after a command line option. Like '-Os'.
llvm-svn: 70437
2009-04-29 23:26:16 +00:00
Chris Lattner b869a0ade1 Fix PR4040: APInt's string constructor is too strict
patch by Jeff Yasskin!

llvm-svn: 70058
2009-04-25 18:34:04 +00:00
Douglas Gregor b231e5791e Make all raw_ostreams support the tell() function.
llvm-svn: 69583
2009-04-20 07:34:17 +00:00
Chris Lattner baf9535284 teach EscapeString and UnescapeString to handle ".
llvm-svn: 69211
2009-04-15 20:12:52 +00:00
Chris Lattner 3875195865 Remove AllowInverse: it leaks memory and is not the right
abstraction for CommandLine.

llvm-svn: 68588
2009-04-08 03:43:51 +00:00
Mikhail Glushenkov 12062ba83d Fix build on Linux.
llvm-svn: 68269
2009-04-02 01:11:37 +00:00
Daniel Dunbar 4abd56677d Add llvm::Triple class for abstracting access to target triples.
- The code is silly, I'm just amusing myself. Rewrite to be efficient
   if you like. :)

Also, if you wish to debate the proper names of the triple components
I'm all ears.

llvm-svn: 68252
2009-04-01 21:53:23 +00:00
Dan Gohman cff6953c45 Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented
calculations from target-oriented calculations.

llvm-svn: 68227
2009-04-01 18:45:54 +00:00
Misha Brukman 5fc1a0339c * Fixed spelling of `invertible'
* Simplified if statement

llvm-svn: 68163
2009-04-01 00:15:46 +00:00
Chris Lattner 7516668998 move a large method out of line.
llvm-svn: 67892
2009-03-28 02:08:47 +00:00
Dale Johannesen 93eefa0043 Fix internal representation of fp80 to be the
same as a normal i80 {low64, high16} rather
than its own {high64, low16}.  A depressing number
of places know about this; I think I got them all.
Bitcode readers and writers convert back to the old
form to avoid breaking compatibility.

llvm-svn: 67562
2009-03-23 21:16:53 +00:00
Dan Gohman 4f2fea1a21 Now that errs() is properly non-buffered, there's no need to
explicitly flush it.

llvm-svn: 67526
2009-03-23 15:57:19 +00:00
Duncan Sands 8208465036 Fix comment typo.
llvm-svn: 67302
2009-03-19 11:37:15 +00:00
Daniel Dunbar 437b8a5ccc Add BUILTIN_EXPECT Support/Compiler macro.
- Use for exceptional buffer conditions in raw_ostream:write to shave
   off a cycle or two.

 - Please rename if you have a better one.

llvm-svn: 67103
2009-03-17 21:15:18 +00:00
Daniel Dunbar 64fa3860ed raw_ostream: Put all exceptional conditions in raw_ostream::write
under a single branch.

Also, add a FIXME for formatted output.

llvm-svn: 67069
2009-03-17 01:36:56 +00:00
Daniel Dunbar 2d603dae2c raw_ostream: Rework implementation of unbuffered streams so outputting
a single character requires only one branch to follow slow path.
 - Never use a buffer when writing on an unbuffered stream.

 - Move default buffer size to header.

llvm-svn: 67066
2009-03-17 01:13:35 +00:00
Daniel Dunbar db7a36cdac raw_ostream: Replace flush_impl with write_impl, which takes data to
write as arguments.
 - Add raw_ostream::GetNumBytesInBuffer.
 - Privatize buffer pointers.
 - Get rid of slow and unnecessary code for writing out large strings.

llvm-svn: 67060
2009-03-16 23:29:31 +00:00
Daniel Dunbar d24535fe3c raw_ostream: Lift out flush_nonempty.
- Flush a known non-empty buffers; enforces the interface to
   flush_impl and kills off HandleFlush (which I saw no reason to be
   an inline method, Chris?).

 - Clarify invariant that flush_impl is only called with OutBufCur >
   OutBufStart.

 - This also cleary collects all places where we have to deal with the
   buffer possibly not existing.

 - A few more comments and fixing the unbuffered behavior remain in
   this commit sequence.

llvm-svn: 67057
2009-03-16 22:55:06 +00:00
Daniel Dunbar 8786218b0c Make raw_ostream::operator<<(const void *) fast; it doesn't matter but
it is easy.

llvm-svn: 67054
2009-03-16 22:08:44 +00:00
Daniel Dunbar 7a9bb9eeec Add slow path for single character write, and use exclusively for
single characters writes outside of the fast path in raw_ostream.h

llvm-svn: 67053
2009-03-16 22:00:17 +00:00
Stuart Hastings 7440952c01 Fix a hashing bug in APInt. A certain pathological testcase (too
large for the testsuite) took over six minutes to compile on my Mac.
The patched LLVM-GCC compiles that testcase in three seconds (GCC
takes less than one second).  This hash function is more complex
(about 35 instructions on x86) than what Chris wanted, but I expect it
will be well-behaved with arbitrary inputs.

Thank you to everyone who responded to my previous request for advice.

llvm-svn: 66962
2009-03-13 21:51:13 +00:00
Chris Lattner b858c0eba0 just initialize the first element, we don't need to set the rest to zeros.
llvm-svn: 66850
2009-03-13 00:24:01 +00:00
Chris Lattner 0bf186906b Eliminate a 9640 byte static mutable initialized data item by moving it
to the stack.  This shrinks all llvm tools by 9k, and improves reentrancy.

llvm-svn: 66847
2009-03-13 00:03:51 +00:00
Chris Lattner 9170209603 static functions don't need an anonymous namespace.
llvm-svn: 66845
2009-03-12 23:59:55 +00:00
Daniel Dunbar 3da6a7071a PR3478: raw_ostream should not buffer stderr
- Add unbuffered flag to raw_ostream, forwarded by raw_fd_ostream and
   used by raw_stderr_ostream.

llvm-svn: 66545
2009-03-10 16:21:55 +00:00
Dan Gohman ec5f2b5e05 Use c_str() to force the string to be nul-terminated.
llvm-svn: 66279
2009-03-06 18:13:15 +00:00
Chris Lattner e41a434f89 on apple systems, integrate nicely with crash reporter.
llvm-svn: 66264
2009-03-06 07:19:54 +00:00
Duncan Sands 96f52eb13f Add missing file.
llvm-svn: 66160
2009-03-05 09:19:13 +00:00
Chris Lattner 8d0fe8cd90 Daniel wanted the stack printed upside down. Perhaps he
feels a kinship to machine stacks that grow down.  Now we get
stuff like this:

Stack dump:
0.	Program arguments: clang clang_crash_Iw2Osj.mi 
1.	/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/xmmintrin.h:624:1: parsing function body '_mm_cvtpi16_ps'
2.	/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/xmmintrin.h:624:1: in compound statement ('{}')
Abort

llvm-svn: 66145
2009-03-05 07:03:49 +00:00
Chris Lattner 2674eb4bd1 indicate what the program args line is.
llvm-svn: 66144
2009-03-05 06:51:42 +00:00
Chris Lattner 68061d5995 add some helper classes for building light-weight symbolic stack traces
that get printed when a program crashes.  This is the first step of many.

llvm-svn: 66076
2009-03-04 21:40:23 +00:00
Devang Patel 4d20395a5f The debugger sometimes lookup dynamically in the runtime to find ivar info of any Objective-C classes. It would be very helpful to debugger if the compiler encodes runtime version number in DWARF.
Add support for two additional DWARF attributes to encode Objective-C runtime version number.

llvm-svn: 64834
2009-02-17 22:43:44 +00:00
Cedric Venet d1e179d992 Unbreak the build on win32.
Cleanup some warning.

Remark: when struct/class are declared differently than they are defined, this make problem for VC++ since it seems to mangle class differently that struct. These error are very hard to understand and find. So please, try to keep your definition/declaration in sync.

Only tested with VS2008. hope it does not break anything. feel free to revert.

llvm-svn: 64554
2009-02-14 16:06:42 +00:00
Evan Cheng cf4bd2319c Switch from new[] + delete[] to malloc + free since llvm does not catch C++ exceptions.
llvm-svn: 64448
2009-02-13 08:24:55 +00:00
Evan Cheng 333db7abbd If new[] fails, return 0 rather then trying to dereference a null pointer.
llvm-svn: 64444
2009-02-13 07:54:34 +00:00
Nick Lewycky ef01e112aa Add an API for strings with possible NULLs in the middle. Refactor the other
two AddString methods to use it.

llvm-svn: 64005
2009-02-07 04:57:08 +00:00
Mike Stump b92f839f9c Improve -fno-opt style option processing to not require an extra
option to make the -fno- form on the option.  We also document the new
form in the CommandLine documentation.

llvm-svn: 63559
2009-02-02 22:48:49 +00:00
Mike Stump ecbe4a0860 Add opposite_of and inverse_opt to support -fno- style options. This
is necessary for eventual gcc commmand line compatibility.

llvm-svn: 63384
2009-01-30 08:19:46 +00:00
Mikhail Glushenkov 57cf3964f3 Clarify comment.
llvm-svn: 63171
2009-01-28 03:46:22 +00:00
Torok Edwin ec39eb8519 APInt's countLeadingOnes() was broken for negative i128 values,
causing assertion failures in getSExtValue().
Fix it by making highWordBits actually contain what its name says,
and add some more unit-tests for APInt.
This fixes PR3419.

llvm-svn: 63107
2009-01-27 18:06:03 +00:00
Ted Kremenek a26699211d Add method raw_fd_ostream::seek() for random access within a file.
llvm-svn: 63044
2009-01-26 21:42:04 +00:00
Devang Patel ccfacfff9a Introduce two DWARF attribute extentions DW_AT_APPLE_optimized, DW_AT_APPLE_flags.
DW_AT_APPLE_optimized flag is set when a compile_unit is optimized. The debugger takes advantage of this information some way.

DW_AT_APPLE_flags encodes command line options when certain env. variable is set. This is used by build engineers to track various gcc command lines used by by  a project, irrespective of whether the project used makefile, Xcode or something else.

llvm-gcc patch is next.

llvm-svn: 62888
2009-01-23 22:33:47 +00:00
Dale Johannesen 1f86498f93 Do not use host floating point types when emitting
ASCII IR; loading and storing these can change the
bits of NaNs on some hosts.  Remove or add warnings
at a few other places using host floating point;
this is a bad thing to do in general.

llvm-svn: 62712
2009-01-21 20:32:55 +00:00
Chris Lattner 77527f5812 Remove uses of uint32_t in favor of 'unsigned' for better
compatibility with cygwin.  Patch by Jay Foad!

llvm-svn: 62695
2009-01-21 18:09:24 +00:00
Mikhail Glushenkov 6a4f729dc9 Mimic gcc behaviour with regard to response files.
llvm-svn: 62688
2009-01-21 13:14:02 +00:00
Dale Johannesen b5721632ee Make special cases (0 inf nan) work for frem.
Besides APFloat, this involved removing code
from two places that thought they knew the
result of frem(0., x) but were wrong.

llvm-svn: 62645
2009-01-21 00:35:19 +00:00
Dale Johannesen fe750179ff Add an IEEE remainder function, which is not
fully implemented yet and not used.  This is
mainly to clarify that APFloat::mod implements
C fmod, not remainder.

llvm-svn: 62593
2009-01-20 18:35:05 +00:00
Chris Lattner 17844c7a88 improve compatibility with various versions of graphviz, patch by
Patrick Boettcher!

llvm-svn: 62592
2009-01-20 18:25:03 +00:00
Dale Johannesen 740e98704d compile-time fmod was done incorrectly. PR 3316.
llvm-svn: 62528
2009-01-19 21:17:05 +00:00
Nick Lewycky 030c450fdc Fix typo, sentence fragment.
llvm-svn: 62512
2009-01-19 17:42:33 +00:00
Mikhail Glushenkov cbc26fdb6e Support for multi-valued options in CommandLine
Makes possible to specify options that take multiple arguments (a-la
-sectalign on Darwin). See documentation for details.

llvm-svn: 62372
2009-01-16 22:54:19 +00:00
Misha Brukman 5cbf223916 Removed trailing whitespace from Makefiles.
llvm-svn: 61991
2009-01-09 16:44:42 +00:00
Steve Naroff b0ad08b39a Tweak --version to include the date and time.
llvm-svn: 61378
2008-12-23 18:41:47 +00:00
Nuno Lopes 10ab44a3a2 remove unused var
llvm-svn: 60770
2008-12-09 17:04:06 +00:00
Nick Lewycky d745adedd7 Fixes for Visual Studio users. Patch by OvermindDL1 on llvm-dev!
llvm-svn: 60679
2008-12-08 00:45:02 +00:00
Ted Kremenek 123a35a81c Have raw_fd_ostream keep track of the position in the file to make tell() go faster by not requiring a flush().
llvm-svn: 60560
2008-12-04 22:51:11 +00:00
Nuno Lopes 50343cd2fe fix build on some machines. thanks buildbot
llvm-svn: 60175
2008-11-27 16:42:44 +00:00
Nuno Lopes d5c2a144e1 fix my previous commit r60064: compare strings instead of pointers
llvm-svn: 60174
2008-11-27 16:37:02 +00:00
Bill Wendling c6075401c2 Get rid of bogus "control may reach end of non-void function ‘...’ being
inlined" message.

llvm-svn: 60165
2008-11-27 08:00:12 +00:00
Ted Kremenek e076257b8c Add 'tell' method to raw_fd_ostream that clients can use to query the current location in the file the stream is writing to.
llvm-svn: 60085
2008-11-26 03:33:13 +00:00
Evan Cheng 496b042e20 Revert r60042. IndVarSimplify should check if APFloat is PPCDoubleDouble first before trying to convert it to an integer.
llvm-svn: 60072
2008-11-26 01:11:57 +00:00
Nuno Lopes b472c9fac7 change AnnotationManager to use 'const char*' instead of std::string. this fixes the leakage of those strings and avoids the creation of such strings in static cosntructors (should result in a little improvement of startup time)
llvm-svn: 60064
2008-11-26 00:00:44 +00:00
Evan Cheng 2e5aeff676 convertToSignExtendedInteger should return opInvalidOp instead of asserting if sematics of float does not allow arithmetics.
llvm-svn: 60042
2008-11-25 19:00:29 +00:00
Daniel Dunbar ed90e701f0 Add Binary flag to raw_fd_ostream constructor.
Document raw_fd_ostream's treatment of "-".

llvm-svn: 59219
2008-11-13 05:01:07 +00:00
Dan Gohman bde853911f Overload AddInteger on int/long/long long instead of on int/int64_t,
to avoid overload ambiguities. This fixes build errors introduced
by r58623.

llvm-svn: 58632
2008-11-03 19:40:18 +00:00
Chris Lattner 2bfc72e65e fix PR2953, an off-by-one error handling formatted i/o.
Thanks to Török Edwin for the awesome reduced testcase.

llvm-svn: 58199
2008-10-26 19:20:47 +00:00
Ted Kremenek 3c6de496b0 Added raw_fd_ostream::close().
llvm-svn: 58052
2008-10-23 23:49:09 +00:00
Julien Lerouge e9de15b88a Fix for PR2881: fix a small leak exposed by valgrind, using a ManagedStatic.
llvm-svn: 57984
2008-10-22 16:30:41 +00:00
Daniel Dunbar 1ca20df437 Clear raw_fd_ostream error string on success and explain behavior in
documentation.

Add C++ header marker.

llvm-svn: 57923
2008-10-21 19:53:10 +00:00
Dan Gohman 9c4b7d5c4f Fix command-line option printing to print two spaces where needed,
instead of requiring all "short description" strings to begin with
two spaces. This makes these strings less mysterious, and it fixes
some cases where short description strings mistakenly did not
begin with two spaces.

llvm-svn: 57521
2008-10-14 20:25:08 +00:00
Dale Johannesen cc98e28f37 Change TAG_ names to DW_TAG for gcc (testsuite) compatibility.
llvm-svn: 57425
2008-10-12 21:23:01 +00:00
Dale Johannesen ba074c0fed Change Dwarf comments starting with AT_ to DW_AT_ to
match gcc.  Helps with the testsuite.

llvm-svn: 57410
2008-10-12 06:20:47 +00:00
Chris Lattner d57b7603f9 rearrange some code.
llvm-svn: 57384
2008-10-11 22:07:19 +00:00
Dale Johannesen 4f0bd68cfe Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.

llvm-svn: 57329
2008-10-09 23:00:39 +00:00
Dale Johannesen 54306fe499 Rename APFloat::convertToAPInt to bitcastToAPInt to
make it clearer what the function does.  No functional
change.

llvm-svn: 57325
2008-10-09 18:53:47 +00:00
Dale Johannesen 7221af384d Mark negative-zero-to-int conversion as Inexact,
since -0.0 can't be represented as an int.
This prevents llvm from reducing -0.0 to a
load-and-convert of int 0.  Fixes
ieee.exp/mzero[2356].c in gcc testsuite.

llvm-svn: 57224
2008-10-07 00:40:01 +00:00
Dale Johannesen 6c6729f3a8 Be more precise about which conversions of NaNs
are Inexact.  (These are not Inexact as defined
by IEEE754, but that seems like a reasonable way
to abstract what happens:  information is lost.)

llvm-svn: 57218
2008-10-06 22:59:10 +00:00
Dale Johannesen 6271b0a83c Temporarily revert functionality change from my previous patch;
it is too aggressive.

llvm-svn: 57203
2008-10-06 20:43:48 +00:00
Dale Johannesen fff2995532 Mark shortening NaN conversions as Inexact. PR 2856.
Improve description of unsupported formats.

llvm-svn: 57185
2008-10-06 18:22:29 +00:00
Oscar Fuentes a229b3c9a7 Initial support for the CMake build system.
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Cedric Venet 0f7b5666a2 Updating VC++ project.
Adding one include file and correct one declaration from class to struct in order to make llvm compile on VC2005.

llvm-svn: 55279
2008-08-24 11:56:40 +00:00
Chris Lattner 205af9643d Add raw_stream adaptors that write into an std::string and SmallVector/SmallString.
llvm-svn: 55265
2008-08-23 22:43:04 +00:00
Chris Lattner 0c19df4871 Switch the asmprinter (.ll) and all the stuff it requires over to
use raw_ostream instead of std::ostream.  Among other goodness,
this speeds up llvm-dis of kc++ with a release build from 0.85s
to 0.49s (88% faster).

Other interesting changes:
 1) This makes Value::print be non-virtual.
 2) AP[S]Int and ConstantRange can no longer print to ostream directly, 
    use raw_ostream instead.
 3) This fixes a bug in raw_os_ostream where it didn't flush itself 
    when destroyed.
 4) This adds a new SDNode::print method, instead of only allowing "dump".


A lot of APIs have both std::ostream and raw_ostream versions, it would
be useful to go through and systematically anihilate the std::ostream 
versions.

This passes dejagnu, but there may be minor fallout, plz let me know if
so and I'll fix it.

llvm-svn: 55263
2008-08-23 22:23:09 +00:00
Chris Lattner da42964999 add #include
llvm-svn: 55252
2008-08-23 20:34:06 +00:00
Chris Lattner 22b52c984a add a simple mechanism for formatted output. This gives raw_ostream's
all the power and risk of fprintf format strings.  Use them like this:

  OS << format("%10.4f", 42.0) << "\n" << format("%x", 42) << '\n';

llvm-svn: 55246
2008-08-23 19:23:10 +00:00
Dan Gohman 0e44e0d7a8 Add a clear() method to FoldingSet.
llvm-svn: 55210
2008-08-23 00:42:16 +00:00
Chris Lattner d564f29957 improve support for systems that need unistd.h to get STDOUT_FILENO.
Patch contributed by Bjorn Reese!

llvm-svn: 55179
2008-08-22 15:45:00 +00:00
Owen Anderson 3ad8ac90b6 Fix write() when the string being written is larger than the buffer. This broke various ObjC testcases
with very long symbol names.

llvm-svn: 55148
2008-08-21 22:39:33 +00:00
Owen Anderson d2850538db Move non-trivial methods out of line to avoid code-size bloat.
llvm-svn: 55138
2008-08-21 20:58:52 +00:00
Owen Anderson 9371964f47 Use raw_ostream throughout the AsmPrinter.
llvm-svn: 55092
2008-08-21 00:14:44 +00:00
Chris Lattner 1ac3e2545b Move the fast-path (<=i64) cases of various APInt methods inline
and the slow-path cases out of line.  This speeds up instcombine
a bit in real world cases.  Patch contributed by m-s.

llvm-svn: 55063
2008-08-20 17:02:31 +00:00
Dan Gohman 0f23237b0c It's not necessary to check if a value is null before delete[].
llvm-svn: 55053
2008-08-20 14:55:37 +00:00
Argyrios Kyrtzidis b97ff82bd4 Get raw_ostream.cpp to compile on MSVC.
llvm-svn: 54879
2008-08-17 09:25:21 +00:00
Chris Lattner 17f7165f84 Rework the routines that convert AP[S]Int into a string. Now, instead of
returning an std::string by value, it fills in a SmallString/SmallVector
passed in.  This significantly reduces string thrashing in some cases.

More specifically, this:
 - Adds an operator<< and a print method for APInt that allows you to 
   directly send them to an ostream.
 - Reimplements APInt::toString to be much simpler and more efficient
   algorithmically in addition to not thrashing strings quite as much.

This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter.  This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.

llvm-svn: 54873
2008-08-17 07:19:36 +00:00
Chris Lattner 8fcea67ae9 remove a dead APInt ctor.
llvm-svn: 54869
2008-08-17 04:58:58 +00:00
Chris Lattner d3723fc8a2 add support for a cout/cerr analog (outs()/errs()) as well as
a simple adaptor class to give raw output capabilities to 
something that wants to write to an ostream.

llvm-svn: 54865
2008-08-17 04:13:37 +00:00
Chris Lattner d5bc0683fd opening "-" automatically yields stdout.
llvm-svn: 54863
2008-08-17 03:53:23 +00:00
Chris Lattner 3394262a33 rename OutputData to 'write' to match ostream.
llvm-svn: 54857
2008-08-17 01:46:05 +00:00
Chris Lattner 84b94f77c6 add a new raw_ostream class which is an extremely high performance ostream that
can *only* output data (no seeking, reading, etc).  This is adapted from the
clang "-E outputter", and is roughly 10% faster than stdio on darwin and 30%
(or more) faster than std::ostream.

llvm-svn: 54855
2008-08-17 01:35:29 +00:00
Dan Gohman be5e69ed37 Avoid repeatedly reallocating the FoldingSetNodeID when searching
through multiple nodes in a bucket.

llvm-svn: 54687
2008-08-12 17:40:22 +00:00
Dan Gohman e955c481fd Fix several const-correctness issues, resolving some -Wcast-qual warnings.
llvm-svn: 54349
2008-08-05 14:45:15 +00:00
Dan Gohman 804c95df52 Fold the useful features of alist and alist_node into ilist, and
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.

Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.

Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.

llvm-svn: 54146
2008-07-28 21:51:04 +00:00
Wojciech Matyjewicz f0d21cdd19 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.

llvm-svn: 53810
2008-07-20 15:55:14 +00:00
Dan Gohman adec96f438 Reapply 53476 and 53480, with a fix so that it properly updates
the BB member to the current basic block after emitting
instructions.

llvm-svn: 53567
2008-07-14 18:19:29 +00:00
Evan Cheng ef8412c822 Back out 53476 and 53480 for now. Somehow they cause llc to miscompile 179.art.
llvm-svn: 53502
2008-07-12 01:38:51 +00:00
Dan Gohman 36a69373dc Add support for putting NamedRegionTimers in TimerGroups, and
use a timer group for the timers in SelectionDAGISel. Also,
Split scheduling out from emitting, to give each their own
timer.

llvm-svn: 53476
2008-07-11 21:54:34 +00:00
Dan Gohman 3707f1daba Use find instead of lower_bound.
llvm-svn: 53474
2008-07-11 20:58:19 +00:00
Dan Gohman e5932e5a3d Add some basic Pool-allocation infrastructure. This adds a Recycler class,
for handling bookkeeping for deleted objects, as well as the alist class
template, for keeping lists of objects allocated from Recyclers, and some
related utilities.

llvm-svn: 53210
2008-07-07 22:58:06 +00:00
Owen Anderson 31936d6ab6 Add a version of AddString that takes a const char* so we can avoid extraneous
conversions to std::string.

llvm-svn: 52995
2008-07-01 23:49:59 +00:00
Dan Gohman 5ceb8b676c Append to the ActiveTimers std::vector before looking at the timer instead
of after, so that any reallocation it does doesn't get counted for the pass
being timed.  This probably doesn't account for a timing discrepancy I was
looking into, but I'm fixing it anyway.

llvm-svn: 52693
2008-06-24 22:07:07 +00:00
Wojciech Matyjewicz 41b744dc51 First step to fix PR2088. Implement routine to compute the
multiplicative inverse of a given number. Modify udivrem to allow input and 
output pairs of arguments to overlap. Patch is based on the work by Chandler
Carruth.

llvm-svn: 52638
2008-06-23 19:39:50 +00:00
Dan Gohman 33204b7c20 Avoid creating a redundant zero APInt.
llvm-svn: 52602
2008-06-21 22:03:12 +00:00
Ted Kremenek 90ada832be Consistently set "Buckets[NumBuckets] = reinterpret_cast<void*>(-1)" throughout FoldingSet.cpp.
llvm-svn: 52425
2008-06-17 19:12:43 +00:00
Zhou Sheng 1247c07742 As comments said, for negative value, the arithmetic
over-shift-right should return -1. So here it should be signed-extended,
when bitwidth larger than 64.

test case: llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll

llvm-svn: 51999
2008-06-05 13:27:38 +00:00
Matthijs Kooijman c9c67157d1 Give a proper error message when a command line option is defined more than
once (ie, at two different places in the source, not two times on the
commandline).

llvm-svn: 51771
2008-05-30 13:26:11 +00:00
Bill Wendling 33e396d041 Remove more iostream header includes. Needed to implement a "FlushStream"
function to flush a specified std::ostream.

llvm-svn: 51705
2008-05-29 21:46:33 +00:00
Dan Gohman e3a6a18364 Tidy up whitespace in ConstantRange::print output.
llvm-svn: 51606
2008-05-27 20:29:07 +00:00
Dale Johannesen fa48372a24 Don't assume underlying APInt type is limited
to 64 bits.

llvm-svn: 51135
2008-05-14 22:53:25 +00:00
Dale Johannesen 8d76cdb144 Remove undefined behavior in hex string->APFloat
conversion.  Try 0x1.0000a4p+0f.  Neil, please review.

llvm-svn: 51132
2008-05-14 22:05:31 +00:00
Dan Gohman d78c400b5b Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.

llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Dan Gohman 02e5933fa3 Make firstEightPowers const.
llvm-svn: 50975
2008-05-12 16:38:14 +00:00
Dan Gohman a8b7e78f54 Remove uses of llvm/System/IncludeFile.h that are no longer needed.
llvm-svn: 50695
2008-05-06 01:32:53 +00:00
Evan Cheng 86cb31862f Fix more -Wshorten-64-to-32 warnings.
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Evan Cheng 82b9e96274 Suppress -Wshorten-64-to-32 warnings for 64-bit hosts.
llvm-svn: 50590
2008-05-02 21:15:08 +00:00
Gabor Greif 659e5c4bc9 fcntl.h is pretty standard on unix (without the sys/)
llvm-svn: 50475
2008-04-30 08:53:22 +00:00
Dan Gohman f06226f506 Fix a pointer-arithmetic bug that caused 64-bit host pointer values to
be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-vor
regression on x86-64, among other things.

llvm-svn: 50372
2008-04-28 20:25:15 +00:00
Ted Kremenek e51f22986b Bug fix in BumpPtrAllocator: don't assume that all objects have the same alignment. "Bump" of the pointer for the next allocated object to be of the specified alignment.
llvm-svn: 50362
2008-04-28 17:58:07 +00:00
Mikhail Glushenkov 5653d3bc48 Add support for response files to the CommandLine library.
llvm-svn: 50355
2008-04-28 16:44:25 +00:00
Dan Gohman c107d0020d Make these variables static.
llvm-svn: 50196
2008-04-23 23:15:23 +00:00
Dale Johannesen 64bbdb17f5 Check that APFloat::convert is not trying to target
ppc long double, which doesn't work.

This may break some stuff temporarily, but I want to
avoid the propagation of code that assumes this works.

llvm-svn: 49983
2008-04-20 01:34:03 +00:00
Dan Gohman 53d3241b52 Use gv's --spartan option, which trades away an extra row of UI buttons
for more space for displaying the graph.

llvm-svn: 49730
2008-04-15 17:27:05 +00:00
Dan Gohman f4bc782495 Make several symbols static.
llvm-svn: 49496
2008-04-10 21:11:47 +00:00
Bill Wendling fc9f25dab0 Fix compilation errors on MSVC. Patch by Argiris Kirtzidis!
llvm-svn: 49055
2008-04-01 22:09:20 +00:00
Chris Lattner 6f2ffdb73f Change the MemoryBuffer::getFile* methods to take just a pointer to the
start of a filename, not a filename+length.  All clients can produce a
null terminated name, and the system api's require null terminated 
strings anyway.

llvm-svn: 49041
2008-04-01 18:04:03 +00:00
Chris Lattner a542518315 Reimplement MemoryBuffer::getFile with three enhancements:
1) stop using MappedFile.
2) if profitable use the sys::path::MapInFilePages api to
   read the file.
3) otherwise fallback to read.

When sys::path::MapInFilePages is implemented, this provides
several benefits:

#1: this avoids fragmenting memory for small files.
#2: this avoids extraneous stat calls when the file size is known.
#3: this only keeps the file descriptor open while reading the 
    file, not for the duration of the lifetime of the memory 
    buffer.  This fixes a serious clang FD 'leak' problem.

I believe that this will work on a win32 machine, but I don't have
one to test on.  I'd appreciate it if someone could check.

llvm-svn: 49031
2008-04-01 06:05:21 +00:00
Chris Lattner bcfa564759 Remove the MappedFile::charBase member, rename base -> getBase() and
make getBase() return a const-correct pointer.

llvm-svn: 49025
2008-04-01 03:40:53 +00:00
Chris Lattner 314a1414d0 Change DiffFilesWithTolerance to be written in terms of MemoryBuffer,
not an mmapped file.  This more closely matches its requirements and
provides an implicitly null terminated buffer, something this
routine had to emulate itself before.

llvm-svn: 49024
2008-04-01 03:39:49 +00:00
Chris Lattner 62385ba3a0 Remove MappedFile support for mapping files for write and exec
and shared.  This complicates the design, is not used, and probably
doesn't even work.

llvm-svn: 49022
2008-04-01 03:10:22 +00:00
Dan Gohman c60c67fc37 Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Dan Gohman bdc24adaaf A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.

llvm-svn: 48800
2008-03-25 21:45:14 +00:00
Bill Wendling 9a11a0174f Add assert for non-hexadecimal radixes.
llvm-svn: 48421
2008-03-16 20:05:52 +00:00
Evan Cheng 4e97e94809 Fix a typo. It's causing consumer-typeset to miscompile. Perhaps more.
llvm-svn: 48035
2008-03-07 22:39:49 +00:00
Dan Gohman 105c1d4106 Add support to APInt for shift and rotate operations with APInt
instead of uint32_t for the shift/rotate count operand type.

llvm-svn: 47741
2008-02-29 01:40:47 +00:00
Dan Gohman 35723eb4f6 Add a method to APFloat to convert directly from APInt.
llvm-svn: 47738
2008-02-29 01:26:11 +00:00
Dan Gohman 63d2d1f554 Fix a bug that caused opt and other tools to silently ignore
invalid command-line options.

llvm-svn: 47523
2008-02-23 01:55:25 +00:00
Dan Gohman 360c86aed5 Add explicit keywords.
llvm-svn: 47382
2008-02-20 16:44:09 +00:00
Anton Korobeynikov f275a49f7f Add 'sink' cmdline option. Patch by Mikhail Glushenkov!
llvm-svn: 47377
2008-02-20 12:38:07 +00:00
Anton Korobeynikov 579f07135a Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Ted Kremenek 901540f118 Fixed bug in APInt::Profile() where the BitWidth field was not included in the
profile of the APSInt object. This caused unexpected Profile collisions where
none should have occurred.

llvm-svn: 47338
2008-02-19 20:50:41 +00:00
Ted Kremenek d66c791904 Fixed bug in FoldingSetIteratorImpl where we did not correctly check if
we had reached the "fake bucket" after the last bucket, allowing the iterator
in some cases to run off the end of the hashtable.

llvm-svn: 47178
2008-02-15 21:12:46 +00:00
Dan Gohman c354ebddd1 Fix a warning about comparison between signed and unsigned,
being consistent with the rest of the APInt implementation.

llvm-svn: 47138
2008-02-14 22:38:45 +00:00
Dan Gohman 8b4fa9dc0a Add countTrailingOnes member functions to APInt.
llvm-svn: 47086
2008-02-13 21:11:05 +00:00
Ted Kremenek 6f30a0798f Added "Profile" method to APFloat for use with FoldingSet.
Added member template "Add" to FoldingSetNodeID that allows "adding" arbitrary
objects to a profile via dispatch to FoldingSetTrait<T>::Profile().

Removed FoldingSetNodeID::AddAPFloat and FoldingSetNodeID::APInt, as their
functionality is now replaced using the above mentioned member template.

llvm-svn: 46957
2008-02-11 17:24:50 +00:00
Dan Gohman 4f26eb7270 Add support to FoldingSet for hashing APInt objects.
llvm-svn: 46833
2008-02-06 23:09:15 +00:00
Ted Kremenek e288786356 Added "bucket_iterators" to FoldingSet. Bucket iterators allow iteration
over all the nodes in a particular bucket.

llvm-svn: 46716
2008-02-04 21:11:17 +00:00
Ted Kremenek 726933a589 Fixed 80 col. violation.
llvm-svn: 46709
2008-02-04 17:14:20 +00:00
Dale Johannesen 8ef8f24c40 Chris' change to print an approximation to long doubles
exposed a bug in APFloat's long double->double conversion of
NaNs.  Broke several things in the ieee part of gcc testsuite.

llvm-svn: 46617
2008-01-31 18:34:01 +00:00
Dan Gohman b456a15a5b Remove top-level const qualifiers from casts, avoiding associated
compiler warnings.

llvm-svn: 46509
2008-01-29 12:08:20 +00:00
Lauro Ramos Venancio 0f54a09163 Simplify the code and fix a typo.
llvm-svn: 46458
2008-01-28 20:02:51 +00:00
Lauro Ramos Venancio 99929d20e7 Fix fpcmp infinite loop when comparing "29-266" with "29-268".
llvm-svn: 46455
2008-01-28 18:23:23 +00:00
Ted Kremenek 4875d2d997 Added FoldingSet style 'profiling' support for APSInt.
llvm-svn: 46189
2008-01-19 04:31:12 +00:00
Ted Kremenek 5c75d54c5b Added FoldingSet style 'profiling' support for APInt.
llvm-svn: 46188
2008-01-19 04:23:33 +00:00
Ted Kremenek c0259639ad Made 'FoldingSetNodeID' a proper class instead of a nested class in
'FoldingSetNodeImpl' (previously 'FoldingSetNodeID' was a typedef of
'FoldingSetNodeImpl::NodeID').

Why?  Clients can now easily forward declare 'FoldingSetNodeID' without having
to include FoldingSet.h.

llvm-svn: 46187
2008-01-19 04:22:50 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner a087a8d2ce remove attribution from lib Makefiles.
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Anton Korobeynikov ee6af40c95 Cygwin defines uint32_t as unsigned long. Unbreak call to std::min in this case
llvm-svn: 45342
2007-12-24 11:16:47 +00:00
Reid Spencer 0b1df1d3da Don't have APInt.cpp depend upon DerivedTypes.h. This helps with splitting the
Support libraries separately into their own module.

llvm-svn: 44852
2007-12-11 06:53:58 +00:00
Chris Lattner e5256754e7 proper #include order.
llvm-svn: 44707
2007-12-08 19:00:03 +00:00
Gordon Henriksen 4b41a6f529 Adding a StringPool data structure, which GC will use.
llvm-svn: 44705
2007-12-08 17:07:47 +00:00
Neil Booth 06f20ea4ba Prior commit updated wrong if, apologies.
llvm-svn: 44614
2007-12-05 13:06:04 +00:00
Neil Booth 3ab004bca6 Handle zero correctly.
llvm-svn: 44613
2007-12-05 13:01:24 +00:00
Dale Johannesen 9d43e3d841 Handle 0 correctly in string->APFloat conversion.
llvm-svn: 44594
2007-12-05 01:10:19 +00:00
Chris Lattner 893fe3bbd1 Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
llvm-svn: 44296
2007-11-23 22:42:31 +00:00
Chris Lattner c2c4c7456c Fix APInt::countTrailingZeros to return BitWidth if the input is zero instead of returning some random large number.
llvm-svn: 44294
2007-11-23 22:36:25 +00:00
Chris Lattner 44158478bb Fix the Linker testcase regressions, by making MemoryBuffer::getFileOrSTDIN return
a valid but empty buffer if stdin is empty.

llvm-svn: 44219
2007-11-18 18:52:28 +00:00
Dale Johannesen 06a10df562 Fix denormal check in float->APInt conversion.
PR 1804.

llvm-svn: 44201
2007-11-17 01:02:27 +00:00
Chris Lattner 581f006f5d make smallptrset more const and type correct, which caught a few
minor bugs.

llvm-svn: 43782
2007-11-06 22:12:43 +00:00
Neil Booth 758d0fd736 Remove some unnecessary C-style statics.
Restore an assertion that arithmetic can be performed on this format.

llvm-svn: 43638
2007-11-02 15:10:05 +00:00
Neil Booth ae077d232c Add back line whose removal somehow crept into prior patch
llvm-svn: 43627
2007-11-01 22:51:07 +00:00
Neil Booth 618d0fc377 When converting to integer, do bit manipulations in the destination
memory rather than in a copy of the APFloat.  This avoids problems
when the destination is wider than our significand and is cleaner.

Also provide deterministic values in all cases where conversion
fails, namely zero for NaNs and the minimal or maximal value
respectively for underflow or overflow.

llvm-svn: 43626
2007-11-01 22:43:37 +00:00
Hartmut Kaiser fc69d322f2 Clarified operator precedence.
Silenced VC++ warning.

llvm-svn: 43372
2007-10-25 23:15:31 +00:00
Chris Lattner 1b88e3c2dd This requires rtti info because tblgen uses commandline,
and tblgen requires rtti.

llvm-svn: 43127
2007-10-18 15:57:29 +00:00
Neil Booth 9130551996 Fast-track obviously over-large and over-small exponents during decimal->
integer conversion.  In some such cases this makes us one or two orders
of magnitude faster than NetBSD's libc.  Glibc seems to have a similar
fast path.

Also, tighten up some upper bounds to save a bit of memory.

llvm-svn: 42984
2007-10-15 15:00:55 +00:00
Neil Booth 5fe658b21d Consolidate logic for creating NaNs. Silence compiler warning.
llvm-svn: 42966
2007-10-14 10:39:51 +00:00
Neil Booth 06077e7c3c Whether arithmetic is supported is a property of the semantics. Make it
so, and clean up the checks by putting them in an inline function.

llvm-svn: 42965
2007-10-14 10:29:28 +00:00
Neil Booth 4ed401b898 Separate out parsing of decimal number. Use this to only allocate
memory for the significand once up-front.  Also ignore insignificant
trailing zeroes; this saves unnecessary multiplications later.

llvm-svn: 42964
2007-10-14 10:16:12 +00:00
Neil Booth c799fe9ed9 If the power of 5 is exact, and the reciprocal exact, the error is zero not one half-ulps. This prevents an infinite loop in rare cases.
llvm-svn: 42950
2007-10-13 03:34:08 +00:00
Neil Booth d502a82092 Remove duplicate comment.
llvm-svn: 42913
2007-10-12 16:05:57 +00:00
Neil Booth b93d90e98c Implement correctly-rounded decimal->binary conversion, i.e. conversion
from user input strings.

Such conversions are more intricate and subtle than they may appear;
it is unlikely I have got it completely right first time.  I would
appreciate being informed of any bugs and incorrect roundings you
might discover.

llvm-svn: 42912
2007-10-12 16:02:31 +00:00
Neil Booth e9dbe094aa Remove a field that was never used.
llvm-svn: 42911
2007-10-12 15:35:10 +00:00
Neil Booth 146fdb3eeb If we're trying to be arbitrary precision, unsigned char clearly won't cut it. Needed for dec->bin conversions.
llvm-svn: 42910
2007-10-12 15:33:27 +00:00
Neil Booth 7e74b17ad2 Don't attempt to mask no bits
llvm-svn: 42909
2007-10-12 15:31:31 +00:00
Dale Johannesen 007aa378ad Next PPC long double bits. First cut at constants.
No compile-time support for constant operations yet,
just format transformations.  Make readers and
writers work.  Split constants into 2 doubles in
Legalize.

llvm-svn: 42865
2007-10-11 18:07:22 +00:00
Chris Lattner f5ea386698 Add new MemoryBuffer::getMemBufferCopy method.
llvm-svn: 42815
2007-10-09 21:46:38 +00:00
Dan Gohman 66966403ce Pass argc by value, not by reference, since it isn't modified.
llvm-svn: 42788
2007-10-09 16:04:57 +00:00
Chris Lattner 5c50f59690 Change a #include into a forward declaration
llvm-svn: 42781
2007-10-09 03:40:30 +00:00
Dan Gohman 2c6a821fd7 Move the space in overview output for commands out of each of the
commands and into the common code.

llvm-svn: 42752
2007-10-08 15:45:12 +00:00
Neil Booth 49c6aab7b8 Use APInt::tcExtract. It's cleaner, and works :)
llvm-svn: 42746
2007-10-08 14:39:42 +00:00
Neil Booth b618216e56 Add a new function tcExtract for extracting a bignum from an
arbitrary range of bits embedded in the middle of another bignum.
This kind of operation is desirable in many cases of software
floating point, e.g. converting bignum integers to floating point
numbers of fixed precision (you want to extract the precision most
significant bits).

Elsewhere, add an assertion, and exit the shift functions early if
the shift count is zero.

llvm-svn: 42745
2007-10-08 13:47:12 +00:00
Neil Booth 03f58ab706 Add back convertFromSignExtendedInteger.
llvm-svn: 42735
2007-10-07 12:15:41 +00:00
Neil Booth ba205229e7 Now that convertFromUnsignedParts has a sane, constant interface,
convertFromZeroExtendedInteger can be simplified as it doesn't need
to make a copy of the source bignum.

llvm-svn: 42734
2007-10-07 12:10:57 +00:00
Neil Booth 6c1c8588ae Reimplement convertFromUnsignedInteger so it is passed a const bignum.
It used to modify its argument in-place.

This interface is saner and the implementation more efficient.  It will
be needed for decimal->binary conversion.

llvm-svn: 42733
2007-10-07 12:07:53 +00:00
Neil Booth 5f00973393 convertFromInteger, as originally written, expected sign-extended
input.  APInt unfortunately zero-extends signed integers, so Dale
modified the function to expect zero-extended input.  Make this
assumption explicit in the function name.

llvm-svn: 42732
2007-10-07 11:45:55 +00:00
Neil Booth d3985924f4 combineLostFractions does not need to be a member function
llvm-svn: 42729
2007-10-07 08:51:21 +00:00
Neil Booth 32897f5eb0 Cleaner, more general exponent output.
llvm-svn: 42690
2007-10-06 07:29:25 +00:00
Chris Lattner 2a9bcb9ea7 silence warnings in no-assert build.
llvm-svn: 42687
2007-10-06 06:13:42 +00:00
Neil Booth c8b650ab14 Fix and clarify some comments.
llvm-svn: 42670
2007-10-06 00:43:45 +00:00
Neil Booth 0ea72a9a91 Generalize tcFullMultiply so that the operands can be of differing
part widths.  Also, return the number of parts actually required to
hold the result's value.
Remove an over-cautious condition from rounding of float->hex conversion.

llvm-svn: 42669
2007-10-06 00:24:48 +00:00
Neil Booth 8f1946fa22 Add APFloat -> hexadecimal string conversion, as per %a and %A in C99.
Useful for diagnostics and debugging.

llvm-svn: 42598
2007-10-03 22:26:02 +00:00
Chris Lattner 99f6ab7e4c Add initial iterator support for folding set.
llvm-svn: 42589
2007-10-03 21:12:09 +00:00
Chris Lattner 8c41ed61d1 Simplify implementation of the FoldingSet circular list, a necessary step
to giving it iterators.

llvm-svn: 42586
2007-10-03 20:45:43 +00:00
Neil Booth 1ca1f80b38 Tweak RoundAwayFromZero the bit number below which is truncated, and make
it const.

Preparation for APFloat -> hexadecimal string conversion.

llvm-svn: 42576
2007-10-03 15:16:41 +00:00
Dale Johannesen 28a2c4a9c4 Simplify and fix signed int -> FP conversions.
llvm-svn: 42483
2007-09-30 18:17:01 +00:00
Neil Booth 9acbf5aaf9 Whitespace and compiler warning cleanup.
llvm-svn: 42373
2007-09-26 21:33:42 +00:00
Dale Johannesen e7439eff5a Make APFloat->int conversions deterministic even in
cases with undefined behavior.

llvm-svn: 42328
2007-09-25 23:07:07 +00:00
Dale Johannesen 4f55d9fe0f Fix long double<->shorter FP type conversions
of zero, infinity, and NaNs.

llvm-svn: 42298
2007-09-25 17:25:00 +00:00
Neil Booth a8d7269269 Handle storage complications of float->float conversions.
llvm-svn: 42220
2007-09-22 02:56:19 +00:00
Dale Johannesen 4230512f32 Change APFloat::convertFromInteger to take the incoming
bit width instead of number of words allocated, which
makes it actually work for int->APF conversions.
Adjust callers.  Add const to one of the APInt constructors
to prevent surprising match when called with const
argument.

llvm-svn: 42210
2007-09-21 22:09:37 +00:00
Dale Johannesen 146a0ea071 Fix PR 1688. See comments there.
llvm-svn: 42181
2007-09-20 23:47:58 +00:00
Devang Patel 00064e1bab Do not hide APInt::dump() inside #ifndef NDEBUG.
llvm-svn: 42068
2007-09-17 22:24:00 +00:00
Chris Lattner 6395e5060d fix a gcc warning: comparison between signed and unsigned integer expressions
llvm-svn: 41972
2007-09-14 22:57:00 +00:00
Dale Johannesen 98d3a08d8f Remove the assumption that FP's are either float or
double from some of the many places in the optimizers
it appears, and do something reasonable with x86
long double.
Make APInt::dump() public, remove newline, use it to
dump ConstantSDNode's.
Allow APFloats in FoldingSet.
Expand X86 backend handling of long doubles (conversions
to/from int, mostly).

llvm-svn: 41967
2007-09-14 22:26:36 +00:00
Dan Gohman 14cf78cde5 And an FoldingSetImpl::NodeID::AddInteger overload for int64_t, to avoid
ambiguity.

llvm-svn: 41960
2007-09-14 20:48:42 +00:00
Dan Gohman 58c468fb09 Remove spurious consts. This fixes warnings with compilers that
are strict about such things.

llvm-svn: 41956
2007-09-14 20:08:19 +00:00
Dale Johannesen 521988b604 Compensate for partCount change in Bogus definition
(could break hash table in ConstantFP)

llvm-svn: 41874
2007-09-12 01:22:05 +00:00
Dale Johannesen 245dceb06d Add APInt interfaces to APFloat (allows directly
access to bits).  Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling 
(untested, probably does not work).

llvm-svn: 41858
2007-09-11 18:32:33 +00:00
Evan Cheng ee8d9a0e81 Smarter Reset(). Instead of deallocating all memory regions and reallocate the
first region, just deallocate all but the last region in the list.

llvm-svn: 41782
2007-09-08 00:02:17 +00:00
Evan Cheng 3dba41bf37 Added Reset() to free all allocated memory regions and reset state to be the same as right after ctor.
llvm-svn: 41728
2007-09-05 21:41:34 +00:00
Dale Johannesen 728687c423 Fix mod so it actually works. Fix conversions to
native types to handle denormals correctly.

llvm-svn: 41726
2007-09-05 20:39:49 +00:00
Dale Johannesen 689d17d282 Oops, should be part of 41664; won't work very well without this piece.
llvm-svn: 41665
2007-08-31 23:35:31 +00:00
Dale Johannesen 3cf889f75e Enhance APFloat to retain bits of NaNs (fixes oggenc).
Use APFloat interfaces for more references, mostly
of ConstantFPSDNode.

llvm-svn: 41632
2007-08-31 04:03:46 +00:00
Dale Johannesen d246b2ca5c Change LegalFPImmediates to use APFloat.
Add APFloat interfaces to ConstantFP, SelectionDAG.
Fix integer bit in double->APFloat conversion.
Convert LegalizeDAG to use APFloat interface in
ConstantFPSDNode uses.

llvm-svn: 41587
2007-08-30 00:23:21 +00:00