Commit Graph

30107 Commits

Author SHA1 Message Date
Reid Spencer
e0cdd3349d Reorganize some code to make it clearer, avoid a few uninitialized memory
reads, and reduce the number of temporary APInt instances we construct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34467 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 08:21:52 +00:00
Chris Lattner
122c055711 revert r1.68. This breaks 'make install' without doing 'make' first, but
fixes PR1208.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34466 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 06:23:20 +00:00
Reid Spencer
60c0a6a74b Fix the carry in addition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34465 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 05:44:56 +00:00
Reid Spencer
f31c784f27 Add a dump() method for debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34464 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 03:56:12 +00:00
Reid Spencer
385f7547b9 1. Add a dump() method for faster debugging.
2. Change 0 initialization of union to larger component so all is zeroed.
3. Fix the borrow logic in subtraction so it works for > 128 bits.
4. Rewrite fromString to use a simpler but correct algorithm and also to
   not set the bit width contrary to the user's request.
5. Optimize toString a bit by making it only do one Knuth divide per
   iteration instead of two.

With these changes, all arithmetic passes (verified by pari/GP) up to
1024 bits except for certain division cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34463 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 03:55:44 +00:00
Devang Patel
ffee0d4dfe Fix memory leak (PR 775).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34462 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 02:36:31 +00:00
Evan Cheng
788fb1c103 Out of bound reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34461 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 02:27:39 +00:00
Evan Cheng
957840b3e1 Use BitVector instead. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34460 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 02:22:03 +00:00
Reid Spencer
e549c4940c Fix countLeadingZeros to actually return the correct number.
Fix toString to correctly return "0" for zero valued APInts over 128 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34459 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 00:29:48 +00:00
Reid Spencer
54362ca095 Make long addition and subtraction work. Speed things up by using internal
functions more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34458 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 23:40:25 +00:00
Evan Cheng
e811636f33 This cast broke lots of tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 21:30:56 +00:00
Dan Gohman
e26bff22db Fix typos in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34456 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 20:52:03 +00:00
Reid Spencer
61eb180a53 Clean up variable names in operator*.
Attempt #3 for getting a portable INFINITY value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34454 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 20:42:10 +00:00
Reid Spencer
580546a82b Use INFINITY macro from math.h instead of constructing hex floating point
constants (avoids warnings).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34452 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 18:29:12 +00:00
Reid Spencer
9c0696f153 First version that can process arith.cpp test case up to 1024 bits:
1. Ensure pVal is set to 0 in each constructor.
2. Fix roundToDouble to make correct calculations and not read beyond the
   end of allocated memory.
3. Implement Knuth's "classical algorithm" for division from scratch and
   eliminate buffer overflows and uninitialized mememory reads. Document
   it properly too.
4. Implement a wrapper function for KnuthDiv which handles the 64-bit to
   32-bit conversion and back. It also implement short division for the
   n == 1 case that Knuth's algorithm can't handle.
5. Simplify the logic of udiv and urem a little, make them exit early, and
   have them use the "divide" wrapper function to perform the division
   or remainder operation.
6. Move the toString function to the end of the file, closer to where
   the division functions are located.

Note: division is still broken for some > 64 bit values, but at least it
      doesn't crash any more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34449 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 08:51:03 +00:00
Reid Spencer
e91f7847e6 Add an internal convenience method for division that urem and udiv use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34448 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 08:43:42 +00:00
Chris Lattner
f543f748c3 eliminate some dead friends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34447 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 07:18:01 +00:00
Chris Lattner
9b4ee0c1bd switch ConstantFP's from ValueMap to DenseMap, which is much faster to query
and is more memory efficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 07:17:17 +00:00
Chris Lattner
6b6f6ba66c cleanup ConstantInt to use a single DenseMap for uniquing instead of the
heavy-weight ValueMap class.  This reduces mem usage bc reading kc++ by 29K,
even though it only creates 2955 constant ints!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34445 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 06:39:57 +00:00
Chris Lattner
d283566319 Not all managedstatics need object pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34444 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 06:18:57 +00:00
Chris Lattner
d1afbd02ef Make ConstantInt::getTrue/getFalse be llvm_shutdown safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 06:11:36 +00:00
Chris Lattner
b4d7e35dde add a way to register an arbitrary cleanup function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34442 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 06:08:37 +00:00
Chris Lattner
eb41bddfdf Clean up the internals of the ConstantInt machinery
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34441 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:55:46 +00:00
Chris Lattner
e0e769607c simplify some code that was not llvm_shutdown safe
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34440 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:46:39 +00:00
Chris Lattner
bb9a041100 remove reoptimizer-specific passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34439 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:31:49 +00:00
Chris Lattner
0963ad5271 remove some dead passes and stuff specific to the reoptimizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34438 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:31:35 +00:00
Chris Lattner
a9a23d8faf remove some passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34437 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:31:04 +00:00
Chris Lattner
f00c6add97 remove dead method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34436 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:29:47 +00:00
Evan Cheng
667089de04 Dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34435 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 01:29:10 +00:00
Evan Cheng
58866f43fa How the heck did I forget patterns for llvm.x86.sse2.cmp.sd?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34434 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 00:39:09 +00:00
Reid Spencer
de15194839 Add a section on the target datalayout syntax and describe the defaults
and rules used by LLVM to construct the target's layout rules.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34433 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 23:54:10 +00:00
Reid Spencer
4ecd9ee061 Simplify some code by moving variable declarations into the only block that
uses them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34432 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 23:30:10 +00:00
Reid Spencer
f734ea21a3 Implement support for non-standard integer bit widths of any size. The
rules alignment is to pick the alignment that corresponds to the smallest
specified alignment that is larger than the bit width of the type or the
largest specified integer alignment if none are larger than the bitwidth
of the type. For the byte size, the size returned is the next larger
multiple of the alignment for that type (using the above rule). This patch
also changes bit widths from "short" to "uint32_t" to ensure there are
enough bits to specify any bit width that LLVM can handle (currently 2^23);
16-bits isn't enough.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34431 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 22:35:00 +00:00
Evan Cheng
85f00083f5 Added test case for PR1207.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34429 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 21:53:59 +00:00
Evan Cheng
b371f457b0 Re-apply my liveintervalanalysis changes. Now with PR1207 fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34428 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 21:49:54 +00:00
Evan Cheng
d1b2c5b34d Fix test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34427 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 21:47:02 +00:00
Chris Lattner
96c2f349f0 this passes now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34426 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 20:20:04 +00:00
Chris Lattner
f9021ff740 llvm-gcc issue fixed, revert reversal :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34425 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 20:01:23 +00:00
Chris Lattner
da304d0750 remove warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34424 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 19:46:17 +00:00
Evan Cheng
e02e5e465b Temporarily reverting the patch. It's breaking llvm-gcc build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34423 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 19:23:41 +00:00
Reid Spencer
c552ff2825 Add a FIXME for unwritten code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34422 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 19:00:29 +00:00
Bill Wendling
d932aabff0 Corrected typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34421 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 18:32:40 +00:00
Reid Spencer
cb069bb76e Some minor tweaks and grammar cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34420 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 17:38:38 +00:00
Chris Lattner
32980699c0 remove dead methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34419 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:44:24 +00:00
Chris Lattner
00f59da1df remove use of deprecated apis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:41:31 +00:00
Chris Lattner
ec1f752ae4 eliminate use of deprecated apis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34417 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:34:47 +00:00
Chris Lattner
4227bdbf55 remove use of deprecated api
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34416 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:34:02 +00:00
Chris Lattner
df7490a273 add alternate version of constant ctors that don't take a vector. For now
this offers no performance advantage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:23:24 +00:00
Chris Lattner
64113a5b96 fix validation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34414 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 06:57:46 +00:00
Chris Lattner
0cca50c912 more wording changes and some minor additions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34413 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 06:57:16 +00:00