From a15731cd50d8b44367db9deb4ccfb3105461cfe1 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 19 Jan 2006 10:12:58 +0000 Subject: [PATCH] Use pattern information to determine whether the use expects this instruction to produce a result. e.g MUL8m, the instruction does not produce a explicit result. However it produces an implicit result in AL which would be copied to a temp. The root operator of the matching pattern is a mul so the use would expect it to produce a result. llvm-svn: 25458 --- llvm/utils/TableGen/DAGISelEmitter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp index cd0527729aff..03ec9951dcb4 100644 --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -2255,10 +2255,13 @@ public: OS << " CodeGenMap[N.getValue(" << ValNo << ")] = InFlag;\n"; if (AddedChain && HasOutFlag) { - if (NumResults == 0) { + // Is this pattern expected to produce a result? + if (Pattern->getTypeNum(0) == MVT::isVoid || + Pattern->getTypeNum(0) == MVT::Flag) { OS << " return Result.getValue(N.ResNo+1);\n"; } else { - OS << " if (N.ResNo < " << NumResults << ")\n"; + OS << " if (N.ResNo < " + << ((NumResults > 1) ? NumResults : 1) << ")\n"; OS << " return Result.getValue(N.ResNo);\n"; OS << " else\n"; OS << " return Result.getValue(N.ResNo+1);\n";