aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-15 02:38:02 +0000
committerChris Lattner <sabre@nondot.org>2005-09-15 02:38:02 +0000
commitb39e4be1e18e0df15a4d46d474cd523a9a4cb948 (patch)
tree08e65a4295ab4776bafc1509a3356c0aeff57294 /utils
parentf1311843d542a863a1ae8a813c336b0de23492bb (diff)
downloadexternal_llvm-b39e4be1e18e0df15a4d46d474cd523a9a4cb948.zip
external_llvm-b39e4be1e18e0df15a4d46d474cd523a9a4cb948.tar.gz
external_llvm-b39e4be1e18e0df15a4d46d474cd523a9a4cb948.tar.bz2
rename a couple of methods, add structure for pattern parsing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp41
-rw-r--r--utils/TableGen/DAGISelEmitter.h5
2 files changed, 29 insertions, 17 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index c61ba03..8d0f65f 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -527,14 +527,14 @@ void DAGISelEmitter::ParseNodeTransforms(std::ostream &OS) {
-/// ParseAndResolvePatternFragments - Parse all of the PatFrag definitions in
-/// the .td file, building up the PatternFragments map. After we've collected
-/// them all, inline fragments together as necessary, so that there are no
-/// references left inside a pattern fragment to a pattern fragment.
+/// ParsePatternFragments - Parse all of the PatFrag definitions in the .td
+/// file, building up the PatternFragments map. After we've collected them all,
+/// inline fragments together as necessary, so that there are no references left
+/// inside a pattern fragment to a pattern fragment.
///
/// This also emits all of the predicate functions to the output file.
///
-void DAGISelEmitter::ParseAndResolvePatternFragments(std::ostream &OS) {
+void DAGISelEmitter::ParsePatternFragments(std::ostream &OS) {
std::vector<Record*> Fragments = Records.getAllDerivedDefinitions("PatFrag");
// First step, parse all of the fragments and emit predicate functions.
@@ -739,10 +739,10 @@ FindPatternInputsAndOutputs(TreePattern *I, TreePatternNode *Pat,
}
-/// ParseAndResolveInstructions - Parse all of the instructions, inlining and
-/// resolving any fragments involved. This populates the Instructions list with
-/// fully resolved instructions.
-void DAGISelEmitter::ParseAndResolveInstructions() {
+/// ParseInstructions - Parse all of the instructions, inlining and resolving
+/// any fragments involved. This populates the Instructions list with fully
+/// resolved instructions.
+void DAGISelEmitter::ParseInstructions() {
std::vector<Record*> Instrs = Records.getAllDerivedDefinitions("Instruction");
for (unsigned i = 0, e = Instrs.size(); i != e; ++i) {
@@ -888,12 +888,22 @@ void DAGISelEmitter::ParseAndResolveInstructions() {
TreePatternNode *SrcPattern = Pattern->getChild(1)->clone();
TreePatternNode *DstPattern = Instructions[i].getResultPattern();
PatternsToMatch.push_back(std::make_pair(SrcPattern, DstPattern));
- DEBUG(std::cerr << "PATTERN TO MATCH: "; SrcPattern->dump();
- std::cerr << "\nRESULT DAG : ";
- DstPattern->dump(); std::cerr << "\n");
}
}
+void DAGISelEmitter::ParsePatterns() {
+
+
+
+
+ DEBUG(std::cerr << "\n\nPARSED PATTERNS TO MATCH:\n\n";
+ for (unsigned i = 0, e = PatternsToMatch.size(); i != e; ++i) {
+ std::cerr << "PATTERN: "; PatternsToMatch[i].first->dump();
+ std::cerr << "\nRESULT: ";PatternsToMatch[i].second->dump();
+ std::cerr << "\n";
+ });
+}
+
void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
// Emit boilerplate.
OS << "// The main instruction selector code.\n"
@@ -929,9 +939,10 @@ void DAGISelEmitter::run(std::ostream &OS) {
<< "methods.\n\n";
ParseNodeInfo();
ParseNodeTransforms(OS);
- ParseAndResolvePatternFragments(OS);
- ParseAndResolveInstructions();
-
+ ParsePatternFragments(OS);
+ ParseInstructions();
+ ParsePatterns();
+
// TODO: convert some instructions to expanders if needed or something.
EmitInstructionSelector(OS);
diff --git a/utils/TableGen/DAGISelEmitter.h b/utils/TableGen/DAGISelEmitter.h
index d1381e6..280cab3 100644
--- a/utils/TableGen/DAGISelEmitter.h
+++ b/utils/TableGen/DAGISelEmitter.h
@@ -333,8 +333,9 @@ public:
private:
void ParseNodeInfo();
void ParseNodeTransforms(std::ostream &OS);
- void ParseAndResolvePatternFragments(std::ostream &OS);
- void ParseAndResolveInstructions();
+ void ParsePatternFragments(std::ostream &OS);
+ void ParseInstructions();
+ void ParsePatterns();
void FindPatternInputsAndOutputs(TreePattern *I, TreePatternNode *Pat,
std::map<std::string,
TreePatternNode*> &InstInputs,