aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-06-14 19:27:50 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-06-14 19:27:50 +0000
commitbc6b86a89e762b6c45898df287ff492db87d214a (patch)
tree803d86d253986caf2f95275098610a6225ac3d75 /utils
parentb69d113201a60d0ada9f9e7e1a855acb7a6dfc96 (diff)
downloadexternal_llvm-bc6b86a89e762b6c45898df287ff492db87d214a.zip
external_llvm-bc6b86a89e762b6c45898df287ff492db87d214a.tar.gz
external_llvm-bc6b86a89e762b6c45898df287ff492db87d214a.tar.bz2
Fix support for optional input flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28784 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 34bcd36..459eece 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -2515,8 +2515,10 @@ public:
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 @@ public:
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 @@ private:
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 @@ private:
}
}
- 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