Commit Graph

792 Commits

Author SHA1 Message Date
Bill Wendling 98d2104c6f Add support for the v1i64 type. This makes better code for this:
#include <mmintrin.h>

extern __m64 C;

void baz(__v2si *A, __v2si *B)
{
  *A = C;
  _mm_empty();
}

We get this:

_baz:
        call "L1$pb"
"L1$pb":
        popl %eax
        movl L_C$non_lazy_ptr-"L1$pb"(%eax), %eax
        movq (%eax), %mm0
        movl 4(%esp), %eax
        movq %mm0, (%eax)
        emms
        ret

GCC gives us this:

_baz:
        pushl   %ebx
        call    L3
"L00000000001$pb":
L3:
        popl    %ebx
        subl    $8, %esp
        movl    L_C$non_lazy_ptr-"L00000000001$pb"(%ebx), %eax
        movl    (%eax), %edx
        movl    4(%eax), %ecx
        movl    16(%esp), %eax
        movl    %edx, (%eax)
        movl    %ecx, 4(%eax)
        emms
        addl    $8, %esp
        popl    %ebx
        ret

llvm-svn: 35351
2007-03-26 07:53:08 +00:00
Evan Cheng 9d7d130835 Recognize target instruction flag 'isReMaterializable'.
llvm-svn: 35159
2007-03-19 06:20:37 +00:00
Anton Korobeynikov ed4b303c10 Refactoring of formal parameter flags. Enable properly use of
zext/sext/aext stuff.

llvm-svn: 35008
2007-03-07 16:25:09 +00:00
Anton Korobeynikov e7ec3bc7bc Use new SDIselParamAttr enumeration. This removes "magick" constants
from formal attributes' flags processing.

llvm-svn: 34963
2007-03-06 08:12:33 +00:00
Chris Lattner 7fb0823a7b rename some CCActions
llvm-svn: 34724
2007-02-28 05:29:06 +00:00
Chris Lattner 22778a3d1c implement CCPromoteToType
llvm-svn: 34720
2007-02-28 04:43:48 +00:00
Chris Lattner cbebe4600f reapply
llvm-svn: 34697
2007-02-27 22:08:27 +00:00
Chris Lattner bf5f3945fd *** empty log message ***
llvm-svn: 34696
2007-02-27 22:05:51 +00:00
Evan Cheng 116ec30e4f Backing out
CodeGenTarget.cpp updated: 1.82 -> 1.83
Record.cpp updated: 1.55 -> 1.56
Record.h updated: 1.59 -> 1.60
TableGen.cpp updated: 1.47 -> 1.48
It's missing CallingConvEmitter.h

llvm-svn: 34693
2007-02-27 21:44:08 +00:00
Chris Lattner fa024e1ad1 initial support for calling convention generation, still unfinished.
llvm-svn: 34682
2007-02-27 20:43:37 +00:00
Chris Lattner 68a8bcce99 emit an enum value for the # of target registers.
llvm-svn: 34624
2007-02-26 03:34:38 +00:00
Chris Lattner 49e58cfe42 the lengths of the strings are known, just use memcmp
llvm-svn: 34321
2007-02-15 19:26:16 +00:00
Chris Lattner 1e92e06779 Implement Function::getIntrinsicID without it needing to call Value::getName,
which allocates a string.  This speeds up instcombine on 447.dealII by 5%.

llvm-svn: 34318
2007-02-15 19:17:16 +00:00
Reid Spencer 09575bac2e For PR1195:
Change use of "packed" term to "vector" in comments, strings, variable
names, etc.

llvm-svn: 34300
2007-02-15 03:39:18 +00:00
Reid Spencer d84d35ba70 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.

llvm-svn: 34293
2007-02-15 02:26:10 +00:00
Jim Laskey 2682ea616f Automatically generating intrinsic declarations from Dan Gohman. Modified
to construct FunctionType in separate function, and, have getDeclaration
return a Function instead of a Constant.

llvm-svn: 34008
2007-02-07 20:38:26 +00:00
Reid Spencer 008e65ff96 Set the new NO_INSTALL flag for build-only tools.
llvm-svn: 33967
2007-02-06 18:51:28 +00:00
Jim Laskey 132fb185ee Error check and eliminate unnecessary value.
llvm-svn: 33966
2007-02-06 18:30:58 +00:00
Jim Laskey 207230b984 Regenerate.
llvm-svn: 33965
2007-02-06 18:20:07 +00:00
Jim Laskey a9e7064774 Deemed too cute to live.
llvm-svn: 33964
2007-02-06 18:19:44 +00:00
Jim Laskey f4163f9bbc Regenerate.
llvm-svn: 33963
2007-02-06 18:03:31 +00:00
Jim Laskey 5aed30d5cf Support var arg intrinsics.
llvm-svn: 33962
2007-02-06 18:02:54 +00:00
Jim Laskey 73e79b5a43 Make the constant honest.
llvm-svn: 33557
2007-01-26 23:00:54 +00:00
Jim Laskey 214c582002 Files missing from LABEL check in.
llvm-svn: 33539
2007-01-26 17:29:20 +00:00
Chris Lattner 100602d756 Make tblgen error more useful. Patch by B. Scott Michel
llvm-svn: 33295
2007-01-17 07:45:12 +00:00
Reid Spencer 7a9c62baa6 For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.

This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
   bits in an integer. The Type classes SubclassData field is used to
   store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
   64-bit integers. These are replaced with just IntegerType which is not
   a primitive any more.
3. Adjust the rest of LLVM to account for this change.

Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types.  Future increments
will rectify this situation.

llvm-svn: 33113
2007-01-12 07:05:14 +00:00
Reid Spencer bc013ba367 For PR950:
Convert signed integer types to signless.

llvm-svn: 32786
2006-12-31 05:50:28 +00:00
Jim Laskey 3f7d047a14 Ignore entries with blank names.
llvm-svn: 32491
2006-12-12 20:55:58 +00:00
Jim Laskey 8171e58bd9 Rollback changes to take a different tack.
llvm-svn: 32488
2006-12-12 19:26:50 +00:00
Jim Laskey 7c3cab9ddc Honor the command line specification for machine type.
llvm-svn: 32483
2006-12-12 16:07:33 +00:00
Bill Wendling 9bfb1e1f29 What should be the last unnecessary <iostream>s in the library.
llvm-svn: 32333
2006-12-07 22:21:48 +00:00
Evan Cheng 8e94078483 Match TargetInstrInfo changes.
llvm-svn: 32107
2006-12-01 22:57:41 +00:00
Chris Lattner 55b8683d24 Fix PR1001, patch by Nikhil Patil!
llvm-svn: 31880
2006-11-20 18:54:33 +00:00
Evan Cheng 71adba6dce Add opcode to TargetInstrDescriptor.
llvm-svn: 31804
2006-11-17 01:46:27 +00:00
Chris Lattner 78a403f90e Remove the isTwoAddress property from the CodeGenInstruction class. It should
not be used for anything other than backwards compat constraint handling.

Add support for a new DisableEncoding property which contains a list of
registers that should not be encoded by the generated code emitter.  Convert
the codeemitter generator to use this, fixing some PPC JIT regressions.

llvm-svn: 31769
2006-11-15 23:23:02 +00:00
Chris Lattner c94f214d22 ADd support for adding constraints to suboperands
llvm-svn: 31748
2006-11-15 02:38:17 +00:00
Chris Lattner c75081b7a8 restore some 'magic' code that I removed: it is needed. Add comments explaining
why.

llvm-svn: 31743
2006-11-14 22:17:10 +00:00
Chris Lattner c5dd5b11a4 minimal hack to get patterns whose result type is iPTR to be selected.
llvm-svn: 31742
2006-11-14 21:50:27 +00:00
Chris Lattner 75165d07a0 remove some dead code
llvm-svn: 31740
2006-11-14 21:41:35 +00:00
Chris Lattner 7c9f48cefb Add support for nodes that return iPTR.
llvm-svn: 31739
2006-11-14 21:32:01 +00:00
Chris Lattner 110c777f2c changes to get ptr_rc to be accepted in patterns. This is needed for ppc preinc
stores.

llvm-svn: 31738
2006-11-14 21:18:40 +00:00
Chris Lattner f8c06b335d Fix a bug handling nodes with variable arguments. The code was fixed to assume
that there were two input operands before the variable operand portion.  This
*happened* to be true for all call instructions, which took a chain and a
destination, but was not true for the PPC BCTRL instruction, whose destination
is implicit.

Making this code more general allows elimination of the custom selection logic
for BCTRL.

llvm-svn: 31732
2006-11-14 18:41:38 +00:00
Chris Lattner ba7b3673f9 allow ptr_rc to explicitly appear in an instructions operand list, it doesn't
have to be a subpart of a complex operand.

llvm-svn: 31618
2006-11-10 02:01:40 +00:00
Evan Cheng 1698c2999c Remove M_2_ADDR_FLAG.
llvm-svn: 31583
2006-11-09 02:22:54 +00:00
Evan Cheng 7120b9e9c7 Divide select methods into groups by SelectionDAG node opcodes (ISD::ADD,
X86ISD::CMP, etc.) instead of SDNode names (add, x86cmp, etc). We now allow
multiple SDNodes to map to the same SelectionDAG node (e.g. store, indexed
store).

llvm-svn: 31575
2006-11-08 23:01:03 +00:00
Evan Cheng d715a2cbfb Always pass the root node to ComplexPattern isel matching function.
llvm-svn: 31570
2006-11-08 20:31:10 +00:00
Chris Lattner 5d14eac21d emit TIED_TO correctly
llvm-svn: 31484
2006-11-07 01:27:55 +00:00
Chris Lattner f62138e792 Mark predicate operands as such in operand info.
llvm-svn: 31483
2006-11-06 23:53:31 +00:00
Chris Lattner 33f5a51020 simplify the way operand flags and constraints are handled, making it easier
to extend.

llvm-svn: 31481
2006-11-06 23:49:51 +00:00
Chris Lattner 8a9c91de33 recognize ppc's blr instruction as predicated
llvm-svn: 31480
2006-11-06 21:44:54 +00:00
Chris Lattner 698c900b0c regenerate
llvm-svn: 31472
2006-11-05 23:28:58 +00:00
Jeff Cohen 7d6f3db3e2 Unbreak VC++ build.
llvm-svn: 31464
2006-11-05 19:31:28 +00:00
Evan Cheng 3cb5bf721c Clean up some code.
llvm-svn: 31451
2006-11-04 09:40:23 +00:00
Chris Lattner ed07f23c52 Parse PredicateOperand's. When an instruction takes one, have the generated
isel fill in the instruction operands with the 'execute always' value
automatically.

llvm-svn: 31448
2006-11-04 05:12:02 +00:00
Chris Lattner 1faa9097c7 First steps to getting PredicateOperand's to work. This handles instruction
and pat pattern definitions.  Codegen is not right for them yet.

llvm-svn: 31444
2006-11-04 01:35:50 +00:00
Chris Lattner 7982de167f eliminate need for the NumMIOperands field in Operand.
llvm-svn: 31432
2006-11-03 23:45:17 +00:00
Reid Spencer 03c6038226 Remove an unused variable.
llvm-svn: 31403
2006-11-03 01:48:30 +00:00
Reid Spencer 5314f04de5 Don't write out variables that are never used.
llvm-svn: 31396
2006-11-03 01:28:12 +00:00
Chris Lattner 71f55131d4 silence warnings
llvm-svn: 31392
2006-11-03 01:11:05 +00:00
Reid Spencer 6152ad000c Revert last patch which causes tblgen to segfault (why, I'm not sure).
llvm-svn: 31383
2006-11-02 21:07:40 +00:00
Reid Spencer 2a82686563 For PR786:
Remove unused variables.

llvm-svn: 31381
2006-11-02 20:46:16 +00:00
Evan Cheng 3557a39494 Tied-to constraint must be op_with_larger_idx = op_with_smaller_idx or else throw an exception.
llvm-svn: 31361
2006-11-01 23:03:11 +00:00
Evan Cheng 23654935f4 Not meant to be checked in.
llvm-svn: 31334
2006-11-01 00:27:59 +00:00
Evan Cheng ac79c7c4c0 Add operand constraints to TargetInstrInfo.
llvm-svn: 31333
2006-11-01 00:27:05 +00:00
Evan Cheng a74965f15a Passing isel root and use operands to ComplexPattern functions, these should do the usual load folding checks as well.
llvm-svn: 30972
2006-10-16 06:33:44 +00:00
Evan Cheng cfb9526d61 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.

llvm-svn: 30956
2006-10-14 08:30:15 +00:00
Evan Cheng 1d04dd3aac Really remove dead nodes from isel queue.
llvm-svn: 30923
2006-10-12 23:18:52 +00:00
Evan Cheng 8e770f5589 Use RemoveDeadNode to kill dead node.
llvm-svn: 30917
2006-10-12 20:35:19 +00:00
Evan Cheng d7125583f7 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.

llvm-svn: 30897
2006-10-12 02:08:53 +00:00
Evan Cheng 2022c79d7f Added properties such as SDNPHasChain to ComplexPattern.
llvm-svn: 30890
2006-10-11 21:02:01 +00:00
Chris Lattner c52dab5894 regenerate
llvm-svn: 30888
2006-10-11 18:13:09 +00:00
Chris Lattner 9d9de698b5 Add support for let expressions around an mdef. This implements a new part
of Regression/TableGen/MultiClass.td.

llvm-svn: 30887
2006-10-11 18:12:44 +00:00
Chris Lattner f405928e86 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.

llvm-svn: 30871
2006-10-11 04:05:55 +00:00
Chris Lattner 66fbbca1e7 Split some code out into a new method. The generated code is exactly
identical, this is just a refactoring.

llvm-svn: 30868
2006-10-11 03:35:34 +00:00
Evan Cheng 75a1b70da8 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.

llvm-svn: 30845
2006-10-09 21:02:17 +00:00
Chris Lattner 560804cc50 regenerate
llvm-svn: 30799
2006-10-07 07:15:19 +00:00
Chris Lattner dfbda3598d Bugfix: this allows multiclasses to have default arguments.
llvm-svn: 30798
2006-10-07 07:14:48 +00:00
Chris Lattner 8111c59279 Fix more static dtor issues
llvm-svn: 30725
2006-10-04 21:52:35 +00:00
Chris Lattner 5d751b4a3a This:
AggregateString += "\0\0";

Doesn't add two nuls to the AggregateString (for obvious reasons), which
broke the asmprinter when the first character of an asm string was not
literal text.

llvm-svn: 30625
2006-09-27 16:44:09 +00:00
Chris Lattner 8d21485660 Actually, name the method PrintSpecial to match other stuff in AsmPrinter.h
llvm-svn: 30618
2006-09-26 23:47:10 +00:00
Chris Lattner 5fd0154523 Add support for ${:foo} syntax, where "foo" is passed into "printSpecial" and
has no associated operand.  This is useful for portably encoding stuff like
the comment character into an asm string.

llvm-svn: 30617
2006-09-26 23:45:08 +00:00
Chris Lattner 7d3fd4f888 don't allow 'imm' or specific imms, like '1' on the LHS of a binop.
This shrinks X86GenDAGISel by ~330 lines.

llvm-svn: 30574
2006-09-21 20:46:13 +00:00
Chris Lattner 99ae714459 Fit to 80 columns.
llvm-svn: 30572
2006-09-21 18:28:27 +00:00
Evan Cheng 9de003670f Allow PatFrag to be a leaf node.
llvm-svn: 30498
2006-09-19 19:08:04 +00:00
Evan Cheng 00b2848adb Add result of a Xform to isel queue.
llvm-svn: 30497
2006-09-19 18:40:15 +00:00
Chris Lattner bea5f91946 If multiple predicates are listed, they must all pass
llvm-svn: 30476
2006-09-19 00:41:36 +00:00
Chris Lattner bba17b9913 There!
llvm-svn: 30473
2006-09-18 22:41:07 +00:00
Chris Lattner 82a73a1989 Fix Regression/TableGen/2006-09-18-LargeInt.td
llvm-svn: 30472
2006-09-18 22:28:27 +00:00
Chris Lattner 3ffda067e3 Relax this check.
llvm-svn: 30381
2006-09-14 23:54:24 +00:00
Evan Cheng 1ec61ba00a 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).

llvm-svn: 30242
2006-09-11 02:24:43 +00:00
Evan Cheng 5a798b0648 Generated isel should favors explicit constant operand (+2) over an operand with a predicate (+1).
llvm-svn: 30180
2006-09-08 07:26:39 +00:00
Chris Lattner a2d7d1c4fa Fix JIT encoding of two-addr instructions.
llvm-svn: 30111
2006-09-05 03:01:52 +00:00
Chris Lattner 13a5dcddce Fix a long-standing wart in the code generator: two-address instruction lowering
actually *removes* one of the operands, instead of just assigning both operands
the same register.  This make reasoning about instructions unnecessarily complex,
because you need to know if you are before or after register allocation to match
up operand #'s with the target description file.

Changing this also gets rid of a bunch of hacky code in various places.

This patch also includes changes to fold loads into cmp/test instructions in
the X86 backend, along with a significant simplification to the X86 spill
folding code.

llvm-svn: 30108
2006-09-05 02:12:02 +00:00
Chris Lattner 70fd01a1b8 Make sure to clear CurDefmPrefix = 0, otherwise stuff after a defm won't
parse right.  This fixes TableGen/MultiClass.td

llvm-svn: 30037
2006-09-01 22:07:27 +00:00
Chris Lattner c05fac8b83 fix an assertion with multidefs. Def inside of multiclasses don't need to
be complete.

llvm-svn: 30034
2006-09-01 21:59:03 +00:00
Chris Lattner aec1af2239 regenerate
llvm-svn: 30029
2006-09-01 21:14:42 +00:00
Chris Lattner 66b7235877 Add often-requested support for defining "multiclasses" which can be instantiated.
This allows you to define multiple definitions with one line, encouraging
more .td file factoring.

llvm-svn: 30027
2006-09-01 21:13:49 +00:00
Reid Spencer 97c598083e Add virtual methods to all subclasses so they are not overloaded.
llvm-svn: 29930
2006-08-28 00:12:25 +00:00
Chris Lattner 251468e9d0 Use compiler.h instead of hand rolling our own macro
llvm-svn: 29913
2006-08-27 13:16:24 +00:00
Evan Cheng 44ce57d5c2 Do not emit getTargetNode() and SelectNodeTo() which takes more than 3
SDOperand arguments. Use the variants which take an array and number instead.

llvm-svn: 29906
2006-08-27 08:11:28 +00:00
Evan Cheng 34b70eea5c SelectNodeTo now returns a SDNode*.
llvm-svn: 29901
2006-08-26 08:00:10 +00:00
Evan Cheng b7b5ba5aaf Minor getCopyToReg() call change.
llvm-svn: 29900
2006-08-26 07:39:28 +00:00
Evan Cheng 61413a3d72 Select() no longer require Result operand by reference.
llvm-svn: 29898
2006-08-26 05:34:46 +00:00
Evan Cheng a8b2b6c7ff Remove dead code.
llvm-svn: 29897
2006-08-26 01:34:15 +00:00
Evan Cheng eaf9fba2ff A bit more clean up.
llvm-svn: 29893
2006-08-26 01:02:19 +00:00
Evan Cheng 548bd0dc95 - 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.

llvm-svn: 29892
2006-08-26 00:59:04 +00:00
Evan Cheng 63d178f473 SelectNodeTo() may return a SDOperand that is different from the input.
llvm-svn: 29726
2006-08-16 07:30:09 +00:00
Chris Lattner d16696d115 The generated runloop shouldn't require Select to update 'Result'. In fact
we'd like to remove result entirely.

llvm-svn: 29713
2006-08-15 23:42:26 +00:00
Chris Lattner 72608b5387 allow Select to return the node being selected if RAU isn't needed.
llvm-svn: 29712
2006-08-15 23:27:50 +00:00
Evan Cheng 962752dcea Use SmallVector instead.
llvm-svn: 29619
2006-08-11 18:33:41 +00:00
Evan Cheng 0d3a754ae8 - 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.

llvm-svn: 29602
2006-08-11 08:59:35 +00:00
Chris Lattner f9cab8c965 Revert previous patch
llvm-svn: 29585
2006-08-09 16:44:44 +00:00
Tanya Lattner 7f935ba0ae Reverting back to original 1.8 version so I can manually merge in patch.
llvm-svn: 29584
2006-08-09 16:41:21 +00:00
Chris Lattner c24a1d3093 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.

llvm-svn: 29566
2006-08-08 02:23:42 +00:00
Evan Cheng 97d5cc165a Making TableGen'd instruction selection code non-recursive. This fixes PR805.
llvm-svn: 29548
2006-08-07 22:17:58 +00:00
Chris Lattner b359a7a69c Remove some extraneous newlines.
llvm-svn: 29492
2006-08-03 00:42:26 +00:00
Chris Lattner 6379c96c07 Really add support for compilers without noinline
llvm-svn: 29491
2006-08-03 00:26:13 +00:00
Evan Cheng 70c4ae4bda Pass N by reference to select functions to prevent gcc from allocating more stack.
llvm-svn: 29423
2006-08-01 01:07:48 +00:00
Evan Cheng c1163d2fa7 Remove an unneeded match condition: the type check for root node has been
moved to outside the actual select routine.

llvm-svn: 29415
2006-07-31 19:01:58 +00:00
Evan Cheng 149130ad6b 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.

llvm-svn: 29404
2006-07-28 22:51:01 +00:00
Evan Cheng 75a22216f7 Clean up.
llvm-svn: 29378
2006-07-28 01:19:22 +00:00
Evan Cheng e2a3f7014d Rename IsFoldableBy to CanBeFoldedleBy
llvm-svn: 29376
2006-07-28 01:03:48 +00:00
Evan Cheng b572401bea Remove InFlightSet hack. No longer needed.
llvm-svn: 29373
2006-07-28 00:47:19 +00:00
Evan Cheng 7b0ed57543 Remove dead code.
llvm-svn: 29359
2006-07-27 19:59:34 +00:00
Evan Cheng 061aba35c1 Let each target specific isel provide routine to check if a chain producing node is foldable by another.
llvm-svn: 29335
2006-07-27 06:36:49 +00:00
Evan Cheng 9384400d83 Fix for bug 840. Only use noinline attribute if gcc version >= 3.4
llvm-svn: 29311
2006-07-26 23:06:27 +00:00
Evan Cheng 774d8fd1ef Removed a hack intended to allow (store (op (load))) folding. Will handle this with preprocessing.
llvm-svn: 29258
2006-07-21 22:19:51 +00:00
Jim Laskey 4b49c23571 Eliminate data relocations by using NULL instead of global empty list.
llvm-svn: 29250
2006-07-21 21:15:20 +00:00
Jim Laskey 4e153f1b91 Use an enumeration to eliminate data relocations.
llvm-svn: 29249
2006-07-21 20:57:35 +00:00
Evan Cheng c62c697955 Also checks for noResults field.
llvm-svn: 29235
2006-07-20 23:36:20 +00:00
Evan Cheng 2884b5cc93 Make sub- and super- register classes const.
llvm-svn: 29200
2006-07-19 05:58:18 +00:00
Chris Lattner 3650465273 Fix a bug handling instructions, like blr, which just consist of a text
string.  The return value of printInstruction should be true for these.

llvm-svn: 29196
2006-07-19 01:39:06 +00:00
Evan Cheng c767acd25a Add code size to target instruction use it as the 3rd isel sorting tie-breaker.
llvm-svn: 29193
2006-07-19 00:24:41 +00:00
Evan Cheng aeccc6e676 Make sub- super- reg-class tables static.
llvm-svn: 29190
2006-07-18 22:18:31 +00:00
Chris Lattner 68ee5cfe10 Fix case where identical cases were not detected across case #0, because
instructions not handled would have a case value of #0, throwing things off.
This marginally shrinks the X86 asmprinter, but shrinks the sparc asmwriter
by 25 lines.

llvm-svn: 29187
2006-07-18 19:27:30 +00:00
Chris Lattner 6e17208dff Fix an accidentally duplicated line that caused tblgen to crash on itanium.
Add an assert that catches the real problem earlier.

llvm-svn: 29185
2006-07-18 19:06:01 +00:00
Chris Lattner edee52570c Maximally group commands. When all instructions within a command set have a
series of identical commands, handle them all with one switch.  In the case
of the x86 at&t asm printer, only 3 switches are needed for all instructions.

llvm-svn: 29184
2006-07-18 18:28:27 +00:00
Chris Lattner cb0c848d34 Change generator to remove operands as it processes them. No change in
generated file.

llvm-svn: 29183
2006-07-18 17:56:07 +00:00
Chris Lattner 9d250696b7 Handle the last operand more intelligently. When emitting the \n, also
return from the asmprinter to make the generated asmprinter both more
efficient and smaller.

llvm-svn: 29182
2006-07-18 17:50:22 +00:00
Chris Lattner 75dcf6cbd8 Emit switches with 1/2 cases as unconditional code or an if/then/else for
tidyness.

llvm-svn: 29181
2006-07-18 17:43:54 +00:00
Chris Lattner 66e288bec3 Steal bits from the asm string index to use for operand information. On both
x86 and ppc, this gets us 4 more bits to play with, since the string indices
both only use 12 bits.

llvm-svn: 29180
2006-07-18 17:38:46 +00:00
Chris Lattner 1ac0eb7f8b Merge operand info and asmstr idx into a single 32-bit field. No other change.
llvm-svn: 29179
2006-07-18 17:32:27 +00:00
Chris Lattner 692374c748 Completely change the structure of the generated asmprinter to be more table
based and less switch-statements-with-hundreds-of-cases based.  This shrinks
the x86 asmprinters to about 1/3 their previous size.

Other improvements coming.

llvm-svn: 29177
2006-07-18 17:18:03 +00:00
Evan Cheng 95454e7a2f Use __attribute__((noinline)) only if compiled by gcc.
llvm-svn: 29161
2006-07-16 06:14:37 +00:00
Evan Cheng 87b2fe9474 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.

llvm-svn: 29160
2006-07-16 06:12:52 +00:00
Evan Cheng 69367fedd2 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.

llvm-svn: 29158
2006-07-15 08:45:20 +00:00
Chris Lattner 45fcadc9f0 The generated index array should be const.
llvm-svn: 29155
2006-07-14 23:14:02 +00:00
Chris Lattner e32982cc52 Emit the string information for the asm writer as a single large string
and index into it, instead of emitting it like this:

  static const char * const OpStrs[] = {
    "PHINODE\n",        // PHI
    0,  // INLINEASM
    "adc ",     // ADC32mi
    "adc ",     // ADC32mi8
   ...

The old way required thousands of relocations that slows down link time and
dynamic load times.

This also cuts about 10K off each of the X86 asmprinters, and should shrink
the others as well.

llvm-svn: 29152
2006-07-14 22:59:11 +00:00
Jim Laskey 10d4b040ac Clean up.
llvm-svn: 29137
2006-07-13 22:17:08 +00:00
Jim Laskey a44f6269bf 1. Simplfy bit operations.
2. Coalesce instruction cases.

llvm-svn: 29135
2006-07-13 21:02:53 +00:00
Jim Laskey 23bd480cea Move base value of instruction to lookup table to prepare for case reduction.
llvm-svn: 29122
2006-07-12 19:15:43 +00:00
Jim Laskey f7300b2706 It was pointed out that DEBUG() is only available with -debug.
llvm-svn: 29106
2006-07-11 18:25:13 +00:00
Jim Laskey c3d341ea98 Ensure that dump calls that are associated with asserts are removed from
non-debug build.

llvm-svn: 29105
2006-07-11 17:58:07 +00:00
Jim Laskey 57e4363171 Reduce bloat in target libraries by removing per machine instruction assertion
from code emitter generation.

llvm-svn: 29097
2006-07-11 01:25:59 +00:00
Chris Lattner f0858cb910 tblgen uses EH
llvm-svn: 29034
2006-07-07 00:21:17 +00:00
Evan Cheng d19938834b Ugly hack! Add helper functions InsertInFlightSetEntry and
RemoveInFlightSetEntry. They are used in place of direct set operators to
reduce instruction selection function stack size.

llvm-svn: 28987
2006-06-29 23:57:05 +00:00
Chris Lattner 3c71a13e06 Fix an error message regression. Print:
LI8:    (LI8:i64 (imm:i64):$imm)
instead of:
  LI8:    (LI8:MVT::i64 (imm:MVT::i64):$imm)

llvm-svn: 28868
2006-06-20 00:56:37 +00:00
Chris Lattner c23e641055 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.

llvm-svn: 28865
2006-06-20 00:31:27 +00:00
Chris Lattner 9500b343db 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.

llvm-svn: 28863
2006-06-20 00:18:02 +00:00
Chris Lattner 4b464768d1 Improve a comment.
llvm-svn: 28833
2006-06-16 18:25:06 +00:00
Evan Cheng 55772ccfd6 Instructions with variable operands (variable_ops) can have a number required
operands. e.g.
def CALL32r : I<0xFF, MRM2r, (ops GR32:$dst, variable_ops),
                "call {*}$dst", [(X86call GR32:$dst)]>;
TableGen should emit operand informations for the "required" operands.

Added a target instruction info flag M_VARIABLE_OPS to indicate the target
instruction may have more operands in addition to the minimum required
operands.

llvm-svn: 28791
2006-06-15 07:22:16 +00:00
Evan Cheng 5d038cf802 Allow more use of iPTR in patterns.
llvm-svn: 28790
2006-06-15 00:16:37 +00:00
Evan Cheng ff7c28dfdd Added support for variable_ops.
llvm-svn: 28788
2006-06-14 22:22:20 +00:00
Evan Cheng 1ce02e4c49 Fix support for optional input flag.
llvm-svn: 28784
2006-06-14 19:27:50 +00:00
Evan Cheng 632ee8de55 getOperandNum(): error if specified operand number is out of range.
llvm-svn: 28775
2006-06-13 21:47:27 +00:00
Chris Lattner deafba0325 Wrap to 80 cols
llvm-svn: 28743
2006-06-09 23:59:44 +00:00
Reid Spencer 5cb722f320 Don't build tblgen with -pedantic or -Wno-long-long
llvm-svn: 28638
2006-06-01 18:20:23 +00:00
Evan Cheng cc8c0233b6 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.

llvm-svn: 28476
2006-05-25 20:16:55 +00:00
Evan Cheng 07a4e5ceb1 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).

llvm-svn: 28458
2006-05-25 00:21:44 +00:00
Chris Lattner e7549961cf Don't make zero-sized static arrays
llvm-svn: 28448
2006-05-24 17:31:02 +00:00
Chris Lattner aa2372562e Patches to make the LLVM sources more -pedantic clean. Patch provided
by Anton Korobeynikov!  This is a step towards closing PR786.

llvm-svn: 28447
2006-05-24 17:04:05 +00:00
Evan Cheng 886e8f35aa 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.

llvm-svn: 28389
2006-05-19 07:24:32 +00:00
Evan Cheng d8e2f6ebc1 lib/Target/Target.td
llvm-svn: 28386
2006-05-18 20:42:07 +00:00
Evan Cheng fe72285033 Don't generate getCalleeSaveReg and getCalleeSaveRegClasses anymore.
llvm-svn: 28376
2006-05-18 00:08:46 +00:00
Evan Cheng 318a68e1ee Typo
llvm-svn: 28366
2006-05-17 20:55:51 +00:00
Evan Cheng f5ef47fe74 Remove PointerType from target definition. Use abstract type MVT::iPTR to
represent pointer type.

llvm-svn: 28363
2006-05-17 20:37:59 +00:00
Evan Cheng d985d66781 Allow patterns to refer to physical registers that belong to multiple
register classes.

llvm-svn: 28323
2006-05-16 07:05:30 +00:00
Evan Cheng 21c7c23d7e Noop instruction
llvm-svn: 28241
2006-05-12 07:47:00 +00:00
Evan Cheng e2c1aedc23 Unused instruction
llvm-svn: 28240
2006-05-12 07:42:01 +00:00
Evan Cheng 229a6d0026 Also add super- register classes info.
llvm-svn: 28221
2006-05-11 07:30:26 +00:00
Evan Cheng 32982836b6 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.

llvm-svn: 28209
2006-05-10 02:47:57 +00:00
Evan Cheng d2b8067748 Fix a load folding bug. It is exposed by a multi- resulting instructions
def : Pat<> pattern.

llvm-svn: 28208
2006-05-10 00:05:46 +00:00
Evan Cheng 5e7ba0b049 Add sub-register class information.
llvm-svn: 28195
2006-05-09 06:34:26 +00:00
Evan Cheng 386fb9b0fd Set isStore of instructions with ISD::TRUNCSTORE root node.
llvm-svn: 28075
2006-05-03 02:08:34 +00:00
Chris Lattner 4b177f089e Put instruction names into the first non TargetInstrInfo namespace found.
llvm-svn: 28043
2006-05-01 23:46:16 +00:00
Chris Lattner 017b93dd7c instructions can be in different namespaces. Make sure to use the right
one for each instruction.

llvm-svn: 28038
2006-05-01 17:01:17 +00:00
Evan Cheng 8e63393bc3 Formating
llvm-svn: 28036
2006-05-01 09:30:17 +00:00
Evan Cheng c2ef5e34a8 Mark instructions whose pattern is (store ...) isStore.
llvm-svn: 28032
2006-05-01 09:04:20 +00:00
Evan Cheng c5e8ce8b8c Remove the temporary option: -no-isel-fold-inflight
llvm-svn: 28012
2006-04-28 18:54:11 +00:00
Evan Cheng 54acf6eddc 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.

llvm-svn: 28002
2006-04-28 02:08:10 +00:00
Nate Begeman 4ca2ea5b43 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.

llvm-svn: 27947
2006-04-22 18:53:45 +00:00
Chris Lattner 778509c844 Don't fill in fields that no longer exist.
llvm-svn: 27898
2006-04-20 18:32:22 +00:00
Evan Cheng 9235d848b7 Rename AddedCost to AddedComplexity.
llvm-svn: 27841
2006-04-19 20:36:09 +00:00
Evan Cheng aa3325e925 Allow "let AddedCost = n in" to increase pattern complexity.
llvm-svn: 27834
2006-04-19 18:07:24 +00:00
Reid Spencer 56fdf9ed40 Add missing things to the distribution.
llvm-svn: 27650
2006-04-13 06:27:20 +00:00
Chris Lattner 989b16e488 Fix a typo: Instr* -> Intr*
llvm-svn: 27568
2006-04-10 22:02:59 +00:00
Chris Lattner 726df0bb82 Infer element types for shuffle masks
llvm-svn: 27456
2006-04-06 20:36:51 +00:00
Chris Lattner 09575a9b0a rename a method, to avoid confusion with llvm intrinsics.
llvm-svn: 27455
2006-04-06 20:19:52 +00:00
Chris Lattner 89df307b61 Adjust the Intrinsics.gen interface a little bit
llvm-svn: 27345
2006-04-02 03:35:30 +00:00
Chris Lattner 470d0181e9 regenerate
llvm-svn: 27313
2006-03-31 21:54:11 +00:00