diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-27 20:09:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-27 20:09:24 +0000 |
commit | 9414ae52911f1d62cabd5108e0381b9d17476157 (patch) | |
tree | ef1ee4201f255ad3d1da814bf9f745423c57de8e /utils/TableGen/CodeGenDAGPatterns.cpp | |
parent | 0be6fe71390c50b211beb70e6c50e5fae060f746 (diff) |
hoist some funky logic into CodeGenInstruction
from two places in CodeGenDAGPatterns.cpp, and
use it in DAGISelMatcherGen.cpp instead of using
an incorrect predicate that happened to get lucky
on our current targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenDAGPatterns.cpp')
-rw-r--r-- | utils/TableGen/CodeGenDAGPatterns.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index ba9a98d8dd..b030800c9e 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -779,15 +779,9 @@ static unsigned GetNumNodeResults(Record *Operator, CodeGenDAGPatterns &CDP) { // FIXME: Should allow access to all the results here. unsigned NumDefsToAdd = InstInfo.NumDefs ? 1 : 0; - if (!InstInfo.ImplicitDefs.empty()) { - // Add on one implicit def if it has a resolvable type. - Record *FirstImplicitDef = InstInfo.ImplicitDefs[0]; - assert(FirstImplicitDef->isSubClassOf("Register")); - const std::vector<MVT::SimpleValueType> &RegVTs = - CDP.getTargetInfo().getRegisterVTs(FirstImplicitDef); - if (RegVTs.size() == 1) - return NumDefsToAdd+1; - } + // Add on one implicit def if it has a resolvable type. + if (InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo()) !=MVT::Other) + ++NumDefsToAdd; return NumDefsToAdd; } @@ -1279,12 +1273,13 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { if (!InstInfo.ImplicitDefs.empty()) { unsigned ResNo = NumResultsToAdd; - Record *FirstImplicitDef = InstInfo.ImplicitDefs[0]; - assert(FirstImplicitDef->isSubClassOf("Register")); - const std::vector<MVT::SimpleValueType> &RegVTs = - CDP.getTargetInfo().getRegisterVTs(FirstImplicitDef); - if (RegVTs.size() == 1) // FIXME: Generalize. - MadeChange |= UpdateNodeType(ResNo, EEVT::TypeSet(RegVTs), TP); + // FIXME: Generalize to multiple possible types and multiple possible + // ImplicitDefs. + MVT::SimpleValueType VT = + InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo()); + + if (VT != MVT::Other) + MadeChange |= UpdateNodeType(ResNo, VT, TP); } // If this is an INSERT_SUBREG, constrain the source and destination VTs to |