summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-07 19:21:10 +0000
committerChris Lattner <sabre@nondot.org>2003-08-07 19:21:10 +0000
commitb356a24bf199f448704f5860e4b64af552a22922 (patch)
treed5dd9ed1104be80a477d08b516ed83c87c82138c
parentf8e9683a330afcdc31fd177283f8e0aea6c52b9c (diff)
downloadllvm-b356a24bf199f448704f5860e4b64af552a22922.tar.gz
llvm-b356a24bf199f448704f5860e4b64af552a22922.tar.bz2
llvm-b356a24bf199f448704f5860e4b64af552a22922.tar.xz
Read in expanders too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7678 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--support/tools/TableGen/InstrSelectorEmitter.cpp24
-rw-r--r--support/tools/TableGen/InstrSelectorEmitter.h3
-rw-r--r--utils/TableGen/InstrSelectorEmitter.cpp24
-rw-r--r--utils/TableGen/InstrSelectorEmitter.h3
4 files changed, 46 insertions, 8 deletions
diff --git a/support/tools/TableGen/InstrSelectorEmitter.cpp b/support/tools/TableGen/InstrSelectorEmitter.cpp
index cf3fa68cb7..702438a8e1 100644
--- a/support/tools/TableGen/InstrSelectorEmitter.cpp
+++ b/support/tools/TableGen/InstrSelectorEmitter.cpp
@@ -42,6 +42,7 @@ void TreePatternNode::dump() const { std::cerr << *this; }
///
void InstrSelectorEmitter::ProcessNodeTypes() {
std::vector<Record*> Nodes = Records.getAllDerivedDefinitions("DagNode");
+ DEBUG(std::cerr << "Getting node types: ");
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
Record *Node = Nodes[i];
@@ -70,8 +71,9 @@ void InstrSelectorEmitter::ProcessNodeTypes() {
// Add the node type mapping now...
NodeTypes[Node] = NodeType(RetTy, ArgTypes);
- DEBUG(std::cerr << "Got node type '" << Node->getName() << "'\n");
+ DEBUG(std::cerr << Node->getName() << ", ");
}
+ DEBUG(std::cerr << "DONE!\n");
}
static MVT::ValueType getIntrinsicType(Record *R) {
@@ -106,10 +108,10 @@ Pattern::Pattern(PatternType pty, DagInit *RawPat, Record *TheRec,
AnyUnset = InferTypes(Tree, MadeChange);
} while ((AnyUnset || MadeChange) && !(AnyUnset && !MadeChange));
- if (PTy == Instruction) {
+ if (PTy == Instruction || PTy == Expander) {
// Check to make sure there is not any unset types in the tree pattern...
if (AnyUnset) {
- std::cerr << "In instruction pattern: " << *Tree << "\n";
+ std::cerr << "In pattern: " << *Tree << "\n";
error("Could not infer all types!");
}
@@ -296,6 +298,20 @@ void InstrSelectorEmitter::ProcessInstructionPatterns() {
}
}
+/// ProcessExpanderPatterns - Read in all expander patterns...
+///
+void InstrSelectorEmitter::ProcessExpanderPatterns() {
+ std::vector<Record*> Expanders = Records.getAllDerivedDefinitions("Expander");
+ for (unsigned i = 0, e = Expanders.size(); i != e; ++i) {
+ Record *Expander = Expanders[i];
+ DagInit *DI = Expanders[i]->getValueAsDag("Pattern");
+
+ Pattern *P = new Pattern(Pattern::Expander, DI, Expanders[i], *this);
+
+ DEBUG(std::cerr << "Parsed " << *P << "\n");
+ }
+}
+
void InstrSelectorEmitter::run(std::ostream &OS) {
// Type-check all of the node types to ensure we "understand" them.
@@ -308,5 +324,5 @@ void InstrSelectorEmitter::run(std::ostream &OS) {
ProcessInstructionPatterns();
// Read all of the Expander patterns in...
-
+ ProcessExpanderPatterns();
}
diff --git a/support/tools/TableGen/InstrSelectorEmitter.h b/support/tools/TableGen/InstrSelectorEmitter.h
index b168e50686..681830ffa8 100644
--- a/support/tools/TableGen/InstrSelectorEmitter.h
+++ b/support/tools/TableGen/InstrSelectorEmitter.h
@@ -199,6 +199,9 @@ private:
// ProcessInstructionPatterns - Read in all subclasses of Instruction, and
// process those with a useful Pattern field.
void ProcessInstructionPatterns();
+
+ // ProcessExpanderPatterns - Read in all of the expanded patterns.
+ void ProcessExpanderPatterns();
};
#endif
diff --git a/utils/TableGen/InstrSelectorEmitter.cpp b/utils/TableGen/InstrSelectorEmitter.cpp
index cf3fa68cb7..702438a8e1 100644
--- a/utils/TableGen/InstrSelectorEmitter.cpp
+++ b/utils/TableGen/InstrSelectorEmitter.cpp
@@ -42,6 +42,7 @@ void TreePatternNode::dump() const { std::cerr << *this; }
///
void InstrSelectorEmitter::ProcessNodeTypes() {
std::vector<Record*> Nodes = Records.getAllDerivedDefinitions("DagNode");
+ DEBUG(std::cerr << "Getting node types: ");
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
Record *Node = Nodes[i];
@@ -70,8 +71,9 @@ void InstrSelectorEmitter::ProcessNodeTypes() {
// Add the node type mapping now...
NodeTypes[Node] = NodeType(RetTy, ArgTypes);
- DEBUG(std::cerr << "Got node type '" << Node->getName() << "'\n");
+ DEBUG(std::cerr << Node->getName() << ", ");
}
+ DEBUG(std::cerr << "DONE!\n");
}
static MVT::ValueType getIntrinsicType(Record *R) {
@@ -106,10 +108,10 @@ Pattern::Pattern(PatternType pty, DagInit *RawPat, Record *TheRec,
AnyUnset = InferTypes(Tree, MadeChange);
} while ((AnyUnset || MadeChange) && !(AnyUnset && !MadeChange));
- if (PTy == Instruction) {
+ if (PTy == Instruction || PTy == Expander) {
// Check to make sure there is not any unset types in the tree pattern...
if (AnyUnset) {
- std::cerr << "In instruction pattern: " << *Tree << "\n";
+ std::cerr << "In pattern: " << *Tree << "\n";
error("Could not infer all types!");
}
@@ -296,6 +298,20 @@ void InstrSelectorEmitter::ProcessInstructionPatterns() {
}
}
+/// ProcessExpanderPatterns - Read in all expander patterns...
+///
+void InstrSelectorEmitter::ProcessExpanderPatterns() {
+ std::vector<Record*> Expanders = Records.getAllDerivedDefinitions("Expander");
+ for (unsigned i = 0, e = Expanders.size(); i != e; ++i) {
+ Record *Expander = Expanders[i];
+ DagInit *DI = Expanders[i]->getValueAsDag("Pattern");
+
+ Pattern *P = new Pattern(Pattern::Expander, DI, Expanders[i], *this);
+
+ DEBUG(std::cerr << "Parsed " << *P << "\n");
+ }
+}
+
void InstrSelectorEmitter::run(std::ostream &OS) {
// Type-check all of the node types to ensure we "understand" them.
@@ -308,5 +324,5 @@ void InstrSelectorEmitter::run(std::ostream &OS) {
ProcessInstructionPatterns();
// Read all of the Expander patterns in...
-
+ ProcessExpanderPatterns();
}
diff --git a/utils/TableGen/InstrSelectorEmitter.h b/utils/TableGen/InstrSelectorEmitter.h
index b168e50686..681830ffa8 100644
--- a/utils/TableGen/InstrSelectorEmitter.h
+++ b/utils/TableGen/InstrSelectorEmitter.h
@@ -199,6 +199,9 @@ private:
// ProcessInstructionPatterns - Read in all subclasses of Instruction, and
// process those with a useful Pattern field.
void ProcessInstructionPatterns();
+
+ // ProcessExpanderPatterns - Read in all of the expanded patterns.
+ void ProcessExpanderPatterns();
};
#endif