1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

979 Commits

Author SHA1 Message Date
Nuno Lopes
821f6d257e 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
c11d7e324f 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
a830cb14f3 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
1532a1621c 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
3fed68158c 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
b04b85f615 Added raw_fd_ostream::close().
llvm-svn: 58052
2008-10-23 23:49:09 +00:00
Julien Lerouge
89f4df3eae 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
aa7a7ae8d5 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
9543edc4ef 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
7fbfe2a371 Change TAG_ names to DW_TAG for gcc (testsuite) compatibility.
llvm-svn: 57425
2008-10-12 21:23:01 +00:00
Dale Johannesen
2d23786266 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
3d1cdfc99e rearrange some code.
llvm-svn: 57384
2008-10-11 22:07:19 +00:00
Dale Johannesen
075a62519f 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
9e57068854 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
3b86d974bc 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
40d00c0979 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
24ea5f2be7 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
89329a1d0a 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
0f25988689 Initial support for the CMake build system.
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Cedric Venet
d1b22a76d2 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
3ad9fe55e5 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
fe3155fc62 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
4623abf761 add #include
llvm-svn: 55252
2008-08-23 20:34:06 +00:00
Chris Lattner
b7914ec04e 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
b6827db2c0 Add a clear() method to FoldingSet.
llvm-svn: 55210
2008-08-23 00:42:16 +00:00
Chris Lattner
39ea1a575a 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
0b0215d531 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
5a542e7eda 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
2c1d54952b Use raw_ostream throughout the AsmPrinter.
llvm-svn: 55092
2008-08-21 00:14:44 +00:00
Chris Lattner
c9fdd97035 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
9a43334166 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
5c264cf5c7 Get raw_ostream.cpp to compile on MSVC.
llvm-svn: 54879
2008-08-17 09:25:21 +00:00
Chris Lattner
c0610874cc 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
4e4a482a41 remove a dead APInt ctor.
llvm-svn: 54869
2008-08-17 04:58:58 +00:00
Chris Lattner
dab4a64423 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
c9c1d50446 opening "-" automatically yields stdout.
llvm-svn: 54863
2008-08-17 03:53:23 +00:00
Chris Lattner
eef022091c rename OutputData to 'write' to match ostream.
llvm-svn: 54857
2008-08-17 01:46:05 +00:00
Chris Lattner
312d8de59b 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
74ac3fddee 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
de163bb39d Fix several const-correctness issues, resolving some -Wcast-qual warnings.
llvm-svn: 54349
2008-08-05 14:45:15 +00:00
Dan Gohman
9653b21dc2 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
eea926ec20 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
e76fd33ee5 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
ebf7ff4531 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
6ee2195ab1 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
d1342570f2 Use find instead of lower_bound.
llvm-svn: 53474
2008-07-11 20:58:19 +00:00
Dan Gohman
60e964b34c 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
1530481dd3 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
a08868acb3 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
1de28ac425 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
e6da01721b Avoid creating a redundant zero APInt.
llvm-svn: 52602
2008-06-21 22:03:12 +00:00
Ted Kremenek
a9f1f1db52 Consistently set "Buckets[NumBuckets] = reinterpret_cast<void*>(-1)" throughout FoldingSet.cpp.
llvm-svn: 52425
2008-06-17 19:12:43 +00:00
Zhou Sheng
0d32cd97e1 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
9fc9250ec0 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
2ba98ca60f 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
92d5dff525 Tidy up whitespace in ConstantRange::print output.
llvm-svn: 51606
2008-05-27 20:29:07 +00:00
Dale Johannesen
809ad5df81 Don't assume underlying APInt type is limited
to 64 bits.

llvm-svn: 51135
2008-05-14 22:53:25 +00:00
Dale Johannesen
b9d2bc9303 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
bab18cae46 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
4224373cc8 Make firstEightPowers const.
llvm-svn: 50975
2008-05-12 16:38:14 +00:00
Dan Gohman
a84b75df17 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
d9353009b7 Fix more -Wshorten-64-to-32 warnings.
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Evan Cheng
c2d34f03bf Suppress -Wshorten-64-to-32 warnings for 64-bit hosts.
llvm-svn: 50590
2008-05-02 21:15:08 +00:00
Gabor Greif
134707f8e8 fcntl.h is pretty standard on unix (without the sys/)
llvm-svn: 50475
2008-04-30 08:53:22 +00:00
Dan Gohman
e921f90c15 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
f1304a3762 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
4c358b3125 Add support for response files to the CommandLine library.
llvm-svn: 50355
2008-04-28 16:44:25 +00:00
Dan Gohman
6054efc488 Make these variables static.
llvm-svn: 50196
2008-04-23 23:15:23 +00:00
Dale Johannesen
675fca3ee1 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
d0162df4c1 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
26c2127be9 Make several symbols static.
llvm-svn: 49496
2008-04-10 21:11:47 +00:00
Bill Wendling
fb7564e94c Fix compilation errors on MSVC. Patch by Argiris Kirtzidis!
llvm-svn: 49055
2008-04-01 22:09:20 +00:00
Chris Lattner
d141d16ed7 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
7f88d9043f 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
b29e4e90bc 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
c88457a8b2 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
f2309c208a 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
2b96ce84aa Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Dan Gohman
22002efa15 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
301783caf7 Add assert for non-hexadecimal radixes.
llvm-svn: 48421
2008-03-16 20:05:52 +00:00
Evan Cheng
41a16a1347 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
2b8022a8c6 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
45a26a462f Add a method to APFloat to convert directly from APInt.
llvm-svn: 47738
2008-02-29 01:26:11 +00:00
Dan Gohman
8d536a33ff 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
48d03d5a2d Add explicit keywords.
llvm-svn: 47382
2008-02-20 16:44:09 +00:00
Anton Korobeynikov
9c87c6526e Add 'sink' cmdline option. Patch by Mikhail Glushenkov!
llvm-svn: 47377
2008-02-20 12:38:07 +00:00
Anton Korobeynikov
0c5e186924 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
0449b1da95 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
83e9c3ba5c 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
9ca30afc39 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
d22101a970 Add countTrailingOnes member functions to APInt.
llvm-svn: 47086
2008-02-13 21:11:05 +00:00
Ted Kremenek
f06b7ac532 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
011075cfdb Add support to FoldingSet for hashing APInt objects.
llvm-svn: 46833
2008-02-06 23:09:15 +00:00
Ted Kremenek
6dab41ed32 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
c84b3400b2 Fixed 80 col. violation.
llvm-svn: 46709
2008-02-04 17:14:20 +00:00
Dale Johannesen
c19b8c41c6 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
daa38f69cf 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
ad2a3eb416 Simplify the code and fix a typo.
llvm-svn: 46458
2008-01-28 20:02:51 +00:00
Lauro Ramos Venancio
947e17ae75 Fix fpcmp infinite loop when comparing "29-266" with "29-268".
llvm-svn: 46455
2008-01-28 18:23:23 +00:00
Ted Kremenek
dce31b9785 Added FoldingSet style 'profiling' support for APSInt.
llvm-svn: 46189
2008-01-19 04:31:12 +00:00
Ted Kremenek
702d3b8f37 Added FoldingSet style 'profiling' support for APInt.
llvm-svn: 46188
2008-01-19 04:23:33 +00:00
Ted Kremenek
a0105180ad 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
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner
8193d4af33 remove attribution from lib Makefiles.
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Anton Korobeynikov
a0113f6c70 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
3a83a29e21 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
1fe38f35c1 proper #include order.
llvm-svn: 44707
2007-12-08 19:00:03 +00:00
Gordon Henriksen
e187dc4bfa Adding a StringPool data structure, which GC will use.
llvm-svn: 44705
2007-12-08 17:07:47 +00:00
Neil Booth
054a756682 Prior commit updated wrong if, apologies.
llvm-svn: 44614
2007-12-05 13:06:04 +00:00
Neil Booth
b5afbd8e5a Handle zero correctly.
llvm-svn: 44613
2007-12-05 13:01:24 +00:00
Dale Johannesen
15712dc45a Handle 0 correctly in string->APFloat conversion.
llvm-svn: 44594
2007-12-05 01:10:19 +00:00
Chris Lattner
36854c740d Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
llvm-svn: 44296
2007-11-23 22:42:31 +00:00
Chris Lattner
57a40dc2ad 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
56d872fcbb 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
ea47b8b77d Fix denormal check in float->APInt conversion.
PR 1804.

llvm-svn: 44201
2007-11-17 01:02:27 +00:00
Chris Lattner
edf6668dda 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
cd1d243989 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
7eeb095d37 Add back line whose removal somehow crept into prior patch
llvm-svn: 43627
2007-11-01 22:51:07 +00:00
Neil Booth
d04447b7ae 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
48b3098b43 Clarified operator precedence.
Silenced VC++ warning.

llvm-svn: 43372
2007-10-25 23:15:31 +00:00
Chris Lattner
cee5f18fb6 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
e14f19eda6 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
1463947f03 Consolidate logic for creating NaNs. Silence compiler warning.
llvm-svn: 42966
2007-10-14 10:39:51 +00:00
Neil Booth
138d8ef4a7 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
a352eb14cd 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
f3582ac0e0 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
fb373da5fd Remove duplicate comment.
llvm-svn: 42913
2007-10-12 16:05:57 +00:00
Neil Booth
078f455d15 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
4a0b91bebe Remove a field that was never used.
llvm-svn: 42911
2007-10-12 15:35:10 +00:00
Neil Booth
9b83d8be07 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
39cc673e61 Don't attempt to mask no bits
llvm-svn: 42909
2007-10-12 15:31:31 +00:00
Dale Johannesen
0ee2a2fb59 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
a65ec649fd Add new MemoryBuffer::getMemBufferCopy method.
llvm-svn: 42815
2007-10-09 21:46:38 +00:00
Dan Gohman
2fb0a249d7 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
19cb9fa4cc Change a #include into a forward declaration
llvm-svn: 42781
2007-10-09 03:40:30 +00:00
Dan Gohman
2e8245a376 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
e46d6dbd99 Use APInt::tcExtract. It's cleaner, and works :)
llvm-svn: 42746
2007-10-08 14:39:42 +00:00
Neil Booth
f003f9bf1a 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
6f9602ac12 Add back convertFromSignExtendedInteger.
llvm-svn: 42735
2007-10-07 12:15:41 +00:00
Neil Booth
ac998332c3 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
db4dbedfea 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
6e01c5df37 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
726126f4d6 combineLostFractions does not need to be a member function
llvm-svn: 42729
2007-10-07 08:51:21 +00:00
Neil Booth
beba899ff0 Cleaner, more general exponent output.
llvm-svn: 42690
2007-10-06 07:29:25 +00:00
Chris Lattner
a1de966c80 silence warnings in no-assert build.
llvm-svn: 42687
2007-10-06 06:13:42 +00:00
Neil Booth
0613ec4ee6 Fix and clarify some comments.
llvm-svn: 42670
2007-10-06 00:43:45 +00:00
Neil Booth
2c4419d71b 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
2dc065755d 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
de233151af Add initial iterator support for folding set.
llvm-svn: 42589
2007-10-03 21:12:09 +00:00
Chris Lattner
8955442092 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
1e709921bc 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
4b203b8e44 Simplify and fix signed int -> FP conversions.
llvm-svn: 42483
2007-09-30 18:17:01 +00:00
Neil Booth
3b53530d78 Whitespace and compiler warning cleanup.
llvm-svn: 42373
2007-09-26 21:33:42 +00:00
Dale Johannesen
bc41438bab Make APFloat->int conversions deterministic even in
cases with undefined behavior.

llvm-svn: 42328
2007-09-25 23:07:07 +00:00
Dale Johannesen
ee2f3359f4 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
8cb885c389 Handle storage complications of float->float conversions.
llvm-svn: 42220
2007-09-22 02:56:19 +00:00
Dale Johannesen
c7279629cc 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
346a949bd8 Fix PR 1688. See comments there.
llvm-svn: 42181
2007-09-20 23:47:58 +00:00
Devang Patel
547d418b8e Do not hide APInt::dump() inside #ifndef NDEBUG.
llvm-svn: 42068
2007-09-17 22:24:00 +00:00
Chris Lattner
bb109aed3d fix a gcc warning: comparison between signed and unsigned integer expressions
llvm-svn: 41972
2007-09-14 22:57:00 +00:00
Dale Johannesen
575bd6070a 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
1c9bf0bfb9 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
53119779c2 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
4b03ae1ff5 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
7bc3969cea 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
e6c68e7668 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
5977c55f5d 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
1d92d23a89 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
b336f6207c 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
81d6ecb886 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
e91a908971 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
Dale Johannesen
9ec1e28e79 Poison APFloat::operator==. Replace existing uses with bitwiseIsEqual.
This means backing out the preceding change to Constants.cpp, alas.

llvm-svn: 41378
2007-08-24 22:09:56 +00:00
Dale Johannesen
0aaabb858b Revised per review feedback from previous patch.
llvm-svn: 41353
2007-08-24 05:08:11 +00:00
Chris Lattner
91df26be0f silence some warnings in an optimized build.
llvm-svn: 41352
2007-08-24 03:02:34 +00:00
Dale Johannesen
a3ab055b9d Change internal representation of ConstantFP to use APFloat.
Interface to rest of the compiler unchanged, as yet.

llvm-svn: 41348
2007-08-24 00:56:33 +00:00
Chris Lattner
742b745b0c rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.

llvm-svn: 41309
2007-08-23 05:15:32 +00:00
Chris Lattner
401698e8b5 initial checkin of Neil's APFloat work.
llvm-svn: 41203
2007-08-20 22:49:32 +00:00
Chris Lattner
4c6c787315 This adds a bunch of static functions that implement unsigned
two's complement bignum arithmetic.  They could be used to
implement much of APInt, but the idea is they are enough to
implement APFloat as well, which the current APInt interface
is not suited for.

Patch by Neil Booth!

llvm-svn: 41124
2007-08-16 15:56:55 +00:00
Anton Korobeynikov
958dcad32d Properly use const qualifiers
llvm-svn: 41111
2007-08-15 21:12:30 +00:00
Reid Spencer
e8aa5a5832 Make getSTDIN return null if the standard input is empty, as the header file
documentation implies and as its uses depend.

llvm-svn: 40939
2007-08-08 20:01:58 +00:00
Reid Spencer
0de4350acf Escape some escapes that confuse doxygen.
llvm-svn: 40850
2007-08-05 19:33:11 +00:00
Chris Lattner
10db9656ba When clearing a SmallPtrSet, if the set had a huge capacity, but the
contents of the set were small, deallocate and shrink the set.  This
avoids having us to memset as much data, significantly speeding up
some pathological cases.  For example, this speeds up the verifier
from 0.3899s to 0.0763 (5.1x) on the testcase from PR1432 in a 
release build.

llvm-svn: 40837
2007-08-05 07:32:14 +00:00
Owen Anderson
997b15d967 Allow SmallPtrSet to hold pointers to const data.
llvm-svn: 40556
2007-07-27 18:07:02 +00:00
Owen Anderson
f22326ad3d Make the copy constructor of SmallPtrSet much faster.
llvm-svn: 40474
2007-07-24 21:31:23 +00:00
Owen Anderson
21e3bd1cdc Remember to free the heap allocated array if we're not going to use it.
llvm-svn: 40043
2007-07-19 06:45:33 +00:00
Owen Anderson
03b56ad400 Fix an issue where assignments that caused a SmallPtrSet to become non-small
would result in calling realloc() on a null pointer.  Instead, if we encounter
this situation, make a normal call to malloc().

llvm-svn: 40014
2007-07-18 19:54:15 +00:00
Reid Spencer
3dd7b1699b Unbreak the build by putting calls to free into the implementation file and
having that implementation file #include <cstdlib>.

llvm-svn: 39952
2007-07-17 02:16:12 +00:00
Owen Anderson
f01c29815d Use realloc() to (potentially) resize the contents of SmallPtrSet in place.
llvm-svn: 39926
2007-07-16 21:27:44 +00:00
Nick Lewycky
701e227136 Clarify the language. Pointed out by Duncan Sands.
llvm-svn: 39857
2007-07-14 17:41:03 +00:00
Nick Lewycky
42e8a060a0 Add alternate ConstantRange intersection algorithm.
llvm-svn: 39851
2007-07-14 02:51:34 +00:00
Owen Anderson
31bda05073 Make the assignment operator for SmallPtrSet much faster for normal cases.
llvm-svn: 38474
2007-07-09 22:27:20 +00:00
Owen Anderson
e48ed4f7a8 Make the assignment operator for SmallPtrSet return a reference, and fix a long-standing bug in the copy
ctor while I'm at it.

Thanks to Chris Lattner for help with this patch.

llvm-svn: 38470
2007-07-09 20:59:01 +00:00
Owen Anderson
e12cbdb0be Fix an error in the assignment operator that was causing an infinite loop in GVNPRE.cpp.
Patch by Chis Lattner.

llvm-svn: 38467
2007-07-09 18:51:15 +00:00
Chris Lattner
97ba0c99ed implement operator= for smallptrset
llvm-svn: 38460
2007-07-09 16:54:03 +00:00
Gabor Greif
5f705671e4 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.

llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Nick Lewycky
61fa7b9861 Fix undefined behaviour reported by the new --enable-expensive-checks option.
llvm-svn: 37829
2007-07-01 03:06:30 +00:00
Owen Anderson
41515dcd4b Fix a bug in SmallPtrSet that was causing GVNPRE to enter an infinite loop.
llvm-svn: 37697
2007-06-22 00:11:18 +00:00
Chris Lattner
3ac68a90f2 Two changes:
1. Make SmallPtrSet::erase faster in the small case by replacing a memmove
    with a pointer copy.
 2. Fix a bug where the null terminator at the end of the array in the small
    case was not copied

llvm-svn: 37696
2007-06-21 23:23:32 +00:00
Nick Lewycky
e03bd9ddbb Fix edge case.
llvm-svn: 37532
2007-06-09 04:20:33 +00:00
Dale Johannesen
fe0fe14411 Make tail merging the default, except on powerPC. There was no prior art
for a target-dependent default with a command-line override; this way
should be generally usable.

llvm-svn: 37285
2007-05-22 17:14:46 +00:00
Reid Spencer
fe3c213178 Fix an assertion introduced by my last change to the toString method. We
can't use getZExtValue() to extract the low order bits for each digit.
Instead, we need to access the low order word directly.

llvm-svn: 37242
2007-05-19 00:29:55 +00:00
Reid Spencer
fe3fc94a44 Get rid of leading zeros in the output of toString.
llvm-svn: 37175
2007-05-17 19:23:02 +00:00
Reid Spencer
39e03f53ca For lshr by 0 bits, just return *this as a short cut. This also prevents
undefined behavior when the width > 64 bits.

llvm-svn: 37153
2007-05-17 06:26:29 +00:00
Reid Spencer
1ec1e07949 Fix a bug in the "fromString" method where radix 2,8 and 16 values were
not being generated correctly because the shl operator does not mutate its
object but returns a new value. Also, make the distinction between radix
16 and the others more clear.

llvm-svn: 37111
2007-05-16 19:18:22 +00:00
Reid Spencer
3dab764309 Make the results for the rotate functions correct when rotateAmt == 0.
llvm-svn: 37026
2007-05-14 00:15:28 +00:00
Reid Spencer
a17d02ad08 Add some things needed by the llvm-gcc version supporting bit accurate integer
types:
1. Functions to compute div/rem at the same time.
2. Further assurance that an APInt with 0 bitwidth cannot be constructed.
3. Left and right rotate operations.
4. An exactLogBase2 function which requires an exact power of two or it
   returns -1.

llvm-svn: 37025
2007-05-13 23:44:59 +00:00
Reid Spencer
8c2e0f85eb Fix shl to produce the correct result when the bitwidth is > 64 and the
shift amount is 0. Previously this code would do a lshr by the bit width
which can lead to incorrect results.

llvm-svn: 37010
2007-05-12 18:01:57 +00:00
Chris Lattner
b601311b07 fix a memory leak
llvm-svn: 36981
2007-05-11 00:43:26 +00:00
Jeff Cohen
2e8263c013 Unbreak VC++ build.
llvm-svn: 36901
2007-05-07 15:21:46 +00:00
Chris Lattner
112d26a164 Enhance MemoryBuffer to return error messages in strings if they occur.
llvm-svn: 36899
2007-05-06 23:32:36 +00:00
Chris Lattner
4dca43cc6d remove this file for now, we can bring it back from cvs if we need it in
the future (and integrate it with membuffer, etc)

llvm-svn: 36876
2007-05-06 19:10:47 +00:00
Chris Lattner
71eb8d5e89 remove libbzip2, it is dead
llvm-svn: 36875
2007-05-06 19:05:34 +00:00
Chris Lattner
5bd1b5b32d don't build bzip2 for now
llvm-svn: 36871
2007-05-06 09:31:32 +00:00
Chris Lattner
5f94a8492f disable this for now
llvm-svn: 36870
2007-05-06 09:31:06 +00:00
Chris Lattner
9fa29b4027 Fix MemoryBuffer::getFile to return null if it has an error opening the
file instead of aborting.

llvm-svn: 36858
2007-05-06 07:24:46 +00:00
Chris Lattner
49b1ec44eb This is a patch to fix a compile error in STLExtras.h, and
a bug in GraphWriter.cpp.

Patch by Florian Brandner

llvm-svn: 36684
2007-05-03 18:32:10 +00:00
Chris Lattner
d363044771 silence some annoying gcc 4.3 warnings
llvm-svn: 36680
2007-05-03 18:15:36 +00:00
Jeff Cohen
7cfc4b404f Fix MemoryBuffer breakage correctly.
llvm-svn: 36561
2007-04-29 14:43:31 +00:00
Jeff Cohen
349056458a Unbreak build.
llvm-svn: 36559
2007-04-29 14:21:44 +00:00
Chris Lattner
4749cca517 Add a new memorybuffer class, to unify all the file reading code in the system
llvm-svn: 36553
2007-04-29 06:58:52 +00:00
Zhou Sheng
8c150f133c Using APInt more efficiently.
llvm-svn: 36475
2007-04-26 16:42:07 +00:00
Jeff Cohen
5a502fb622 Fix PR1329.
llvm-svn: 36016
2007-04-14 21:50:21 +00:00
Reid Spencer
84c2475e77 We want the number of bits needed, not the power of 2.
llvm-svn: 35977
2007-04-14 00:00:10 +00:00
Reid Spencer
6e7854339e Implement a getBitsNeeded method to determine how many bits are needed to
represent a string in binary form by an APInt.

llvm-svn: 35968
2007-04-13 19:19:07 +00:00
Zhou Sheng
dedfc40044 Make the apint construction more effective.
llvm-svn: 35960
2007-04-13 05:57:32 +00:00
Chris Lattner
9564abbfb5 improve the patch for PR1318 to also support grouped options with custom
handlers (like the pass list).  My previous fix only supported *new* command
line options, not additions to old ones.

This fixes test/Feature/load_module.ll

llvm-svn: 35935
2007-04-12 00:36:29 +00:00
Chris Lattner
32f6730bb1 Fix PR1318 by reacting appropriately to a mutating option list.
llvm-svn: 35905
2007-04-11 15:35:18 +00:00
Reid Spencer
9b497be3c4 Fix an approximate calculation in an assertion not to give false negatives.
llvm-svn: 35901
2007-04-11 13:00:04 +00:00
Reid Spencer
875a2bc4db For PR1291:
Change uses of sys::Path class to sys::PathWithStatus in those places where
the file status information is needed.

llvm-svn: 35743
2007-04-07 18:53:16 +00:00
Nick Lewycky
ec51e934ef Add signExtend to ConstantRange, to complement zeroExtend and truncate.
llvm-svn: 35733
2007-04-07 15:41:33 +00:00
Chris Lattner
c1bce783e8 Fix a bug in my earlier commit which exposed positional options backwards.
This fixes llvm-ar.

llvm-svn: 35727
2007-04-07 05:38:53 +00:00
Chris Lattner
0160bf7114 rearchitect the registration mechanism used by the command line option stuff.
This dramatically reduce the amount of memory allocated by the commandline stuff
at static init time, changing it to build local data structures when ParseCommandLineOptions
is called.  In a dummy empty program that links some llvm libraries, this reduces
the number of malloc'd bytes from 4864 to 3360 on entry to main.  Most of that
memory is now allocated by non-commandline related stuff.

llvm-svn: 35701
2007-04-06 21:06:55 +00:00
Chris Lattner
d33f94f2d2 remove the dead removeArgument method, rename Options to OptionsMap.
llvm-svn: 35690
2007-04-05 21:58:17 +00:00
Chris Lattner
ed593d6789 stringmap memory managed with malloc now
llvm-svn: 35666
2007-04-04 17:24:28 +00:00
Chris Lattner
8a4ca643dd use calloc instead of new/memset, it is more efficient
llvm-svn: 35644
2007-04-04 00:44:31 +00:00
Chris Lattner
dbf6a79a71 Extend StringMap to support being initialized as completely empty. When
initialized this way, they do not do a malloc to allocate their buckets.

llvm-svn: 35642
2007-04-04 00:29:37 +00:00
Chris Lattner
59994ede6b greatly reduce hte default size of stringmap.
llvm-svn: 35632
2007-04-03 22:15:38 +00:00
Nick Lewycky
03f9c0ffc9 Implement union of wrapped sets.
llvm-svn: 35534
2007-04-01 03:47:44 +00:00
Reid Spencer
4269ae1274 For PR789:
Make the sys::Path::getFileStatus function more efficient by having it
return a pointer to the FileStatus structure rather than copy it. Adjust
uses of the function accordingly. Also, fix some memory issues in sys::Path.

llvm-svn: 35476
2007-03-29 19:05:44 +00:00
Reid Spencer
50b83584c4 For PR789:
Updates for change in interface of getFileStatus method of sys::Path class.

llvm-svn: 35458
2007-03-29 16:48:16 +00:00
Zhou Sheng
427b6bec97 Fix a bug in getAllOnesValue() which broke
some test cases for bitwidth > 64.

llvm-svn: 35232
2007-03-21 04:34:37 +00:00
Jeff Cohen
21c7fc9c1f Fix (and simplify) 48-bit byte swap.
Get pos/neg infinity the correct way.

llvm-svn: 35223
2007-03-20 20:42:36 +00:00
Reid Spencer
41d254c7f4 Fix coding standards violation.
llvm-svn: 35189
2007-03-19 21:19:02 +00:00
Reid Spencer
b7d0a60da1 Implement extension of sign bits for negative values in the uint64_t
constructor. This helps to fix test/Assembler/2007-03-19-NegValue.ll

llvm-svn: 35180
2007-03-19 20:37:47 +00:00
Reid Spencer
7be576b4b0 Revert the last patch as it violates the conditions of sext/zext.
llvm-svn: 35068
2007-03-12 18:37:25 +00:00
Zhou Sheng
0145067d85 For APInt::z/sext(width), if width == BitWidth, just return *this.
llvm-svn: 35065
2007-03-12 17:47:45 +00:00
Nick Lewycky
2af4a3ab17 Add getter methods for the extremes of a ConstantRange.
llvm-svn: 35056
2007-03-10 15:54:12 +00:00
Jeff Cohen
98c99a3a02 Unbreak VC++ build.
llvm-svn: 34917
2007-03-05 00:00:42 +00:00
Reid Spencer
3e3980a403 Fix ashr for bitwidths > 64. This is now validated up to 1024 bits.
llvm-svn: 34852
2007-03-02 22:39:11 +00:00
Reid Spencer
6d483da6c0 Use a better algorithm for rounding sqrt results. Change the FIXME about
this to a NOTE: because pari/gp results start to get rounded incorrectly
after 192 bits of precision. APInt and pari/gp never differ by more than
1, but APInt is more accurate because it does not lose precision after 192
bits as does pari/gp.

llvm-svn: 34834
2007-03-02 04:21:55 +00:00