Commit Graph

17011 Commits

Author SHA1 Message Date
Chris Lattner
0afa8e348e 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. :-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19639 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 17:55:19 +00:00
Chris Lattner
ae3ffba466 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19638 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 17:49:14 +00:00
Chris Lattner
068a81e9fc Refactor code into a new method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19635 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 17:15:02 +00:00
Chris Lattner
80d8a93489 Make methods private, add a method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19634 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 17:14:43 +00:00
Chris Lattner
2a4e508281 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19633 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 06:48:02 +00:00
Tanya Lattner
7a866d9a43 Added tmp instructions to preserve ssa.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19632 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 06:47:26 +00:00
Chris Lattner
4ff348befa 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19631 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 06:26:58 +00:00
Chris Lattner
f60513f71d New testcase for a problem that occurred in 132.ijpeg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19630 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 06:25:59 +00:00
Chris Lattner
a3fd1c569c Delete PHI nodes that are not dead but are locked in a cycle of single
useness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19629 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 05:10:15 +00:00
Chris Lattner
b352fa5853 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
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19628 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 03:20:02 +00:00
Chris Lattner
7ece380440 Add methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19627 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 02:24:59 +00:00
Chris Lattner
cb1aa8d772 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19624 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 01:34:14 +00:00
Reid Spencer
e3e0fb19e9 sysconfdir -> PROJ_etcdir
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19623 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 00:42:31 +00:00
Chris Lattner
c98279d371 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19622 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 00:23:16 +00:00
Chris Lattner
5836082286 Fix typos noticed by Gabor Greif, thanks Gabor!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19621 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 00:12:04 +00:00
Chris Lattner
4df0de975a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19620 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 00:00:33 +00:00
Chris Lattner
714b69d047 Shift and setcc types default to the pointer type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19619 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 23:59:48 +00:00
Chris Lattner
6ae76fcc06 Add comments
Add fields to hold the result type of setcc operations and shift amounts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19618 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 23:59:30 +00:00
Chris Lattner
8ac532c55e Implement legalize of call nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19617 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 19:46:48 +00:00
Alkis Evlogimenos
7bd1ede776 Fix llvm-java project autconfiguration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19616 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 09:44:58 +00:00
Tanya Lattner
7600587e66 Added paramters to a few functions in order to allow me to change the functions to preserve SSA
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19615 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 08:51:10 +00:00
Chris Lattner
da2ce11407 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19614 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:34:08 +00:00
Chris Lattner
55ba8fba75 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19613 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:29:19 +00:00
Chris Lattner
171453a284 add method stub
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19612 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:28:41 +00:00
Chris Lattner
4b7899343e Don't mash stuff together.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19611 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:28:31 +00:00
Chris Lattner
cba82f9339 Use enums, move virtual dtor out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19610 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:28:11 +00:00
Chris Lattner
7e5ee40979 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19609 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:27:49 +00:00
Reid Spencer
cd7c1cae1c * Revise the projects section and make reference to Projects.html
* the dist-clean target no longer implies a check


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19608 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:18:31 +00:00
Reid Spencer
153626a3c0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19607 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 06:53:48 +00:00
Chris Lattner
f8161d83f0 Implement some more missing promotions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19606 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 05:06:12 +00:00
Chris Lattner
8102fcde4c Fix bugpoint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19605 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 04:23:22 +00:00
Chris Lattner
ccad8439e0 cycles_t -> CycleCount_t
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19604 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 04:20:30 +00:00
Jeff Cohen
926b70f96e Add some .cvsignores to the win32 hierarchy to account for generated files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19603 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 03:18:23 +00:00
Reid Spencer
8085cff7eb 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19600 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:58:39 +00:00
Reid Spencer
d967c80d64 Fix locations of libraries and executables to match makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19599 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:38:06 +00:00
Reid Spencer
728ae5e73d BUILD_* to PROJ_*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19598 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:35:47 +00:00
Chris Lattner
9467497ae2 Clarify assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:23:34 +00:00
Chris Lattner
7636512f59 Add assertions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19596 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:23:22 +00:00
Chris Lattner
c8ea3c4710 Add support for promoted registers being live across blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19595 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:23:07 +00:00
Reid Spencer
6a8b5183be Update per new Makefile requirements for projects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19594 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:21:42 +00:00
Reid Spencer
bdf6a39d1c Rename BUILD_* to PROJ_*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19592 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:21:29 +00:00
Reid Spencer
39865c052d Update documentation on how to set up a project
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19591 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:21:18 +00:00
Reid Spencer
11fde54f23 Several changes:
* Rename BUILD_* to PROJ_*
* Differentiate between LLVM's Makefile.conf and the project's
* Use project specific install locations


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19590 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:20:54 +00:00
Reid Spencer
b2cb486151 Several changes:
* Get rid of variables that are duplicates of autoconf variables.
* Rename BUILD_* to PROJ_*
* Define some project related install locations
* Don't assume LLVM's configured values are the project's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19589 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:20:42 +00:00
Reid Spencer
6ca9e444ac Make this file capable of being used by both LLVM and its projects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19588 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:20:30 +00:00
Tanya Lattner
5fd2ef1e43 Fixed a couple of instructions that broke SSA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19587 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:14:17 +00:00
Chris Lattner
638559aaa3 Improve compatiblity with HPUX on Itanium, patch by Duraid Madina
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19586 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 01:31:31 +00:00
Chris Lattner
3eb223eaf7 Improve compatibility with aCC on HPUX. Patch by Duraid Madina
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19585 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 01:22:18 +00:00
Chris Lattner
cfdfe4ce4a Set up identity transforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19584 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 01:20:18 +00:00
Chris Lattner
71c42a0190 Move some information into the TargetLowering object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19583 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 01:11:45 +00:00