1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 14:02:52 +02:00
Commit Graph

191 Commits

Author SHA1 Message Date
Chris Lattner
39d2d17cb3 Implement Regression/TableGen/DagDefSubst.ll
llvm-svn: 27263
2006-03-30 22:50:40 +00:00
Chris Lattner
723cb246c9 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

llvm-svn: 27202
2006-03-28 00:41:33 +00:00
Chris Lattner
a092011a5c 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!

llvm-svn: 27185
2006-03-27 22:21:18 +00:00
Chris Lattner
ed2f2220da Add a missing check which cause an invalid .td file to crash tblgen
llvm-svn: 27126
2006-03-25 22:12:44 +00:00
Chris Lattner
e7a3b00d6a 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

llvm-svn: 27110
2006-03-25 06:47:53 +00:00
Chris Lattner
de644c5e88 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

llvm-svn: 27090
2006-03-24 23:10:39 +00:00
Chris Lattner
d054091a40 fix 80 column violations
llvm-svn: 27084
2006-03-24 21:52:20 +00:00
Chris Lattner
92a040dbbf Parse intrinsics correctly and perform type propagation. This doesn't currently
emit the code to select intrinsics, but that is next :)

llvm-svn: 27082
2006-03-24 21:48:51 +00:00
Evan Cheng
b632a1d0d5 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)>;

llvm-svn: 26968
2006-03-23 02:35:32 +00:00
Evan Cheng
d21f479c5f Don't forget to promote xform function to an explicit node for def : Pat<>
patterns.

llvm-svn: 26929
2006-03-21 20:44:17 +00:00
Chris Lattner
4da595f4c8 minor code simplification
llvm-svn: 26918
2006-03-21 06:42:58 +00:00
Evan Cheng
e87add642d The node wrapped in PatLeaf<> should be treated as a leaf even if it isn't
one, i.e. don't select it.

llvm-svn: 26909
2006-03-20 22:53:06 +00:00
Evan Cheng
38a1075865 It should be ok for a xform output type to be different from input type.
llvm-svn: 26899
2006-03-20 08:09:17 +00:00
Evan Cheng
f0effde00d 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.

llvm-svn: 26892
2006-03-20 06:04:09 +00:00
Chris Lattner
eb65663732 Add a new SDTCisIntVectorOfSameSize type constraint
llvm-svn: 26890
2006-03-20 05:39:48 +00:00
Evan Cheng
df3c89dd52 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.

llvm-svn: 26638
2006-03-09 08:19:11 +00:00
Evan Cheng
71c62ae1f4 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.

llvm-svn: 26592
2006-03-07 08:31:27 +00:00
Chris Lattner
1ffa8d3666 Select inline asm memory operands.
llvm-svn: 26349
2006-02-24 02:13:31 +00:00
Evan Cheng
110f651cba Bump up pattern cost if the resulting instruction is marked
usesCustomDAGSchedInserter.

llvm-svn: 26282
2006-02-18 02:33:09 +00:00
Evan Cheng
e8a0e56482 Call InsertISelMapEntry rather than map insertion operator to prevent overly
aggrssive inlining. This reduces Select_store frame size from 24k to 10k.

llvm-svn: 26095
2006-02-09 22:12:27 +00:00
Evan Cheng
fd9315eaaa Match getTargetNode() changes (now returns SDNode* instead of SDOperand).
llvm-svn: 26084
2006-02-09 07:16:09 +00:00
Evan Cheng
521e5a1bfe Change Select() from
SDOperand Select(SDOperand N);
to
void Select(SDOperand &Result, SDOperand N);

llvm-svn: 26067
2006-02-09 00:37:58 +00:00
Evan Cheng
0ff5d88abd Hoist all SDOperand declarations within a Select_{opcode}() to the top level
to reduce stack memory usage. This is intended to work around the gcc bug.

llvm-svn: 26026
2006-02-07 00:37:41 +00:00
Evan Cheng
2af9230f1e At the end of isel, select a replacement node for each handle that does not
have one. This can happen if a load's real uses are dead (i.e. they do not
have uses themselves).

llvm-svn: 26014
2006-02-06 08:12:55 +00:00
Evan Cheng
6f1778d4e1 Name change.
llvm-svn: 26013
2006-02-06 06:03:35 +00:00
Evan Cheng
09b5e544a9 Handle HANDLENODE: just return itself.
llvm-svn: 26011
2006-02-05 08:46:14 +00:00
Evan Cheng
0b5d4a10a9 Allow more loads to be folded which were previously prevented from happening
due to ordering issue. i.e. they were selected for chain use first.
Now at load select time, check if it is being selected for a chain use and if
it has only a single real use. If so, return a HANDLENODE (with the load as
its operand) in its place and record it.
When it is folded or the load is selected for a real use, the isel records it
as the replacement for the HANDLENODE. The replacement is done when all nodes
are selected.
This scheme exposed a couple of problems where cycles can happen. (See comments
in EmitMatchCode() for descriptions of the problems and their workaround /
solutions.) These problems have been resolved with a small compile time
penality.

llvm-svn: 25995
2006-02-05 06:43:12 +00:00
Evan Cheng
d5d3d7ad9e Re-committing the last bit of change. It shouldn't break PPC this time.
llvm-svn: 25982
2006-02-05 05:22:18 +00:00
Chris Lattner
951217976d Temporarily revert the last change, which breaks PPC and other targets that
DO select things.

llvm-svn: 25970
2006-02-04 09:23:06 +00:00
Evan Cheng
6a366c5eda Complex pattern's custom matcher should not call Select() on any operands.
Select them afterwards if it returns true.

llvm-svn: 25968
2006-02-04 08:50:49 +00:00
Chris Lattner
21f305febf node predicates add to the complexity of a pattern. This ensures that the
X86 backend attempts to match small-immediate versions of instructions before
the full size immediate versions.

llvm-svn: 25937
2006-02-03 18:06:02 +00:00
Evan Cheng
7c8bab62e5 (store (op (load ...))) folding problem. In the generated matching code,
Chain is initially set to the chain operand of store node, when it reaches
load, if it matches the load then Chain is set to the chain operand of the
load.

However, if the matching code that follows this fails, isel moves on to the
next pattern but it does not restore Chain to the chain operand of the store.
So when it tries to match the next store / op / load pattern it would fail on
the Chain == load.getOperand(0) test.

The solution is for each chain operand to get a unique name. e.g. Chain10.

llvm-svn: 25931
2006-02-03 06:22:41 +00:00
Evan Cheng
efdfb534a7 If a pattern's root node is a constant, its size should be 3 rather than 2.
llvm-svn: 25870
2006-02-01 06:06:31 +00:00
Chris Lattner
b7616b85bc simplify some code
llvm-svn: 25791
2006-01-29 20:01:35 +00:00
Andrew Lenharth
1ba3cfd622 it is nice not to chop off bits for those blessed with lots of bits
llvm-svn: 25766
2006-01-29 05:22:37 +00:00
Andrew Lenharth
fde505e9f5 make the casts actually cast to the variable type
llvm-svn: 25765
2006-01-29 05:17:22 +00:00
Andrew Lenharth
896015b24f start of the 64bit safety cleanup
llvm-svn: 25764
2006-01-29 05:07:04 +00:00
Chris Lattner
024ea8e7ca Emit series of conditionals with &&, emitting stuff like this:
if (N1.getOpcode() == ISD::LOAD &&
        N1.hasOneUse() &&
        !CodeGenMap.count(N1.getValue(0)) &&
        !CodeGenMap.count(N1.getValue(1))) {

instead of this:

    if (N1.getOpcode() == ISD::LOAD) {
      if (N1.hasOneUse()) {
        if (!CodeGenMap.count(N1.getValue(0))) {
          if (!CodeGenMap.count(N1.getValue(1))) {

llvm-svn: 25763
2006-01-29 04:41:05 +00:00
Chris Lattner
8624868903 Factor matching code that is common between patterns. This works around
GCC not jump-threading across this common code, and produces far nicer
output.

llvm-svn: 25762
2006-01-29 04:25:26 +00:00
Chris Lattner
f94049edf9 Split out code generation from analysis from emission
llvm-svn: 25759
2006-01-29 02:57:39 +00:00
Chris Lattner
6be3b584f4 move some code around, no change in the generated code
llvm-svn: 25758
2006-01-29 02:43:35 +00:00
Chris Lattner
3cdfba635c now that we have control over emission of the code, emit the code using nested
"if" statements (indenting it appropriately, of course) instead of using goto's.

This inverts the logic for all of the if statements, which makes things simpler
to understand in addition to making the generated code easier to read.

llvm-svn: 25757
2006-01-28 20:43:52 +00:00
Chris Lattner
b6fc7b5e71 Change PatternCodeEmitter to emit code into a buffer instead of emitting it
directly to the output file.  This makes things simple because the code doesn't
have to worry about indentation or the case when there is no goto.  It also
allows us to indent the code better without touching everything :)

llvm-svn: 25756
2006-01-28 20:31:24 +00:00
Chris Lattner
d9026d62f8 Fit to 80 columns, no functionality change
llvm-svn: 25752
2006-01-28 19:06:51 +00:00
Jeff Cohen
96bb922537 Teach tablegen to generate code that is VC++ warning-free.
llvm-svn: 25709
2006-01-27 22:22:28 +00:00
Evan Cheng
450fcb1d91 (store (op (load ...)), ...)
If store's chain operand is load, then use load's chain operand instead. If
it isn't (likely a TokenFactor), then do not allow the folding.

llvm-svn: 25708
2006-01-27 22:13:45 +00:00
Chris Lattner
0ee2c3b109 Teach the dag selectors to select InlineAsm nodes.
Aren't we happy the pattern selectors are almost all gone?

llvm-svn: 25666
2006-01-26 23:08:55 +00:00
Evan Cheng
8b6fb0763c Another folding problem: if a node r/w chain or flag, don't fold it if it
has already been selected. The number of use check is not strong enough since
a node can be replaced with newly created target node. e.g. If the original
node has two uses, when it is selected for one of the uses it is replaced with
another. Each node now has a single use but isel still should not fold it.

llvm-svn: 25651
2006-01-26 19:13:45 +00:00
Evan Cheng
37d647c562 Add a FIXME comment.
llvm-svn: 25635
2006-01-26 02:13:31 +00:00
Evan Cheng
849d522805 Incoming (and optional) flag bugs. They may be embedded inside a inner node of
a pattern. Also, nodes which take incoming flag should not be folded if it has
more than one use.

llvm-svn: 25627
2006-01-26 00:22:25 +00:00