oota-llvm.git
19 years agoFold two consequtive branches that share a common destination between them.
Chris Lattner [Fri, 23 Sep 2005 18:47:20 +0000 (18:47 +0000)]
Fold two consequtive branches that share a common destination between them.
This implements SimplifyCFG/branch-fold.ll, and is useful on ?:/min/max heavy
code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23410 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Fri, 23 Sep 2005 18:43:57 +0000 (18:43 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23409 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agosimplify some logic further
Chris Lattner [Fri, 23 Sep 2005 07:23:18 +0000 (07:23 +0000)]
simplify some logic further

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23408 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agopull a bunch of logic out of SimplifyCFG into a helper fn
Chris Lattner [Fri, 23 Sep 2005 06:39:30 +0000 (06:39 +0000)]
pull a bunch of logic out of SimplifyCFG into a helper fn

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23407 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agospeed up Archive::isBytecodeArchive in the case when the archive doesn't have
Chris Lattner [Fri, 23 Sep 2005 06:22:58 +0000 (06:22 +0000)]
speed up Archive::isBytecodeArchive in the case when the archive doesn't have
an llvm-ranlib symtab.  This speeds up gccld -native on an almost empty .o file
from 1.63s to 0.18s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23406 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSpeed up isBytecodeLPath from 20s to .01s in common cases. This makes -native
Chris Lattner [Fri, 23 Sep 2005 06:11:24 +0000 (06:11 +0000)]
Speed up isBytecodeLPath from 20s to .01s in common cases.  This makes -native
not completely painful to use.  Once we decide a directory has a bytecode
library, we know it this function returns true, no need to scan entire directories.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23405 91177308-0d34-0410-b5e6-96231b3b80d8

19 years ago1. Do not use .c_str() to keep a persistent handle on a temporary string.
Chris Lattner [Fri, 23 Sep 2005 06:05:46 +0000 (06:05 +0000)]
1. Do not use .c_str() to keep a persistent handle on a temporary string.
2. Concatenate -lfoo and -L/bar options into a single option instead of
   passing "-L /bar" (for example) which doesn't work on Darwin.
3. Send -v output to stderr instead of stdout

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23404 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTurn (X^C1) == C2 into X == C1^C2 iff X&~C1 = 0 (and move a function)
Chris Lattner [Fri, 23 Sep 2005 00:55:52 +0000 (00:55 +0000)]
Turn (X^C1) == C2 into X == C1^C2 iff X&~C1 = 0 (and move a function)

This happens all the time on PPC for bool values, e.g. eliminating a xori
in inverted-bool-compares.ll.

This should be added to the dag combiner as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23403 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Fri, 23 Sep 2005 00:53:06 +0000 (00:53 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23402 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTestcase for PR629
Chris Lattner [Wed, 21 Sep 2005 06:53:56 +0000 (06:53 +0000)]
Testcase for PR629

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23401 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoExpose the LiveInterval interfaces as public headers.
Chris Lattner [Wed, 21 Sep 2005 04:19:09 +0000 (04:19 +0000)]
Expose the LiveInterval interfaces as public headers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23400 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agomove the live interval headers out of lib/CodeGen/
Chris Lattner [Wed, 21 Sep 2005 04:18:25 +0000 (04:18 +0000)]
move the live interval headers out of lib/CodeGen/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23399 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRecommend what I actually test
Chris Lattner [Wed, 21 Sep 2005 03:56:26 +0000 (03:56 +0000)]
Recommend what I actually test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23398 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoStart threading across blocks with code in them, so long as the code does
Chris Lattner [Tue, 20 Sep 2005 01:48:40 +0000 (01:48 +0000)]
Start threading across blocks with code in them, so long as the code does
not define a value that is used outside of it's block.  This catches many
more simplifications, e.g. 854 in 176.gcc, 137 in vpr, etc.

This implements branch-phi-thread.ll:test3.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23397 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agomake this test harder: add a case where instructions are in the bb to be
Chris Lattner [Tue, 20 Sep 2005 01:43:41 +0000 (01:43 +0000)]
make this test harder: add a case where instructions are in the bb to be
threaded over

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23396 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement merging of blocks with the same condition if the block has multiple
Chris Lattner [Tue, 20 Sep 2005 00:43:16 +0000 (00:43 +0000)]
Implement merging of blocks with the same condition if the block has multiple
predecessors.  This implements branch-phi-thread.ll::test1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23395 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Tue, 20 Sep 2005 00:41:55 +0000 (00:41 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23394 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoReject a case we don't handle yet
Chris Lattner [Mon, 19 Sep 2005 23:57:04 +0000 (23:57 +0000)]
Reject a case we don't handle yet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23393 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoremove debugging code :-/
Chris Lattner [Mon, 19 Sep 2005 23:50:15 +0000 (23:50 +0000)]
remove debugging code :-/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23392 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement SimplifyCFG/branch-phi-thread.ll, the most trivial case of threading
Chris Lattner [Mon, 19 Sep 2005 23:49:37 +0000 (23:49 +0000)]
Implement SimplifyCFG/branch-phi-thread.ll, the most trivial case of threading
control across branches with determined outcomes.  More generality to follow.
This triggers a couple thousand times in specint.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23391 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase.
Chris Lattner [Mon, 19 Sep 2005 23:48:04 +0000 (23:48 +0000)]
new testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23390 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoStub out the rest of the DAG Combiner. Just need to fill in the
Nate Begeman [Mon, 19 Sep 2005 22:34:01 +0000 (22:34 +0000)]
Stub out the rest of the DAG Combiner.  Just need to fill in the
select_cc bits and then wrap it in a convenience function for  use with
regular select.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23389 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTeach the local spiller to turn stack slot loads into register-register copies
Chris Lattner [Mon, 19 Sep 2005 06:56:21 +0000 (06:56 +0000)]
Teach the local spiller to turn stack slot loads into register-register copies
when possible, avoiding the load (and avoiding the copy if the value is already
in the right register).

This patch came about when I noticed code like the following being generated:

  store R17 -> [SS1]
  ...blah...
  R4 = load [SS1]

This was causing an LSU reject on the G5.  This problem was due to the register
allocator folding spill code into a reg-reg copy (producing the load), which
prevented the spiller from being able to rewrite the load into a copy, despite
the fact that the value was already available in a register.  In the case
above, we now rip out the R4 load and replace it with a R4 = R17 copy.

This speeds up several programs on X86 (which spills a lot :) ), e.g.
smg2k from 22.39->20.60s, povray from 12.93->12.66s, 168.wupwise from
68.54->53.83s (!), 197.parser from 7.33->6.62s (!), etc.  This may have a larger
impact in some cases on the G5 (by avoiding LSU rejects), though it probably
won't trigger as often (less spilling in general).

Targets that implement folding of loads/stores into copies should implement
the isLoadFromStackSlot hook to get this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23388 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement the isLoadFromStackSlot interface
Chris Lattner [Mon, 19 Sep 2005 05:23:44 +0000 (05:23 +0000)]
Implement the isLoadFromStackSlot interface

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23387 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRefactor this code a bit and make it more general. This now compiles:
Chris Lattner [Sun, 18 Sep 2005 07:22:02 +0000 (07:22 +0000)]
Refactor this code a bit and make it more general.  This now compiles:

struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus2 (unsigned int x) { b.j += x; }

To:

_plus2:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        slwi r3, r3, 6
        add r3, r4, r3
        rlwimi r3, r4, 0, 26, 14
        stw r3, 0(r2)
        blr

instead of:

_plus2:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        rlwinm r5, r4, 26, 21, 31
        add r3, r5, r3
        rlwimi r4, r3, 6, 15, 25
        stw r4, 0(r2)
        blr

by eliminating an 'and'.

I'm pretty sure this is as small as we can go :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23386 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoCompile
Chris Lattner [Sun, 18 Sep 2005 06:30:59 +0000 (06:30 +0000)]
Compile
struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus2 (unsigned int x) {
  b.j += x;
}

to:

plus2:
        mov %EAX, DWORD PTR [b]
        mov %ECX, %EAX
        and %ECX, 131008
        mov %EDX, DWORD PTR [%ESP + 4]
        shl %EDX, 6
        add %EDX, %ECX
        and %EDX, 131008
        and %EAX, -131009
        or %EDX, %EAX
        mov DWORD PTR [b], %EDX
        ret

instead of:

plus2:
        mov %EAX, DWORD PTR [b]
        mov %ECX, %EAX
        shr %ECX, 6
        and %ECX, 2047
        add %ECX, DWORD PTR [%ESP + 4]
        shl %ECX, 6
        and %ECX, 131008
        and %EAX, -131009
        or %ECX, %EAX
        mov DWORD PTR [b], %ECX
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23385 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoGeneralize this transform, using MaskedValueIsZero, allowing us to compile:
Chris Lattner [Sun, 18 Sep 2005 06:02:59 +0000 (06:02 +0000)]
Generalize this transform, using MaskedValueIsZero, allowing us to compile:

struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus3 (unsigned int x) { b.k += x; }

To:

plus3:
        mov %EAX, DWORD PTR [%ESP + 4]
        shl %EAX, 17
        add DWORD PTR [b], %EAX
        ret

instead of:

plus3:
        mov %EAX, DWORD PTR [%ESP + 4]
        shl %EAX, 17
        mov %ECX, DWORD PTR [b]
        add %EAX, %ECX
        and %EAX, -131072
        and %ECX, 131071
        or %ECX, %EAX
        mov DWORD PTR [b], %ECX
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23384 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofix typeo
Chris Lattner [Sun, 18 Sep 2005 05:25:20 +0000 (05:25 +0000)]
fix typeo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23383 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRemove unintentionally committed code
Chris Lattner [Sun, 18 Sep 2005 05:12:51 +0000 (05:12 +0000)]
Remove unintentionally committed code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23382 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoimplement shift.ll:test25. This compiles:
Chris Lattner [Sun, 18 Sep 2005 05:12:10 +0000 (05:12 +0000)]
implement shift.ll:test25.  This compiles:

struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus3 (unsigned int x) {
  b.k += x;
}

to:

_plus3:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r3, 0(r2)
        rlwinm r4, r3, 0, 0, 14
        add r4, r4, r3
        rlwimi r4, r3, 0, 15, 31
        stw r4, 0(r2)
        blr

instead of:

_plus3:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        srwi r5, r4, 17
        add r3, r5, r3
        slwi r3, r3, 17
        rlwimi r3, r4, 0, 15, 31
        stw r3, 0(r2)
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23381 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Sun, 18 Sep 2005 05:10:39 +0000 (05:10 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23380 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement add.ll:test29. Codegening:
Chris Lattner [Sun, 18 Sep 2005 04:24:45 +0000 (04:24 +0000)]
Implement add.ll:test29.  Codegening:

struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus1 (unsigned int x) {
  b.i += x;
}

as:
_plus1:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        add r3, r4, r3
        rlwimi r3, r4, 0, 0, 25
        stw r3, 0(r2)
        blr

instead of:

_plus1:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        rlwinm r5, r4, 0, 26, 31
        add r3, r5, r3
        rlwimi r3, r4, 0, 0, 25
        stw r3, 0(r2)
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23379 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Sun, 18 Sep 2005 04:22:59 +0000 (04:22 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23378 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoremove debug output
Chris Lattner [Sun, 18 Sep 2005 03:50:25 +0000 (03:50 +0000)]
remove debug output

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23377 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement or.ll:test21. This teaches instcombine to be able to turn this:
Chris Lattner [Sun, 18 Sep 2005 03:42:07 +0000 (03:42 +0000)]
Implement or.ll:test21.  This teaches instcombine to be able to turn this:

struct {
   unsigned int bit0:1;
   unsigned int ubyte:31;
} sdata;

void foo() {
  sdata.ubyte++;
}

into this:

foo:
        add DWORD PTR [sdata], 2
        ret

instead of this:

foo:
        mov %EAX, DWORD PTR [sdata]
        mov %ECX, %EAX
        add %ECX, 2
        and %ECX, -2
        and %EAX, 1
        or %EAX, %ECX
        mov DWORD PTR [sdata], %EAX
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23376 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Sun, 18 Sep 2005 03:39:02 +0000 (03:39 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23375 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement hook for ppc
Chris Lattner [Sat, 17 Sep 2005 01:03:26 +0000 (01:03 +0000)]
Implement hook for ppc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23374 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd a new callback
Chris Lattner [Sat, 17 Sep 2005 01:02:45 +0000 (01:02 +0000)]
add a new callback

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23373 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMore DAG combining. Still need the branch instructions, and select_cc
Nate Begeman [Fri, 16 Sep 2005 00:54:12 +0000 (00:54 +0000)]
More DAG combining.  Still need the branch instructions, and select_cc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23371 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a minor bug, add comments
Chris Lattner [Fri, 16 Sep 2005 00:29:46 +0000 (00:29 +0000)]
Fix a minor bug, add comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23370 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoteach the type inference code how to infer types for instructions and node
Chris Lattner [Thu, 15 Sep 2005 22:23:50 +0000 (22:23 +0000)]
teach the type inference code how to infer types for instructions and node
xforms.  Run type inference on result patterns, so we always have fully typed
results (and to catch errors in .td files).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23369 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoput instructions into a map instead of a vector for quick lookup
Chris Lattner [Thu, 15 Sep 2005 21:57:35 +0000 (21:57 +0000)]
put instructions into a map instead of a vector for quick lookup

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23368 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agowhen parsing instructions remember information about the types taken and
Chris Lattner [Thu, 15 Sep 2005 21:51:12 +0000 (21:51 +0000)]
when parsing instructions remember information about the types taken and
returned.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23367 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agodisable this for now
Chris Lattner [Thu, 15 Sep 2005 21:44:00 +0000 (21:44 +0000)]
disable this for now

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23366 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoStart parsing "Pattern" nodes
Chris Lattner [Thu, 15 Sep 2005 21:42:00 +0000 (21:42 +0000)]
Start parsing "Pattern" nodes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23365 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agorename a couple of methods, add structure for pattern parsing
Chris Lattner [Thu, 15 Sep 2005 02:38:02 +0000 (02:38 +0000)]
rename a couple of methods, add structure for pattern parsing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23364 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoVerify that xform functions only occur in logical places
Chris Lattner [Wed, 14 Sep 2005 23:05:13 +0000 (23:05 +0000)]
Verify that xform functions only occur in logical places

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23363 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPromote xform fns to be explicit nodes in result patterns, and clean off
Chris Lattner [Wed, 14 Sep 2005 23:01:59 +0000 (23:01 +0000)]
Promote xform fns to be explicit nodes in result patterns, and clean off
predicates since they will have already matched at this point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23362 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agostart building the instruction dest pattern correctly. Change the xform
Chris Lattner [Wed, 14 Sep 2005 22:55:26 +0000 (22:55 +0000)]
start building the instruction dest pattern correctly.  Change the xform
functions to preserve the Record for the xform instead of making it into a
function name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23361 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agocatch unnamed inputs
Chris Lattner [Wed, 14 Sep 2005 22:06:36 +0000 (22:06 +0000)]
catch unnamed inputs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23360 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agocheck that there are no unexpected operands
Chris Lattner [Wed, 14 Sep 2005 21:59:34 +0000 (21:59 +0000)]
check that there are no unexpected operands

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23359 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoforce all instruction operands to be named.
Chris Lattner [Wed, 14 Sep 2005 21:13:50 +0000 (21:13 +0000)]
force all instruction operands to be named.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23358 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoGive all operands names
Chris Lattner [Wed, 14 Sep 2005 21:11:13 +0000 (21:11 +0000)]
Give all operands names

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23357 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agogive all operands names
Chris Lattner [Wed, 14 Sep 2005 21:10:24 +0000 (21:10 +0000)]
give all operands names

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23356 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoCheck that operands have unique names. REJECT instructions with broken operand
Chris Lattner [Wed, 14 Sep 2005 21:05:02 +0000 (21:05 +0000)]
Check that operands have unique names.  REJECT instructions with broken operand
lists: only don't parse them if they are entirely missing (sparcv9).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23355 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofix a broke range check
Chris Lattner [Wed, 14 Sep 2005 21:04:12 +0000 (21:04 +0000)]
fix a broke range check

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23354 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoParse significantly more of the instruction pattern, now collecting and
Chris Lattner [Wed, 14 Sep 2005 20:53:42 +0000 (20:53 +0000)]
Parse significantly more of the instruction pattern, now collecting and
verifying information about the operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23353 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix some issues exposed by more testing. XORIS had the wrong operands
Chris Lattner [Wed, 14 Sep 2005 20:53:05 +0000 (20:53 +0000)]
Fix some issues exposed by more testing.  XORIS had the wrong operands
specified.  The various *imm operands defined by PPC are really all i32,
even though the actual immediate is restricted to a smaller value in it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23352 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoVerify that set destinations occur first in the instruction operand list.
Chris Lattner [Wed, 14 Sep 2005 18:19:25 +0000 (18:19 +0000)]
Verify that set destinations occur first in the instruction operand list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23351 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix some bugs noticed by new checking code
Chris Lattner [Wed, 14 Sep 2005 18:18:39 +0000 (18:18 +0000)]
Fix some bugs noticed by new checking code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23350 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd an accessor
Chris Lattner [Wed, 14 Sep 2005 18:02:53 +0000 (18:02 +0000)]
add an accessor

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23349 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix the regression last night compiling povray
Chris Lattner [Wed, 14 Sep 2005 17:32:56 +0000 (17:32 +0000)]
Fix the regression last night compiling povray

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23348 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofix a major regression from my patch this afternoon
Chris Lattner [Wed, 14 Sep 2005 06:06:45 +0000 (06:06 +0000)]
fix a major regression from my patch this afternoon

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23347 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoremove some code that isn't ready for prime time
Chris Lattner [Wed, 14 Sep 2005 06:03:10 +0000 (06:03 +0000)]
remove some code that isn't ready for prime time

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23346 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSwitch to a slightly more structured representation for instructions
Chris Lattner [Wed, 14 Sep 2005 04:03:16 +0000 (04:03 +0000)]
Switch to a slightly more structured representation for instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23345 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd some more checking/verification code
Chris Lattner [Wed, 14 Sep 2005 02:11:12 +0000 (02:11 +0000)]
Add some more checking/verification code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23344 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agostart parsing instructions into patterns, start doing many more checks of
Chris Lattner [Wed, 14 Sep 2005 00:09:24 +0000 (00:09 +0000)]
start parsing instructions into patterns, start doing many more checks of
'set's.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23343 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agowe don't need this proto any longer
Chris Lattner [Tue, 13 Sep 2005 22:05:21 +0000 (22:05 +0000)]
we don't need this proto any longer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23342 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agodon't emit the namespace inside the class!
Chris Lattner [Tue, 13 Sep 2005 22:05:02 +0000 (22:05 +0000)]
don't emit the namespace inside the class!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23341 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoEmit code suitable for emission into the ISel class, allowing us to use/define
Chris Lattner [Tue, 13 Sep 2005 22:03:37 +0000 (22:03 +0000)]
Emit code suitable for emission into the ISel class, allowing us to use/define
methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23340 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agomove the #include for the generated code into the isel class body so we
Chris Lattner [Tue, 13 Sep 2005 22:03:06 +0000 (22:03 +0000)]
move the #include for the generated code into the isel class body so we
can use/define class methods

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23339 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agocontinue xform function parsing
Chris Lattner [Tue, 13 Sep 2005 21:59:15 +0000 (21:59 +0000)]
continue xform function parsing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23338 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoStart parsing node transformation information
Chris Lattner [Tue, 13 Sep 2005 21:51:00 +0000 (21:51 +0000)]
Start parsing node transformation information

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23337 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a new Record::getValueAsCode method to mirror the other getValueAs*
Chris Lattner [Tue, 13 Sep 2005 21:44:28 +0000 (21:44 +0000)]
Add a new Record::getValueAsCode method to mirror the other getValueAs*
methods.  Use it to simplify some code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23336 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agocompletely eliminate TreePattern::PatternType
Chris Lattner [Tue, 13 Sep 2005 21:20:49 +0000 (21:20 +0000)]
completely eliminate TreePattern::PatternType

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23335 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoChange the arg lowering code to use copyfromreg from vregs associated
Chris Lattner [Tue, 13 Sep 2005 19:33:40 +0000 (19:33 +0000)]
Change the arg lowering code to use copyfromreg from vregs associated
with incoming arguments instead of the pregs themselves.  This fixes
the scheduler from causing problems by moving a copyfromreg for an argument
to after a select_cc node (now it can, and bad things won't happen).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23334 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoThis has been moved to the target-indep code
Chris Lattner [Tue, 13 Sep 2005 19:32:18 +0000 (19:32 +0000)]
This has been moved to the target-indep code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23333 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoThis code is no longer needed, it is moved to the target-indep code
Chris Lattner [Tue, 13 Sep 2005 19:31:44 +0000 (19:31 +0000)]
This code is no longer needed, it is moved to the target-indep code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23332 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoIf a function has liveins, and if the target requested that they be plopped
Chris Lattner [Tue, 13 Sep 2005 19:30:54 +0000 (19:30 +0000)]
If a function has liveins, and if the target requested that they be plopped
into particular vregs, emit copies into the entry MBB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23331 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMajik numbers are bad
Chris Lattner [Tue, 13 Sep 2005 19:03:13 +0000 (19:03 +0000)]
Majik numbers are bad

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23330 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRemove some dead vectors
Chris Lattner [Tue, 13 Sep 2005 18:47:49 +0000 (18:47 +0000)]
Remove some dead vectors

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23329 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a simple xform to simplify array accesses with casts in the way.
Chris Lattner [Tue, 13 Sep 2005 18:36:04 +0000 (18:36 +0000)]
Add a simple xform to simplify array accesses with casts in the way.
This is useful for 178.galgel where resolution of dope vectors (by the
optimizer) causes the scales to become apparent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23328 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix an issue where LSR would miss rewriting a use of an IV expression by a PHI node...
Chris Lattner [Tue, 13 Sep 2005 02:09:55 +0000 (02:09 +0000)]
Fix an issue where LSR would miss rewriting a use of an IV expression by a PHI node that is not the original PHI.

This fixes up a dot-product loop in galgel, speeding it up from 18.47s to
16.13s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23327 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agofails since linux-itanium headers are Different
Duraid Madina [Tue, 13 Sep 2005 01:03:53 +0000 (01:03 +0000)]
fails since linux-itanium headers are Different

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23326 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a helper function, allowing us to simplify some code a bit, changing
Chris Lattner [Tue, 13 Sep 2005 00:40:14 +0000 (00:40 +0000)]
Add a helper function, allowing us to simplify some code a bit, changing
indentation, no functionality change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23325 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement a simple xform to turn code like this:
Chris Lattner [Mon, 12 Sep 2005 23:23:25 +0000 (23:23 +0000)]
Implement a simple xform to turn code like this:

  if () { store A -> P; } else { store B -> P; }

into a PHI node with one store, in the most trival case.  This implements
load.ll:test10.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23324 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Mon, 12 Sep 2005 23:22:17 +0000 (23:22 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23323 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAnother load-peephole optimization: do gcse when two loads are next to
Chris Lattner [Mon, 12 Sep 2005 22:21:03 +0000 (22:21 +0000)]
Another load-peephole optimization: do gcse when two loads are next to
each other.  This implements InstCombine/load.ll:test9

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23322 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Mon, 12 Sep 2005 22:19:46 +0000 (22:19 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23321 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement a trivial form of store->load forwarding where the store and the
Chris Lattner [Mon, 12 Sep 2005 22:00:15 +0000 (22:00 +0000)]
Implement a trivial form of store->load forwarding where the store and the
load are exactly consequtive.  This is picked up by other passes, but this
triggers thousands of times in fortran programs that use static locals
(and is thus a compile-time speedup).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23320 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Mon, 12 Sep 2005 21:59:22 +0000 (21:59 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23319 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a regression from last night, which caused this pass to create invalid
Chris Lattner [Mon, 12 Sep 2005 17:11:27 +0000 (17:11 +0000)]
Fix a regression from last night, which caused this pass to create invalid
code for IV uses outside of loops that are not dominated by the latch block.
We should only convert these uses to use the post-inc value if they ARE
dominated by the latch block.

Also use a new LoopInfo method to simplify some code.

This fixes Transforms/LoopStrengthReduce/2005-09-12-UsesOutOutsideOfLoop.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23318 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agorelax pattern match on name
Chris Lattner [Mon, 12 Sep 2005 17:09:40 +0000 (17:09 +0000)]
relax pattern match on name

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23317 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Mon, 12 Sep 2005 17:08:15 +0000 (17:08 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23316 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a new getLoopLatch() method.
Chris Lattner [Mon, 12 Sep 2005 17:03:55 +0000 (17:03 +0000)]
Add a new getLoopLatch() method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23315 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew method
Chris Lattner [Mon, 12 Sep 2005 17:03:16 +0000 (17:03 +0000)]
new method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23314 91177308-0d34-0410-b5e6-96231b3b80d8

19 years ago_test:
Chris Lattner [Mon, 12 Sep 2005 06:04:47 +0000 (06:04 +0000)]
_test:
        li r2, 0
LBB_test_1:     ; no_exit.2
        li r5, 0
        stw r5, 0(r3)
        addi r2, r2, 1
        addi r3, r3, 4
        cmpwi cr0, r2, 701
        blt cr0, LBB_test_1     ; no_exit.2
LBB_test_2:     ; loopexit.2.loopexit
        addi r2, r2, 1
        stw r2, 0(r4)
        blr
[zion ~/llvm]$ cat > ~/xx
Uses of IV's outside of the loop should use hte post-incremented version
of the IV, not the preincremented version.  This helps many loops (e.g. in sixtrack)
which used to generate code like this (this is the code from the
dont-hoist-simple-loop-constants.ll testcase):

_test:
        li r2, 0                 **** IV starts at 0
LBB_test_1:     ; no_exit.2
        or r5, r2, r2            **** Copy for loop exit
        li r2, 0
        stw r2, 0(r3)
        addi r3, r3, 4
        addi r2, r5, 1
        addi r6, r5, 2           **** IV+2
        cmpwi cr0, r6, 701
        blt cr0, LBB_test_1     ; no_exit.2
LBB_test_2:     ; loopexit.2.loopexit
        addi r2, r5, 2       ****  IV+2
        stw r2, 0(r4)
        blr

And now generated code like this:

_test:
        li r2, 1               *** IV starts at 1
LBB_test_1:     ; no_exit.2
        li r5, 0
        stw r5, 0(r3)
        addi r2, r2, 1
        addi r3, r3, 4
        cmpwi cr0, r2, 701     *** IV.postinc + 0
        blt cr0, LBB_test_1
LBB_test_2:     ; loopexit.2.loopexit
        stw r2, 0(r4)          *** IV.postinc + 0
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23313 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agonew testcase
Chris Lattner [Mon, 12 Sep 2005 05:50:15 +0000 (05:50 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23312 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRegenerate
Chris Lattner [Mon, 12 Sep 2005 05:30:06 +0000 (05:30 +0000)]
Regenerate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23311 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRearrange two rules, which apparently makes some versions of bison happier.
Chris Lattner [Mon, 12 Sep 2005 05:29:43 +0000 (05:29 +0000)]
Rearrange two rules, which apparently makes some versions of bison happier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23310 91177308-0d34-0410-b5e6-96231b3b80d8