Commit Graph

322 Commits

Author SHA1 Message Date
Evan Cheng
13e9e9c235 Passing isel root and use operands to ComplexPattern functions, these should do the usual load folding checks as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30972 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-16 06:33:44 +00:00
Evan Cheng
ce1381afd9 When checking if a load can be folded, we check if there is any non-direct
way to reach the load via any nodes that would be folded. Start from the
root of the matched sub-tree.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30956 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-14 08:30:15 +00:00
Evan Cheng
4f77616c28 Really remove dead nodes from isel queue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30923 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 23:18:52 +00:00
Evan Cheng
1fae00f1ad Use RemoveDeadNode to kill dead node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30917 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 20:35:19 +00:00
Evan Cheng
4326ef582b Prior load folding check on chain operand was too strict. It requires the
chain operand to point to the load being folded. Now we relax this, traversing
up the chain, if it doesn't reach the load, then it's ok. We will create a
TokenFactor (of all the chain operands and the load's chain) to capture all
the control flow dependencies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30897 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 02:08:53 +00:00
Evan Cheng
94b3040fef Added properties such as SDNPHasChain to ComplexPattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30890 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 21:02:01 +00:00
Chris Lattner
39e73f7c83 Special case tblgen generated code for patterns like (and X, 255) or (or X, 42).
The dag/inst combiners often 'simplify' the masked value based on whether
or not the bits are live or known zero/one.  This is good and dandy, but
often causes special case patterns to fail, such as alpha's CMPBGE pattern,
which looks like "(set GPRC:$RC, (setuge (and GPRC:$RA, 255), (and GPRC:$RB, 255)))".
Here the pattern for (and X, 255) should match actual dags like (and X, 254) if
the dag combiner proved that the missing bits are already zero (one for 'or').

For CodeGen/Alpha/cmpbge.ll:test2 for example, this results in:

        sll $16,1,$0
        cmpbge $0,$17,$0
        ret $31,($26),1

instead of:

        sll $16,1,$0
        and $0,254,$0
        and $17,255,$1
        cmpule $1,$0,$0
        ret $31,($26),1

... and requires no target-specific code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30871 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 04:05:55 +00:00
Chris Lattner
be8e72120d Split some code out into a new method. The generated code is exactly
identical, this is just a refactoring.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30868 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 03:35:34 +00:00
Evan Cheng
d3eea90a9b Predicate function on the node should be matched before its childrean' matching
code. This is especially important now matching ISD::LOAD also requires a
Predicate_Load call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30845 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-09 21:02:17 +00:00
Chris Lattner
ce6e84ca6c don't allow 'imm' or specific imms, like '1' on the LHS of a binop.
This shrinks X86GenDAGISel by ~330 lines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30574 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 20:46:13 +00:00
Chris Lattner
649069728f Fit to 80 columns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30572 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 18:28:27 +00:00
Evan Cheng
d46bd604ed Allow PatFrag to be a leaf node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30498 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-19 19:08:04 +00:00
Evan Cheng
cf6d791e08 Add result of a Xform to isel queue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30497 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-19 18:40:15 +00:00
Chris Lattner
bc7fa5277f If multiple predicates are listed, they must all pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30476 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-19 00:41:36 +00:00
Chris Lattner
47a7e2681e There!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30473 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-18 22:41:07 +00:00
Chris Lattner
a4503de431 Fix Regression/TableGen/2006-09-18-LargeInt.td
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30472 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-18 22:28:27 +00:00
Chris Lattner
7905c55b12 Relax this check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30381 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-14 23:54:24 +00:00
Evan Cheng
966fd37ba5 1) With X86 lowering change, the following can no longer happen since
the branch's chain is also produced by cmp.
          [ch, r : ld]
             ^ ^
             | |
      [XX]--/   \- [flag : cmp]
       ^             ^
       |             |
       \---[br flag]-

Remove an isel check which prevents loads from being folded into cmp / test
instructions.

2) Whenever possible, delete a selected node to allow more load folding
opportunities. Note not all nodes can be deleted after it has been
selected. Some may have simply morphed; some have not changed at all (e.g.
EntryToken).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30242 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-11 02:24:43 +00:00
Evan Cheng
6cec34e094 Generated isel should favors explicit constant operand (+2) over an operand with a predicate (+1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30180 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-08 07:26:39 +00:00
Chris Lattner
8dc728e440 Use compiler.h instead of hand rolling our own macro
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29913 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-27 13:16:24 +00:00
Evan Cheng
f037ca6245 Do not emit getTargetNode() and SelectNodeTo() which takes more than 3
SDOperand arguments. Use the variants which take an array and number instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29906 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-27 08:11:28 +00:00
Evan Cheng
95514bae73 SelectNodeTo now returns a SDNode*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29901 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-26 08:00:10 +00:00
Evan Cheng
7a33db0b20 Minor getCopyToReg() call change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29900 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-26 07:39:28 +00:00
Evan Cheng
9ade218533 Select() no longer require Result operand by reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29898 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-26 05:34:46 +00:00
Evan Cheng
2a318cfad5 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29897 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-26 01:34:15 +00:00
Evan Cheng
f549319b4a A bit more clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29893 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-26 01:02:19 +00:00
Evan Cheng
676d731c61 - Clean up tablegen dag isel generator code.
- Clean up the code generated by tablegen:
  * AddToISelQueue now takes one argument.
  * ComplexPattern matching condition can now be shared.
  * Eliminate passing unnecessary arguments to emit routines.
  * Eliminate some unneeded SDOperand declarations in select routines.
  * Other minor clean ups.
- This reduces foot print slightly: X86ISelDAGToDAG.o is reduced from 971k
  to 823k.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29892 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-26 00:59:04 +00:00
Evan Cheng
23329f5e03 SelectNodeTo() may return a SDOperand that is different from the input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29726 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-16 07:30:09 +00:00
Chris Lattner
dfb8607397 The generated runloop shouldn't require Select to update 'Result'. In fact
we'd like to remove result entirely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29713 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-15 23:42:26 +00:00
Chris Lattner
5298de51b8 allow Select to return the node being selected if RAU isn't needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29712 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-15 23:27:50 +00:00
Evan Cheng
1e060f0242 Use SmallVector instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29619 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-11 18:33:41 +00:00
Evan Cheng
06d6470c65 - Prevent some functions from being inlined to eliminate the code size bloat
introduced by previous commit.
- SelectCode now returns a SDNode*. If it is not null, the selected node
  produces the same number of results as the input node. The seletion loop
  is responsible for calling ReplaceAllUsesWith() to replace the input node
  with the output target node. For other cases, e.g. when load is folded,
  the selection code is responsible for calling ReplaceAllUsesOfValueWith()
  and SelectCode returns NULL.
- Other clean ups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29602 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-11 08:59:35 +00:00
Chris Lattner
706d2d3608 Revert previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29585 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-09 16:44:44 +00:00
Tanya Lattner
8d4ccf0ad4 Reverting back to original 1.8 version so I can manually merge in patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29584 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-09 16:41:21 +00:00
Chris Lattner
bd564bfc63 Start eliminating temporary vectors used to create DAG nodes. Instead, pass
in the start of an array and a count of operands where applicable.  In many
cases, the number of operands is known, so this static array can be allocated
on the stack, avoiding the heap.  In many other cases, a SmallVector can be
used, which has the same benefit in the common cases.

I updated a lot of code calling getNode that takes a vector, but ran out of
time.  The rest of the code should be updated, and these methods should be
removed.

We should also do the same thing to eliminate the methods that take a
vector of MVT::ValueTypes.

It would be extra nice to convert the dagiselemitter to avoid creating vectors
for operands when calling getTargetNode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29566 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-08 02:23:42 +00:00
Evan Cheng
9bdca0302a Making TableGen'd instruction selection code non-recursive. This fixes PR805.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29548 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-07 22:17:58 +00:00
Chris Lattner
58d63567ea Remove some extraneous newlines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29492 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-03 00:42:26 +00:00
Chris Lattner
32501a0e33 Really add support for compilers without noinline
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29491 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-03 00:26:13 +00:00
Evan Cheng
d3f8429f01 Pass N by reference to select functions to prevent gcc from allocating more stack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29423 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-01 01:07:48 +00:00
Evan Cheng
6966c48767 Remove an unneeded match condition: the type check for root node has been
moved to outside the actual select routine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29415 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-31 19:01:58 +00:00
Evan Cheng
b6ee7f73e5 Split each select function for a particular opcode into multiple ones. One
per possible ValueType of the node. e.g. Select_add is split into Select_add_i8,
Select_add_i16, etc.

For opcodes which do not produce a non-chain result, it is split on the
ValueType of its first non-chain operand. e.g. Select_store.

On X86 / Mac OS X, Select_store used to be the largest function. It had a stack
frame size of 8.5k. Now the largest one is Store_i32 with a frame size of 3.1k.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29404 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-28 22:51:01 +00:00
Evan Cheng
dc7a66a081 Clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29378 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-28 01:19:22 +00:00
Evan Cheng
f2dfafcbc1 Rename IsFoldableBy to CanBeFoldedleBy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29376 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-28 01:03:48 +00:00
Evan Cheng
2641cad180 Remove InFlightSet hack. No longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29373 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-28 00:47:19 +00:00
Evan Cheng
3aac4d58e4 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29359 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-27 19:59:34 +00:00
Evan Cheng
b2c121ac14 Let each target specific isel provide routine to check if a chain producing node is foldable by another.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29335 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-27 06:36:49 +00:00
Evan Cheng
233baf1c4b Fix for bug 840. Only use noinline attribute if gcc version >= 3.4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29311 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-26 23:06:27 +00:00
Evan Cheng
e6389935a9 Removed a hack intended to allow (store (op (load))) folding. Will handle this with preprocessing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29258 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-21 22:19:51 +00:00
Evan Cheng
eb1f40d3af Also checks for noResults field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29235 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-20 23:36:20 +00:00
Evan Cheng
e6f32034db Add code size to target instruction use it as the 3rd isel sorting tie-breaker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29193 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-19 00:24:41 +00:00
Evan Cheng
fb878a37ba Use __attribute__((noinline)) only if compiled by gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29161 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-16 06:14:37 +00:00
Evan Cheng
f872940dfc Parameterize target node ValueType to allow more sharing of emit functions.
Also reduce the number of arguments passed to emit functions and removed a
hack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29160 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-16 06:12:52 +00:00
Evan Cheng
fceb57a917 Reduce instruction selection code size and stack frame size by factoring
code that emit target specific nodes into emit functions that are uniquified
and shared among selection routines.
e.g. This reduces X86ISelDAGToDAG.o (release) from ~2M to ~1.5M. Stack frame
size of Select_store from ~13k down to ~8k.
This is the first step. Further work to enable more sharing will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29158 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-15 08:45:20 +00:00
Jim Laskey
16d42c6ac6 It was pointed out that DEBUG() is only available with -debug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29106 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-11 18:25:13 +00:00
Jim Laskey
e37fe9b3a1 Ensure that dump calls that are associated with asserts are removed from
non-debug build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29105 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-11 17:58:07 +00:00
Evan Cheng
322812e603 Ugly hack! Add helper functions InsertInFlightSetEntry and
RemoveInFlightSetEntry. They are used in place of direct set operators to
reduce instruction selection function stack size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28987 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-29 23:57:05 +00:00
Chris Lattner
02cdb377ec Fix an error message regression. Print:
LI8:    (LI8:i64 (imm:i64):$imm)
instead of:
  LI8:    (LI8:MVT::i64 (imm:MVT::i64):$imm)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28868 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 00:56:37 +00:00
Chris Lattner
186fb7d131 Don't require src/dst patterns to be able to fully resolve their types,
because information about one can help refine the other.  This allows us to
write:

def : Pat<(i32 (extload xaddr:$src, i8)),
          (LBZX xaddr:$src)>;

as:

def : Pat<(extload xaddr:$src, i8),
          (LBZX xaddr:$src)>;

because tblgen knows LBZX returns i32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28865 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 00:31:27 +00:00
Chris Lattner
a354849c27 Make sure to use the result of the pattern to infer the result type of the
instruction, and the result type of the instruction to refine the pattern.
This allows us to write things like this:

def : Pat<(v2i64 (bitconvert (v16i8 VR128:$src))), (v2i64 VR128:$src)>;

as:
def : Pat<(v2i64 (bitconvert (v16i8 VR128:$src))), (VR128:$src)>

and fixes a ppc64 issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28863 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 00:18:02 +00:00
Chris Lattner
8f60d54fb1 Improve a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28833 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-16 18:25:06 +00:00
Evan Cheng
d7c2c86239 Allow more use of iPTR in patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28790 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-15 00:16:37 +00:00
Evan Cheng
e945f4d3d4 Added support for variable_ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28788 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-14 22:22:20 +00:00
Evan Cheng
bc6b86a89e Fix support for optional input flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28784 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-14 19:27:50 +00:00
Evan Cheng
50c997e26a getOperandNum(): error if specified operand number is out of range.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28775 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-13 21:47:27 +00:00
Chris Lattner
11bcd28dff Wrap to 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28743 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-09 23:59:44 +00:00
Evan Cheng
553ef1be94 Can't trust NodeDepth when checking for possibility of load folding creating
a cycle. This increase the search space and will increase compile time (in
practice it appears to be small, e.g. 176.gcc goes from 62 sec to 65 sec)
that will be addressed later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28476 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-25 20:16:55 +00:00
Evan Cheng
b0793f9741 Fixed a really ugly bug. The TableGen'd isel is not freeing the "inflight set"
correctly. That is causing non-deterministic behavior (and possibly preventing
some load folding from happening).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28458 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-25 00:21:44 +00:00
Evan Cheng
d15531b430 Now that iPTR is a fully resolved type. We end up losing the type check for
patterns that look like this:

def : Pat<(i32 (X86Wrapper tconstpool  :$dst)), (MOV32ri tconstpool  :$dst)>;

InsertOneTypeCheck should copy the type from the resolved pattern to the
unresolved one as long as there types are different.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28389 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-19 07:24:32 +00:00
Evan Cheng
2618d07765 Remove PointerType from target definition. Use abstract type MVT::iPTR to
represent pointer type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28363 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-17 20:37:59 +00:00
Evan Cheng
44a65fa552 Allow patterns to refer to physical registers that belong to multiple
register classes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28323 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-16 07:05:30 +00:00
Evan Cheng
d9d4518a86 Unused instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28240 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-12 07:42:01 +00:00
Evan Cheng
3eff89bf89 Watch out for the following case:
1. Use expects a chain output.
2. Node is expanded into multiple target ops.
3. One of the inner node produces a chain, the outer most one doesn't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28209 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 02:47:57 +00:00
Evan Cheng
045953c37a Fix a load folding bug. It is exposed by a multi- resulting instructions
def : Pat<> pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28208 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 00:05:46 +00:00
Evan Cheng
55d0fa1bfa Remove the temporary option: -no-isel-fold-inflight
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28012 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-28 18:54:11 +00:00
Evan Cheng
61a0209a8a When isel'ing a node, mark its operands "InFlight" before selecting them. These
nodes should not be folded into other nodes.
This fixes the miscompilation of PR 749.
Temporarily under flag control.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28002 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-28 02:08:10 +00:00
Nate Begeman
37efe67645 JumpTable support! What this represents is working asm and jit support for
x86 and ppc for 100% dense switch statements when relocations are non-PIC.
This support will be extended and enhanced in the coming days to support
PIC, and less dense forms of jump tables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27947 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-22 18:53:45 +00:00
Evan Cheng
c81d2a041d Rename AddedCost to AddedComplexity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27841 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-19 20:36:09 +00:00
Evan Cheng
5941320c0d Allow "let AddedCost = n in" to increase pattern complexity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27834 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-19 18:07:24 +00:00
Chris Lattner
91ded08224 Infer element types for shuffle masks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27456 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-06 20:36:51 +00:00
Chris Lattner
52793e2c41 rename a method, to avoid confusion with llvm intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27455 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-06 20:19:52 +00:00
Chris Lattner
ffa4fdcd17 Allow bits init values to be used in patterns, turn them into ints.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27286 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-31 05:25:56 +00:00
Chris Lattner
8c06318821 Implement Regression/TableGen/DagDefSubst.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27263 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-30 22:50:40 +00:00
Chris Lattner
b026e70462 Tblgen doesn't like multiple SDNode<> definitions that map to the sameenum value. Split them into separate enums.
Also, don't emit dynamic checks when we can compute them statically


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27202 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-28 00:41:33 +00:00
Chris Lattner
2c4e65d460 Print error messages like this:
tblgen: In STVEBX: Intrinsic 'llvm.ppc.altivec.stvebx' expects 3 operands, not 2 operands!

instead of like this:
tblgen: In STVEBX: Intrinsic 'intrinsic_void expects 3 operands, not 2 operands!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27185 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-27 22:21:18 +00:00
Chris Lattner
5c4c774c75 Add a missing check which cause an invalid .td file to crash tblgen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27126 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-25 22:12:44 +00:00
Chris Lattner
9bf2d3e6d6 When failing selection for an intrinsic, print this:
Cannot yet select: intrinsic %llvm.ppc.altivec.lvx

instead of this:

Cannot yet select: 0x9b047e0: v4i32,ch = INTRINSIC 0x9b04540:1, 0x9b04710, 0x9b04790, 0x9b04540


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27110 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-25 06:47:53 +00:00
Chris Lattner
5a1df389a6 Change approach so that we get codegen for free for intrinsics. With this,
intrinsics that don't take pointer arguments now work.  For example, we can
compile this:

int test3( __m128d *A) {
  return _mm_movemask_pd(*A);
}
int test4( __m128 *A) {
  return _mm_movemask_ps(*A);
}

to this:

_test3:
        movl 4(%esp), %eax
        movapd (%eax), %xmm0
        movmskpd %xmm0, %eax
        ret
_test4:
        movl 4(%esp), %eax
        movaps (%eax), %xmm0
        movmskps %xmm0, %eax
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27090 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 23:10:39 +00:00
Chris Lattner
947604b0e2 fix 80 column violations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27084 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 21:52:20 +00:00
Chris Lattner
550525e3cf Parse intrinsics correctly and perform type propagation. This doesn't currently
emit the code to select intrinsics, but that is next :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27082 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 21:48:51 +00:00
Evan Cheng
83e1a6ab95 Allow result node to be a simple leaf node. This enable bitconvert patterns
like this:
def : Pat<(v4i32 (bitconvert (v4f32 VR128:$src))), (v4i32 VR128:$src)>;


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26968 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-23 02:35:32 +00:00
Evan Cheng
3a7a14b0ae Don't forget to promote xform function to an explicit node for def : Pat<>
patterns.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26929 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-21 20:44:17 +00:00
Chris Lattner
4e2f54d99e minor code simplification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26918 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-21 06:42:58 +00:00
Evan Cheng
863bf5afb0 The node wrapped in PatLeaf<> should be treated as a leaf even if it isn't
one, i.e. don't select it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26909 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-20 22:53:06 +00:00
Evan Cheng
f26ba69725 It should be ok for a xform output type to be different from input type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26899 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-20 08:09:17 +00:00
Evan Cheng
420132e1eb Copy matching pattern's output type info to instruction result pattern.
The instruction patterns do not contain enough information to resolve the
exact type of the destination if it of a generic vector type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26892 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-20 06:04:09 +00:00
Chris Lattner
697f88456c Add a new SDTCisIntVectorOfSameSize type constraint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26890 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-20 05:39:48 +00:00
Evan Cheng
ed66e855ec Temporary hack to enable more (store (op (load ...))) folding. This makes
it possible when a TokenFactor is between the load and store. But is still
missing some cases due to ordering issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26638 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-09 08:19:11 +00:00
Evan Cheng
6f8aaf2cb0 Don't generate silly matching code like this:
if (N1.getOpcode() == ISD::ADD &&
     ...)
   if (... &&
       (N1.getNumOperands() == 1 || !isNonImmUse(N1.Val, N10.Val))) &&
       ...)

TableGen knows N1 must have more than one operand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26592 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-07 08:31:27 +00:00
Chris Lattner
fd105d464a Select inline asm memory operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26349 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 02:13:31 +00:00
Evan Cheng
fbad70808c Bump up pattern cost if the resulting instruction is marked
usesCustomDAGSchedInserter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26282 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-18 02:33:09 +00:00