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

16984 Commits

Author SHA1 Message Date
Chris Lattner
ce2e0125dc Fix a problem where probing for addressing modes caused expressions to be
emitted too early.  In particular, this fixes
Regression/CodeGen/X86/regpressure.ll:regpressure3.

This also improves the 2nd basic block in 164.gzip:flush_block, which went from

.LBBflush_block_1:      # loopentry.1.i
        movzx %EAX, WORD PTR [dyn_ltree + 20]
        movzx %ECX, WORD PTR [dyn_ltree + 16]
        mov DWORD PTR [%ESP + 32], %ECX
        movzx %ECX, WORD PTR [dyn_ltree + 12]
        movzx %EDX, WORD PTR [dyn_ltree + 8]
        movzx %EBX, WORD PTR [dyn_ltree + 4]
        mov DWORD PTR [%ESP + 36], %EBX
        movzx %EBX, WORD PTR [dyn_ltree]
        add DWORD PTR [%ESP + 36], %EBX
        add %EDX, DWORD PTR [%ESP + 36]
        add %ECX, %EDX
        add DWORD PTR [%ESP + 32], %ECX
        add %EAX, DWORD PTR [%ESP + 32]
        movzx %ECX, WORD PTR [dyn_ltree + 24]
        add %EAX, %ECX
        mov %ECX, 0
        mov %EDX, %ECX

to

.LBBflush_block_1:      # loopentry.1.i
        movzx %EAX, WORD PTR [dyn_ltree]
        movzx %ECX, WORD PTR [dyn_ltree + 4]
        add %ECX, %EAX
        movzx %EAX, WORD PTR [dyn_ltree + 8]
        add %EAX, %ECX
        movzx %ECX, WORD PTR [dyn_ltree + 12]
        add %ECX, %EAX
        movzx %EAX, WORD PTR [dyn_ltree + 16]
        add %EAX, %ECX
        movzx %ECX, WORD PTR [dyn_ltree + 20]
        add %ECX, %EAX
        movzx %EAX, WORD PTR [dyn_ltree + 24]
        add %ECX, %EAX
        mov %EAX, 0
        mov %EDX, %EAX

... which results in less spilling in the function.

This change alone speeds up 164.gzip from 37.23s to 36.24s on apoc.  The
default isel takes 37.31s.

llvm-svn: 19650
2005-01-18 01:06:26 +00:00
Chris Lattner
a78f9ced61 Fix indentation.
llvm-svn: 19649
2005-01-17 23:25:45 +00:00
Chris Lattner
84cb260633 This is a carefully contrived testcase where the X86 ISel is emitting all loads
before other ops, causing it to spill like mad.  This occurs in
164.gzip:flush_block.

llvm-svn: 19648
2005-01-17 23:16:01 +00:00
Chris Lattner
dff1e3e86f Don't bother using max here.
llvm-svn: 19647
2005-01-17 23:02:13 +00:00
Chris Lattner
2d86b43318 Do not give token factor nodes outrageous weights
llvm-svn: 19645
2005-01-17 22:56:09 +00:00
Chris Lattner
c0aca0d13c Non-volatile loads can be freely reordered against each other. This fixes
X86/reg-pressure.ll again, and allows us to do nice things in other cases.
For example, we now codegen this sort of thing:

int %loadload(int *%X, int* %Y) {
  %Z = load int* %Y
  %Y = load int* %X      ;; load between %Z and store
  %Q = add int %Z, 1
  store int %Q, int* %Y
  ret int %Y
}

Into this:

loadload:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%EAX]
        mov %ECX, DWORD PTR [%ESP + 8]
        inc DWORD PTR [%ECX]
        ret

where we weren't able to form the 'inc [mem]' before.  This also lets the
instruction selector emit loads in any order it wants to, which can be good
for register pressure as well.

llvm-svn: 19644
2005-01-17 22:19:26 +00:00
Chris Lattner
f2878ce8ba Two changes:
1. Fold  [mem] += (1|-1) into inc [mem]/dec [mem] to save some icache space.
 2. Do not let token factor nodes prevent forming '[mem] op= val' folds.

llvm-svn: 19643
2005-01-17 22:10:42 +00:00
Chris Lattner
49291c4d96 Don't call SelectionDAG.getRoot() directly, go through a forwarding method.
llvm-svn: 19642
2005-01-17 19:43:36 +00:00
Chris Lattner
40c0fca632 Refactor load/op/store folding into it's own method, no functionality changes.
llvm-svn: 19641
2005-01-17 19:25:26 +00:00
Chris Lattner
88bbcfc893 Implement a target independent optimization to codegen arguments only into
the basic block that uses them if possible.  This is a big win on X86, as it
lets us fold the argument loads into instructions and reduce register pressure
(by not loading all of the arguments in the entry block).

For this (contrived to show the optimization) testcase:

int %argtest(int %A, int %B) {
        %X = sub int 12345, %A
        br label %L
L:
        %Y = add int %X, %B
        ret int %Y
}

we used to produce:

argtest:
        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EAX, 12345
        sub %EAX, %ECX
        mov %EDX, DWORD PTR [%ESP + 8]
.LBBargtest_1:  # L
        add %EAX, %EDX
        ret


now we produce:

argtest:
        mov %EAX, 12345
        sub %EAX, DWORD PTR [%ESP + 4]
.LBBargtest_1:  # L
        add %EAX, DWORD PTR [%ESP + 8]
        ret

This also fixes the FIXME in the code.

BTW, this occurs in real code.  164.gzip shrinks from 8623 to 8608 lines of
.s file.  The stack frame in huft_build shrinks from 1644->1628 bytes,
inflate_codes shrinks from 116->108 bytes, and inflate_block from 2620->2612,
due to fewer spills.

Take that alkis. :-)

llvm-svn: 19639
2005-01-17 17:55:19 +00:00
Chris Lattner
2348abc421 Fix a major regression last night that prevented us from producing [mem] op= reg
operations.

The body of the if is less indented but unmodified in this patch.

llvm-svn: 19638
2005-01-17 17:49:14 +00:00
Chris Lattner
49a1f3a109 Refactor code into a new method.
llvm-svn: 19635
2005-01-17 17:15:02 +00:00
Chris Lattner
e2fd07b43d Make methods private, add a method.
llvm-svn: 19634
2005-01-17 17:14:43 +00:00
Chris Lattner
adb669ab1f Codegen this:
int %foo(int %X) {
        %T = add int %X, 13
        %S = mul int %T, 3
        ret int %S
}

as this:

        mov %ECX, DWORD PTR [%ESP + 4]
        lea %EAX, DWORD PTR [%ECX + 2*%ECX + 39]
        ret

instead of this:

        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EAX, %ECX
        add %EAX, 13
        imul %EAX, %EAX, 3
        ret

llvm-svn: 19633
2005-01-17 06:48:02 +00:00
Tanya Lattner
5a10531cf8 Added tmp instructions to preserve ssa.
llvm-svn: 19632
2005-01-17 06:47:26 +00:00
Chris Lattner
51590b615c Fix test/Regression/CodeGen/X86/2005-01-17-CycleInDAG.ll and 132.ijpeg.
Do not fold a load into an operation if it will induce a cycle in the DAG.

Repeat after me: dAg.

llvm-svn: 19631
2005-01-17 06:26:58 +00:00
Chris Lattner
a5f6a52471 New testcase for a problem that occurred in 132.ijpeg
llvm-svn: 19630
2005-01-17 06:25:59 +00:00
Chris Lattner
3402945d52 Delete PHI nodes that are not dead but are locked in a cycle of single
useness.

llvm-svn: 19629
2005-01-17 05:10:15 +00:00
Chris Lattner
de6b1ca556 Move code out of indentation one level to make it easier to read.
Disable the xform for < > cases.  It turns out that the following is being
miscompiled:

bool %test(sbyte %S) {
        %T = cast sbyte %S to uint
        %V = setgt uint %T, 255
        ret bool %V
}

llvm-svn: 19628
2005-01-17 03:20:02 +00:00
Chris Lattner
783a9d8893 Add methods
llvm-svn: 19627
2005-01-17 02:24:59 +00:00
Chris Lattner
f1e85bec5a Do not fold a load into a comparison that is used by more than one place.
The comparison will probably be folded, so this is not ok to do.
This fixed 197.parser.

llvm-svn: 19624
2005-01-17 01:34:14 +00:00
Reid Spencer
603b94aed8 sysconfdir -> PROJ_etcdir
llvm-svn: 19623
2005-01-17 00:42:31 +00:00
Chris Lattner
1b8c8fe020 Do not codegen 'xor bool, true' as 'not reg'. not reg inverts the upper bits
of the bytereg.  This fixes yacr2, 300.twolf and probably others.

llvm-svn: 19622
2005-01-17 00:23:16 +00:00
Chris Lattner
6d7f927699 Fix typos noticed by Gabor Greif, thanks Gabor!
llvm-svn: 19621
2005-01-17 00:12:04 +00:00
Chris Lattner
46dac4394c Set up the shift and setcc types.
If we emit a load because we followed a token chain to get to it, try to
fold it into its single user if possible.

llvm-svn: 19620
2005-01-17 00:00:33 +00:00
Chris Lattner
4c88cc95ee Shift and setcc types default to the pointer type.
llvm-svn: 19619
2005-01-16 23:59:48 +00:00
Chris Lattner
8dd332e4e5 Add comments
Add fields to hold the result type of setcc operations and shift amounts.

llvm-svn: 19618
2005-01-16 23:59:30 +00:00
Chris Lattner
ec55e3e529 Implement legalize of call nodes.
llvm-svn: 19617
2005-01-16 19:46:48 +00:00
Alkis Evlogimenos
5d7bd7411a Fix llvm-java project autconfiguration.
llvm-svn: 19616
2005-01-16 09:44:58 +00:00
Tanya Lattner
fea188af7e Added paramters to a few functions in order to allow me to change the functions to preserve SSA
llvm-svn: 19615
2005-01-16 08:51:10 +00:00
Chris Lattner
9ffc59287e * Adjust to changes in TargetLowering interfaces.
* Remove custom promotion for bool and byte select ops.  Legalize now
  promotes them for us.
* Allow folding ConstantPoolIndexes into EXTLOAD's, useful for float immediates.
* Declare which operations are not supported better.
* Add some hacky code for TRUNCSTORE to pretend that we have truncstore
  for i16 types.  This is useful for testing promotion code because I can
  just remove 16-bit registers all together and verify that programs work.

llvm-svn: 19614
2005-01-16 07:34:08 +00:00
Chris Lattner
0eca430af1 Revamp supported ops. Instead of just being supported or not, we now keep
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.

Implement custom lowering for a couple of ops, implement promotion for select
operations (which x86 needs).

llvm-svn: 19613
2005-01-16 07:29:19 +00:00
Chris Lattner
835a5efef3 add method stub
llvm-svn: 19612
2005-01-16 07:28:41 +00:00
Chris Lattner
907534af24 Don't mash stuff together.
llvm-svn: 19611
2005-01-16 07:28:31 +00:00
Chris Lattner
b49d2a7b0f Use enums, move virtual dtor out of line.
llvm-svn: 19610
2005-01-16 07:28:11 +00:00
Chris Lattner
e38f72316d Revamp supported ops. Instead of just being supported or not, we now keep
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.

llvm-svn: 19609
2005-01-16 07:27:49 +00:00
Reid Spencer
cf01eefc07 * Revise the projects section and make reference to Projects.html
* the dist-clean target no longer implies a check

llvm-svn: 19608
2005-01-16 07:18:31 +00:00
Reid Spencer
5bf1026416 Don't confuse the LLVM_OBJ_DIR and the PROJ_OBJ_DIR because there might be
a symbolic link making the autoconf name for the directory (LLVM_OBJ_ROOT)
and the "make" name for the directory (PROJ_OBJ_ROOT) different.

llvm-svn: 19607
2005-01-16 06:53:48 +00:00
Chris Lattner
0f4f239899 Implement some more missing promotions.
llvm-svn: 19606
2005-01-16 05:06:12 +00:00
Chris Lattner
e88e660817 Fix bugpoint
llvm-svn: 19605
2005-01-16 04:23:22 +00:00
Chris Lattner
be2a427f51 cycles_t -> CycleCount_t
llvm-svn: 19604
2005-01-16 04:20:30 +00:00
Jeff Cohen
5971039a26 Add some .cvsignores to the win32 hierarchy to account for generated files
llvm-svn: 19603
2005-01-16 03:18:23 +00:00
Reid Spencer
5d058e0ec8 Provide support for HP/UX aCC compiler's variant of hash_map and hash_set
(RogueWave). These are implemented in rw/stdex/hash_map.h and
rw/stdex/hash_set.h on HP/UX.

llvm-svn: 19600
2005-01-16 02:58:39 +00:00
Reid Spencer
7ca6d9a743 Fix locations of libraries and executables to match makefiles.
llvm-svn: 19599
2005-01-16 02:38:06 +00:00
Reid Spencer
9f8c7b0720 BUILD_* to PROJ_*
llvm-svn: 19598
2005-01-16 02:35:47 +00:00
Chris Lattner
742b77f9af Clarify assertion.
llvm-svn: 19597
2005-01-16 02:23:34 +00:00
Chris Lattner
4517b8af97 Add assertions.
llvm-svn: 19596
2005-01-16 02:23:22 +00:00
Chris Lattner
9f8589f4b3 Add support for promoted registers being live across blocks.
llvm-svn: 19595
2005-01-16 02:23:07 +00:00
Reid Spencer
25e0c1e8d7 Update per new Makefile requirements for projects
llvm-svn: 19594
2005-01-16 02:21:42 +00:00
Reid Spencer
afa1cb9e11 Rename BUILD_* to PROJ_*
llvm-svn: 19592
2005-01-16 02:21:29 +00:00