aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-09-04 20:18:28 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-09-04 20:18:28 +0000
commit425e8c7eaee57e3c9dab6701bf2ae6872beab628 (patch)
tree0aaddb8b427999b74188802ef00e2c5c6c489c5b /utils
parent5fd22a84fdc870ac950d4a9b19ddbf0a942b1080 (diff)
downloadexternal_llvm-425e8c7eaee57e3c9dab6701bf2ae6872beab628.zip
external_llvm-425e8c7eaee57e3c9dab6701bf2ae6872beab628.tar.gz
external_llvm-425e8c7eaee57e3c9dab6701bf2ae6872beab628.tar.bz2
Always check the type of node. This prevents situations such as selecting 32-bit rotate target instruction for a 64-bit node when 64-bit pattern is missing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp66
1 files changed, 30 insertions, 36 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index b5b2ba1..0fa3ba4 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -3811,47 +3811,41 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
OpcodeVTMap.find(OpName);
std::vector<std::string> &OpVTs = OpVTI->second;
OS << " case " << OpName << ": {\n";
- if (OpVTs.size() == 1) {
- std::string &VTStr = OpVTs[0];
- OS << " return Select_" << getLegalCName(OpName)
- << VTStr << "(N);\n";
- } else {
- // Keep track of whether we see a pattern that has an iPtr result.
- bool HasPtrPattern = false;
- bool HasDefaultPattern = false;
+ // Keep track of whether we see a pattern that has an iPtr result.
+ bool HasPtrPattern = false;
+ bool HasDefaultPattern = false;
- OS << " switch (NVT) {\n";
- for (unsigned i = 0, e = OpVTs.size(); i < e; ++i) {
- std::string &VTStr = OpVTs[i];
- if (VTStr.empty()) {
- HasDefaultPattern = true;
- continue;
- }
+ OS << " switch (NVT) {\n";
+ for (unsigned i = 0, e = OpVTs.size(); i < e; ++i) {
+ std::string &VTStr = OpVTs[i];
+ if (VTStr.empty()) {
+ HasDefaultPattern = true;
+ continue;
+ }
- // If this is a match on iPTR: don't emit it directly, we need special
- // code.
- if (VTStr == "_iPTR") {
- HasPtrPattern = true;
- continue;
- }
- OS << " case MVT::" << VTStr.substr(1) << ":\n"
- << " return Select_" << getLegalCName(OpName)
- << VTStr << "(N);\n";
+ // If this is a match on iPTR: don't emit it directly, we need special
+ // code.
+ if (VTStr == "_iPTR") {
+ HasPtrPattern = true;
+ continue;
}
- OS << " default:\n";
+ OS << " case MVT::" << VTStr.substr(1) << ":\n"
+ << " return Select_" << getLegalCName(OpName)
+ << VTStr << "(N);\n";
+ }
+ OS << " default:\n";
- // If there is an iPTR result version of this pattern, emit it here.
- if (HasPtrPattern) {
- OS << " if (NVT == TLI.getPointerTy())\n";
- OS << " return Select_" << getLegalCName(OpName) <<"_iPTR(N);\n";
- }
- if (HasDefaultPattern) {
- OS << " return Select_" << getLegalCName(OpName) << "(N);\n";
- }
- OS << " break;\n";
- OS << " }\n";
- OS << " break;\n";
+ // If there is an iPTR result version of this pattern, emit it here.
+ if (HasPtrPattern) {
+ OS << " if (NVT == TLI.getPointerTy())\n";
+ OS << " return Select_" << getLegalCName(OpName) <<"_iPTR(N);\n";
+ }
+ if (HasDefaultPattern) {
+ OS << " return Select_" << getLegalCName(OpName) << "(N);\n";
}
+ OS << " break;\n";
+ OS << " }\n";
+ OS << " break;\n";
OS << " }\n";
}