[llvm-commits] [llvm] r96561 - in /llvm/trunk/utils/TableGen: DAGISelMatcher.cpp DAGISelMatcher.h DAGISelMatcherEmitter.cpp DAGISelMatcherGen.cpp
Chris Lattner
sabre at nondot.org
Wed Feb 17 18:53:41 PST 2010
Author: lattner
Date: Wed Feb 17 20:53:41 2010
New Revision: 96561
URL: http://llvm.org/viewvc/llvm-project?rev=96561&view=rev
Log:
rename the child field to 'next'. This is not a parent/child
relationship, this is a linear list relationship.
Modified:
llvm/trunk/utils/TableGen/DAGISelMatcher.cpp
llvm/trunk/utils/TableGen/DAGISelMatcher.h
llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.cpp?rev=96561&r1=96560&r2=96561&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.cpp Wed Feb 17 20:53:41 2010
@@ -22,98 +22,98 @@
OS.indent(indent) << "EmitNode: Dst = " << *Pattern.getDstPattern() << "\n";
}
-void MatcherNode::printChild(raw_ostream &OS, unsigned indent) const {
- if (Child)
- return Child->print(OS, indent);
- OS.indent(indent) << "<null child>\n";
+void MatcherNode::printNext(raw_ostream &OS, unsigned indent) const {
+ if (Next)
+ return Next->print(OS, indent);
+ OS.indent(indent) << "<null next field>\n";
}
void PushMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "Push\n";
- printChild(OS, indent+2);
+ printNext(OS, indent+2);
Failure->print(OS, indent);
}
void RecordMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "Record\n";
- printChild(OS, indent);
+ printNext(OS, indent);
}
void MoveChildMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "MoveChild " << ChildNo << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void MoveParentMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "MoveParent\n";
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckSameMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckSame " << MatchNumber << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckPatternPredicateMatcherNode::
print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckPatternPredicate " << Predicate << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckPredicateMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckPredicate " << PredName << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckOpcodeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckOpcode " << OpcodeName << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckTypeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckType " << getEnumName(Type) << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckIntegerMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckInteger " << Value << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckCondCodeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckCondCode ISD::" << CondCodeName << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckValueTypeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckValueType MVT::" << TypeName << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckComplexPatMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckComplexPat " << Pattern.getSelectFunc() << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckAndImmMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckAndImm " << Value << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckOrImmMatcherNode::print(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckOrImm " << Value << '\n';
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckFoldableChainNodeMatcherNode::print(raw_ostream &OS,
unsigned indent) const {
OS.indent(indent) << "CheckFoldableChainNode\n";
- printChild(OS, indent);
+ printNext(OS, indent);
}
void CheckChainCompatibleMatcherNode::print(raw_ostream &OS,
unsigned indent) const {
OS.indent(indent) << "CheckChainCompatibleMatcherNode " << PreviousOp << "\n";
- printChild(OS, indent);
+ printNext(OS, indent);
}
Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.h?rev=96561&r1=96560&r2=96561&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.h (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.h Wed Feb 17 20:53:41 2010
@@ -31,7 +31,9 @@
/// MatcherNode - Base class for all the the DAG ISel Matcher representation
/// nodes.
class MatcherNode {
- OwningPtr<MatcherNode> Child;
+ // The next matcher node that is executed after this one. Null if this is the
+ // last stage of a match.
+ OwningPtr<MatcherNode> Next;
public:
enum KindTy {
EmitNode,
@@ -63,16 +65,16 @@
KindTy getKind() const { return Kind; }
- MatcherNode *getChild() { return Child.get(); }
- const MatcherNode *getChild() const { return Child.get(); }
- void setChild(MatcherNode *C) { Child.reset(C); }
+ MatcherNode *getNext() { return Next.get(); }
+ const MatcherNode *getNext() const { return Next.get(); }
+ void setNext(MatcherNode *C) { Next.reset(C); }
static inline bool classof(const MatcherNode *) { return true; }
virtual void print(raw_ostream &OS, unsigned indent = 0) const = 0;
void dump() const;
protected:
- void printChild(raw_ostream &OS, unsigned indent) const;
+ void printNext(raw_ostream &OS, unsigned indent) const;
};
/// EmitNodeMatcherNode - This signals a successful match and generates a node.
@@ -93,14 +95,14 @@
/// PushMatcherNode - This pushes a failure scope on the stack and evaluates
-/// 'child'. If 'child' fails to match, it pops its scope and attempts to
+/// 'Next'. If 'Next' fails to match, it pops its scope and attempts to
/// match 'Failure'.
class PushMatcherNode : public MatcherNode {
OwningPtr<MatcherNode> Failure;
public:
- PushMatcherNode(MatcherNode *child = 0, MatcherNode *failure = 0)
+ PushMatcherNode(MatcherNode *next = 0, MatcherNode *failure = 0)
: MatcherNode(Push), Failure(failure) {
- setChild(child);
+ setNext(next);
}
MatcherNode *getFailure() { return Failure.get(); }
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=96561&r1=96560&r2=96561&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp Wed Feb 17 20:53:41 2010
@@ -76,7 +76,7 @@
public:
MatcherTableEmitter(formatted_raw_ostream &os) : OS(os) {}
- unsigned EmitMatcherAndChildren(const MatcherNode *N, unsigned Indent);
+ unsigned EmitMatcherList(const MatcherNode *N, unsigned Indent);
void EmitPredicateFunctions();
private:
@@ -217,9 +217,9 @@
return 0;
}
-/// EmitMatcherAndChildren - Emit the bytes for the specified matcher subtree.
+/// EmitMatcherList - Emit the bytes for the specified matcher subtree.
unsigned MatcherTableEmitter::
-EmitMatcherAndChildren(const MatcherNode *N, unsigned Indent) {
+EmitMatcherList(const MatcherNode *N, unsigned Indent) {
unsigned Size = 0;
while (N) {
// Push is a special case since it is binary.
@@ -228,25 +228,25 @@
// emitting either of them. Handle this by buffering the output into a
// string while we get the size.
SmallString<128> TmpBuf;
- unsigned ChildSize;
+ unsigned NextSize;
{
raw_svector_ostream OS(TmpBuf);
formatted_raw_ostream FOS(OS);
- ChildSize =
- EmitMatcherAndChildren(cast<PushMatcherNode>(N)->getChild(),Indent+1);
+ NextSize = EmitMatcherList(cast<PushMatcherNode>(N)->getNext(),
+ Indent+1);
}
- if (ChildSize > 255) {
+ if (NextSize > 255) {
errs() <<
"Tblgen internal error: can't handle predicate this complex yet\n";
exit(1);
}
OS.PadToColumn(Indent*2);
- OS << "OPC_Push, " << ChildSize << ",\n";
+ OS << "OPC_Push, " << NextSize << ",\n";
OS << TmpBuf.str();
- Size += 2 + ChildSize;
+ Size += 2 + NextSize;
N = PMN->getFailure();
continue;
@@ -254,9 +254,9 @@
Size += EmitMatcher(N, Indent);
- // If there are children of this node, iterate to them, otherwise we're
+ // If there are other nodes in this list, iterate to them, otherwise we're
// done.
- N = N->getChild();
+ N = N->getNext();
}
return Size;
}
@@ -311,7 +311,7 @@
MatcherTableEmitter MatcherEmitter(OS);
OS << " static const unsigned char MatcherTable[] = {\n";
- unsigned TotalSize = MatcherEmitter.EmitMatcherAndChildren(Matcher, 2);
+ unsigned TotalSize = MatcherEmitter.EmitMatcherList(Matcher, 2);
OS << " 0\n }; // Total Array size is " << (TotalSize+1) << " bytes\n\n";
OS << " return SelectCodeCommon(N, MatcherTable,sizeof(MatcherTable));\n}\n";
OS << "\n";
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=96561&r1=96560&r2=96561&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Wed Feb 17 20:53:41 2010
@@ -38,7 +38,7 @@
MatcherNode *Matcher;
/// CurPredicate - As we emit matcher nodes, this points to the latest check
- /// which should have future checks stuck into its child position.
+ /// which should have future checks stuck into its Next position.
MatcherNode *CurPredicate;
public:
MatcherGen(const PatternToMatch &pattern, const CodeGenDAGPatterns &cgp);
@@ -109,7 +109,7 @@
/// AddMatcherNode - Add a matcher node to the current graph we're building.
void MatcherGen::AddMatcherNode(MatcherNode *NewNode) {
if (CurPredicate != 0)
- CurPredicate->setChild(NewNode);
+ CurPredicate->setNext(NewNode);
else
Matcher = NewNode;
CurPredicate = NewNode;
@@ -389,7 +389,7 @@
// Link it into the pattern.
if (MatcherNode *Pred = Gen.GetCurPredicate()) {
- Pred->setChild(Result);
+ Pred->setNext(Result);
return Gen.GetMatcher();
}
More information about the llvm-commits
mailing list