Commit Graph

1730 Commits

Author SHA1 Message Date
Chris Lattner
ed461e0faf Make this code safe for when loadRegFromStackSlot inserts multiple instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23108 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 22:18:32 +00:00
Chris Lattner
579cfabdad Checking types here is not safe, because multiple types can map to the same
register class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23103 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 21:39:15 +00:00
Chris Lattner
025c39bf36 Call the InsertAtEndOfBasicBlock hook if the usesCustomDAGSchedInserter
flag is set on an instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23098 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 20:54:47 +00:00
Chris Lattner
8b52f21f10 Revampt ReplaceAllUsesWith to be more efficient and easier to use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23087 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 18:36:28 +00:00
Chris Lattner
5839bf2b3b Change ConstantPoolSDNode to actually hold the Constant itself instead of
putting it into the constant pool.  This allows the isel machinery to
create constants that it will end up deciding are not needed, without them
ending up in the resultant function constant pool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23081 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 17:15:30 +00:00
Chris Lattner
2bb06cdf27 Fix a huge annoyance: SelectNodeTo took types before the opcode unlike
every other SD API.  Fix it to take the opcode before the types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23079 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 16:36:26 +00:00
Chris Lattner
d7050a9c50 the 5th operand is the 4th number
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23074 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:43:46 +00:00
Chris Lattner
23004e5f21 Add support for targets that want to custom expand select_cc in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23071 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:23:59 +00:00
Chris Lattner
07dffd6af6 Allow LowerOperation to return a null SDOperand in case it wants to lower
some things given to it, but not all.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23070 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:14:16 +00:00
Chris Lattner
f07d023dd9 Fix a nasty bug from a previous patch of mine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23069 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 00:13:12 +00:00
Nate Begeman
1999b4b974 New fold for SELECT_CC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23058 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 20:04:38 +00:00
Chris Lattner
43247a157b Don't auto-cse nodes that return flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23055 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 19:12:10 +00:00
Chris Lattner
9d338cf3a3 simplify the code a bit using isOperationLegal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23053 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 17:54:58 +00:00
Chris Lattner
376d54f9b6 Add support for flag operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23050 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 17:48:54 +00:00
Chris Lattner
4025a9c2cc ADd support for TargetConstantPool nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23041 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 05:03:06 +00:00
Chris Lattner
afb2dd43de add a new TargetFrameIndex node
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23035 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-25 00:43:01 +00:00
Chris Lattner
7651fa4a7e add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23027 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 23:00:29 +00:00
Chris Lattner
7b2880c4cd Add ReplaceAllUsesWith that can take a vector of replacement values.
Add some foldings to hopefully help the illegal setcc issue, and move some code around.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23025 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 22:44:39 +00:00
Chris Lattner
14b392af1d Add support for external symbols, and support for variable arity instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23022 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 22:02:41 +00:00
Chris Lattner
e39db07713 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
2005-08-24 18:30:00 +00:00
Chris Lattner
1d6373c1af 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
2005-08-24 16:46:55 +00:00
Chris Lattner
c9c60f6429 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
2005-08-24 16:35:28 +00:00
Chris Lattner
9ed62c16f2 Adjust to new interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23010 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 16:34:12 +00:00
Nate Begeman
cebd433d8d 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
2005-08-24 04:57:57 +00:00
Chris Lattner
82cfa5d616 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
2005-08-24 00:34:29 +00:00
Nate Begeman
0750a40a4f 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
2005-08-24 00:21:28 +00:00
Chris Lattner
657b4d1ac6 Implement LiveVariables.h change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22994 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 00:09:33 +00:00
Chris Lattner
44b94c2185 adjust to new live variables interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22992 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-23 23:42:17 +00:00
Chris Lattner
ab4b66d4c2 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
2005-08-23 22:51:41 +00:00
Chris Lattner
b980578b41 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
2005-08-23 22:27:31 +00:00
Nate Begeman
7042f15bde 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
2005-08-23 05:41:12 +00:00
Nate Begeman
b942a3dd5f 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
2005-08-23 04:29:48 +00:00
Chris Lattner
a411cbca5c 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
2005-08-22 20:59:30 +00:00
Chris Lattner
a6c1750362 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
2005-08-22 20:20:42 +00:00
Chris Lattner
8f03405ee5 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
2005-08-22 17:28:31 +00:00
Chris Lattner
f8355d9846 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
2005-08-22 16:55:22 +00:00
Chris Lattner
23553cfb4a 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
2005-08-22 01:04:32 +00:00
Chris Lattner
c975e1dedc add anew method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22957 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 22:30:30 +00:00
Chris Lattner
81e72b13d7 Add support for frame index nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22956 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:56:04 +00:00
Chris Lattner
99baddaf57 add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22955 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 19:48:59 +00:00
Chris Lattner
6b09a29604 add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22949 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-21 18:49:33 +00:00
Chris Lattner
f85ab15acf 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
2005-08-21 18:49:29 +00:00
Chris Lattner
550b1e59c4 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
2005-08-21 18:03:09 +00:00
Chris Lattner
fe0c2c8721 fix bogus warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22943 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-20 18:07:27 +00:00
Chris Lattner
9b78db7f16 Add support for global address nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22940 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 22:38:24 +00:00
Chris Lattner
aaaa0b67dd Add support for TargetGlobalAddress nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22938 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 22:31:04 +00:00
Chris Lattner
7ef330478f 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
2005-08-19 21:43:53 +00:00
Chris Lattner
fa164b61d1 Fix a bug in previous commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22936 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-19 21:34:13 +00:00
Chris Lattner
7228aa7868 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
2005-08-19 21:21:16 +00:00
Chris Lattner
0189197608 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
2005-08-19 20:50:53 +00:00