[llvm-commits] [llvm] r96433 - in /llvm/trunk/utils/TableGen: DAGISelMatcher.h DAGISelMatcherEmitter.cpp DAGISelMatcherGen.cpp
Chris Lattner
sabre at nondot.org
Tue Feb 16 17:03:10 PST 2010
Author: lattner
Date: Tue Feb 16 19:03:09 2010
New Revision: 96433
URL: http://llvm.org/viewvc/llvm-project?rev=96433&view=rev
Log:
improve comments on OPC_Record to say what we're recording a node.
Modified:
llvm/trunk/utils/TableGen/DAGISelMatcher.h
llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.h?rev=96433&r1=96432&r2=96433&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.h (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.h Tue Feb 16 19:03:09 2010
@@ -127,8 +127,14 @@
/// 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;
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=96433&r1=96432&r2=96433&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp Tue Feb 16 19:03:09 2010
@@ -126,7 +126,9 @@
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, "
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=96433&r1=96432&r2=96433&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Tue Feb 16 19:03:09 2010
@@ -288,7 +288,7 @@
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;
More information about the llvm-commits
mailing list