Commit Graph

30293 Commits

Author SHA1 Message Date
Chris Lattner
d637a8b436 Add calling convention info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34661 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 06:59:52 +00:00
Reid Spencer
9472c373a3 For PR1205:
Implement constant folding via APInt instead of uint64_t.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34660 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 06:23:51 +00:00
Chris Lattner
00836648ae move target independent calling convention stuff to TargetCallingConv.td
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34659 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 05:57:32 +00:00
Chris Lattner
d50110d8dc fill in some holes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34658 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 05:51:05 +00:00
Chris Lattner
9774c915f1 switch x86-64 return value lowering over to using same mechanism as argument
lowering uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34657 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 05:28:59 +00:00
Chris Lattner
13513b7a50 Minor refactoring of CC Lowering interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34656 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 05:13:54 +00:00
Chris Lattner
362e98a5f5 move CC Lowering stuff to its own public interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34655 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 04:43:02 +00:00
Chris Lattner
9c71ab77cd refactor x86-64 argument lowering yet again, this time eliminating templates,
'clients', etc, and adding CCValAssign instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34654 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 04:18:15 +00:00
Chris Lattner
92f6feaf79 ConstantFolding.cpp/h -> ConstantFold.cpp/h to avoid confusion with
lib/Analysis/ConstantFolding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34653 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 03:05:06 +00:00
Evan Cheng
3d3d627513 Backing out Jim's LR spill changes. This was causing llvm-gcc bootstrapping
to infinite loop:
PPCMachineFunctionInfo.h updated: 1.2 -> 1.3
PPCRegisterInfo.cpp updated: 1.110 -> 1.111
PPCRegisterInfo.h updated: 1.28 -> 1.29


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 02:55:29 +00:00
Reid Spencer
79224c4407 XFAIL this on x86-Linux until its fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34651 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 02:45:12 +00:00
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