it will populate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97363
91177308-0d34-0410-b5e6-
96231b3b80d8
void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent);
void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent);
- OS << (isSelectNodeTo() ? "SelectNodeTo: " : "EmitNode: ")
+ OS << (isa<SelectNodeToMatcher>(this) ? "SelectNodeTo: " : "EmitNode: ")
<< OpcodeName << ": <todo flags> ";
for (unsigned i = 0, e = VTs.size(); i != e; ++i)
<< OpcodeName << ": <todo flags> ";
for (unsigned i = 0, e = VTs.size(); i != e; ++i)
HasChain(hasChain), HasFlag(hasFlag), HasMemRefs(hasmemrefs),
NumFixedArityOperands(numfixedarityoperands) {}
HasChain(hasChain), HasFlag(hasFlag), HasMemRefs(hasmemrefs),
NumFixedArityOperands(numfixedarityoperands) {}
- bool isSelectNodeTo() const { return getKind() == SelectNodeTo; }
-
const std::string &getOpcodeName() const { return OpcodeName; }
unsigned getNumVTs() const { return VTs.size(); }
const std::string &getOpcodeName() const { return OpcodeName; }
unsigned getNumVTs() const { return VTs.size(); }
/// EmitNodeMatcher - This signals a successful match and generates a node.
class EmitNodeMatcher : public EmitNodeMatcherCommon {
/// EmitNodeMatcher - This signals a successful match and generates a node.
class EmitNodeMatcher : public EmitNodeMatcherCommon {
+ unsigned FirstResultSlot;
public:
EmitNodeMatcher(const std::string &opcodeName,
const MVT::SimpleValueType *vts, unsigned numvts,
const unsigned *operands, unsigned numops,
bool hasChain, bool hasFlag, bool hasmemrefs,
public:
EmitNodeMatcher(const std::string &opcodeName,
const MVT::SimpleValueType *vts, unsigned numvts,
const unsigned *operands, unsigned numops,
bool hasChain, bool hasFlag, bool hasmemrefs,
- int numfixedarityoperands)
+ int numfixedarityoperands, unsigned firstresultslot)
: EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain,
: EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain,
- hasFlag, hasmemrefs, numfixedarityoperands, false)
- {}
+ hasFlag, hasmemrefs, numfixedarityoperands, false),
+ FirstResultSlot(firstresultslot) {}
+
+ unsigned getFirstResultSlot() const { return FirstResultSlot; }
static inline bool classof(const Matcher *N) {
return N->getKind() == EmitNode;
static inline bool classof(const Matcher *N) {
return N->getKind() == EmitNode;
case Matcher::EmitNode:
case Matcher::SelectNodeTo: {
const EmitNodeMatcherCommon *EN = cast<EmitNodeMatcherCommon>(N);
case Matcher::EmitNode:
case Matcher::SelectNodeTo: {
const EmitNodeMatcherCommon *EN = cast<EmitNodeMatcherCommon>(N);
- OS << (EN->isSelectNodeTo() ? "OPC_EmitNode" : "OPC_SelectNodeTo");
+ OS << (isa<EmitNodeMatcher>(EN) ? "OPC_EmitNode" : "OPC_SelectNodeTo");
OS << ", TARGET_OPCODE(" << EN->getOpcodeName() << "), 0";
if (EN->hasChain()) OS << "|OPFL_Chain";
OS << ", TARGET_OPCODE(" << EN->getOpcodeName() << "), 0";
if (EN->hasChain()) OS << "|OPFL_Chain";
// is too large to represent with a byte.
NumOperandBytes += EmitVBRValue(EN->getOperand(i), OS);
}
// is too large to represent with a byte.
NumOperandBytes += EmitVBRValue(EN->getOperand(i), OS);
}
+
+ // Print the result #'s for EmitNode.
+ if (const EmitNodeMatcher *E = dyn_cast<EmitNodeMatcher>(EN)) {
+ if (EN->getVT(0) != MVT::Flag && EN->getVT(0) != MVT::Other) {
+ OS.PadToColumn(CommentIndent) << "// Results = ";
+ unsigned First = E->getFirstResultSlot();
+ for (unsigned i = 0, e = EN->getNumVTs(); i != e; ++i) {
+ if (EN->getVT(0) == MVT::Flag || EN->getVT(0) == MVT::Other)
+ break;
+ OS << "#" << First+i << " ";
+ }
+ }
+ }
+
OS << '\n';
return 6+EN->getNumVTs()+NumOperandBytes;
}
OS << '\n';
return 6+EN->getNumVTs()+NumOperandBytes;
}
ResultVTs.data(), ResultVTs.size(),
InstOps.data(), InstOps.size(),
NodeHasChain, TreeHasInFlag,
ResultVTs.data(), ResultVTs.size(),
InstOps.data(), InstOps.size(),
NodeHasChain, TreeHasInFlag,
- NodeHasMemRefs, NumFixedArityOperands));
+ NodeHasMemRefs, NumFixedArityOperands,
+ NextRecordedOperandNo));
// The non-chain and non-flag results of the newly emitted node get recorded.
for (unsigned i = 0, e = ResultVTs.size(); i != e; ++i) {
// The non-chain and non-flag results of the newly emitted node get recorded.
for (unsigned i = 0, e = ResultVTs.size(); i != e; ++i) {
// Turn EmitNode->CompleteMatch into SelectNodeTo if we can.
if (EmitNodeMatcher *EN = dyn_cast<EmitNodeMatcher>(N))
// Turn EmitNode->CompleteMatch into SelectNodeTo if we can.
if (EmitNodeMatcher *EN = dyn_cast<EmitNodeMatcher>(N))
- if (CompleteMatchMatcher *CM = cast<CompleteMatchMatcher>(EN->getNext())) {
+ if (CompleteMatchMatcher *CM =
+ dyn_cast<CompleteMatchMatcher>(EN->getNext())) {
}
ContractNodes(N->getNextPtr());
}
ContractNodes(N->getNextPtr());