summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-17 01:03:09 +0000
committerChris Lattner <sabre@nondot.org>2010-02-17 01:03:09 +0000
commitc96087b3433582f1c2bdb4f0ad3dad7f0b350339 (patch)
tree504b2a4013314d19cc912027c296f68a17d53763 /utils
parent9ee7123ab462d97a2b242280e9bf0b47883531cb (diff)
downloadllvm-c96087b3433582f1c2bdb4f0ad3dad7f0b350339.tar.gz
llvm-c96087b3433582f1c2bdb4f0ad3dad7f0b350339.tar.bz2
llvm-c96087b3433582f1c2bdb4f0ad3dad7f0b350339.tar.xz
improve comments on OPC_Record to say what we're recording a node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelMatcher.h8
-rw-r--r--utils/TableGen/DAGISelMatcherEmitter.cpp4
-rw-r--r--utils/TableGen/DAGISelMatcherGen.cpp2
3 files changed, 11 insertions, 3 deletions
diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h
index b5dabafa52..e20a00ee31 100644
--- a/utils/TableGen/DAGISelMatcher.h
+++ b/utils/TableGen/DAGISelMatcher.h
@@ -127,8 +127,14 @@ public:
/// RecordMatcherNode - Save the current node in the operand list.
class RecordMatcherNode : public MatcherNodeWithChild {
+ /// WhatFor - This is a string indicating why we're recording this. This
+ /// should only be used for comment generation not anything semantic.
+ std::string WhatFor;
public:
- RecordMatcherNode() : MatcherNodeWithChild(Record) {}
+ RecordMatcherNode(StringRef whatfor)
+ : MatcherNodeWithChild(Record), WhatFor(whatfor) {}
+
+ StringRef getWhatFor() const { return WhatFor; }
static inline bool classof(const MatcherNode *N) {
return N->getKind() == Record;
diff --git a/utils/TableGen/DAGISelMatcherEmitter.cpp b/utils/TableGen/DAGISelMatcherEmitter.cpp
index af75d7d71e..9b37254cbd 100644
--- a/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -126,7 +126,9 @@ EmitMatcher(const MatcherNode *N, unsigned Indent) {
OS.PadToColumn(Indent*2) << "OPC_Emit, /*XXX*/\n\n";
return 1;
case MatcherNode::Record:
- OS << "OPC_Record,\n";
+ OS << "OPC_Record,";
+ OS.PadToColumn(CommentIndent) << "// "
+ << cast<RecordMatcherNode>(N)->getWhatFor() << '\n';
return 1;
case MatcherNode::MoveChild:
OS << "OPC_MoveChild, "
diff --git a/utils/TableGen/DAGISelMatcherGen.cpp b/utils/TableGen/DAGISelMatcherGen.cpp
index c44be1cad0..5591cfb2a8 100644
--- a/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/utils/TableGen/DAGISelMatcherGen.cpp
@@ -288,7 +288,7 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N,
NumRecorded += 2; // Input and output chains.
} else {
// If it is a normal named node, we must emit a 'Record' opcode.
- AddMatcherNode(new RecordMatcherNode());
+ AddMatcherNode(new RecordMatcherNode(N->getName()));
NumRecorded = 1;
}
NextRecordedOperandNo += NumRecorded;