Commit Graph

93 Commits

Author SHA1 Message Date
Evan Cheng
ba7fa0b5d4 Stop emitting a redudant type check for complex pattern node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24655 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-10 01:57:33 +00:00
Evan Cheng
1129e87ff4 For instructions which produce no result, e.g. store, chain's Resno == 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24652 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-10 00:09:17 +00:00
Chris Lattner
5b21be76e1 Add a new SDTCisPtrTy constraint, which indicates that an operand must have
the same type as the pointer type for a target.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24649 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-09 22:57:42 +00:00
Evan Cheng
b915f3110d * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24647 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-09 22:45:35 +00:00
Evan Cheng
cbc09c8eaa Prevent folding of instructions which produce chains that have more than 1 real use
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24643 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-09 06:06:08 +00:00
Evan Cheng
c45146ace5 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24642 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-09 00:48:42 +00:00
Evan Cheng
3aa39f439a * Added an explicit type field to ComplexPattern.
* Renamed MatchingNodes to RootNodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24636 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-08 02:14:08 +00:00
Evan Cheng
0fc7198890 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24634 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-08 02:00:36 +00:00
Evan Cheng
dd304dd4bd * Infer instruction property hasCtrlDep from pattern if it has one.
* Fixed a bug related to hasCtrlDep property use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24610 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-05 23:08:55 +00:00
Chris Lattner
22faeabb3a Implement PR673: for explicit register references, use type information
if available


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-05 02:36:37 +00:00
Chris Lattner
7292c5ee32 Generate code to silence bogus GCC warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24593 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-05 00:48:51 +00:00
Evan Cheng
1c3d19eb15 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24587 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-04 08:18:16 +00:00
Nate Begeman
6510b22cec Support multiple ValueTypes per RegisterClass, needed for upcoming vector
work.  This change has no effect on generated code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24563 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-01 04:51:06 +00:00
Evan Cheng
66a48bbc35 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24557 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-01 00:18:45 +00:00
Nate Begeman
ddb395463c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24555 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-01 00:06:14 +00:00
Chris Lattner
5d28ffdfec Make the code generated by tblgen return the result of SelectNodeTo, to
permit future changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24553 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-30 23:08:45 +00:00
Evan Cheng
76021f010b Better error message when unrecognized opcode is seen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24519 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-29 18:44:58 +00:00
Chris Lattner
09c033962b Validate that the input to 'Pat' patterns is sane.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24393 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-17 17:43:52 +00:00
Chris Lattner
b120a64e13 teach tblgen to be smart enough to handle tglobaladdr nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24391 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-17 07:39:45 +00:00
Chris Lattner
12cf9090a4 fix a tblgen bug that Evan ran into, where we would lose the '$src' name
on patterns like "(set R32:$dst, (i32 imm:$src))"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24383 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-16 23:14:54 +00:00
Chris Lattner
465c737467 Reject integer literals that are out of range for their type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24162 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-03 05:46:11 +00:00
Chris Lattner
0614b628cf Add support for immediates directly in the pattern, this allows itanium to
define:

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24149 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-02 06:49:14 +00:00
Chris Lattner
9d1a02345c Make negative immediates in patterns work correctly, silence some warnings
building the itanium backend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24095 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-29 16:39:40 +00:00
Chris Lattner
b0e103d46b Rename Record::getValueAsListDef to getValueAsListOfDefs, to more accurately
reflect what it is.
Convert some more code over to use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24072 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-28 22:49:02 +00:00
Chris Lattner
6bc0d742c2 Use the new interface Jim added
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24071 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-28 22:43:25 +00:00
Chris Lattner
a7ad198f89 Condcodes are in the ISD namespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24010 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-26 17:02:02 +00:00
Chris Lattner
1531f2025c Add support for CondCode's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24008 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-26 16:59:37 +00:00
Chris Lattner
f071bb5b87 Emit some boilerplate for targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23983 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-25 20:35:14 +00:00
Chris Lattner
edbd8711de Make tblgen emit:
tblgen: In ZAPNOTi: Cannot use 'IZAPX' in an input pattern!
for a bad pattern, instead of an ugly assertion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23854 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-21 01:19:59 +00:00
Chris Lattner
2f041d49a9 add support for literal immediates in patterns to match, allowing us to
write things like this:

def : Pat<(add GPRC:$in, 12),
          (ADD12 GPRC:$in)>;

Andrew: if this isn't enough or doesn't work for you, please lemme know.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23819 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-19 04:41:05 +00:00
Chris Lattner
5d5a056092 Add basic support for integer constants in pattern results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23817 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-19 04:30:56 +00:00
Chris Lattner
4c59309f59 Add support for patterns that have physical registers in them. Testcase:
def : Pat<(trunc G8RC:$in),
          (OR8To4 G8RC:$in, X0)>;

Even though this doesn't make any sense on PPC :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23815 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-19 02:07:26 +00:00
Chris Lattner
ab1bf27be5 Asserting here is to violent
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23814 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-19 01:55:23 +00:00
Chris Lattner
0c0cfa741f Nate wants to define 'Pat's which turn into instructions that don't have
patterns.  Certainly a logical request.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23810 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-19 01:27:22 +00:00
Chris Lattner
b277cbc087 Duraid pointed out that it is impolite to emit PPC:: into the IA64 backend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23780 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-18 04:41:01 +00:00
Chris Lattner
5024d93c8b Make the generated code significantly more memory efficient, by using
SelectNodeTo instead of getTargetNode when possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23758 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-16 01:41:58 +00:00
Chris Lattner
7e82f1322c Implement the last major missing piece in the DAG isel generator: when emitting
a pattern match, make sure to emit the (minimal number of) type checks that
verify the pattern matches this specific instruction.  This allows FMA32
patterns to not match double expressions for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23748 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-15 21:34:21 +00:00
Chris Lattner
603d78c9de Now that we have int/fp lattice values, implement the SDTCisOpSmallerThanOp
type constraint.  This lets tblgen realize that it doesn't need any dynamic
type checks for fextend/fround on PPC (and many other targets), because there
are only two fp types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23730 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-14 06:25:00 +00:00
Chris Lattner
3c7e18d690 Fairly serious rework of the typing code to add new int/fp lattice values.
Overall, no functionality change yet though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23729 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-14 06:12:03 +00:00
Chris Lattner
e0583b1b92 simplify the code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23728 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-14 05:08:37 +00:00
Chris Lattner
03ebd802c7 Add basic support for recognizing a new SDTCisOpSmallerThanOp type constraint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23725 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-14 04:53:53 +00:00
Chris Lattner
0ee7cff4fb 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23724 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-14 04:11:13 +00:00
Chris Lattner
af302914d1 Teach tablegen to reassociate operators when possible. This allows it to
find all of teh pattern matches for EQV from one definition


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23529 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 22:36:54 +00:00
Chris Lattner
e46e17b7fb 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23526 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 19:28:10 +00:00
Chris Lattner
7cf2fe6c48 add support for an associative marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23502 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 20:58:06 +00:00
Chris Lattner
e97603f1bd 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23501 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 19:27:25 +00:00
Chris Lattner
a1a68ae061 collect commutativity information
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23499 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 18:28:29 +00:00
Chris Lattner
05814af29f Prefer cheaper patterns to more expensive ones. Print the costs to the generated
file


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23492 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 17:57:56 +00:00
Chris Lattner
f6f9416363 Select Constant nodes to TargetConstant nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23488 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 16:58:06 +00:00
Chris Lattner
fab3728801 memoize the assert results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23457 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 22:10:24 +00:00