[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Evan Cheng
evan.cheng at apple.com
Tue Jan 24 12:47:02 PST 2006
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.140 -> 1.141
---
Log message:
Fix an optional in flag bug.
---
Diffs of the changes: (+63 -18)
DAGISelEmitter.cpp | 81 +++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 63 insertions(+), 18 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.140 llvm/utils/TableGen/DAGISelEmitter.cpp:1.141
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.140 Tue Jan 24 14:07:38 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Tue Jan 24 14:46:50 2006
@@ -2206,26 +2206,71 @@
<< NumResults << ");\n";
}
} else if (HasChain || HasOutFlag) {
- OS << " SDOperand Result = CurDAG->getTargetNode("
- << II.Namespace << "::" << II.TheDef->getName();
+ if (HasOptInFlag) {
+ OS << " SDOperand Result = SDOperand(0, 0);\n";
+ unsigned FlagNo = (unsigned) NodeHasChain + Pattern->getNumChildren();
+ OS << " if (N.getNumOperands() == " << FlagNo+1 << ")\n";
+ OS << " Result = CurDAG->getTargetNode("
+ << II.Namespace << "::" << II.TheDef->getName();
+
+ // Output order: results, chain, flags
+ // Result types.
+ if (NumResults > 0) {
+ if (N->getTypeNum(0) != MVT::isVoid)
+ OS << ", MVT::" << getEnumName(N->getTypeNum(0));
+ }
+ if (HasChain)
+ OS << ", MVT::Other";
+ if (HasOutFlag)
+ OS << ", MVT::Flag";
+
+ // Inputs.
+ for (unsigned i = 0, e = Ops.size(); i != e; ++i)
+ OS << ", Tmp" << Ops[i];
+ if (HasChain) OS << ", Chain";
+ OS << ", InFlag);\n";
+
+ OS << " else\n";
+ OS << " Result = CurDAG->getTargetNode("
+ << II.Namespace << "::" << II.TheDef->getName();
+
+ // Output order: results, chain, flags
+ // Result types.
+ if (NumResults > 0) {
+ if (N->getTypeNum(0) != MVT::isVoid)
+ OS << ", MVT::" << getEnumName(N->getTypeNum(0));
+ }
+ if (HasChain)
+ OS << ", MVT::Other";
+ if (HasOutFlag)
+ OS << ", MVT::Flag";
+
+ // Inputs.
+ for (unsigned i = 0, e = Ops.size(); i != e; ++i)
+ OS << ", Tmp" << Ops[i];
+ if (HasChain) OS << ", Chain);\n";
+ } else {
+ OS << " SDOperand Result = CurDAG->getTargetNode("
+ << II.Namespace << "::" << II.TheDef->getName();
- // Output order: results, chain, flags
- // Result types.
- if (NumResults > 0) {
- if (N->getTypeNum(0) != MVT::isVoid)
- OS << ", MVT::" << getEnumName(N->getTypeNum(0));
+ // Output order: results, chain, flags
+ // Result types.
+ if (NumResults > 0) {
+ if (N->getTypeNum(0) != MVT::isVoid)
+ OS << ", MVT::" << getEnumName(N->getTypeNum(0));
+ }
+ if (HasChain)
+ OS << ", MVT::Other";
+ if (HasOutFlag)
+ OS << ", MVT::Flag";
+
+ // Inputs.
+ for (unsigned i = 0, e = Ops.size(); i != e; ++i)
+ OS << ", Tmp" << Ops[i];
+ if (HasChain) OS << ", Chain";
+ if (HasInFlag || HasImpInputs) OS << ", InFlag";
+ OS << ");\n";
}
- if (HasChain)
- OS << ", MVT::Other";
- if (HasOutFlag)
- OS << ", MVT::Flag";
-
- // Inputs.
- for (unsigned i = 0, e = Ops.size(); i != e; ++i)
- OS << ", Tmp" << Ops[i];
- if (HasChain) OS << ", Chain";
- if (HasInFlag || HasOptInFlag || HasImpInputs) OS << ", InFlag";
- OS << ");\n";
unsigned ValNo = 0;
for (unsigned i = 0; i < NumResults; i++) {
More information about the llvm-commits
mailing list