1 //===- Record.h - Classes to represent Table Records ------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the main TableGen data structures, including the TableGen
11 // types, values, and high-level data structures.
13 //===----------------------------------------------------------------------===//
24 // RecTy subclasses...
53 //===----------------------------------------------------------------------===//
55 //===----------------------------------------------------------------------===//
60 virtual void print(std::ostream &OS) const = 0;
63 /// typeIsConvertibleTo - Return true if all values of 'this' type can be
64 /// converted to the specified type.
65 virtual bool typeIsConvertibleTo(const RecTy *RHS) const = 0;
67 public: // These methods should only be called from subclasses of Init
68 virtual Init *convertValue( UnsetInit *UI) { return 0; }
69 virtual Init *convertValue( BitInit *BI) { return 0; }
70 virtual Init *convertValue( BitsInit *BI) { return 0; }
71 virtual Init *convertValue( IntInit *II) { return 0; }
72 virtual Init *convertValue(StringInit *SI) { return 0; }
73 virtual Init *convertValue( ListInit *LI) { return 0; }
74 virtual Init *convertValue( CodeInit *CI) { return 0; }
75 virtual Init *convertValue(VarBitInit *VB) { return 0; }
76 virtual Init *convertValue( DefInit *DI) { return 0; }
77 virtual Init *convertValue( DagInit *DI) { return 0; }
78 virtual Init *convertValue( TypedInit *TI) { return 0; }
79 virtual Init *convertValue( VarInit *VI) {
80 return convertValue((TypedInit*)VI);
82 virtual Init *convertValue( FieldInit *FI) {
83 return convertValue((TypedInit*)FI);
86 public: // These methods should only be called by subclasses of RecTy.
87 // baseClassOf - These virtual methods should be overloaded to return true iff
88 // all values of type 'RHS' can be converted to the 'this' type.
89 virtual bool baseClassOf(const BitRecTy *RHS) const { return false; }
90 virtual bool baseClassOf(const BitsRecTy *RHS) const { return false; }
91 virtual bool baseClassOf(const IntRecTy *RHS) const { return false; }
92 virtual bool baseClassOf(const StringRecTy *RHS) const { return false; }
93 virtual bool baseClassOf(const ListRecTy *RHS) const { return false; }
94 virtual bool baseClassOf(const CodeRecTy *RHS) const { return false; }
95 virtual bool baseClassOf(const DagRecTy *RHS) const { return false; }
96 virtual bool baseClassOf(const RecordRecTy *RHS) const { return false; }
99 inline std::ostream &operator<<(std::ostream &OS, const RecTy &Ty) {
105 /// BitRecTy - 'bit' - Represent a single bit
107 struct BitRecTy : public RecTy {
108 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
109 Init *convertValue(BitInit *BI) { return (Init*)BI; }
110 Init *convertValue(BitsInit *BI);
111 Init *convertValue(IntInit *II);
112 Init *convertValue(TypedInit *VI);
113 Init *convertValue(VarBitInit *VB) { return (Init*)VB; }
115 void print(std::ostream &OS) const { OS << "bit"; }
117 bool typeIsConvertibleTo(const RecTy *RHS) const {
118 return RHS->baseClassOf(this);
120 virtual bool baseClassOf(const BitRecTy *RHS) const { return true; }
121 virtual bool baseClassOf(const BitsRecTy *RHS) const;
122 virtual bool baseClassOf(const IntRecTy *RHS) const { return true; }
126 /// BitsRecTy - 'bits<n>' - Represent a fixed number of bits
128 class BitsRecTy : public RecTy {
131 BitsRecTy(unsigned Sz) : Size(Sz) {}
133 unsigned getNumBits() const { return Size; }
135 Init *convertValue(UnsetInit *UI);
136 Init *convertValue(BitInit *UI);
137 Init *convertValue(BitsInit *BI);
138 Init *convertValue(IntInit *II);
139 Init *convertValue(TypedInit *VI);
141 void print(std::ostream &OS) const { OS << "bits<" << Size << ">"; }
143 bool typeIsConvertibleTo(const RecTy *RHS) const {
144 return RHS->baseClassOf(this);
146 virtual bool baseClassOf(const BitRecTy *RHS) const { return Size == 1; }
147 virtual bool baseClassOf(const IntRecTy *RHS) const { return true; }
148 virtual bool baseClassOf(const BitsRecTy *RHS) const {
149 return RHS->Size == Size;
154 /// IntRecTy - 'int' - Represent an integer value of no particular size
156 struct IntRecTy : public RecTy {
157 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
158 Init *convertValue(IntInit *II) { return (Init*)II; }
159 Init *convertValue(BitInit *BI);
160 Init *convertValue(BitsInit *BI);
161 Init *convertValue(TypedInit *TI);
163 void print(std::ostream &OS) const { OS << "int"; }
165 bool typeIsConvertibleTo(const RecTy *RHS) const {
166 return RHS->baseClassOf(this);
169 virtual bool baseClassOf(const BitRecTy *RHS) const { return true; }
170 virtual bool baseClassOf(const IntRecTy *RHS) const { return true; }
171 virtual bool baseClassOf(const BitsRecTy *RHS) const { return true; }
174 /// StringRecTy - 'string' - Represent an string value
176 struct StringRecTy : public RecTy {
177 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
178 Init *convertValue(StringInit *SI) { return (Init*)SI; }
179 Init *convertValue(TypedInit *TI);
180 void print(std::ostream &OS) const { OS << "string"; }
182 bool typeIsConvertibleTo(const RecTy *RHS) const {
183 return RHS->baseClassOf(this);
186 virtual bool baseClassOf(const StringRecTy *RHS) const { return true; }
189 /// ListRecTy - 'list<Ty>' - Represent a list of values, all of which must be of
190 /// the specified type.
192 class ListRecTy : public RecTy {
195 ListRecTy(RecTy *T) : Ty(T) {}
197 RecTy *getElementType() const { return Ty; }
199 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
200 Init *convertValue(ListInit *LI);
201 Init *convertValue(TypedInit *TI);
203 void print(std::ostream &OS) const;
205 bool typeIsConvertibleTo(const RecTy *RHS) const {
206 return RHS->baseClassOf(this);
209 virtual bool baseClassOf(const ListRecTy *RHS) const {
210 return RHS->getElementType()->typeIsConvertibleTo(Ty);
214 /// CodeRecTy - 'code' - Represent an code fragment, function or method.
216 struct CodeRecTy : public RecTy {
217 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
218 Init *convertValue( CodeInit *CI) { return (Init*)CI; }
219 Init *convertValue(TypedInit *TI);
221 void print(std::ostream &OS) const { OS << "code"; }
223 bool typeIsConvertibleTo(const RecTy *RHS) const {
224 return RHS->baseClassOf(this);
226 virtual bool baseClassOf(const CodeRecTy *RHS) const { return true; }
229 /// DagRecTy - 'dag' - Represent a dag fragment
231 struct DagRecTy : public RecTy {
232 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
233 Init *convertValue( DagInit *CI) { return (Init*)CI; }
234 Init *convertValue(TypedInit *TI);
236 void print(std::ostream &OS) const { OS << "dag"; }
238 bool typeIsConvertibleTo(const RecTy *RHS) const {
239 return RHS->baseClassOf(this);
241 virtual bool baseClassOf(const DagRecTy *RHS) const { return true; }
245 /// RecordRecTy - '<classname>' - Represent an instance of a class, such as:
248 class RecordRecTy : public RecTy {
251 RecordRecTy(Record *R) : Rec(R) {}
253 Record *getRecord() const { return Rec; }
255 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
256 Init *convertValue( DefInit *DI);
257 Init *convertValue(TypedInit *VI);
259 void print(std::ostream &OS) const;
261 bool typeIsConvertibleTo(const RecTy *RHS) const {
262 return RHS->baseClassOf(this);
264 virtual bool baseClassOf(const RecordRecTy *RHS) const;
269 //===----------------------------------------------------------------------===//
270 // Initializer Classes
271 //===----------------------------------------------------------------------===//
276 /// isComplete - This virtual method should be overridden by values that may
277 /// not be completely specified yet.
278 virtual bool isComplete() const { return true; }
280 /// print - Print out this value.
281 virtual void print(std::ostream &OS) const = 0;
283 /// dump - Debugging method that may be called through a debugger, just
284 /// invokes print on cerr.
287 /// convertInitializerTo - This virtual function is a simple call-back
288 /// function that should be overridden to call the appropriate
289 /// RecTy::convertValue method.
291 virtual Init *convertInitializerTo(RecTy *Ty) = 0;
293 /// convertInitializerBitRange - This method is used to implement the bitrange
294 /// selection operator. Given an initializer, it selects the specified bits
295 /// out, returning them as a new init of bits type. If it is not legal to use
296 /// the bit subscript operator on this initializer, return null.
298 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits) {
302 /// getFieldType - This method is used to implement the FieldInit class.
303 /// Implementors of this method should return the type of the named field if
304 /// they are of record type.
306 virtual RecTy *getFieldType(const std::string &FieldName) const { return 0; }
308 /// getFieldInit - This method complements getFieldType to return the
309 /// initializer for the specified field. If getFieldType returns non-null
310 /// this method should return non-null, otherwise it returns null.
312 virtual Init *getFieldInit(Record &R, const std::string &FieldName) const {
316 /// resolveReferences - This method is used by classes that refer to other
317 /// variables which may not be defined at the time they expression is formed.
318 /// If a value is set for the variable later, this method will be called on
319 /// users of the value to allow the value to propagate out.
321 virtual Init *resolveReferences(Record &R) { return this; }
324 inline std::ostream &operator<<(std::ostream &OS, const Init &I) {
325 I.print(OS); return OS;
329 /// UnsetInit - ? - Represents an uninitialized value
331 struct UnsetInit : public Init {
332 virtual Init *convertInitializerTo(RecTy *Ty) {
333 return Ty->convertValue(this);
336 virtual bool isComplete() const { return false; }
337 virtual void print(std::ostream &OS) const { OS << "?"; }
341 /// BitInit - true/false - Represent a concrete initializer for a bit.
343 class BitInit : public Init {
346 BitInit(bool V) : Value(V) {}
348 bool getValue() const { return Value; }
350 virtual Init *convertInitializerTo(RecTy *Ty) {
351 return Ty->convertValue(this);
354 virtual void print(std::ostream &OS) const { OS << (Value ? "1" : "0"); }
357 /// BitsInit - { a, b, c } - Represents an initializer for a BitsRecTy value.
358 /// It contains a vector of bits, whose size is determined by the type.
360 class BitsInit : public Init {
361 std::vector<Init*> Bits;
363 BitsInit(unsigned Size) : Bits(Size) {}
365 unsigned getNumBits() const { return Bits.size(); }
367 Init *getBit(unsigned Bit) const {
368 assert(Bit < Bits.size() && "Bit index out of range!");
371 void setBit(unsigned Bit, Init *V) {
372 assert(Bit < Bits.size() && "Bit index out of range!");
373 assert(Bits[Bit] == 0 && "Bit already set!");
377 virtual Init *convertInitializerTo(RecTy *Ty) {
378 return Ty->convertValue(this);
380 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
382 virtual bool isComplete() const {
383 for (unsigned i = 0; i != getNumBits(); ++i)
384 if (!getBit(i)->isComplete()) return false;
387 virtual void print(std::ostream &OS) const;
389 virtual Init *resolveReferences(Record &R);
391 // printXX - Print this bitstream with the specified format, returning true if
392 // it is not possible.
393 bool printInHex(std::ostream &OS) const;
394 bool printAsVariable(std::ostream &OS) const;
395 bool printAsUnset(std::ostream &OS) const;
399 /// IntInit - 7 - Represent an initalization by a literal integer value.
401 class IntInit : public Init {
404 IntInit(int V) : Value(V) {}
406 int getValue() const { return Value; }
408 virtual Init *convertInitializerTo(RecTy *Ty) {
409 return Ty->convertValue(this);
411 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
413 virtual void print(std::ostream &OS) const { OS << Value; }
417 /// StringInit - "foo" - Represent an initialization by a string value.
419 class StringInit : public Init {
422 StringInit(const std::string &V) : Value(V) {}
424 const std::string &getValue() const { return Value; }
426 virtual Init *convertInitializerTo(RecTy *Ty) {
427 return Ty->convertValue(this);
430 virtual void print(std::ostream &OS) const { OS << "\"" << Value << "\""; }
433 /// CodeInit - "[{...}]" - Represent a code fragment.
435 class CodeInit : public Init {
438 CodeInit(const std::string &V) : Value(V) {}
440 const std::string getValue() const { return Value; }
442 virtual Init *convertInitializerTo(RecTy *Ty) {
443 return Ty->convertValue(this);
446 virtual void print(std::ostream &OS) const { OS << "[{" << Value << "}]"; }
449 /// ListInit - [AL, AH, CL] - Represent a list of defs
451 class ListInit : public Init {
452 std::vector<Init*> Values;
454 ListInit(std::vector<Init*> &Vs) {
458 unsigned getSize() const { return Values.size(); }
459 Init *getElement(unsigned i) const {
460 assert(i < Values.size() && "List element index out of range!");
464 virtual Init *convertInitializerTo(RecTy *Ty) {
465 return Ty->convertValue(this);
468 virtual void print(std::ostream &OS) const;
472 /// TypedInit - This is the common super-class of types that have a specific,
475 class TypedInit : public Init {
478 TypedInit(RecTy *T) : Ty(T) {}
480 RecTy *getType() const { return Ty; }
482 /// resolveBitReference - This method is used to implement
483 /// VarBitInit::resolveReferences. If the bit is able to be resolved, we
484 /// simply return the resolved value, otherwise we return this.
486 virtual Init *resolveBitReference(Record &R, unsigned Bit) = 0;
489 /// VarInit - 'Opcode' - Represent a reference to an entire variable object.
491 class VarInit : public TypedInit {
494 VarInit(const std::string &VN, RecTy *T) : TypedInit(T), VarName(VN) {}
496 virtual Init *convertInitializerTo(RecTy *Ty) {
497 return Ty->convertValue(this);
500 const std::string &getName() const { return VarName; }
502 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
504 virtual Init *resolveBitReference(Record &R, unsigned Bit);
506 virtual RecTy *getFieldType(const std::string &FieldName) const;
507 virtual Init *getFieldInit(Record &R, const std::string &FieldName) const;
509 /// resolveReferences - This method is used by classes that refer to other
510 /// variables which may not be defined at the time they expression is formed.
511 /// If a value is set for the variable later, this method will be called on
512 /// users of the value to allow the value to propagate out.
514 virtual Init *resolveReferences(Record &R);
516 virtual void print(std::ostream &OS) const { OS << VarName; }
520 /// VarBitInit - Opcode{0} - Represent access to one bit of a variable or field.
522 class VarBitInit : public Init {
526 VarBitInit(TypedInit *T, unsigned B) : TI(T), Bit(B) {
527 assert(T->getType() && dynamic_cast<BitsRecTy*>(T->getType()) &&
528 ((BitsRecTy*)T->getType())->getNumBits() > B &&
529 "Illegal VarBitInit expression!");
532 virtual Init *convertInitializerTo(RecTy *Ty) {
533 return Ty->convertValue(this);
536 TypedInit *getVariable() const { return TI; }
537 unsigned getBitNum() const { return Bit; }
539 virtual void print(std::ostream &OS) const {
540 TI->print(OS); OS << "{" << Bit << "}";
542 virtual Init *resolveReferences(Record &R);
546 /// DefInit - AL - Represent a reference to a 'def' in the description
548 class DefInit : public Init {
551 DefInit(Record *D) : Def(D) {}
553 virtual Init *convertInitializerTo(RecTy *Ty) {
554 return Ty->convertValue(this);
557 Record *getDef() const { return Def; }
559 //virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
561 virtual RecTy *getFieldType(const std::string &FieldName) const;
562 virtual Init *getFieldInit(Record &R, const std::string &FieldName) const;
564 virtual void print(std::ostream &OS) const;
568 /// FieldInit - X.Y - Represent a reference to a subfield of a variable
570 class FieldInit : public TypedInit {
571 Init *Rec; // Record we are referring to
572 std::string FieldName; // Field we are accessing
574 FieldInit(Init *R, const std::string &FN)
575 : TypedInit(R->getFieldType(FN)), Rec(R), FieldName(FN) {
576 assert(getType() && "FieldInit with non-record type!");
579 virtual Init *convertInitializerTo(RecTy *Ty) {
580 return Ty->convertValue(this);
583 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
585 virtual Init *resolveBitReference(Record &R, unsigned Bit);
587 virtual Init *resolveReferences(Record &R);
589 virtual void print(std::ostream &OS) const {
590 Rec->print(OS); OS << "." << FieldName;
594 /// DagInit - (def a, b) - Represent a DAG tree value. DAG inits are required
595 /// to have Records for their first value, after that, any legal Init is
598 class DagInit : public Init {
600 std::vector<Init*> Args;
601 std::vector<std::string> ArgNames;
603 DagInit(Record *D, const std::vector<std::pair<Init*, std::string> > &args)
605 Args.reserve(args.size());
606 ArgNames.reserve(args.size());
607 for (unsigned i = 0, e = args.size(); i != e; ++i) {
608 Args.push_back(args[i].first);
609 ArgNames.push_back(args[i].second);
613 virtual Init *convertInitializerTo(RecTy *Ty) {
614 return Ty->convertValue(this);
617 Record *getNodeType() const { return NodeTypeDef; }
619 unsigned getNumArgs() const { return Args.size(); }
620 Init *getArg(unsigned Num) const {
621 assert(Num < Args.size() && "Arg number out of range!");
624 const std::string &getArgName(unsigned Num) const {
625 assert(Num < ArgNames.size() && "Arg number out of range!");
626 return ArgNames[Num];
629 void setArg(unsigned Num, Init *I) {
630 assert(Num < Args.size() && "Arg number out of range!");
634 virtual void print(std::ostream &OS) const;
637 //===----------------------------------------------------------------------===//
638 // High-Level Classes
639 //===----------------------------------------------------------------------===//
647 RecordVal(const std::string &N, RecTy *T, unsigned P);
649 const std::string &getName() const { return Name; }
651 unsigned getPrefix() const { return Prefix; }
652 RecTy *getType() const { return Ty; }
653 Init *getValue() const { return Value; }
655 bool setValue(Init *V) {
657 Value = V->convertInitializerTo(Ty);
665 void print(std::ostream &OS, bool PrintSem = true) const;
668 inline std::ostream &operator<<(std::ostream &OS, const RecordVal &RV) {
674 const std::string Name;
675 std::vector<std::string> TemplateArgs;
676 std::vector<RecordVal> Values;
677 std::vector<Record*> SuperClasses;
680 Record(const std::string &N) : Name(N) {}
683 const std::string &getName() const { return Name; }
684 const std::vector<std::string> &getTemplateArgs() const {
687 const std::vector<RecordVal> &getValues() const { return Values; }
688 const std::vector<Record*> &getSuperClasses() const { return SuperClasses; }
690 bool isTemplateArg(const std::string &Name) const {
691 for (unsigned i = 0, e = TemplateArgs.size(); i != e; ++i)
692 if (TemplateArgs[i] == Name) return true;
696 const RecordVal *getValue(const std::string &Name) const {
697 for (unsigned i = 0, e = Values.size(); i != e; ++i)
698 if (Values[i].getName() == Name) return &Values[i];
701 RecordVal *getValue(const std::string &Name) {
702 for (unsigned i = 0, e = Values.size(); i != e; ++i)
703 if (Values[i].getName() == Name) return &Values[i];
707 void addTemplateArg(const std::string &Name) {
708 assert(!isTemplateArg(Name) && "Template arg already defined!");
709 TemplateArgs.push_back(Name);
712 void addValue(const RecordVal &RV) {
713 assert(getValue(RV.getName()) == 0 && "Value already added!");
714 Values.push_back(RV);
717 void removeValue(const std::string &Name) {
718 assert(getValue(Name) && "Cannot remove an entry that does not exist!");
719 for (unsigned i = 0, e = Values.size(); i != e; ++i)
720 if (Values[i].getName() == Name) {
721 Values.erase(Values.begin()+i);
724 assert(0 && "Name does not exist in record!");
727 bool isSubClassOf(Record *R) const {
728 for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
729 if (SuperClasses[i] == R)
734 bool isSubClassOf(const std::string &Name) const {
735 for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
736 if (SuperClasses[i]->getName() == Name)
741 void addSuperClass(Record *R) {
742 assert(!isSubClassOf(R) && "Already subclassing record!");
743 SuperClasses.push_back(R);
746 // resolveReferences - If there are any field references that refer to fields
747 // that have been filled in, we can propagate the values now.
749 void resolveReferences();
753 //===--------------------------------------------------------------------===//
754 // High-level methods useful to tablegen back-ends
757 /// getValueInit - Return the initializer for a value with the specified name,
758 /// or throw an exception if the field does not exist.
760 Init *getValueInit(const std::string &FieldName) const;
762 /// getValueAsString - This method looks up the specified field and returns
763 /// its value as a string, throwing an exception if the field does not exist
764 /// or if the value is not a string.
766 std::string getValueAsString(const std::string &FieldName) const;
768 /// getValueAsBitsInit - This method looks up the specified field and returns
769 /// its value as a BitsInit, throwing an exception if the field does not exist
770 /// or if the value is not the right type.
772 BitsInit *getValueAsBitsInit(const std::string &FieldName) const;
774 /// getValueAsListInit - This method looks up the specified field and returns
775 /// its value as a ListInit, throwing an exception if the field does not exist
776 /// or if the value is not the right type.
778 ListInit *getValueAsListInit(const std::string &FieldName) const;
780 /// getValueAsDef - This method looks up the specified field and returns its
781 /// value as a Record, throwing an exception if the field does not exist or if
782 /// the value is not the right type.
784 Record *getValueAsDef(const std::string &FieldName) const;
786 /// getValueAsBit - This method looks up the specified field and returns its
787 /// value as a bit, throwing an exception if the field does not exist or if
788 /// the value is not the right type.
790 bool getValueAsBit(const std::string &FieldName) const;
792 /// getValueAsInt - This method looks up the specified field and returns its
793 /// value as an int, throwing an exception if the field does not exist or if
794 /// the value is not the right type.
796 int getValueAsInt(const std::string &FieldName) const;
798 /// getValueAsDag - This method looks up the specified field and returns its
799 /// value as an Dag, throwing an exception if the field does not exist or if
800 /// the value is not the right type.
802 DagInit *getValueAsDag(const std::string &FieldName) const;
805 std::ostream &operator<<(std::ostream &OS, const Record &R);
808 std::map<std::string, Record*> Classes, Defs;
811 for (std::map<std::string, Record*>::iterator I = Classes.begin(),
812 E = Classes.end(); I != E; ++I)
814 for (std::map<std::string, Record*>::iterator I = Defs.begin(),
815 E = Defs.end(); I != E; ++I)
819 const std::map<std::string, Record*> &getClasses() const { return Classes; }
820 const std::map<std::string, Record*> &getDefs() const { return Defs; }
822 Record *getClass(const std::string &Name) const {
823 std::map<std::string, Record*>::const_iterator I = Classes.find(Name);
824 return I == Classes.end() ? 0 : I->second;
826 Record *getDef(const std::string &Name) const {
827 std::map<std::string, Record*>::const_iterator I = Defs.find(Name);
828 return I == Defs.end() ? 0 : I->second;
830 void addClass(Record *R) {
831 assert(getClass(R->getName()) == 0 && "Class already exists!");
832 Classes.insert(std::make_pair(R->getName(), R));
834 void addDef(Record *R) {
835 assert(getDef(R->getName()) == 0 && "Def already exists!");
836 Defs.insert(std::make_pair(R->getName(), R));
839 //===--------------------------------------------------------------------===//
840 // High-level helper methods, useful for tablegen backends...
842 /// getAllDerivedDefinitions - This method returns all concrete definitions
843 /// that derive from the specified class name. If a class with the specified
844 /// name does not exist, an exception is thrown.
846 getAllDerivedDefinitions(const std::string &ClassName) const;
852 std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK);
854 extern RecordKeeper Records;