diff options
author | Chris Lattner <sabre@nondot.org> | 2010-02-28 21:53:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-02-28 21:53:42 +0000 |
commit | ff7fb60f2a7e2f3efd54df6480aadcb4adf5cab7 (patch) | |
tree | 7204ffaf2b65ea7b49772943f5c8386a15a718a1 /utils/TableGen | |
parent | 21221e357c6aa9ade3966ee86dab7d44c25220d0 (diff) | |
download | external_llvm-ff7fb60f2a7e2f3efd54df6480aadcb4adf5cab7.zip external_llvm-ff7fb60f2a7e2f3efd54df6480aadcb4adf5cab7.tar.gz external_llvm-ff7fb60f2a7e2f3efd54df6480aadcb4adf5cab7.tar.bz2 |
enhance the EmitNode/MorphNodeTo operands to take a bit that
specifies whether there is an output flag or not. Use this
instead of redundantly encoding the chain/flag results in the
output vtlist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97419 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r-- | utils/TableGen/DAGISelMatcher.cpp | 3 | ||||
-rw-r--r-- | utils/TableGen/DAGISelMatcher.h | 24 | ||||
-rw-r--r-- | utils/TableGen/DAGISelMatcherEmitter.cpp | 3 | ||||
-rw-r--r-- | utils/TableGen/DAGISelMatcherGen.cpp | 6 | ||||
-rw-r--r-- | utils/TableGen/DAGISelMatcherOpt.cpp | 7 |
5 files changed, 24 insertions, 19 deletions
diff --git a/utils/TableGen/DAGISelMatcher.cpp b/utils/TableGen/DAGISelMatcher.cpp index 1f1bb60..f1bfec0 100644 --- a/utils/TableGen/DAGISelMatcher.cpp +++ b/utils/TableGen/DAGISelMatcher.cpp @@ -246,7 +246,8 @@ bool EmitNodeMatcherCommon::isEqualImpl(const Matcher *m) const { const EmitNodeMatcherCommon *M = cast<EmitNodeMatcherCommon>(m); return M->OpcodeName == OpcodeName && M->VTs == VTs && M->Operands == Operands && M->HasChain == HasChain && - M->HasFlag == HasFlag && M->HasMemRefs == HasMemRefs && + M->HasInFlag == HasInFlag && M->HasOutFlag == HasOutFlag && + M->HasMemRefs == HasMemRefs && M->NumFixedArityOperands == NumFixedArityOperands; } diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h index 46652d9..d9c8b29 100644 --- a/utils/TableGen/DAGISelMatcher.h +++ b/utils/TableGen/DAGISelMatcher.h @@ -876,7 +876,7 @@ class EmitNodeMatcherCommon : public Matcher { std::string OpcodeName; const SmallVector<MVT::SimpleValueType, 3> VTs; const SmallVector<unsigned, 6> Operands; - bool HasChain, HasFlag, HasMemRefs; + bool HasChain, HasInFlag, HasOutFlag, HasMemRefs; /// NumFixedArityOperands - If this is a fixed arity node, this is set to -1. /// If this is a varidic node, this is set to the number of fixed arity @@ -886,12 +886,13 @@ public: EmitNodeMatcherCommon(const std::string &opcodeName, const MVT::SimpleValueType *vts, unsigned numvts, const unsigned *operands, unsigned numops, - bool hasChain, bool hasFlag, bool hasmemrefs, + bool hasChain, bool hasInFlag, bool hasOutFlag, + bool hasmemrefs, int numfixedarityoperands, bool isMorphNodeTo) : Matcher(isMorphNodeTo ? MorphNodeTo : EmitNode), OpcodeName(opcodeName), VTs(vts, vts+numvts), Operands(operands, operands+numops), - HasChain(hasChain), HasFlag(hasFlag), HasMemRefs(hasmemrefs), - NumFixedArityOperands(numfixedarityoperands) {} + HasChain(hasChain), HasInFlag(hasInFlag), HasOutFlag(hasOutFlag), + HasMemRefs(hasmemrefs), NumFixedArityOperands(numfixedarityoperands) {} const std::string &getOpcodeName() const { return OpcodeName; } @@ -921,7 +922,8 @@ public: bool hasChain() const { return HasChain; } - bool hasFlag() const { return HasFlag; } + bool hasInFlag() const { return HasInFlag; } + bool hasOutFlag() const { return HasOutFlag; } bool hasMemRefs() const { return HasMemRefs; } int getNumFixedArityOperands() const { return NumFixedArityOperands; } @@ -942,10 +944,12 @@ public: EmitNodeMatcher(const std::string &opcodeName, const MVT::SimpleValueType *vts, unsigned numvts, const unsigned *operands, unsigned numops, - bool hasChain, bool hasFlag, bool hasmemrefs, + bool hasChain, bool hasInFlag, bool hasOutFlag, + bool hasmemrefs, int numfixedarityoperands, unsigned firstresultslot) : EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain, - hasFlag, hasmemrefs, numfixedarityoperands, false), + hasInFlag, hasOutFlag, hasmemrefs, + numfixedarityoperands, false), FirstResultSlot(firstresultslot) {} unsigned getFirstResultSlot() const { return FirstResultSlot; } @@ -962,10 +966,12 @@ public: MorphNodeToMatcher(const std::string &opcodeName, const MVT::SimpleValueType *vts, unsigned numvts, const unsigned *operands, unsigned numops, - bool hasChain, bool hasFlag, bool hasmemrefs, + bool hasChain, bool hasInFlag, bool hasOutFlag, + bool hasmemrefs, int numfixedarityoperands, const PatternToMatch &pattern) : EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain, - hasFlag, hasmemrefs, numfixedarityoperands, true), + hasInFlag, hasOutFlag, hasmemrefs, + numfixedarityoperands, true), Pattern(pattern) { } diff --git a/utils/TableGen/DAGISelMatcherEmitter.cpp b/utils/TableGen/DAGISelMatcherEmitter.cpp index c4c005c..c6addd8 100644 --- a/utils/TableGen/DAGISelMatcherEmitter.cpp +++ b/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -396,7 +396,8 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, OS << ", TARGET_OPCODE(" << EN->getOpcodeName() << "), 0"; if (EN->hasChain()) OS << "|OPFL_Chain"; - if (EN->hasFlag()) OS << "|OPFL_Flag"; + if (EN->hasInFlag()) OS << "|OPFL_FlagInput"; + if (EN->hasOutFlag()) OS << "|OPFL_FlagOutput"; if (EN->hasMemRefs()) OS << "|OPFL_MemRefs"; if (EN->getNumFixedArityOperands() != -1) OS << "|OPFL_Variadic" << EN->getNumFixedArityOperands(); diff --git a/utils/TableGen/DAGISelMatcherGen.cpp b/utils/TableGen/DAGISelMatcherGen.cpp index c558eba..8f8fcf7 100644 --- a/utils/TableGen/DAGISelMatcherGen.cpp +++ b/utils/TableGen/DAGISelMatcherGen.cpp @@ -713,10 +713,6 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, if (Pattern.getDstRegs()[i]->isSubClassOf("Register")) ResultVTs.push_back(getRegisterValueType(Pattern.getDstRegs()[i], CGT)); } - if (NodeHasChain) - ResultVTs.push_back(MVT::Other); - if (TreeHasOutFlag) - ResultVTs.push_back(MVT::Flag); // FIXME2: Instead of using the isVariadic flag on the instruction, we should // have an SDNP that indicates variadicism. The TargetInstrInfo isVariadic @@ -744,7 +740,7 @@ EmitResultInstructionAsOperand(const TreePatternNode *N, AddMatcher(new EmitNodeMatcher(II.Namespace+"::"+II.TheDef->getName(), ResultVTs.data(), ResultVTs.size(), InstOps.data(), InstOps.size(), - NodeHasChain, TreeHasInFlag, + NodeHasChain, TreeHasInFlag, TreeHasOutFlag, NodeHasMemRefs, NumFixedArityOperands, NextRecordedOperandNo)); diff --git a/utils/TableGen/DAGISelMatcherOpt.cpp b/utils/TableGen/DAGISelMatcherOpt.cpp index 65a01fa..01723d3 100644 --- a/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/utils/TableGen/DAGISelMatcherOpt.cpp @@ -92,7 +92,7 @@ static void ContractNodes(OwningPtr<Matcher> &MatcherPtr, // NOTE: Strictly speaking, we don't have to check for the flag here // because the code in the pattern generator doesn't handle it right. We // do it anyway for thoroughness. - if (!EN->hasFlag() && + if (!EN->hasOutFlag() && Pattern.getSrcPattern()->NodeHasProperty(SDNPOutFlag, CGP)) ResultsMatch = false; @@ -110,9 +110,10 @@ static void ContractNodes(OwningPtr<Matcher> &MatcherPtr, const SmallVectorImpl<MVT::SimpleValueType> &VTs = EN->getVTList(); const SmallVectorImpl<unsigned> &Operands = EN->getOperandList(); MatcherPtr.reset(new MorphNodeToMatcher(EN->getOpcodeName(), - &VTs[0], VTs.size(), + VTs.data(), VTs.size(), Operands.data(),Operands.size(), - EN->hasChain(), EN->hasFlag(), + EN->hasChain(), EN->hasInFlag(), + EN->hasOutFlag(), EN->hasMemRefs(), EN->getNumFixedArityOperands(), Pattern)); |