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 //===----------------------------------------------------------------------===//
26 // RecTy subclasses...
55 //===----------------------------------------------------------------------===//
57 //===----------------------------------------------------------------------===//
62 virtual void print(std::ostream &OS) const = 0;
65 /// typeIsConvertibleTo - Return true if all values of 'this' type can be
66 /// converted to the specified type.
67 virtual bool typeIsConvertibleTo(const RecTy *RHS) const = 0;
69 public: // These methods should only be called from subclasses of Init
70 virtual Init *convertValue( UnsetInit *UI) { return 0; }
71 virtual Init *convertValue( BitInit *BI) { return 0; }
72 virtual Init *convertValue( BitsInit *BI) { return 0; }
73 virtual Init *convertValue( IntInit *II) { return 0; }
74 virtual Init *convertValue(StringInit *SI) { return 0; }
75 virtual Init *convertValue( ListInit *LI) { return 0; }
76 virtual Init *convertValue( CodeInit *CI) { return 0; }
77 virtual Init *convertValue(VarBitInit *VB) { return 0; }
78 virtual Init *convertValue( DefInit *DI) { return 0; }
79 virtual Init *convertValue( DagInit *DI) { return 0; }
80 virtual Init *convertValue( TypedInit *TI) { return 0; }
81 virtual Init *convertValue( VarInit *VI) {
82 return convertValue((TypedInit*)VI);
84 virtual Init *convertValue( FieldInit *FI) {
85 return convertValue((TypedInit*)FI);
88 public: // These methods should only be called by subclasses of RecTy.
89 // baseClassOf - These virtual methods should be overloaded to return true iff
90 // all values of type 'RHS' can be converted to the 'this' type.
91 virtual bool baseClassOf(const BitRecTy *RHS) const { return false; }
92 virtual bool baseClassOf(const BitsRecTy *RHS) const { return false; }
93 virtual bool baseClassOf(const IntRecTy *RHS) const { return false; }
94 virtual bool baseClassOf(const StringRecTy *RHS) const { return false; }
95 virtual bool baseClassOf(const ListRecTy *RHS) const { return false; }
96 virtual bool baseClassOf(const CodeRecTy *RHS) const { return false; }
97 virtual bool baseClassOf(const DagRecTy *RHS) const { return false; }
98 virtual bool baseClassOf(const RecordRecTy *RHS) const { return false; }
101 inline std::ostream &operator<<(std::ostream &OS, const RecTy &Ty) {
107 /// BitRecTy - 'bit' - Represent a single bit
109 struct BitRecTy : public RecTy {
110 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
111 Init *convertValue(BitInit *BI) { return (Init*)BI; }
112 Init *convertValue(BitsInit *BI);
113 Init *convertValue(IntInit *II);
114 Init *convertValue(TypedInit *VI);
115 Init *convertValue(VarBitInit *VB) { return (Init*)VB; }
117 void print(std::ostream &OS) const { OS << "bit"; }
119 bool typeIsConvertibleTo(const RecTy *RHS) const {
120 return RHS->baseClassOf(this);
122 virtual bool baseClassOf(const BitRecTy *RHS) const { return true; }
123 virtual bool baseClassOf(const BitsRecTy *RHS) const;
124 virtual bool baseClassOf(const IntRecTy *RHS) const { return true; }
128 /// BitsRecTy - 'bits<n>' - Represent a fixed number of bits
130 class BitsRecTy : public RecTy {
133 BitsRecTy(unsigned Sz) : Size(Sz) {}
135 unsigned getNumBits() const { return Size; }
137 Init *convertValue(UnsetInit *UI);
138 Init *convertValue(BitInit *UI);
139 Init *convertValue(BitsInit *BI);
140 Init *convertValue(IntInit *II);
141 Init *convertValue(TypedInit *VI);
143 void print(std::ostream &OS) const { OS << "bits<" << Size << ">"; }
145 bool typeIsConvertibleTo(const RecTy *RHS) const {
146 return RHS->baseClassOf(this);
148 virtual bool baseClassOf(const BitRecTy *RHS) const { return Size == 1; }
149 virtual bool baseClassOf(const IntRecTy *RHS) const { return true; }
150 virtual bool baseClassOf(const BitsRecTy *RHS) const {
151 return RHS->Size == Size;
156 /// IntRecTy - 'int' - Represent an integer value of no particular size
158 struct IntRecTy : public RecTy {
159 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
160 Init *convertValue(IntInit *II) { return (Init*)II; }
161 Init *convertValue(BitInit *BI);
162 Init *convertValue(BitsInit *BI);
163 Init *convertValue(TypedInit *TI);
165 void print(std::ostream &OS) const { OS << "int"; }
167 bool typeIsConvertibleTo(const RecTy *RHS) const {
168 return RHS->baseClassOf(this);
171 virtual bool baseClassOf(const BitRecTy *RHS) const { return true; }
172 virtual bool baseClassOf(const IntRecTy *RHS) const { return true; }
173 virtual bool baseClassOf(const BitsRecTy *RHS) const { return true; }
176 /// StringRecTy - 'string' - Represent an string value
178 struct StringRecTy : public RecTy {
179 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
180 Init *convertValue(StringInit *SI) { return (Init*)SI; }
181 Init *convertValue(TypedInit *TI);
182 void print(std::ostream &OS) const { OS << "string"; }
184 bool typeIsConvertibleTo(const RecTy *RHS) const {
185 return RHS->baseClassOf(this);
188 virtual bool baseClassOf(const StringRecTy *RHS) const { return true; }
191 /// ListRecTy - 'list<Ty>' - Represent a list of values, all of which must be of
192 /// the specified type.
194 class ListRecTy : public RecTy {
197 ListRecTy(RecTy *T) : Ty(T) {}
199 RecTy *getElementType() const { return Ty; }
201 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
202 Init *convertValue(ListInit *LI);
203 Init *convertValue(TypedInit *TI);
205 void print(std::ostream &OS) const;
207 bool typeIsConvertibleTo(const RecTy *RHS) const {
208 return RHS->baseClassOf(this);
211 virtual bool baseClassOf(const ListRecTy *RHS) const {
212 return RHS->getElementType()->typeIsConvertibleTo(Ty);
216 /// CodeRecTy - 'code' - Represent an code fragment, function or method.
218 struct CodeRecTy : public RecTy {
219 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
220 Init *convertValue( CodeInit *CI) { return (Init*)CI; }
221 Init *convertValue(TypedInit *TI);
223 void print(std::ostream &OS) const { OS << "code"; }
225 bool typeIsConvertibleTo(const RecTy *RHS) const {
226 return RHS->baseClassOf(this);
228 virtual bool baseClassOf(const CodeRecTy *RHS) const { return true; }
231 /// DagRecTy - 'dag' - Represent a dag fragment
233 struct DagRecTy : public RecTy {
234 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
235 Init *convertValue( DagInit *CI) { return (Init*)CI; }
236 Init *convertValue(TypedInit *TI);
238 void print(std::ostream &OS) const { OS << "dag"; }
240 bool typeIsConvertibleTo(const RecTy *RHS) const {
241 return RHS->baseClassOf(this);
243 virtual bool baseClassOf(const DagRecTy *RHS) const { return true; }
247 /// RecordRecTy - '<classname>' - Represent an instance of a class, such as:
250 class RecordRecTy : public RecTy {
253 RecordRecTy(Record *R) : Rec(R) {}
255 Record *getRecord() const { return Rec; }
257 Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
258 Init *convertValue( DefInit *DI);
259 Init *convertValue(TypedInit *VI);
261 void print(std::ostream &OS) const;
263 bool typeIsConvertibleTo(const RecTy *RHS) const {
264 return RHS->baseClassOf(this);
266 virtual bool baseClassOf(const RecordRecTy *RHS) const;
271 //===----------------------------------------------------------------------===//
272 // Initializer Classes
273 //===----------------------------------------------------------------------===//
278 /// isComplete - This virtual method should be overridden by values that may
279 /// not be completely specified yet.
280 virtual bool isComplete() const { return true; }
282 /// print - Print out this value.
283 virtual void print(std::ostream &OS) const = 0;
285 /// dump - Debugging method that may be called through a debugger, just
286 /// invokes print on cerr.
289 /// convertInitializerTo - This virtual function is a simple call-back
290 /// function that should be overridden to call the appropriate
291 /// RecTy::convertValue method.
293 virtual Init *convertInitializerTo(RecTy *Ty) = 0;
295 /// convertInitializerBitRange - This method is used to implement the bitrange
296 /// selection operator. Given an initializer, it selects the specified bits
297 /// out, returning them as a new init of bits type. If it is not legal to use
298 /// the bit subscript operator on this initializer, return null.
300 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits) {
304 /// getFieldType - This method is used to implement the FieldInit class.
305 /// Implementors of this method should return the type of the named field if
306 /// they are of record type.
308 virtual RecTy *getFieldType(const std::string &FieldName) const { return 0; }
310 /// getFieldInit - This method complements getFieldType to return the
311 /// initializer for the specified field. If getFieldType returns non-null
312 /// this method should return non-null, otherwise it returns null.
314 virtual Init *getFieldInit(Record &R, const std::string &FieldName) const {
318 /// resolveReferences - This method is used by classes that refer to other
319 /// variables which may not be defined at the time they expression is formed.
320 /// If a value is set for the variable later, this method will be called on
321 /// users of the value to allow the value to propagate out.
323 virtual Init *resolveReferences(Record &R) { return this; }
326 inline std::ostream &operator<<(std::ostream &OS, const Init &I) {
327 I.print(OS); return OS;
331 /// UnsetInit - ? - Represents an uninitialized value
333 struct UnsetInit : public Init {
334 virtual Init *convertInitializerTo(RecTy *Ty) {
335 return Ty->convertValue(this);
338 virtual bool isComplete() const { return false; }
339 virtual void print(std::ostream &OS) const { OS << "?"; }
343 /// BitInit - true/false - Represent a concrete initializer for a bit.
345 class BitInit : public Init {
348 BitInit(bool V) : Value(V) {}
350 bool getValue() const { return Value; }
352 virtual Init *convertInitializerTo(RecTy *Ty) {
353 return Ty->convertValue(this);
356 virtual void print(std::ostream &OS) const { OS << (Value ? "1" : "0"); }
359 /// BitsInit - { a, b, c } - Represents an initializer for a BitsRecTy value.
360 /// It contains a vector of bits, whose size is determined by the type.
362 class BitsInit : public Init {
363 std::vector<Init*> Bits;
365 BitsInit(unsigned Size) : Bits(Size) {}
367 unsigned getNumBits() const { return Bits.size(); }
369 Init *getBit(unsigned Bit) const {
370 assert(Bit < Bits.size() && "Bit index out of range!");
373 void setBit(unsigned Bit, Init *V) {
374 assert(Bit < Bits.size() && "Bit index out of range!");
375 assert(Bits[Bit] == 0 && "Bit already set!");
379 virtual Init *convertInitializerTo(RecTy *Ty) {
380 return Ty->convertValue(this);
382 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
384 virtual bool isComplete() const {
385 for (unsigned i = 0; i != getNumBits(); ++i)
386 if (!getBit(i)->isComplete()) return false;
389 virtual void print(std::ostream &OS) const;
391 virtual Init *resolveReferences(Record &R);
393 // printXX - Print this bitstream with the specified format, returning true if
394 // it is not possible.
395 bool printInHex(std::ostream &OS) const;
396 bool printAsVariable(std::ostream &OS) const;
397 bool printAsUnset(std::ostream &OS) const;
401 /// IntInit - 7 - Represent an initalization by a literal integer value.
403 class IntInit : public Init {
406 IntInit(int V) : Value(V) {}
408 int getValue() const { return Value; }
410 virtual Init *convertInitializerTo(RecTy *Ty) {
411 return Ty->convertValue(this);
413 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
415 virtual void print(std::ostream &OS) const { OS << Value; }
419 /// StringInit - "foo" - Represent an initialization by a string value.
421 class StringInit : public Init {
424 StringInit(const std::string &V) : Value(V) {}
426 const std::string &getValue() const { return Value; }
428 virtual Init *convertInitializerTo(RecTy *Ty) {
429 return Ty->convertValue(this);
432 virtual void print(std::ostream &OS) const { OS << "\"" << Value << "\""; }
435 /// CodeInit - "[{...}]" - Represent a code fragment.
437 class CodeInit : public Init {
440 CodeInit(const std::string &V) : Value(V) {}
442 const std::string getValue() const { return Value; }
444 virtual Init *convertInitializerTo(RecTy *Ty) {
445 return Ty->convertValue(this);
448 virtual void print(std::ostream &OS) const { OS << "[{" << Value << "}]"; }
451 /// ListInit - [AL, AH, CL] - Represent a list of defs
453 class ListInit : public Init {
454 std::vector<Init*> Values;
456 ListInit(std::vector<Init*> &Vs) {
460 unsigned getSize() const { return Values.size(); }
461 Init *getElement(unsigned i) const {
462 assert(i < Values.size() && "List element index out of range!");
466 virtual Init *convertInitializerTo(RecTy *Ty) {
467 return Ty->convertValue(this);
470 virtual void print(std::ostream &OS) const;
474 /// TypedInit - This is the common super-class of types that have a specific,
477 class TypedInit : public Init {
480 TypedInit(RecTy *T) : Ty(T) {}
482 RecTy *getType() const { return Ty; }
484 /// resolveBitReference - This method is used to implement
485 /// VarBitInit::resolveReferences. If the bit is able to be resolved, we
486 /// simply return the resolved value, otherwise we return this.
488 virtual Init *resolveBitReference(Record &R, unsigned Bit) = 0;
491 /// VarInit - 'Opcode' - Represent a reference to an entire variable object.
493 class VarInit : public TypedInit {
496 VarInit(const std::string &VN, RecTy *T) : TypedInit(T), VarName(VN) {}
498 virtual Init *convertInitializerTo(RecTy *Ty) {
499 return Ty->convertValue(this);
502 const std::string &getName() const { return VarName; }
504 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
506 virtual Init *resolveBitReference(Record &R, unsigned Bit);
508 virtual RecTy *getFieldType(const std::string &FieldName) const;
509 virtual Init *getFieldInit(Record &R, const std::string &FieldName) const;
511 /// resolveReferences - This method is used by classes that refer to other
512 /// variables which may not be defined at the time they expression is formed.
513 /// If a value is set for the variable later, this method will be called on
514 /// users of the value to allow the value to propagate out.
516 virtual Init *resolveReferences(Record &R);
518 virtual void print(std::ostream &OS) const { OS << VarName; }
522 /// VarBitInit - Opcode{0} - Represent access to one bit of a variable or field.
524 class VarBitInit : public Init {
528 VarBitInit(TypedInit *T, unsigned B) : TI(T), Bit(B) {
529 assert(T->getType() && dynamic_cast<BitsRecTy*>(T->getType()) &&
530 ((BitsRecTy*)T->getType())->getNumBits() > B &&
531 "Illegal VarBitInit expression!");
534 virtual Init *convertInitializerTo(RecTy *Ty) {
535 return Ty->convertValue(this);
538 TypedInit *getVariable() const { return TI; }
539 unsigned getBitNum() const { return Bit; }
541 virtual void print(std::ostream &OS) const {
542 TI->print(OS); OS << "{" << Bit << "}";
544 virtual Init *resolveReferences(Record &R);
548 /// DefInit - AL - Represent a reference to a 'def' in the description
550 class DefInit : public Init {
553 DefInit(Record *D) : Def(D) {}
555 virtual Init *convertInitializerTo(RecTy *Ty) {
556 return Ty->convertValue(this);
559 Record *getDef() const { return Def; }
561 //virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
563 virtual RecTy *getFieldType(const std::string &FieldName) const;
564 virtual Init *getFieldInit(Record &R, const std::string &FieldName) const;
566 virtual void print(std::ostream &OS) const;
570 /// FieldInit - X.Y - Represent a reference to a subfield of a variable
572 class FieldInit : public TypedInit {
573 Init *Rec; // Record we are referring to
574 std::string FieldName; // Field we are accessing
576 FieldInit(Init *R, const std::string &FN)
577 : TypedInit(R->getFieldType(FN)), Rec(R), FieldName(FN) {
578 assert(getType() && "FieldInit with non-record type!");
581 virtual Init *convertInitializerTo(RecTy *Ty) {
582 return Ty->convertValue(this);
585 virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
587 virtual Init *resolveBitReference(Record &R, unsigned Bit);
589 virtual Init *resolveReferences(Record &R);
591 virtual void print(std::ostream &OS) const {
592 Rec->print(OS); OS << "." << FieldName;
596 /// DagInit - (def a, b) - Represent a DAG tree value. DAG inits are required
597 /// to have Records for their first value, after that, any legal Init is
600 class DagInit : public Init {
602 std::vector<Init*> Args;
603 std::vector<std::string> ArgNames;
605 DagInit(Record *D, const std::vector<std::pair<Init*, std::string> > &args)
607 Args.reserve(args.size());
608 ArgNames.reserve(args.size());
609 for (unsigned i = 0, e = args.size(); i != e; ++i) {
610 Args.push_back(args[i].first);
611 ArgNames.push_back(args[i].second);
615 virtual Init *convertInitializerTo(RecTy *Ty) {
616 return Ty->convertValue(this);
619 Record *getNodeType() const { return NodeTypeDef; }
621 unsigned getNumArgs() const { return Args.size(); }
622 Init *getArg(unsigned Num) const {
623 assert(Num < Args.size() && "Arg number out of range!");
626 const std::string &getArgName(unsigned Num) const {
627 assert(Num < ArgNames.size() && "Arg number out of range!");
628 return ArgNames[Num];
631 void setArg(unsigned Num, Init *I) {
632 assert(Num < Args.size() && "Arg number out of range!");
636 virtual void print(std::ostream &OS) const;
639 //===----------------------------------------------------------------------===//
640 // High-Level Classes
641 //===----------------------------------------------------------------------===//
649 RecordVal(const std::string &N, RecTy *T, unsigned P);
651 const std::string &getName() const { return Name; }
653 unsigned getPrefix() const { return Prefix; }
654 RecTy *getType() const { return Ty; }
655 Init *getValue() const { return Value; }
657 bool setValue(Init *V) {
659 Value = V->convertInitializerTo(Ty);
667 void print(std::ostream &OS, bool PrintSem = true) const;
670 inline std::ostream &operator<<(std::ostream &OS, const RecordVal &RV) {
676 const std::string Name;
677 std::vector<std::string> TemplateArgs;
678 std::vector<RecordVal> Values;
679 std::vector<Record*> SuperClasses;
682 Record(const std::string &N) : Name(N) {}
685 const std::string &getName() const { return Name; }
686 const std::vector<std::string> &getTemplateArgs() const {
689 const std::vector<RecordVal> &getValues() const { return Values; }
690 const std::vector<Record*> &getSuperClasses() const { return SuperClasses; }
692 bool isTemplateArg(const std::string &Name) const {
693 for (unsigned i = 0, e = TemplateArgs.size(); i != e; ++i)
694 if (TemplateArgs[i] == Name) return true;
698 const RecordVal *getValue(const std::string &Name) const {
699 for (unsigned i = 0, e = Values.size(); i != e; ++i)
700 if (Values[i].getName() == Name) return &Values[i];
703 RecordVal *getValue(const std::string &Name) {
704 for (unsigned i = 0, e = Values.size(); i != e; ++i)
705 if (Values[i].getName() == Name) return &Values[i];
709 void addTemplateArg(const std::string &Name) {
710 assert(!isTemplateArg(Name) && "Template arg already defined!");
711 TemplateArgs.push_back(Name);
714 void addValue(const RecordVal &RV) {
715 assert(getValue(RV.getName()) == 0 && "Value already added!");
716 Values.push_back(RV);
719 void removeValue(const std::string &Name) {
720 assert(getValue(Name) && "Cannot remove an entry that does not exist!");
721 for (unsigned i = 0, e = Values.size(); i != e; ++i)
722 if (Values[i].getName() == Name) {
723 Values.erase(Values.begin()+i);
726 assert(0 && "Name does not exist in record!");
729 bool isSubClassOf(Record *R) const {
730 for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
731 if (SuperClasses[i] == R)
736 bool isSubClassOf(const std::string &Name) const {
737 for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
738 if (SuperClasses[i]->getName() == Name)
743 void addSuperClass(Record *R) {
744 assert(!isSubClassOf(R) && "Already subclassing record!");
745 SuperClasses.push_back(R);
748 // resolveReferences - If there are any field references that refer to fields
749 // that have been filled in, we can propagate the values now.
751 void resolveReferences();
755 //===--------------------------------------------------------------------===//
756 // High-level methods useful to tablegen back-ends
759 /// getValueInit - Return the initializer for a value with the specified name,
760 /// or throw an exception if the field does not exist.
762 Init *getValueInit(const std::string &FieldName) const;
764 /// getValueAsString - This method looks up the specified field and returns
765 /// its value as a string, throwing an exception if the field does not exist
766 /// or if the value is not a string.
768 std::string getValueAsString(const std::string &FieldName) const;
770 /// getValueAsBitsInit - This method looks up the specified field and returns
771 /// its value as a BitsInit, throwing an exception if the field does not exist
772 /// or if the value is not the right type.
774 BitsInit *getValueAsBitsInit(const std::string &FieldName) const;
776 /// getValueAsListInit - This method looks up the specified field and returns
777 /// its value as a ListInit, throwing an exception if the field does not exist
778 /// or if the value is not the right type.
780 ListInit *getValueAsListInit(const std::string &FieldName) const;
782 /// getValueAsDef - This method looks up the specified field and returns its
783 /// value as a Record, throwing an exception if the field does not exist or if
784 /// the value is not the right type.
786 Record *getValueAsDef(const std::string &FieldName) const;
788 /// getValueAsBit - This method looks up the specified field and returns its
789 /// value as a bit, throwing an exception if the field does not exist or if
790 /// the value is not the right type.
792 bool getValueAsBit(const std::string &FieldName) const;
794 /// getValueAsInt - This method looks up the specified field and returns its
795 /// value as an int, throwing an exception if the field does not exist or if
796 /// the value is not the right type.
798 int getValueAsInt(const std::string &FieldName) const;
800 /// getValueAsDag - This method looks up the specified field and returns its
801 /// value as an Dag, throwing an exception if the field does not exist or if
802 /// the value is not the right type.
804 DagInit *getValueAsDag(const std::string &FieldName) const;
807 std::ostream &operator<<(std::ostream &OS, const Record &R);
810 std::map<std::string, Record*> Classes, Defs;
813 for (std::map<std::string, Record*>::iterator I = Classes.begin(),
814 E = Classes.end(); I != E; ++I)
816 for (std::map<std::string, Record*>::iterator I = Defs.begin(),
817 E = Defs.end(); I != E; ++I)
821 const std::map<std::string, Record*> &getClasses() const { return Classes; }
822 const std::map<std::string, Record*> &getDefs() const { return Defs; }
824 Record *getClass(const std::string &Name) const {
825 std::map<std::string, Record*>::const_iterator I = Classes.find(Name);
826 return I == Classes.end() ? 0 : I->second;
828 Record *getDef(const std::string &Name) const {
829 std::map<std::string, Record*>::const_iterator I = Defs.find(Name);
830 return I == Defs.end() ? 0 : I->second;
832 void addClass(Record *R) {
833 assert(getClass(R->getName()) == 0 && "Class already exists!");
834 Classes.insert(std::make_pair(R->getName(), R));
836 void addDef(Record *R) {
837 assert(getDef(R->getName()) == 0 && "Def already exists!");
838 Defs.insert(std::make_pair(R->getName(), R));
841 //===--------------------------------------------------------------------===//
842 // High-level helper methods, useful for tablegen backends...
844 /// getAllDerivedDefinitions - This method returns all concrete definitions
845 /// that derive from the specified class name. If a class with the specified
846 /// name does not exist, an exception is thrown.
848 getAllDerivedDefinitions(const std::string &ClassName) const;
854 std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK);
856 extern RecordKeeper Records;
858 } // End llvm namespace