oota-llvm.git
18 years agoFix pasto that prevented VT ndoes from showing up in -view-isel-dags correctly
Chris Lattner [Wed, 24 Aug 2005 18:30:00 +0000 (18:30 +0000)]
Fix pasto that prevented VT ndoes from showing up in -view-isel-dags correctly

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

18 years agoadd an idea
Chris Lattner [Wed, 24 Aug 2005 18:15:24 +0000 (18:15 +0000)]
add an idea

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

18 years agoFix Regression/Transforms/Reassociate/2005-08-24-Crash.ll
Chris Lattner [Wed, 24 Aug 2005 17:55:32 +0000 (17:55 +0000)]
Fix Regression/Transforms/Reassociate/2005-08-24-Crash.ll

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

18 years agonew testcase that crashes -reassociate
Chris Lattner [Wed, 24 Aug 2005 17:54:56 +0000 (17:54 +0000)]
new testcase that crashes -reassociate

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

18 years agoTransform floor((double)FLT) -> (double)floorf(FLT), implementing
Chris Lattner [Wed, 24 Aug 2005 17:22:17 +0000 (17:22 +0000)]
Transform floor((double)FLT) -> (double)floorf(FLT), implementing
Regression/Transforms/SimplifyLibCalls/floor.ll.  This triggers 19 times in
177.mesa.

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

18 years agonew testcase
Chris Lattner [Wed, 24 Aug 2005 17:20:30 +0000 (17:20 +0000)]
new testcase

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

18 years agofloor/ceil don't read/write memory. This allows gcse to eliminate 6 calls
Chris Lattner [Wed, 24 Aug 2005 16:58:56 +0000 (16:58 +0000)]
floor/ceil don't read/write memory.  This allows gcse to eliminate 6 calls
in mesa.

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

18 years agoMake sure this doesn't break when we're improving the isels
Chris Lattner [Wed, 24 Aug 2005 16:48:49 +0000 (16:48 +0000)]
Make sure this doesn't break when we're improving the isels

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

18 years agoteach selection dag mask tracking about the fact that select_cc operates like
Chris Lattner [Wed, 24 Aug 2005 16:46:55 +0000 (16:46 +0000)]
teach selection dag mask tracking about the fact that select_cc operates like
select.  Also teach it that the bit count instructions can only set the low bits
of the result, depending on the size of the input.

This allows us to compile this:

int %eq0(int %a) {
        %tmp.1 = seteq int %a, 0                ; <bool> [#uses=1]
        %tmp.2 = cast bool %tmp.1 to int                ; <int> [#uses=1]
        ret int %tmp.2
}

To this:

_eq0:
        cntlzw r2, r3
        srwi r3, r2, 5
        blr

instead of this:

_eq0:
        cntlzw r2, r3
        rlwinm r3, r2, 27, 31, 31
        blr

when setcc is marked illegal on ppc (which restores parity to non-illegal
setcc).  Thanks to Nate for pointing this out.

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

18 years agoStart using isOperationLegal and isTypeLegal to simplify the code
Chris Lattner [Wed, 24 Aug 2005 16:35:28 +0000 (16:35 +0000)]
Start using isOperationLegal and isTypeLegal to simplify the code

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

18 years agorename hasNativeSupportFor* -> is(Operation|Type)Legal.
Chris Lattner [Wed, 24 Aug 2005 16:34:59 +0000 (16:34 +0000)]
rename hasNativeSupportFor* -> is(Operation|Type)Legal.

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

18 years agoAdjust to new interface
Chris Lattner [Wed, 24 Aug 2005 16:34:12 +0000 (16:34 +0000)]
Adjust to new interface

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

18 years agoWrap long lines
Misha Brukman [Wed, 24 Aug 2005 14:03:07 +0000 (14:03 +0000)]
Wrap long lines

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

18 years agoRemove some tabs.
Reid Spencer [Wed, 24 Aug 2005 10:57:30 +0000 (10:57 +0000)]
Remove some tabs.
Wrap a line.

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

18 years agoWhoops, don't use PROJ variables, these are all LLVM headers. This allows
Reid Spencer [Wed, 24 Aug 2005 10:55:07 +0000 (10:55 +0000)]
Whoops, don't use PROJ variables, these are all LLVM headers. This allows
projects to compile properly.

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

18 years agoFor PR619:
Reid Spencer [Wed, 24 Aug 2005 10:43:10 +0000 (10:43 +0000)]
For PR619:
Make any header files that are automatically generated be preconditions of
the compilation. This ensures that if a *.h.in file is changed then its
corresponding *.h file gets updated on the next rebuild. Note that this can
lead to confusing (but correct) results if the *.h.in file changed
unsubstantially so that autoheader doesn't update the *.h file. In that case,
manually touch the *.h file in question to restore order. Moral of the story,
if you're going to "touch" a *.in file then modify it substantially.

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

18 years agoFor PR616:
Reid Spencer [Wed, 24 Aug 2005 10:07:20 +0000 (10:07 +0000)]
For PR616:
These patches make threading optional in LLVM. The configuration scripts are now
modified to accept a --disable-threads switch. If this is used, the Mutex class
will be implemented with all functions as no-op. Furthermore, linking against
libpthread will not be done. Finally, the ParallelJIT example needs libpthread
so its makefile was changed to always add -lpthread to the link line.

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

18 years agoWhoops, fix a thinko. All cases except SETNE are now handled by the
Nate Begeman [Wed, 24 Aug 2005 05:06:48 +0000 (05:06 +0000)]
Whoops, fix a thinko.  All cases except SETNE are now handled by the
target independent code in SelectionDAG.cpp

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

18 years agoRemove unused statistic
Nate Begeman [Wed, 24 Aug 2005 05:03:20 +0000 (05:03 +0000)]
Remove unused statistic
Prefer 'neg X' to 'subfic 0, X' since neg does not set XER[CA]

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

18 years agoAdd the "ppc specific" setcc-equivalent select_cc cases
Nate Begeman [Wed, 24 Aug 2005 04:59:21 +0000 (04:59 +0000)]
Add the "ppc specific" setcc-equivalent select_cc cases
Prefer 'neg X' to 'subfic 0, X' since it does not set XER[CA]

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

18 years agoTeach SelectionDAG how to simplify a few more setcc-equivalent select_cc
Nate Begeman [Wed, 24 Aug 2005 04:57:57 +0000 (04:57 +0000)]
Teach SelectionDAG how to simplify a few more setcc-equivalent select_cc
nodes so that backends don't have to.

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

18 years agoAdd callseq_begin/end support
Chris Lattner [Wed, 24 Aug 2005 00:47:15 +0000 (00:47 +0000)]
Add callseq_begin/end support
Call stil not supported yet

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

18 years agoMake -view-isel-dags show the dag before instruction selecting, in case
Chris Lattner [Wed, 24 Aug 2005 00:34:29 +0000 (00:34 +0000)]
Make -view-isel-dags show the dag before instruction selecting, in case
the target isel crashes due to unimplemented features like calls :)

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

18 years agoFix optimization of select_cc seteq X, 0, 1, 0 -> srl (ctlz X), log2 X size
Nate Begeman [Wed, 24 Aug 2005 00:21:28 +0000 (00:21 +0000)]
Fix optimization of select_cc seteq X, 0, 1, 0 -> srl (ctlz X), log2 X size

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

18 years agoImplement LiveVariables.h change
Chris Lattner [Wed, 24 Aug 2005 00:09:33 +0000 (00:09 +0000)]
Implement LiveVariables.h change

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

18 years agoKeep the killed/dead sets sorted, so that "KillsRegister" can do a quick
Chris Lattner [Wed, 24 Aug 2005 00:09:02 +0000 (00:09 +0000)]
Keep the killed/dead sets sorted, so that "KillsRegister" can do a quick
binary search to test for membership.  This speeds up LLC a bit more on KC++,
e.g. on itanium from 16.6974s to 14.8272s, PPC from 11.4926s to 10.7089s and
X86 from 10.8128s to 9.7943s, with no difference in generated code (like all
of the RA patches).

With these changes, isel is the slowest pass for PPC/X86, but linscan+live
intervals is still > 50% of the compile time for itanium.  More work could
be done, but this is the last for now.

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

18 years agoadjust to new live variables interface
Chris Lattner [Tue, 23 Aug 2005 23:42:17 +0000 (23:42 +0000)]
adjust to new live variables interface

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

18 years agoAdjust to new livevars interface
Chris Lattner [Tue, 23 Aug 2005 23:41:14 +0000 (23:41 +0000)]
Adjust to new livevars interface

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

18 years agoChange live variables from using multimaps to using maps of vectors and
Chris Lattner [Tue, 23 Aug 2005 23:40:41 +0000 (23:40 +0000)]
Change live variables from using multimaps to using maps of vectors and
rearrange some of the accessors to be more efficient.

This makes it much more efficient to iterate over all of the things with the
same value.  This speeds up liveintervals analysis from 8.63s to 3.79s with
a release build of llc on kc++ with -march=ia64.  This also speeds up live
var from 1.66s -> 0.87s as well, reducing total llc time from 20.1s->15.2s.

This also speeds up other targets slightly, e.g. llc time on X86 from 16.84
-> 16.45s, and PPC from 17.64->17.03s.

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

18 years agoSimplify this code by using higher-level LiveVariables methods
Chris Lattner [Tue, 23 Aug 2005 22:51:41 +0000 (22:51 +0000)]
Simplify this code by using higher-level LiveVariables methods

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

18 years agoSimplify this code by using LiveVariables::KillsRegister
Chris Lattner [Tue, 23 Aug 2005 22:49:55 +0000 (22:49 +0000)]
Simplify this code by using LiveVariables::KillsRegister

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

18 years agoAdd RegisterDefIsDead to correspond to KillsRegister, mark both const
Chris Lattner [Tue, 23 Aug 2005 22:43:24 +0000 (22:43 +0000)]
Add RegisterDefIsDead to correspond to KillsRegister, mark both const

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

18 years agoKeep track of which registers are related to which other registers.
Chris Lattner [Tue, 23 Aug 2005 22:27:31 +0000 (22:27 +0000)]
Keep track of which registers are related to which other registers.
Use this information to avoid doing expensive interval intersections for
registers that could not possible be interesting.  This speeds up linscan
on ia64 compiling kc++ in release mode from taking 7.82s to 4.8s(!), total
itanium llc time on this program is 27.3s now.  This marginally speeds up
PPC and X86, but they appear to be limited by other parts of linscan, not
this code.

On this program, on itanium, live intervals now takes 41% of llc time.

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

18 years agoadd a method
Chris Lattner [Tue, 23 Aug 2005 21:45:31 +0000 (21:45 +0000)]
add a method

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

18 years agoFix PR618 and Regression/CodeGen/CBackend/2005-08-23-Fmod.ll by not emitting
Chris Lattner [Tue, 23 Aug 2005 20:22:50 +0000 (20:22 +0000)]
Fix PR618 and Regression/CodeGen/CBackend/2005-08-23-Fmod.ll by not emitting
x%y for 'rem' on fp values.

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

18 years agoNew testcase for PR618
Chris Lattner [Tue, 23 Aug 2005 20:22:07 +0000 (20:22 +0000)]
New testcase for PR618

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

18 years agoadd a note
Chris Lattner [Tue, 23 Aug 2005 06:27:59 +0000 (06:27 +0000)]
add a note

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

18 years agoAck, typo
Nate Begeman [Tue, 23 Aug 2005 05:45:10 +0000 (05:45 +0000)]
Ack, typo

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

18 years agoAdd an option to make SetCC illegal as a beta option
Nate Begeman [Tue, 23 Aug 2005 05:42:36 +0000 (05:42 +0000)]
Add an option to make SetCC illegal as a beta option

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

18 years agoTeach the SelectionDAG how to transform select_cc eq, X, 0, 1, 0 into
Nate Begeman [Tue, 23 Aug 2005 05:41:12 +0000 (05:41 +0000)]
Teach the SelectionDAG how to transform select_cc eq, X, 0, 1, 0 into
either seteq X, 0 or srl (ctlz X), size(X-1), depending on what's legal
for the target.

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

18 years agoTeach Legalize how to turn setcc into select_cc
Nate Begeman [Tue, 23 Aug 2005 04:29:48 +0000 (04:29 +0000)]
Teach Legalize how to turn setcc into select_cc

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

18 years agoRemove some instructions we no longer generate
Nate Begeman [Tue, 23 Aug 2005 01:16:46 +0000 (01:16 +0000)]
Remove some instructions we no longer generate

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

18 years agoRemove some regs that are not used.
Chris Lattner [Mon, 22 Aug 2005 22:32:13 +0000 (22:32 +0000)]
Remove some regs that are not used.

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

18 years agoNate noticed that 30% of the malloc/frees in llc come from calls to LowercaseString
Chris Lattner [Mon, 22 Aug 2005 22:00:02 +0000 (22:00 +0000)]
Nate noticed that 30% of the malloc/frees in llc come from calls to LowercaseString
in the asmprinter.  This changes the .td files to use lower case register names,
avoiding the need to do this call.  This speeds up the asmprinter from 1.52s
to 1.06s on kc++ in a release build.

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

18 years agoFix a crash I introduced into the IA64 backend with my copyfromreg change.
Chris Lattner [Mon, 22 Aug 2005 21:33:11 +0000 (21:33 +0000)]
Fix a crash I introduced into the IA64 backend with my copyfromreg change.
It used to crash on any function that took float arguments.

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

18 years agoTry to avoid scanning the fixed list. On architectures with a non-stupid
Chris Lattner [Mon, 22 Aug 2005 20:59:30 +0000 (20:59 +0000)]
Try to avoid scanning the fixed list.  On architectures with a non-stupid
number of regs (e.g. most riscs), many functions won't need to use callee
clobbered registers.  Do a speculative check to see if we can get a free
register without processing the fixed list (which has all of these).  This
saves a lot of time on machines with lots of callee clobbered regs (e.g.
ppc and itanium, also x86).

This reduces ppc llc compile time from 184s -> 172s on kc++.  This is probably
worth FAR FAR more on itanium though.

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

18 years agoMove some code in the register assignment case that only needs to happen if
Chris Lattner [Mon, 22 Aug 2005 20:20:42 +0000 (20:20 +0000)]
Move some code in the register assignment case that only needs to happen if
we spill out of the fast path.  The scan of active_ and the calls to
updateSpillWeights don't need to happen unless a spill occurs.  This reduces
debug llc time of kc++ with ppc from 187.3s to 183.2s.

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

18 years agoAdd a pass name for -time-passes output
Chris Lattner [Mon, 22 Aug 2005 18:28:09 +0000 (18:28 +0000)]
Add a pass name for -time-passes output

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

18 years agoFix a problem where constant expr shifts would not have their shift amount
Chris Lattner [Mon, 22 Aug 2005 17:28:31 +0000 (17:28 +0000)]
Fix a problem where constant expr shifts would not have their shift amount
promoted to the right type.  This fixes: IA64/2005-08-22-LegalizerCrash.ll

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

18 years agoTestcase for a crash in the legalizer on ia64. This is reduced from kc++.
Chris Lattner [Mon, 22 Aug 2005 17:16:49 +0000 (17:16 +0000)]
Testcase for a crash in the legalizer on ia64.  This is reduced from kc++.

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

18 years agoAdd a long-overdue itanium regression test dir: hint hint Duraid :)
Chris Lattner [Mon, 22 Aug 2005 17:15:41 +0000 (17:15 +0000)]
Add a long-overdue itanium regression test dir: hint hint Duraid :)

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

18 years agoSpeed up this loop a bit, based on some observations that Nate made, and
Chris Lattner [Mon, 22 Aug 2005 16:55:22 +0000 (16:55 +0000)]
Speed up this loop a bit, based on some observations that Nate made, and
add some comments.  This loop really needs to be reevaluated!

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

18 years agoRevert my patch which changed the code to not work.
Chris Lattner [Mon, 22 Aug 2005 16:24:25 +0000 (16:24 +0000)]
Revert my patch which changed the code to not work.

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

18 years agoMake the example a bit easier to understand, suggested by Jim.
Chris Lattner [Mon, 22 Aug 2005 16:11:46 +0000 (16:11 +0000)]
Make the example a bit easier to understand, suggested by Jim.

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

18 years agoImplement stores.
Chris Lattner [Mon, 22 Aug 2005 01:27:59 +0000 (01:27 +0000)]
Implement stores.

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

18 years agoAdd a fast-path for register values. Add support for constant pool entries,
Chris Lattner [Mon, 22 Aug 2005 01:04:32 +0000 (01:04 +0000)]
Add a fast-path for register values.  Add support for constant pool entries,
allowing us to compile this:

float %test2(float* %P) {
        %Q = load float* %P
        %R = add float %Q, 10.1
        ret float %R
}

to this:

_test2:
        lfs r2, 0(r3)
        lis r3, ha16(.CPI_test2_0)
        lfs r3, lo16(.CPI_test2_0)(r3)
        fadds f1, r2, r3
        blr

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

18 years agoFix compilation of:
Chris Lattner [Mon, 22 Aug 2005 00:59:14 +0000 (00:59 +0000)]
Fix compilation of:
float %test2(float* %P) {
        %Q = load float* %P
        %R = add float %Q, %Q
        ret float %R
}

By returning the right result.

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

18 years agoMake sure expressions only have one use before emitting them into a place that is...
Chris Lattner [Mon, 22 Aug 2005 00:47:28 +0000 (00:47 +0000)]
Make sure expressions only have one use before emitting them into a place that is conditionally executed

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

18 years agoImplement most of load support. There is still a bug though.
Chris Lattner [Sun, 21 Aug 2005 22:31:09 +0000 (22:31 +0000)]
Implement most of load support.  There is still a bug though.

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

18 years agoadd a method
Chris Lattner [Sun, 21 Aug 2005 22:30:42 +0000 (22:30 +0000)]
add a method

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

18 years agoadd anew method
Chris Lattner [Sun, 21 Aug 2005 22:30:30 +0000 (22:30 +0000)]
add anew method

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

18 years agoAdd support for frame index nodes
Chris Lattner [Sun, 21 Aug 2005 19:56:04 +0000 (19:56 +0000)]
Add support for frame index nodes

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

18 years agoadd a method
Chris Lattner [Sun, 21 Aug 2005 19:48:59 +0000 (19:48 +0000)]
add a method

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

18 years agoADd a method
Chris Lattner [Sun, 21 Aug 2005 19:48:53 +0000 (19:48 +0000)]
ADd a method

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

18 years agoDon't print out the MBB label for the entry mbb
Chris Lattner [Sun, 21 Aug 2005 19:09:33 +0000 (19:09 +0000)]
Don't print out the MBB label for the entry mbb

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

18 years agoSimplify the logic for BRTWOWAY_CC handling. The isel code already
Chris Lattner [Sun, 21 Aug 2005 19:03:28 +0000 (19:03 +0000)]
Simplify the logic for BRTWOWAY_CC handling.  The isel code already
simplifies BRTWOWAY into BR if one of the results is a fall-through.
Unless I'm missing something, there is no reason to duplicate this
in the target-specific code.

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

18 years agoImplement selection for branches.
Chris Lattner [Sun, 21 Aug 2005 18:50:37 +0000 (18:50 +0000)]
Implement selection for branches.

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

18 years agoAdd 5-operand version of SelectNodeTo
Chris Lattner [Sun, 21 Aug 2005 18:49:58 +0000 (18:49 +0000)]
Add 5-operand version of SelectNodeTo

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

18 years agoadd a method
Chris Lattner [Sun, 21 Aug 2005 18:49:33 +0000 (18:49 +0000)]
add a method

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

18 years agoAdd support for basic blocks, fix a bug in result # computation
Chris Lattner [Sun, 21 Aug 2005 18:49:29 +0000 (18:49 +0000)]
Add support for basic blocks, fix a bug in result # computation

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

18 years agoWhen legalizing brcond ->brcc or select -> selectcc, make sure to truncate
Chris Lattner [Sun, 21 Aug 2005 18:03:09 +0000 (18:03 +0000)]
When legalizing brcond ->brcc or select -> selectcc, make sure to truncate
the old condition to a one bit value.  The incoming value must have been
promoted, and the top bits are undefined.  This causes us to generate:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r3, 17
        cmpwi cr0, r2, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        li r3, 1
.LBB_test_2:    ;
        blr

instead of:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r2, 17
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        li r2, 1
.LBB_test_2:    ;
        or r3, r2, r2
        blr

for:

int %test(bool %c) {
        %retval = select bool %c, int 17, int 1
        ret int %retval
}

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

18 years agoIf the false value for a select_cc is really simple (has no inputs), evaluate
Chris Lattner [Sun, 21 Aug 2005 17:41:11 +0000 (17:41 +0000)]
If the false value for a select_cc is really simple (has no inputs), evaluate
it in the block.  This codegens:

int %test(bool %c) {
        %retval = select bool %c, int 17, int 1
        ret int %retval
}

as:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r2, 17
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        li r2, 1
.LBB_test_2:    ;
        or r3, r2, r2
        blr

instead of:

_test:
        rlwinm r2, r3, 0, 31, 31
        li r2, 17
        li r4, 1
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        or r2, r4, r4
.LBB_test_2:    ;
        or r3, r2, r2
        blr

... which is one fewer instruction.  The savings are more significant for
global address and constantfp nodes.

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

18 years agoFix a bug in the RUN line
Chris Lattner [Sun, 21 Aug 2005 16:37:36 +0000 (16:37 +0000)]
Fix a bug in the RUN line

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

18 years agoreenable collapse of loadimm+AND -> dep.z (thanks guys)
Duraid Madina [Sun, 21 Aug 2005 15:43:53 +0000 (15:43 +0000)]
reenable collapse of loadimm+AND -> dep.z (thanks guys)

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

18 years agofix bogus warning
Chris Lattner [Sat, 20 Aug 2005 18:07:27 +0000 (18:07 +0000)]
fix bogus warning

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

18 years agoRepair an out by one error for IA64.
Jim Laskey [Sat, 20 Aug 2005 11:05:23 +0000 (11:05 +0000)]
Repair an out by one error for IA64.

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

18 years agoadd support for global address, including PIC support.
Chris Lattner [Fri, 19 Aug 2005 22:38:53 +0000 (22:38 +0000)]
add support for global address, including PIC support.
This REALLY should be lowered by the legalizer!

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

18 years agoAdd support for global address nodes
Chris Lattner [Fri, 19 Aug 2005 22:38:24 +0000 (22:38 +0000)]
Add support for global address nodes

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

18 years agoADd support for TargetGlobalAddress nodes
Chris Lattner [Fri, 19 Aug 2005 22:31:34 +0000 (22:31 +0000)]
ADd support for TargetGlobalAddress nodes

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

18 years agoAdd support for TargetGlobalAddress nodes
Chris Lattner [Fri, 19 Aug 2005 22:31:04 +0000 (22:31 +0000)]
Add support for TargetGlobalAddress nodes

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

18 years agoImplement CopyFromReg, TokenFactor, and fix a bug in CopyToReg. This allows
Chris Lattner [Fri, 19 Aug 2005 21:43:53 +0000 (21:43 +0000)]
Implement CopyFromReg, TokenFactor, and fix a bug in CopyToReg.  This allows
us to compile stuff like this:

double %test(double %A, double %B, double %C, double %E) {
        %F = mul double %A, %A
        %G = add double %F, %B
        %H = sub double -0.0, %G
        %I = mul double %H, %C
        %J = add double %I, %E
        ret double %J
}

to:

_test:
        fnmadd f0, f1, f1, f2
        fmadd f1, f0, f3, f4
        blr

woot!

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

18 years agoFix a bug in previous commit
Chris Lattner [Fri, 19 Aug 2005 21:34:13 +0000 (21:34 +0000)]
Fix a bug in previous commit

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

18 years agoFix a typeo, no wonder all tokenfactor edges were the same!
Chris Lattner [Fri, 19 Aug 2005 21:33:02 +0000 (21:33 +0000)]
Fix a typeo, no wonder all tokenfactor edges were the same!

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

18 years agoPrint physreg register nodes with target names (e.g. F1) instead of numbers
Chris Lattner [Fri, 19 Aug 2005 21:21:16 +0000 (21:21 +0000)]
Print physreg register nodes with target names (e.g. F1) instead of numbers

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

18 years agoBefore implementing copyfromreg, we'll implement copytoreg correctly.
Chris Lattner [Fri, 19 Aug 2005 20:50:53 +0000 (20:50 +0000)]
Before implementing copyfromreg, we'll implement copytoreg correctly.
This gets us this for the previous testcase:

_test:
        lis r2, 0
        ori r3, r2, 65535
        blr

Note that we actually write to r3 (the return reg) correctly now :)

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

18 years agoNow that we have operand info for machine instructions, use it to create
Chris Lattner [Fri, 19 Aug 2005 20:45:43 +0000 (20:45 +0000)]
Now that we have operand info for machine instructions, use it to create
temporary registers for things that define a register.  This allows dag->dag
isel to compile this:

int %test() { ret int 65535 }

into:

_test:
        lis r2, 0
        ori r2, r2, 65535
        blr

Next up, getting CopyFromReg to work, allowing arguments and cross-bb values.

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

18 years agoEmit this:
Chris Lattner [Fri, 19 Aug 2005 20:29:14 +0000 (20:29 +0000)]
Emit this:

static const TargetOperandInfo OperandInfo6[] = { { &PPC32::CRRCRegClass }, { 0 }, };

instead of this:

static const TargetOperandInfo OperandInfo6[] = { { PPC32::CRRCRegisterClass }, { 0 }, };

For operand information, which does not require dynamic (startup-time)
initialization.

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

18 years agoExpose the derived register classes to the public header, allowing them
Chris Lattner [Fri, 19 Aug 2005 20:23:42 +0000 (20:23 +0000)]
Expose the derived register classes to the public header, allowing them
to be accessed.

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

18 years agoSplit RegisterClass 'Methods' into MethodProtos and MethodBodies
Chris Lattner [Fri, 19 Aug 2005 19:13:20 +0000 (19:13 +0000)]
Split RegisterClass 'Methods' into MethodProtos and MethodBodies

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

18 years agoSplit register class "Methods" into MethodProtos and MethodBodies
Chris Lattner [Fri, 19 Aug 2005 19:12:51 +0000 (19:12 +0000)]
Split register class "Methods" into MethodProtos and MethodBodies

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

18 years agoput reg classes into namespace
Chris Lattner [Fri, 19 Aug 2005 18:53:43 +0000 (18:53 +0000)]
put reg classes into namespace

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

18 years agoPut reg classes into namespaces
Chris Lattner [Fri, 19 Aug 2005 18:52:55 +0000 (18:52 +0000)]
Put reg classes into namespaces

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

18 years agoPut register classes into namespaces
Chris Lattner [Fri, 19 Aug 2005 18:51:57 +0000 (18:51 +0000)]
Put register classes into namespaces

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

18 years agoPut register classes in namespaces
Chris Lattner [Fri, 19 Aug 2005 18:50:46 +0000 (18:50 +0000)]
Put register classes in namespaces

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

18 years agoFix code that assumes the register info will be dumped into a target
Chris Lattner [Fri, 19 Aug 2005 18:50:11 +0000 (18:50 +0000)]
Fix code that assumes the register info will be dumped into a target
namespace instead of the reg class namespace.  Update getRegClassForType()
to use modified names due to tblgen change.

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

18 years agoput reg classes in namespaces
Chris Lattner [Fri, 19 Aug 2005 18:49:22 +0000 (18:49 +0000)]
put reg classes in namespaces

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

18 years agoRequire that targets specify a namespace for their register classes.
Chris Lattner [Fri, 19 Aug 2005 18:48:48 +0000 (18:48 +0000)]
Require that targets specify a namespace for their register classes.

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

18 years agoRefactor to use Target.getRegisterClasses consistently, which provides
Chris Lattner [Fri, 19 Aug 2005 18:47:59 +0000 (18:47 +0000)]
Refactor to use Target.getRegisterClasses consistently, which provides
anonymous regclass definition renaming.

Change the generated code to emit register classes as properly namespace
qualified entities like everything else.

expose the actual class definition as an object, though this isn't quite
usable yet.

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

18 years agoEmit real operand info for instructions. This currently works but is bad
Chris Lattner [Fri, 19 Aug 2005 18:46:26 +0000 (18:46 +0000)]
Emit real operand info for instructions.  This currently works but is bad
in one way: the generated tables require dynamic initialization for the
register classes.  This will be fixed in a future patch.

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

18 years agoRead the namespace field from register classes
Chris Lattner [Fri, 19 Aug 2005 18:45:20 +0000 (18:45 +0000)]
Read the namespace field from register classes

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