1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

61 Commits

Author SHA1 Message Date
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
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
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
fd9315eaaa Match getTargetNode() changes (now returns SDNode* instead of SDOperand).
llvm-svn: 26084
2006-02-09 07:16:09 +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
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
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
6be3b584f4 move some code around, no change in the generated code
llvm-svn: 25758
2006-01-29 02:43:35 +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
Chris Lattner
6efb726290 fix a broken comment
llvm-svn: 25411
2006-01-17 21:31:18 +00:00
Evan Cheng
7b8f8c317e * Remove instruction fields hasInFlag / hasOutFlag and added SNDPInFlag and
SNDPOutFlag to DAG nodes. These properties do not belong to target specific
instructions.
* Added DAG node property SNDPOptInFlag. It's same as SNDPInFlag except it's
optional. Used by ret / call, etc.

llvm-svn: 25154
2006-01-09 18:27:06 +00:00
Nate Begeman
ec7c28a28c Add support for generating v4i32 altivec code
llvm-svn: 25046
2005-12-30 00:12:56 +00:00
Evan Cheng
bd79f871a2 * Support for hasInFlag and hasOutFlag (on instructions). Remove nameless FLAG
support which is fragile.
* Fixed a number of bugs.

llvm-svn: 24996
2005-12-23 22:11:47 +00:00
Evan Cheng
578fad3f9d * Added support for FLAG - a special nameless flag register. Can be used as
either an operand or a result.
* Fixed some more flag / chain bugs.

llvm-svn: 24933
2005-12-22 02:24:50 +00:00
Evan Cheng
54695fd38d Support for read / write from explicit registers with FlagVT type.
llvm-svn: 24753
2005-12-17 01:19:28 +00:00
Evan Cheng
297c23d2e7 Added support to specify predicates.
llvm-svn: 24715
2005-12-14 22:02:59 +00:00
Chris Lattner
aaec1f6faa Add a new SDTCisPtrTy constraint, which indicates that an operand must have
the same type as the pointer type for a target.

llvm-svn: 24649
2005-12-09 22:57:42 +00:00
Evan Cheng
9586e87904 * Do not allow nodes which produce chain results (e.g. loads) to be folded if
it has more than one real use (non-chain uses).
* Record folded chain producing node in CodeGenMap.
* Do not fold a chain producing node if it has already been selected as an
  operand of a chain use.

llvm-svn: 24647
2005-12-09 22:45:35 +00:00
Evan Cheng
18134d8c96 Prevent folding of instructions which produce chains that have more than 1 real use
llvm-svn: 24643
2005-12-09 06:06:08 +00:00
Evan Cheng
1d7435f478 * Make sure complex pattern operands are selected first since their select
functions can return false and causing the instruction pattern match to fail.
* Code clean up.

llvm-svn: 24642
2005-12-09 00:48:42 +00:00
Evan Cheng
d11d31e0bd Added support for ComplexPattern. These are patterns that require C++ pattern
matching code that is not currently auto-generated by tblgen, e.g. X86
addressing mode. Selection routines for complex patterns can return multiple operands, e.g. X86 addressing mode returns 4.

llvm-svn: 24634
2005-12-08 02:00:36 +00:00
Evan Cheng
cf4f349880 * Commit the fix (by Chris) for a tblgen type inferencing bug.
* Enhanced tblgen to handle instructions which have chain operand and writes a
chain result.
* Enhanced tblgen to handle instructions which produces no results. Part of
the change is a temporary hack which relies on instruction property (e.g.
isReturn, isBranch). The proper fix would be to change the .td syntax to
separate results dag from ops dag.

llvm-svn: 24587
2005-12-04 08:18:16 +00:00
Evan Cheng
9c3508e1ab Teach tblgen to accept register source operands in patterns, e.g.
def SHL8rCL  : I<0xD2, MRM4r, (ops R8 :$dst, R8 :$src),
                 "shl{b} {%cl, $dst|$dst, %CL}",
                 [(set R8:$dst, (shl R8:$src, CL))]>, Imp<[CL],[]>;

This generates a CopyToReg operand and added its 2nd result to the shl as
a flag operand.

llvm-svn: 24557
2005-12-01 00:18:45 +00:00
Nate Begeman
466eaefd38 Stop checking the ValueType of the CodeGenInstruction. Instead, use the
ValueType from the RegisterClass or Operands.  This step is necessary to
allow RegisterClasses to have multiple ValueTypes.

llvm-svn: 24555
2005-12-01 00:06:14 +00:00
Chris Lattner
e3897f6c24 Add support for immediates directly in the pattern, this allows itanium to
define:

def : Pat<(i1 1), (CMPEQ r0, r0)>;

llvm-svn: 24149
2005-11-02 06:49:14 +00:00
Chris Lattner
b018f20c7b Make tblgen emit:
tblgen: In ZAPNOTi: Cannot use 'IZAPX' in an input pattern!
for a bad pattern, instead of an ugly assertion.

llvm-svn: 23854
2005-10-21 01:19:59 +00:00
Chris Lattner
cac2ff4864 Fix some checking that was causing duraid to get a perplexing assertion
instead of a happy error message

llvm-svn: 23816
2005-10-19 04:12:14 +00:00
Chris Lattner
a4dc9eda40 Make the generated code significantly more memory efficient, by using
SelectNodeTo instead of getTargetNode when possible.

llvm-svn: 23758
2005-10-16 01:41:58 +00:00
Chris Lattner
28621890d9 Fairly serious rework of the typing code to add new int/fp lattice values.
Overall, no functionality change yet though.

llvm-svn: 23729
2005-10-14 06:12:03 +00:00
Chris Lattner
d83bbd0f14 Add basic support for recognizing a new SDTCisOpSmallerThanOp type constraint
llvm-svn: 23725
2005-10-14 04:53:53 +00:00
Chris Lattner
81047cdfc0 Implement a couple of new (important) features.
1. If an operation has to be int or fp and the target only supports one
   int or fp type, relize that the op has to have that type.
2. If a target has operations on multiple types, do not emit matching code
   for patterns involving those operators, since we do not emit the code to
   check for them yet.  This prevents PPC from generating FP ops currently.

Also move some code around into more logical places.

llvm-svn: 23724
2005-10-14 04:11:13 +00:00
Chris Lattner
31a9d318a3 Teach tblgen to build permutations of instructions, so that the target author
doesn't have to specify them manually.  It currently handles associativity,
e.g. knowing that (X*Y)+Z  also matches  X+(Y*Z)  and will be extended in
the future.

It is smart enough to not introduce duplicate patterns or patterns that can
never match.

llvm-svn: 23526
2005-09-29 19:28:10 +00:00
Chris Lattner
86a339dc34 add support for an associative marker
llvm-svn: 23502
2005-09-28 20:58:06 +00:00
Chris Lattner
0231f57a46 Emit an error if instructions or patterns are defined but can never match.
Currently we check that immediate values live on the RHS of commutative
operators.  Defining ORI like this, for example:

def ORI   : DForm_4<24, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
                    "ori $dst, $src1, $src2",
                    [(set GPRC:$dst, (or immZExt16:$src2, GPRC:$src1))]>;

results in:

tblgen: In ORI: Instruction can never match: Immediate values must be on the RHS of commutative operators!
llvm-svn: 23501
2005-09-28 19:27:25 +00:00
Chris Lattner
18ccb532b5 collect commutativity information
llvm-svn: 23499
2005-09-28 18:28:29 +00:00
Chris Lattner
9e2188cf4e Teach the DAG isel generator to emit code that creates nodes.
Fix a few corner cases parsing things like (i32 imm:$foo)

llvm-svn: 23417
2005-09-24 00:40:24 +00:00
Chris Lattner
7c7fbdc7e1 Emit better code (no more copies for var references), and support DAG patterns
(e.g. things like rotates).

llvm-svn: 23416
2005-09-23 23:16:51 +00:00
Chris Lattner
6c5dfefcb3 Emit code that matches the incoming DAG pattern and checks predicates.
This does not check that types match yet, but PPC only has one integer type
;-).

This also doesn't have the code to build the resultant dag.

llvm-svn: 23414
2005-09-23 21:33:23 +00:00
Chris Lattner
9949ef9748 emit information about the order patterns are to be matched.
llvm-svn: 23413
2005-09-23 20:52:47 +00:00
Chris Lattner
d9b4002bac start filling in the switch stmt
llvm-svn: 23412
2005-09-23 19:36:15 +00:00
Chris Lattner
4c1ec1c784 teach the type inference code how to infer types for instructions and node
xforms.  Run type inference on result patterns, so we always have fully typed
results (and to catch errors in .td files).

llvm-svn: 23369
2005-09-15 22:23:50 +00:00
Chris Lattner
07b63eafa1 put instructions into a map instead of a vector for quick lookup
llvm-svn: 23368
2005-09-15 21:57:35 +00:00
Chris Lattner
335614b54a when parsing instructions remember information about the types taken and
returned.

llvm-svn: 23367
2005-09-15 21:51:12 +00:00
Chris Lattner
fe7a70834b rename a couple of methods, add structure for pattern parsing
llvm-svn: 23364
2005-09-15 02:38:02 +00:00
Chris Lattner
57cae81b5e start building the instruction dest pattern correctly. Change the xform
functions to preserve the Record for the xform instead of making it into a
function name.

llvm-svn: 23361
2005-09-14 22:55:26 +00:00
Chris Lattner
a5ba887c02 Parse significantly more of the instruction pattern, now collecting and
verifying information about the operands.

llvm-svn: 23353
2005-09-14 20:53:42 +00:00
Chris Lattner
72cfebc71b remove some code that isn't ready for prime time
llvm-svn: 23346
2005-09-14 06:03:10 +00:00
Chris Lattner
c4ae94aa32 Switch to a slightly more structured representation for instructions
llvm-svn: 23345
2005-09-14 04:03:16 +00:00
Chris Lattner
9ab561788e start parsing instructions into patterns, start doing many more checks of
'set's.

llvm-svn: 23343
2005-09-14 00:09:24 +00:00