[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Evan Cheng
evan.cheng at apple.com
Wed Jun 14 12:28:03 PDT 2006
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.209 -> 1.210
---
Log message:
Fix support for optional input flag.
---
Diffs of the changes: (+11 -17)
DAGISelEmitter.cpp | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.209 llvm/utils/TableGen/DAGISelEmitter.cpp:1.210
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.209 Tue Jun 13 16:47:27 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Wed Jun 14 14:27:50 2006
@@ -2515,8 +2515,10 @@
if (NodeHasInFlag || NodeHasOutFlag || NodeHasOptInFlag || HasImpInputs)
emitDecl("InFlag");
- if (NodeHasOptInFlag)
- emitCode("bool HasOptInFlag = false;");
+ if (NodeHasOptInFlag) {
+ emitCode("bool HasOptInFlag = "
+ "N.getOperand(N.getNumOperands()-1).getValueType() == MVT::Flag;");
+ }
// How many results is this pattern expected to produce?
unsigned PatResults = 0;
@@ -2576,8 +2578,12 @@
bool ChainEmitted = NodeHasChain;
if (NodeHasChain)
emitCode("Select(" + ChainName + ", " + ChainName + ");");
- if (NodeHasInFlag || NodeHasOptInFlag || HasImpInputs)
+ if (NodeHasInFlag || HasImpInputs)
EmitInFlagSelectCode(Pattern, "N", ChainEmitted, true);
+ if (NodeHasOptInFlag) {
+ emitCode("if (HasOptInFlag)");
+ emitCode(" Select(InFlag, N.getOperand(N.getNumOperands()-1));");
+ }
if (isRoot) {
// The operands have been selected. Remove them from InFlightSet.
@@ -2854,7 +2860,6 @@
unsigned OpNo =
(unsigned) NodeHasProperty(N, SDNodeInfo::SDNPHasChain, ISE);
bool HasInFlag = NodeHasProperty(N, SDNodeInfo::SDNPInFlag, ISE);
- bool HasOptInFlag = NodeHasProperty(N, SDNodeInfo::SDNPOptInFlag, ISE);
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i, ++OpNo) {
TreePatternNode *Child = N->getChild(i);
if (!Child->isLeaf()) {
@@ -2894,20 +2899,9 @@
}
}
- if (HasInFlag || HasOptInFlag) {
- std::string Code;
- if (HasOptInFlag) {
- emitCode("if (" + RootName + ".getNumOperands() == " + utostr(OpNo+1) +
- ") {");
- Code = " ";
- }
- emitCode(Code + "Select(InFlag, " + RootName +
+ if (HasInFlag)
+ emitCode("Select(InFlag, " + RootName +
".getOperand(" + utostr(OpNo) + "));");
- if (HasOptInFlag) {
- emitCode(" HasOptInFlag = true;");
- emitCode("}");
- }
- }
}
/// EmitCopyFromRegs - Emit code to copy result to physical registers
More information about the llvm-commits
mailing list