1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

30384 Commits

Author SHA1 Message Date
Reid Spencer
2dc808284e Implement the getHashValue method.
Fix toString use of getValue to use getZExtValue()

llvm-svn: 34642
2007-02-26 21:02:27 +00:00
Reid Spencer
18629544d3 1. Split getValue() into getSExtValue() and getZExtValue() to match
ConstantInt better.
2. Add a getHashValue() method.

llvm-svn: 34641
2007-02-26 20:57:12 +00:00
Devang Patel
c13055b251 Use efficient container SmallPtrSet
llvm-svn: 34640
2007-02-26 20:22:50 +00:00
Chris Lattner
d4cd3a31e6 always lower to RETFLAG, never leave it as just ret.
llvm-svn: 34639
2007-02-26 19:44:02 +00:00
Devang Patel
b0b949f93e Do not unswitch loop on same value again and again.
llvm-svn: 34638
2007-02-26 19:31:58 +00:00
Chris Lattner
656996aab8 fix attribution
llvm-svn: 34637
2007-02-26 18:56:07 +00:00
Chris Lattner
948965f809 Add a description of the X86-64 calling convention and the return
conventions.  This doesn't do anything yet, but may in the future.

llvm-svn: 34636
2007-02-26 18:17:14 +00:00
Reid Spencer
11f19f730c Implement inline methods that make transition of ConstantInt to use APInt
easier to comprehend and might be useful elsewhere.

llvm-svn: 34635
2007-02-26 17:50:32 +00:00
Reid Spencer
728cf2d5cf Re-enable this. The header was committed.
llvm-svn: 34634
2007-02-26 08:10:54 +00:00
Chris Lattner
7165ee9b6b switch to smallvector
llvm-svn: 34633
2007-02-26 07:59:53 +00:00
Chris Lattner
4b7b0a145a another missing header :( :( :(
llvm-svn: 34632
2007-02-26 07:51:00 +00:00
Chris Lattner
3fe1132dcd 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.

llvm-svn: 34631
2007-02-26 07:50:02 +00:00
Reid Spencer
1252a271a1 Make isNegative() a const function since it doesn't modify the APInt.
llvm-svn: 34630
2007-02-26 07:45:40 +00:00
Reid Spencer
050bd4479e 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.

llvm-svn: 34629
2007-02-26 07:44:38 +00:00
Chris Lattner
d0c941c89e the truncate must always be done, it's only the assert that is conditional.
llvm-svn: 34628
2007-02-26 05:21:05 +00:00
Chris Lattner
cdbef93603 reapply my previous patch with a bugfix.
llvm-svn: 34627
2007-02-26 05:02:39 +00:00
Chris Lattner
96aac36de5 revert my previous change, something strange is happening.
llvm-svn: 34626
2007-02-26 04:43:19 +00:00
Chris Lattner
decf97fae2 add an accessor.
llvm-svn: 34625
2007-02-26 04:01:25 +00:00
Chris Lattner
d01ebce896 emit an enum value for the # of target registers.
llvm-svn: 34624
2007-02-26 03:34:38 +00:00
Chris Lattner
2e7125dc74 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

llvm-svn: 34623
2007-02-26 03:18:56 +00:00
Chris Lattner
0a14efc457 new testcase
llvm-svn: 34622
2007-02-26 03:16:20 +00:00
Chris Lattner
65de507797 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.

llvm-svn: 34621
2007-02-26 03:13:59 +00:00
Chris Lattner
38db1ad2ab track signedness of formal argument, though we have a fixme here.
llvm-svn: 34620
2007-02-26 02:56:58 +00:00
Reid Spencer
e8e8ea4fba Add an isNegative method to determine if the APInt's value is negative.
This is much less expensive than a test against zero.

llvm-svn: 34619
2007-02-26 01:20:59 +00:00
Reid Spencer
6177d67365 Rewrite lshr to not do bit by bit copy but to copy and shift whole words.
This makes it much more efficient.

llvm-svn: 34618
2007-02-26 01:19:48 +00:00
Reid Spencer
82a5b300ad Fix sext operation. Shifting by zero would leave an incorrect mask.
llvm-svn: 34617
2007-02-25 23:54:00 +00:00
Reid Spencer
c0d07ad61a 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.

llvm-svn: 34616
2007-02-25 23:44:53 +00:00
Chris Lattner
ad14e21b97 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

llvm-svn: 34615
2007-02-25 23:10:46 +00:00
Chris Lattner
5c1d3eff0a new testcase
llvm-svn: 34614
2007-02-25 23:08:29 +00:00
Chris Lattner
15c167cc61 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.

llvm-svn: 34613
2007-02-25 22:23:46 +00:00
Chris Lattner
4d419b02ec new testcase
llvm-svn: 34612
2007-02-25 22:23:15 +00:00
Chris Lattner
51ee558f56 new testcase
llvm-svn: 34611
2007-02-25 22:02:01 +00:00
Jim Laskey
c2e9ceb475 Fix for PR1224.
llvm-svn: 34610
2007-02-25 21:43:59 +00:00
Jim Laskey
1c9a412982 Test for PR1224.
llvm-svn: 34609
2007-02-25 21:43:21 +00:00
Chris Lattner
50be7cd320 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.

llvm-svn: 34608
2007-02-25 21:06:13 +00:00
Chris Lattner
1f16d0f345 new testcase. @foo should be marked fastcc by globalopt
llvm-svn: 34607
2007-02-25 21:04:39 +00:00
Chris Lattner
2fbfbcd9cd disable some noisy debug output
llvm-svn: 34606
2007-02-25 20:42:59 +00:00
Chris Lattner
796625a49d no really, this is the right patch
llvm-svn: 34605
2007-02-25 20:01:40 +00:00
Chris Lattner
49fc72110a always promote float varargs to double.
llvm-svn: 34604
2007-02-25 19:59:18 +00:00
Reid Spencer
e6f7201099 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).

llvm-svn: 34603
2007-02-25 19:32:03 +00:00
Reid Spencer
a4ab1c36d2 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.

llvm-svn: 34602
2007-02-25 19:26:01 +00:00
Chris Lattner
b5ce97a83a 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.

llvm-svn: 34601
2007-02-25 19:20:53 +00:00
Chris Lattner
05de718ae8 add -enable-eh
llvm-svn: 34600
2007-02-25 18:50:48 +00:00
Chris Lattner
a9c561b9e6 optimize duplicate ValueMap lookups
llvm-svn: 34599
2007-02-25 18:40:32 +00:00
Dale Johannesen
f6f34ec2e0 cosmetic changes from review of last patch. obvious
llvm-svn: 34598
2007-02-25 18:31:31 +00:00
Evan Cheng
550798e5d5 A couple of more places where a register liveness has been extended and its last kill should be updated accordingly.
llvm-svn: 34597
2007-02-25 09:51:27 +00:00
Evan Cheng
13e48f975c Add an assertion.
llvm-svn: 34596
2007-02-25 09:47:31 +00:00
Evan Cheng
189678c421 Fix a couple of bugs related IsDead back propagation during coalescing.
llvm-svn: 34595
2007-02-25 09:46:31 +00:00
Evan Cheng
8f3e6bfeb3 If the liveinterval of the source instruction has been extended, remove the IsKill marker.
llvm-svn: 34594
2007-02-25 09:41:59 +00:00
Evan Cheng
9968353d64 Only add liveinterval to livein set if it isn't assigned a stack slot.
llvm-svn: 34593
2007-02-25 09:39:02 +00:00