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 | 7bc5d9b576827b4c629e7dd6707804ee61ef18c9 (patch) | |
tree | 7b6efe1112b3ebe639a6ad4330914cfadac02212 /llvm/utils/TableGen/CodeGenInstruction.cpp | |
parent | d44966f26de2e7ca05cb888a1ea5b5bdc22a65c0 (diff) | |
download | bcm5719-llvm-7bc5d9b576827b4c629e7dd6707804ee61ef18c9.tar.gz bcm5719-llvm-7bc5d9b576827b4c629e7dd6707804ee61ef18c9.zip |
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.
llvm-svn: 99726
Diffstat (limited to 'llvm/utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r-- | llvm/utils/TableGen/CodeGenInstruction.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp index eea55618721..99d196c3ceb 100644 --- a/llvm/utils/TableGen/CodeGenInstruction.cpp +++ b/llvm/utils/TableGen/CodeGenInstruction.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "CodeGenInstruction.h" +#include "CodeGenTarget.h" #include "Record.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" @@ -294,3 +295,22 @@ CodeGenInstruction::ParseOperandName(const std::string &Op, // Otherwise, didn't find it! throw TheDef->getName() + ": unknown suboperand name in '" + Op + "'"; } + + +/// HasOneImplicitDefWithKnownVT - If the instruction has at least one +/// implicit def and it has a known VT, return the VT, otherwise return +/// MVT::Other. +MVT::SimpleValueType CodeGenInstruction:: +HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const { + if (ImplicitDefs.empty()) return MVT::Other; + + // Check to see if the first implicit def has a resolvable type. + Record *FirstImplicitDef = ImplicitDefs[0]; + assert(FirstImplicitDef->isSubClassOf("Register")); + const std::vector<MVT::SimpleValueType> &RegVTs = + TargetInfo.getRegisterVTs(FirstImplicitDef); + if (RegVTs.size() == 1) + return RegVTs[0]; + return MVT::Other; +} + |