Commit Graph

619 Commits

Author SHA1 Message Date
Owen Anderson
bf31b85ea2 Make the copy constructor of SmallPtrSet much faster.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 21:31:23 +00:00
Owen Anderson
71a1e57d18 Remember to free the heap allocated array if we're not going to use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40043 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 06:45:33 +00:00
Owen Anderson
b54b315251 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40014 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-18 19:54:15 +00:00
Reid Spencer
845b31de0c Unbreak the build by putting calls to free into the implementation file and
having that implementation file #include <cstdlib>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39952 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-17 02:16:12 +00:00
Owen Anderson
1629a1fa87 Use realloc() to (potentially) resize the contents of SmallPtrSet in place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39926 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 21:27:44 +00:00
Nick Lewycky
28753f8df2 Clarify the language. Pointed out by Duncan Sands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39857 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 17:41:03 +00:00
Nick Lewycky
377b1190cb Add alternate ConstantRange intersection algorithm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39851 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 02:51:34 +00:00
Owen Anderson
69b5d12676 Make the assignment operator for SmallPtrSet much faster for normal cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 22:27:20 +00:00
Owen Anderson
4d6f96d699 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38470 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 20:59:01 +00:00
Owen Anderson
da8ebc6b43 Fix an error in the assignment operator that was causing an infinite loop in GVNPRE.cpp.
Patch by Chis Lattner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38467 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 18:51:15 +00:00
Chris Lattner
91f0158d4d implement operator= for smallptrset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38460 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 16:54:03 +00:00
Gabor Greif
a99be51bf5 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37913 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 17:07:56 +00:00
Nick Lewycky
ea332946d3 Fix undefined behaviour reported by the new --enable-expensive-checks option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37829 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-01 03:06:30 +00:00
Owen Anderson
6394e5e4fd Fix a bug in SmallPtrSet that was causing GVNPRE to enter an infinite loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37697 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-22 00:11:18 +00:00
Chris Lattner
61766cae0b 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37696 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 23:23:32 +00:00
Nick Lewycky
ae5eb7accf Fix edge case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37532 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-09 04:20:33 +00:00
Dale Johannesen
81da02b553 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37285 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-22 17:14:46 +00:00
Reid Spencer
20a4c23bcc 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37242 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-19 00:29:55 +00:00
Reid Spencer
fb0709a180 Get rid of leading zeros in the output of toString.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37175 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-17 19:23:02 +00:00
Reid Spencer
02ae8b78ff For lshr by 0 bits, just return *this as a short cut. This also prevents
undefined behavior when the width > 64 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37153 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-17 06:26:29 +00:00
Reid Spencer
6551dcdd8a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37111 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-16 19:18:22 +00:00
Reid Spencer
69944e85aa Make the results for the rotate functions correct when rotateAmt == 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37026 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-14 00:15:28 +00:00
Reid Spencer
19dc32a2d4 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37025 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-13 23:44:59 +00:00
Reid Spencer
92c7283500 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37010 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-12 18:01:57 +00:00
Chris Lattner
a24b04e9e5 fix a memory leak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36981 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 00:43:26 +00:00
Jeff Cohen
0fea8ebb4a Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36901 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-07 15:21:46 +00:00
Chris Lattner
5499da8833 Enhance MemoryBuffer to return error messages in strings if they occur.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36899 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 23:32:36 +00:00
Chris Lattner
9e66233361 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)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36876 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 19:10:47 +00:00
Chris Lattner
d6f595946d remove libbzip2, it is dead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36875 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 19:05:34 +00:00
Chris Lattner
73a978a753 don't build bzip2 for now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36871 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 09:31:32 +00:00
Chris Lattner
dfa8d8c6ee disable this for now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36870 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 09:31:06 +00:00
Chris Lattner
82e791dc42 Fix MemoryBuffer::getFile to return null if it has an error opening the
file instead of aborting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 07:24:46 +00:00
Chris Lattner
82493289e0 This is a patch to fix a compile error in STLExtras.h, and
a bug in GraphWriter.cpp.

Patch by Florian Brandner


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36684 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 18:32:10 +00:00
Chris Lattner
a5ae15ecb7 silence some annoying gcc 4.3 warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36680 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 18:15:36 +00:00
Jeff Cohen
930c0fead9 Fix MemoryBuffer breakage correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36561 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 14:43:31 +00:00
Jeff Cohen
9bc406019e Unbreak build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36559 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 14:21:44 +00:00
Chris Lattner
333ffd4abf Add a new memorybuffer class, to unify all the file reading code in the system
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36553 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 06:58:52 +00:00
Zhou Sheng
c125c00e68 Using APInt more efficiently.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36475 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-26 16:42:07 +00:00
Jeff Cohen
ac58a16f85 Fix PR1329.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36016 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-14 21:50:21 +00:00
Reid Spencer
0468ab3025 We want the number of bits needed, not the power of 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35977 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-14 00:00:10 +00:00
Reid Spencer
57ae4f5f01 Implement a getBitsNeeded method to determine how many bits are needed to
represent a string in binary form by an APInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35968 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-13 19:19:07 +00:00
Zhou Sheng
daacf22537 Make the apint construction more effective.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35960 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-13 05:57:32 +00:00
Chris Lattner
69d6f1358c 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35935 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-12 00:36:29 +00:00
Chris Lattner
159b0a4340 Fix PR1318 by reacting appropriately to a mutating option list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35905 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 15:35:18 +00:00
Reid Spencer
2cd43e402a Fix an approximate calculation in an assertion not to give false negatives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35901 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 13:00:04 +00:00
Reid Spencer
c74b461507 For PR1291:
Change uses of sys::Path class to sys::PathWithStatus in those places where
the file status information is needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35743 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 18:53:16 +00:00
Nick Lewycky
e32157c609 Add signExtend to ConstantRange, to complement zeroExtend and truncate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35733 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 15:41:33 +00:00
Chris Lattner
ee2b32082e Fix a bug in my earlier commit which exposed positional options backwards.
This fixes llvm-ar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35727 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 05:38:53 +00:00
Chris Lattner
9878d6ae3a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35701 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-06 21:06:55 +00:00
Chris Lattner
af035f3460 remove the dead removeArgument method, rename Options to OptionsMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35690 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-05 21:58:17 +00:00