Commit Graph

20062 Commits

Author SHA1 Message Date
Chris Lattner 3361eab530 Switch to a slightly more structured representation for instructions
llvm-svn: 23345
2005-09-14 04:03:16 +00:00
Chris Lattner 4cfcb544bf Add some more checking/verification code
llvm-svn: 23344
2005-09-14 02:11:12 +00:00
Chris Lattner 4c7b604091 start parsing instructions into patterns, start doing many more checks of
'set's.

llvm-svn: 23343
2005-09-14 00:09:24 +00:00
Chris Lattner b011cb2746 we don't need this proto any longer
llvm-svn: 23342
2005-09-13 22:05:21 +00:00
Chris Lattner bb9b01644e don't emit the namespace inside the class!
llvm-svn: 23341
2005-09-13 22:05:02 +00:00
Chris Lattner 70a7234111 Emit code suitable for emission into the ISel class, allowing us to use/define
methods.

llvm-svn: 23340
2005-09-13 22:03:37 +00:00
Chris Lattner 03e08eefc7 move the #include for the generated code into the isel class body so we
can use/define class methods

llvm-svn: 23339
2005-09-13 22:03:06 +00:00
Chris Lattner 3556d849da continue xform function parsing
llvm-svn: 23338
2005-09-13 21:59:15 +00:00
Chris Lattner 2617de498d Start parsing node transformation information
llvm-svn: 23337
2005-09-13 21:51:00 +00:00
Chris Lattner ae939eb6bb Add a new Record::getValueAsCode method to mirror the other getValueAs*
methods.  Use it to simplify some code.

llvm-svn: 23336
2005-09-13 21:44:28 +00:00
Chris Lattner f365e25a5c completely eliminate TreePattern::PatternType
llvm-svn: 23335
2005-09-13 21:20:49 +00:00
Chris Lattner 0f965a615e 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).

llvm-svn: 23334
2005-09-13 19:33:40 +00:00
Chris Lattner ee8113293e This has been moved to the target-indep code
llvm-svn: 23333
2005-09-13 19:32:18 +00:00
Chris Lattner fb96e50b8c This code is no longer needed, it is moved to the target-indep code
llvm-svn: 23332
2005-09-13 19:31:44 +00:00
Chris Lattner d4382f0afa If a function has liveins, and if the target requested that they be plopped
into particular vregs, emit copies into the entry MBB.

llvm-svn: 23331
2005-09-13 19:30:54 +00:00
Chris Lattner 64685b4ca2 Majik numbers are bad
llvm-svn: 23330
2005-09-13 19:03:13 +00:00
Chris Lattner aa6cbd90c5 Remove some dead vectors
llvm-svn: 23329
2005-09-13 18:47:49 +00:00
Chris Lattner 2a8932960d 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.

llvm-svn: 23328
2005-09-13 18:36:04 +00:00
Chris Lattner fd018c8dfe 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.

llvm-svn: 23327
2005-09-13 02:09:55 +00:00
Duraid Madina a78635c1f0 fails since linux-itanium headers are Different
llvm-svn: 23326
2005-09-13 01:03:53 +00:00
Chris Lattner 567b81f0d2 Add a helper function, allowing us to simplify some code a bit, changing
indentation, no functionality change

llvm-svn: 23325
2005-09-13 00:40:14 +00:00
Chris Lattner 219175c84d 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.

llvm-svn: 23324
2005-09-12 23:23:25 +00:00
Chris Lattner 42a6cefa49 new testcase
llvm-svn: 23323
2005-09-12 23:22:17 +00:00
Chris Lattner e0bfdf1485 Another load-peephole optimization: do gcse when two loads are next to
each other.  This implements InstCombine/load.ll:test9

llvm-svn: 23322
2005-09-12 22:21:03 +00:00
Chris Lattner 20c1cc0741 new testcase
llvm-svn: 23321
2005-09-12 22:19:46 +00:00
Chris Lattner b990f7d8ed 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).

llvm-svn: 23320
2005-09-12 22:00:15 +00:00
Chris Lattner 4cd474ebbd new testcase
llvm-svn: 23319
2005-09-12 21:59:22 +00:00
Chris Lattner 8048b85e8f 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

llvm-svn: 23318
2005-09-12 17:11:27 +00:00
Chris Lattner 2ee807c70f relax pattern match on name
llvm-svn: 23317
2005-09-12 17:09:40 +00:00
Chris Lattner 7efb86dc11 new testcase
llvm-svn: 23316
2005-09-12 17:08:15 +00:00
Chris Lattner b35df5f5bc Add a new getLoopLatch() method.
llvm-svn: 23315
2005-09-12 17:03:55 +00:00
Chris Lattner 589e605f42 new method
llvm-svn: 23314
2005-09-12 17:03:16 +00:00
Chris Lattner a67648396a _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

llvm-svn: 23313
2005-09-12 06:04:47 +00:00
Chris Lattner 2bb00dda5a new testcase
llvm-svn: 23312
2005-09-12 05:50:15 +00:00
Chris Lattner d0c7a5eeb7 Regenerate
llvm-svn: 23311
2005-09-12 05:30:06 +00:00
Chris Lattner 564d240799 Rearrange two rules, which apparently makes some versions of bison happier.
llvm-svn: 23310
2005-09-12 05:29:43 +00:00
Chris Lattner ecd98d5d77 Make sure to disable 64-bit extensions for this test
llvm-svn: 23309
2005-09-11 03:50:38 +00:00
Jeff Cohen e19ca3ab0c Fix more Visual Studio build problems.
llvm-svn: 23308
2005-09-10 02:33:17 +00:00
Jeff Cohen 0dce12dd90 Fix miscellaneous Visual Studio build problems.
llvm-svn: 23307
2005-09-10 02:00:02 +00:00
Chris Lattner 530fe6ab30 implement Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll.
We used to emit this code for it:

_test:
        li r2, 1     ;; Value tying up a register for the whole loop
        li r5, 0
LBB_test_1:     ; no_exit.2
        or r6, r5, r5
        li r5, 0
        stw r5, 0(r3)
        addi r5, r6, 1
        addi r3, r3, 4
        add r7, r2, r5  ;; should be addi r7, r5, 1
        cmpwi cr0, r7, 701
        blt cr0, LBB_test_1     ; no_exit.2
LBB_test_2:     ; loopexit.2.loopexit
        addi r2, r6, 2
        stw r2, 0(r4)
        blr

now we emit this:

_test:
        li r2, 0
LBB_test_1:     ; no_exit.2
        or r5, r2, r2
        li r2, 0
        stw r2, 0(r3)
        addi r3, r3, 4
        addi r2, r5, 1
        addi r6, r5, 2   ;; whoa, fold those adds!
        cmpwi cr0, r6, 701
        blt cr0, LBB_test_1     ; no_exit.2
LBB_test_2:     ; loopexit.2.loopexit
        addi r2, r5, 2
        stw r2, 0(r4)
        blr

more improvement coming.

llvm-svn: 23306
2005-09-10 01:18:45 +00:00
Chris Lattner 0c7728e4d6 new testcase
llvm-svn: 23305
2005-09-10 01:14:37 +00:00
Chris Lattner 4309c3a785 PowerPC cannot truncstore i1 natively
llvm-svn: 23304
2005-09-10 00:21:06 +00:00
Chris Lattner 2d454bf5be Allow targets to say they don't support truncstore i1 (which includes a mask
when storing to an 8-bit memory location), as most don't.

llvm-svn: 23303
2005-09-10 00:20:18 +00:00
Chris Lattner bd39c1a4c6 Add a missing #include, patch courtesy of Baptiste Lepilleur.
llvm-svn: 23302
2005-09-09 23:53:39 +00:00
Chris Lattner 331b311f7b Fix a problem duraid encountered on itanium where this folding:
select (x < y), 1, 0 -> (x < y) incorrectly: the setcc returns i1 but the
select returned i32.  Add the zero extend as needed.

llvm-svn: 23301
2005-09-09 23:00:07 +00:00
Chris Lattner 16e5cb87ba Fix a crash viewing dags that have target nodes in them
llvm-svn: 23300
2005-09-09 22:35:03 +00:00
Chris Lattner 0f2146bb5d I forgot that we always spill fp values as 64-bits. Implement spill folding
for FP as well.  This triggers a couple dozen times on 177.mesa (for example).

llvm-svn: 23299
2005-09-09 21:59:44 +00:00
Chris Lattner 712e78ee28 Fix a problem that Nate noticed, where spill code was not getting coallesced
with copies, leading to code like this:

       lwz r4, 380(r1)
       or r10, r4, r4    ;; Last use of r4

By teaching the PPC backend how to fold spills into copies, we now get this
code:

       lwz r10, 380(r1)

wow. :)

This reduces a testcase nate sent me from 1505 instructions to 1484.

Note that this could handle FP values but doesn't currently, for reasons
mentioned in the patch

llvm-svn: 23298
2005-09-09 21:46:49 +00:00
Chris Lattner f540c1a2e8 code cleanup
llvm-svn: 23297
2005-09-09 20:51:08 +00:00
Chris Lattner 1410003751 Use continue in the use-processing loop to make it clear what the early exits
are, simplify logic, and cause things to not be nested as deeply.  This also
uses MRI->areAliases instead of an explicit loop.

No functionality change, just code cleanup.

llvm-svn: 23296
2005-09-09 20:29:51 +00:00