summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelEmitter.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-03-20 08:09:17 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-03-20 08:09:17 +0000
commitf26ba697258755b0b7b9642822f3c4c18a5004aa (patch)
tree499269e734c7d0ac26dcde0181f3626a339c4834 /utils/TableGen/DAGISelEmitter.cpp
parentdd4d2d0e4086905d85bc3011c2de78822d873d83 (diff)
downloadllvm-f26ba697258755b0b7b9642822f3c4c18a5004aa.tar.gz
llvm-f26ba697258755b0b7b9642822f3c4c18a5004aa.tar.bz2
llvm-f26ba697258755b0b7b9642822f3c4c18a5004aa.tar.xz
It should be ok for a xform output type to be different from input type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index e66223e53e..a63d060321 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -694,14 +694,26 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
} else {
assert(getOperator()->isSubClassOf("SDNodeXForm") && "Unknown node type!");
- // Node transforms always take one operand, and take and return the same
- // type.
+ // Node transforms always take one operand.
if (getNumChildren() != 1)
TP.error("Node transform '" + getOperator()->getName() +
"' requires one operand!");
- bool MadeChange = UpdateNodeType(getChild(0)->getExtTypes(), TP);
- MadeChange |= getChild(0)->UpdateNodeType(getExtTypes(), TP);
- return MadeChange;
+ unsigned char ExtType0 = getExtTypeNum(0);
+ unsigned char ChildExtType0 = getChild(0)->getExtTypeNum(0);
+ if (ExtType0 == MVT::isInt ||
+ ExtType0 == MVT::isFP ||
+ ExtType0 == MVT::isUnknown ||
+ ChildExtType0 == MVT::isInt ||
+ ChildExtType0 == MVT::isFP ||
+ ChildExtType0 == MVT::isUnknown) {
+ // If either the output or input of the xform does not have exact
+ // type info. We assume they must be the same. Otherwise, it is perfectly
+ // legal to transform from one type to a completely different type.
+ bool MadeChange = UpdateNodeType(getChild(0)->getExtTypes(), TP);
+ MadeChange |= getChild(0)->UpdateNodeType(getExtTypes(), TP);
+ return MadeChange;
+ }
+ return false;
}
}