[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Sep 8 18:11:56 PDT 2005
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.7 -> 1.8
---
Log message:
use new accessors to simplify code. Add checking to make sure top-level instr
definitions are void
---
Diffs of the changes: (+12 -4)
DAGISelEmitter.cpp | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.7 llvm/utils/TableGen/DAGISelEmitter.cpp:1.8
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.7 Thu Sep 8 18:26:30 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Thu Sep 8 20:11:44 2005
@@ -277,7 +277,7 @@
TP.error("'" + Op->getName() + "' fragment requires " +
utostr(Frag->getNumArgs()) + " operands!");
- TreePatternNode *FragTree = Frag->getTrees()[0]->clone();
+ TreePatternNode *FragTree = Frag->getTree(0)->clone();
// Resolve formal arguments to their actual value.
if (Frag->getNumArgs()) {
@@ -574,9 +574,9 @@
CodeInit *CI =
dynamic_cast<CodeInit*>(Fragments[i]->getValueInit("Predicate"));
if (!CI->getValue().empty()) {
- assert(!P->getTrees()[0]->isLeaf() && "Can't be a leaf!");
+ assert(!P->getTree(0)->isLeaf() && "Can't be a leaf!");
std::string ClassName =
- getSDNodeInfo(P->getTrees()[0]->getOperator()).getSDClassName();
+ getSDNodeInfo(P->getTree(0)->getOperator()).getSDClassName();
const char *C2 = ClassName == "SDNode" ? "N" : "inN";
OS << "static inline bool Predicate_" << Fragments[i]->getName()
@@ -584,7 +584,7 @@
if (ClassName != "SDNode")
OS << " " << ClassName << " *N = cast<" << ClassName << ">(inN);\n";
OS << CI->getValue() << "\n}\n";
- P->getTrees()[0]->setPredicateFn("Predicate_"+Fragments[i]->getName());
+ P->getTree(0)->setPredicateFn("Predicate_"+Fragments[i]->getName());
}
}
@@ -642,6 +642,14 @@
I->dump();
I->error("Could not infer all types in pattern!");
}
+
+ // Verify that the top-level forms in the instruction are of void type.
+ for (unsigned j = 0, e = I->getNumTrees(); j != e; ++j)
+ if (I->getTree(j)->getType() != MVT::isVoid) {
+ I->dump();
+ I->error("Top-level forms in instruction pattern should have"
+ " void types");
+ }
DEBUG(I->dump());
Instructions.push_back(I);
More information about the llvm-commits
mailing list