Commit Graph

30282 Commits

Author SHA1 Message Date
Reid Spencer
51c1c03484 Remove test cases that produce undefined results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34650 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 02:34:02 +00:00
Evan Cheng
ed570dedad forward() should not increment internal iterator. Its client may insert instruction between now and next forward() call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 01:58:48 +00:00
Reid Spencer
30f44f3287 Simplify and document RoundDoubleToAPInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34648 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 01:28:10 +00:00
Reid Spencer
532d0ce208 For PR1205:
Implement the first step towards arbitrary precision integer support in
LLVM. The APInt class provides arbitrary precision arithmetic and value
representation. This patch changes ConstantInt to use APInt as its value
representation without supporting bit widths > 64 yet. That change will
come after ConstantFolding handles bit widths > 64 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34647 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 23:54:03 +00:00
Reid Spencer
9ac44113a8 1. Make sure all delete operators of arrays use the array form of delete.
2. Rewrite operator=(const APInt& RHS) to allow the RHS to be a different
   bit width than the LHS. This makes it possible to use APInt as the key
   of a DenseMap, as needed for the IntConstants map in Constants.cpp
3. Fix operator=(uint64_t) to clear unused bits in case the client assigns
   a value that has more bits than the APInt allows.
4. Assert that bit widths are equal in operator==
5. Revise getHashValue() to put the bit width in the low order six bits.
   This should help to make i1 0, i2 0, ... i64 0 all distinct in the
   IntConstants DenseMap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34646 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 23:38:21 +00:00
Evan Cheng
edeffb37dc Joining an interval with a dead copy instruction. Shorten the live range to the last use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34645 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 21:37:37 +00:00
Reid Spencer
946bca5bae Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34643 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 21:06:05 +00:00
Reid Spencer
794f4725b8 Implement the getHashValue method.
Fix toString use of getValue to use getZExtValue()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34642 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 21:02:27 +00:00
Reid Spencer
31a81f0190 1. Split getValue() into getSExtValue() and getZExtValue() to match
ConstantInt better.
2. Add a getHashValue() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34641 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 20:57:12 +00:00
Devang Patel
fb688d4d1c Use efficient container SmallPtrSet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34640 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 20:22:50 +00:00
Chris Lattner
caddd44be7 always lower to RETFLAG, never leave it as just ret.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34639 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 19:44:02 +00:00
Devang Patel
5295692061 Do not unswitch loop on same value again and again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34638 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 19:31:58 +00:00
Chris Lattner
bffc1b3c4e fix attribution
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34637 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 18:56:07 +00:00
Chris Lattner
31c8a6d511 Add a description of the X86-64 calling convention and the return
conventions.  This doesn't do anything yet, but may in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34636 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 18:17:14 +00:00
Reid Spencer
f99705e898 Implement inline methods that make transition of ConstantInt to use APInt
easier to comprehend and might be useful elsewhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34635 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 17:50:32 +00:00
Reid Spencer
9d1ae8fabe Re-enable this. The header was committed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34634 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 08:10:54 +00:00
Chris Lattner
6e50f8cfe9 switch to smallvector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34633 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 07:59:53 +00:00
Chris Lattner
ab143beb93 another missing header :( :( :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 07:51:00 +00:00
Chris Lattner
14dd4c9735 initial hack at splitting the x86-64 calling convention info out from the
mechanics that process it.  I'm still not happy with this, but it's a step
in the right direction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34631 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 07:50:02 +00:00
Reid Spencer
ebf4ebd691 Make isNegative() a const function since it doesn't modify the APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34630 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 07:45:40 +00:00
Reid Spencer
47fbe9e00c 1. Remove redundant calls to clearUsedBits().
2. Fix countTrailingZeros to use a faster algorithm.
3. Simplify sext() slightly by using isNegative().
4. Implement ashr using word-at-a-time logic instead of bit-at-a-time
5. Rename locals named isNegative so they don't clash with method name.
6. Fix fromString to compute negated value correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34629 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 07:44:38 +00:00
Chris Lattner
cc7b07a0ff the truncate must always be done, it's only the assert that is conditional.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34628 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 05:21:05 +00:00
Chris Lattner
00f23ec5c2 reapply my previous patch with a bugfix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34627 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 05:02:39 +00:00
Chris Lattner
e2c2b76c8a revert my previous change, something strange is happening.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34626 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 04:43:19 +00:00
Chris Lattner
54e3efde46 add an accessor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34625 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 04:01:25 +00:00
Chris Lattner
114e5dd464 emit an enum value for the # of target registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34624 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 03:34:38 +00:00
Chris Lattner
df5cdb5288 in X86-64 CCC, i8/i16 arguments are already properly zext/sext'd on input.
Capture this so that downstream zext/sext's are optimized out.  This
compiles:
  int test(short X) { return (int)X; }

to:

_test:
        movl %edi, %eax
        ret

instead of:

_test:
        movswl %di, %eax
        ret


GCC produces this bizarre code:

_test:
        movw    %di, -12(%rsp)
        movswl  -12(%rsp),%eax
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34623 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 03:18:56 +00:00
Chris Lattner
6c0880c624 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34622 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 03:16:20 +00:00
Chris Lattner
2255887574 Fold (sext (truncate x)) more aggressively, by avoiding creation of a
sextinreg if not needed.   This is useful in two cases: before legalize,
it avoids creating a sextinreg that will be trivially removed.  After legalize
if the target doesn't support sextinreg, the trunc/sext would not have been
removed before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34621 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 03:13:59 +00:00
Chris Lattner
ddf53e45b2 track signedness of formal argument, though we have a fixme here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 02:56:58 +00:00
Reid Spencer
dcffd5c3d9 Add an isNegative method to determine if the APInt's value is negative.
This is much less expensive than a test against zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34619 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 01:20:59 +00:00
Reid Spencer
ba81c2b871 Rewrite lshr to not do bit by bit copy but to copy and shift whole words.
This makes it much more efficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34618 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 01:19:48 +00:00
Reid Spencer
f30b1885ae Fix sext operation. Shifting by zero would leave an incorrect mask.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34617 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 23:54:00 +00:00
Reid Spencer
9eec241347 1. Fix the flip() method to correctly flip all words of the APInt.
2. Implement the trunc, sext, and zext operations.
3. Improve fromString to accept negative values as input.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34616 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 23:44:53 +00:00
Chris Lattner
c30654cc96 Fix an X86-64 abi bug. We now compile:
void foo(short);
void bar(unsigned short A) {
  foo(A);
}

into:

_bar:
        subq $8, %rsp
        movswl %di, %edi
        call _foo
        addq $8, %rsp
        ret

instead of:

_bar:
        subq $8, %rsp
        call _foo
        addq $8, %rsp
        ret

Testcase here: test/CodeGen/X86/x86-64-shortint.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34615 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 23:10:46 +00:00
Chris Lattner
df6b57ad48 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34614 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 23:08:29 +00:00
Chris Lattner
7e22977c0f fix CodeGen/X86/2007-02-25-FastCCStack.ll, a regression from my patch last
night:  fastcc returns should only go in XMM0 if we have SSE2 or above.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34613 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 22:23:46 +00:00
Chris Lattner
f82435d4d7 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34612 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 22:23:15 +00:00
Chris Lattner
876e5942bc new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34611 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 22:02:01 +00:00
Jim Laskey
183f47fb1a Fix for PR1224.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34610 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 21:43:59 +00:00
Jim Laskey
98770d4ed2 Test for PR1224.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34609 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 21:43:21 +00:00
Chris Lattner
1cf5574636 Rework GlobalValue::removeDeadConstantUsers to always remove dead constant
exprs hanging off a global, even if the global is not otherwise dead.  This
requires some tricky iterator gymnastics.

This implements Transforms/GlobalOpt/constantexpr-dangle.ll by deleting a
constantexpr that made it appear that the address of the function was taken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34608 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 21:06:13 +00:00
Chris Lattner
2aef09a06b new testcase. @foo should be marked fastcc by globalopt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34607 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 21:04:39 +00:00
Chris Lattner
3f3098c8ca disable some noisy debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34606 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 20:42:59 +00:00
Chris Lattner
4ddf7a4ca6 no really, this is the right patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34605 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 20:01:40 +00:00
Chris Lattner
640c0ac01d always promote float varargs to double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34604 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 19:59:18 +00:00
Reid Spencer
5d0d05c9b8 1. Provide more detail in file comment.
2. Move comments for methods to .h file, delete them in .cpp file.
3. All places that were doing manual clear of high order bits now call the
   clearUnusedBits() method in order to not depend on undefined behavior
   of the >> operator when the number of bits shifted equals the word size.
4. Reduced # of loc by using the new result of clearUnusedBits() method.
5. Simplified logic (decreased indentation) in a few places.
6. Added code comments to larger functions that needed them.
7. Added FIXME notes about weak implementations of things (e.g. bit-by-bit
   shift right is sub-optimal).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34603 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 19:32:03 +00:00
Reid Spencer
c68c2243dc Fix clearUnusedBits to not depend on "undefined behavior" of >> operator
when the bit size is equal to the word size. This happens to work out okay
on x86, but might not on other platforms. The change just detects when
there are no bits to clear (because BitWidth is a multiple of the word size)
and returns early.

Also, move some comments from .cpp file into header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34602 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 19:26:01 +00:00
Chris Lattner
1fa3d9ef93 one important bugfix: PPC32 didn't have both elf and macho support for
external symbols and global addresses.  Add the missing ones.

one important workaround: PPCISD::CALL is matched by both PPCcall_ELF
and PPCcall_Macho, disable the _ELF patterns for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34601 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 19:20:53 +00:00
Chris Lattner
c25904f23a add -enable-eh
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34600 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 18:50:48 +00:00