diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-03-23 02:35:32 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-03-23 02:35:32 +0000 |
commit | 83e1a6ab9587cffcbeae527ab003e321f3da4775 (patch) | |
tree | ca610839e61119b762ecf6fe7273ade754a17cdc | |
parent | a971f6f967db2edc027bb5c1e59e5c9c3ab0b13b (diff) |
Allow result node to be a simple leaf node. This enable bitconvert patterns
like this:
def : Pat<(v4i32 (bitconvert (v4f32 VR128:$src))), (v4i32 VR128:$src)>;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26968 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | utils/TableGen/DAGISelEmitter.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index ae2fcc7540..4aa6f7fc7e 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -1459,8 +1459,10 @@ void DAGISelEmitter::ParsePatterns() { } ResultNodeOperands.push_back(OpNode); } - DstPattern = new TreePatternNode(Result->getOnlyTree()->getOperator(), - ResultNodeOperands); + DstPattern = Result->getOnlyTree(); + if (!DstPattern->isLeaf()) + DstPattern = new TreePatternNode(DstPattern->getOperator(), + ResultNodeOperands); DstPattern->setTypes(Result->getOnlyTree()->getExtTypes()); TreePattern Temp(Result->getRecord(), DstPattern, false, *this); Temp.InferAllTypes(); @@ -2191,7 +2193,6 @@ public: EmitResultCode(TreePatternNode *N, bool LikeLeaf = false, bool isRoot = false) { // This is something selected from the pattern we matched. if (!N->getName().empty()) { - assert(!isRoot && "Root of pattern cannot be a leaf!"); std::string &Val = VariableMap[N->getName()]; assert(!Val.empty() && "Variable referenced but not defined and not caught earlier!"); @@ -2276,13 +2277,17 @@ public: emitCode("Tmp" + utostr(ResNo) + " = " + Val + ";"); else emitCode("Select(Tmp" + utostr(ResNo) + ", " + Val + ");"); + + if (isRoot && N->isLeaf()) { + emitCode("Result = Tmp" + utostr(ResNo) + ";"); + emitCode("return;"); + } } // Add Tmp<ResNo> to VariableMap, so that we don't multiply select this // value if used multiple times by this pattern result. Val = "Tmp"+utostr(ResNo); return std::make_pair(NumRes, ResNo); } - if (N->isLeaf()) { // If this is an explicit register reference, handle it. if (DefInit *DI = dynamic_cast<DefInit*>(N->getLeafValue())) { |