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