aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/CodeGenInstruction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-27 20:09:24 +0000
committerChris Lattner <sabre@nondot.org>2010-03-27 20:09:24 +0000
commit9414ae52911f1d62cabd5108e0381b9d17476157 (patch)
treeef1ee4201f255ad3d1da814bf9f745423c57de8e /utils/TableGen/CodeGenInstruction.cpp
parent0be6fe71390c50b211beb70e6c50e5fae060f746 (diff)
downloadexternal_llvm-9414ae52911f1d62cabd5108e0381b9d17476157.zip
external_llvm-9414ae52911f1d62cabd5108e0381b9d17476157.tar.gz
external_llvm-9414ae52911f1d62cabd5108e0381b9d17476157.tar.bz2
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/CodeGenInstruction.cpp')
-rw-r--r--utils/TableGen/CodeGenInstruction.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp
index eea5561..99d196c 100644
--- a/utils/TableGen/CodeGenInstruction.cpp
+++ b/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;
+}
+