+bool MatcherGen::recordUniqueNode(std::string Name) {
+ unsigned &VarMapEntry = VariableMap[Name];
+ if (VarMapEntry == 0) {
+ // If it is a named node, we must emit a 'Record' opcode.
+ AddMatcher(new RecordMatcher("$" + Name, NextRecordedOperandNo));
+ VarMapEntry = ++NextRecordedOperandNo;
+ return true;
+ }
+
+ // If we get here, this is a second reference to a specific name. Since
+ // we already have checked that the first reference is valid, we don't
+ // have to recursively match it, just check that it's the same as the
+ // previously named thing.
+ AddMatcher(new CheckSameMatcher(VarMapEntry-1));
+ return false;
+}