[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Evan Cheng
evan.cheng at apple.com
Mon Mar 20 00:09:30 PST 2006
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.178 -> 1.179
---
Log message:
It should be ok for a xform output type to be different from input type.
---
Diffs of the changes: (+17 -5)
DAGISelEmitter.cpp | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.178 llvm/utils/TableGen/DAGISelEmitter.cpp:1.179
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.178 Mon Mar 20 00:04:09 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Mon Mar 20 02:09:17 2006
@@ -694,14 +694,26 @@
} 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;
}
}
More information about the llvm-commits
mailing list