|
LLVM 24.0.0git
|
#include "llvm/TableGen/Record.h"
Classes | |
| struct | AssertionInfo |
| struct | DumpInfo |
Public Types | |
| enum | RecordKind { RK_Def , RK_AnonymousDef , RK_Class , RK_MultiClass } |
Public Member Functions | |
| Record (const Init *N, ArrayRef< SMLoc > locs, RecordKeeper &records, RecordKind Kind=RK_Def) | |
| Record (StringRef N, ArrayRef< SMLoc > locs, RecordKeeper &records, RecordKind Kind=RK_Def) | |
| Record (const Record &O) | |
| unsigned | getID () const |
| StringRef | getName () const |
| const Init * | getNameInit () const |
| std::string | getNameInitAsString () const |
| void | setName (const Init *Name) |
| ArrayRef< SMLoc > | getLoc () const |
| void | appendLoc (SMLoc Loc) |
| ArrayRef< SMLoc > | getForwardDeclarationLocs () const |
| void | appendReferenceLoc (SMRange Loc) const |
| Add a reference to this record value. | |
| ArrayRef< SMRange > | getReferenceLocs () const |
| Return the references of this record value. | |
| void | appendValueReferenceLoc (const Init *Name, SMRange Loc) const |
Add a reference to the value named Name. | |
| void | appendValueReferenceLocs (const Record &From, const Init *Name) const |
Add the references to the value named Name in From. | |
| ArrayRef< SMRange > | getValueReferenceLocs (const Init *Name) const |
Return the references to the value named Name. | |
| void | updateClassLoc (SMLoc Loc) |
| const RecordRecTy * | getType () const |
| DefInit * | getDefInit () const |
| get the corresponding DefInit. | |
| bool | isClass () const |
| bool | isMultiClass () const |
| bool | isAnonymous () const |
| ArrayRef< RecordVal > | getTemplateArgs () const |
| Return the template arguments of this class or multiclass. | |
| ArrayRef< RecordVal > | getValues () const |
| Return the fields of this record. | |
| ArrayRef< AssertionInfo > | getAssertions () const |
| ArrayRef< DumpInfo > | getDumps () const |
| void | getSuperClasses (std::vector< const Record * > &Classes) const |
Append all superclasses in post-order to Classes. | |
| std::vector< const Record * > | getSuperClasses () const |
| Return all superclasses in post-order. | |
| bool | hasDirectSuperClass (const Record *SuperClass) const |
| Determine whether this record has the specified direct superclass. | |
| ArrayRef< std::pair< const Record *, SMRange > > | getDirectSuperClasses () const |
| Return the direct superclasses of this record. | |
| const RecordVal * | getTemplateArg (const Init *Name) const |
| Return the template argument with the given name, or null if there is none. | |
| RecordVal * | getTemplateArg (const Init *Name) |
| const RecordVal * | getValue (const Init *Name) const |
| Return the field with the given name, or null if there is none. | |
| const RecordVal * | getValue (StringRef Name) const |
| RecordVal * | getValue (const Init *Name) |
| RecordVal * | getValue (StringRef Name) |
| bool | addTemplateArg (const RecordVal &Arg) |
| Add a template argument. | |
| void | addValue (const RecordVal &RV) |
| void | removeValue (const Init *Name) |
| void | removeValue (StringRef Name) |
| void | addAssertion (SMLoc Loc, const Init *Condition, const Init *Message) |
| void | addDump (SMLoc Loc, const Init *Message) |
| void | appendAssertions (const Record *Rec) |
| void | appendDumps (const Record *Rec) |
| void | checkRecordAssertions () |
| void | emitRecordDumps () |
| void | checkUnusedTemplateArgs () |
| bool | isSubClassOf (const Record *R) const |
| bool | isSubClassOf (StringRef Name) const |
| void | addDirectSuperClass (const Record *R, SMRange Range) |
| void | resolveReferences (const Init *NewName=nullptr) |
| If there are any field references that refer to fields that have been filled in, we can propagate the values now. | |
| void | resolveReferences (Resolver &R, const RecordVal *SkipVal=nullptr) |
| Apply the resolver to the name of the record as well as to the initializers of all fields of the record except SkipVal. | |
| RecordKeeper & | getRecords () const |
| void | dump () const |
| SMLoc | getFieldLoc (StringRef FieldName) const |
| Return the source location for the named field. | |
| const Init * | getValueInit (StringRef FieldName) const |
| Return the initializer for a value with the specified name, or throw an exception if the field does not exist. | |
| bool | isValueUnset (StringRef FieldName) const |
| Return true if the named field is unset. | |
| StringRef | getValueAsString (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a string, throwing an exception if the field does not exist or if the value is not a string. | |
| std::optional< StringRef > | getValueAsOptionalString (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a string, throwing an exception if the value is not a string and std::nullopt if the field does not exist. | |
| const BitsInit * | getValueAsBitsInit (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a BitsInit, throwing an exception if the field does not exist or if the value is not the right type. | |
| const ListInit * | getValueAsListInit (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a ListInit, throwing an exception if the field does not exist or if the value is not the right type. | |
| std::vector< const Record * > | getValueAsListOfDefs (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a vector of records, throwing an exception if the field does not exist or if the value is not the right type. | |
| std::vector< int64_t > | getValueAsListOfInts (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a vector of integers, throwing an exception if the field does not exist or if the value is not the right type. | |
| std::vector< StringRef > | getValueAsListOfStrings (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a vector of strings, throwing an exception if the field does not exist or if the value is not the right type. | |
| const Record * | getValueAsDef (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a Record, throwing an exception if the field does not exist or if the value is not the right type. | |
| const Record * | getValueAsOptionalDef (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a Record, returning null if the field exists but is "uninitialized" (i.e. | |
| bool | getValueAsBit (StringRef FieldName) const |
| This method looks up the specified field and returns its value as a bit, throwing an exception if the field does not exist or if the value is not the right type. | |
| bool | getValueAsBitOrUnset (StringRef FieldName, bool &Unset) const |
| This method looks up the specified field and returns its value as a bit. | |
| int64_t | getValueAsInt (StringRef FieldName) const |
| This method looks up the specified field and returns its value as an int64_t, throwing an exception if the field does not exist or if the value is not the right type. | |
| const DagInit * | getValueAsDag (StringRef FieldName) const |
| This method looks up the specified field and returns its value as an Dag, throwing an exception if the field does not exist or if the value is not the right type. | |
Static Public Member Functions | |
| static unsigned | getNewUID (RecordKeeper &RK) |
|
inlineexplicit |
Definition at line 1734 of file Record.h.
References getNewUID(), N, and RK_Def.
Referenced by addDirectSuperClass(), appendAssertions(), appendDumps(), appendValueReferenceLocs(), getSuperClasses(), getTemplateArg(), getValue(), getValue(), getValueAsDef(), getValueAsOptionalDef(), hasDirectSuperClass(), isSubClassOf(), isSubClassOf(), Record(), and Record().
|
inlineexplicit |
Definition at line 1748 of file Record.h.
References getNewUID(), getRecords(), and Record().
Add a template argument.
Return false, without adding it, if there is already a template argument with the same name.
Definition at line 1890 of file Record.h.
References assert(), llvm::RecordVal::getNameInit(), getTemplateArg(), and llvm::RecordVal::isTemplateArg().
Definition at line 1898 of file Record.h.
References assert(), llvm::RecordVal::getNameInit(), getValue(), and llvm::RecordVal::isTemplateArg().
|
inline |
Add the references to the value named Name in From.
Definition at line 1789 of file Record.h.
References llvm::append_range(), and Record().
| void Record::checkRecordAssertions | ( | ) |
Definition at line 3106 of file Record.cpp.
References llvm::CheckAssert(), getAssertions(), llvm::PrintError(), and llvm::Init::resolveReferences().
| void Record::checkUnusedTemplateArgs | ( | ) |
Definition at line 3136 of file Record.cpp.
References getTemplateArgs(), and llvm::PrintWarning().
| LLVM_DUMP_METHOD void Record::dump | ( | ) | const |
Definition at line 2906 of file Record.cpp.
References llvm::errs(), and LLVM_DUMP_METHOD.
| void Record::emitRecordDumps | ( | ) |
Definition at line 3125 of file Record.cpp.
References llvm::dumpMessage(), and getDumps().
|
inline |
Definition at line 1824 of file Record.h.
Referenced by checkRecordAssertions().
| DefInit * Record::getDefInit | ( | ) | const |
get the corresponding DefInit.
Definition at line 2827 of file Record.cpp.
Referenced by llvm::TernOpInit::Fold().
Definition at line 1825 of file Record.h.
Referenced by emitRecordDumps().
Return the source location for the named field.
Definition at line 2942 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Definition at line 1770 of file Record.h.
Referenced by llvm::BinOpInit::Fold(), llvm::CondOpInit::Fold(), llvm::FieldInit::Fold(), llvm::TernOpInit::Fold(), llvm::UnOpInit::Fold(), getFieldLoc(), getValueAsBit(), getValueAsBitOrUnset(), getValueAsBitsInit(), getValueAsDag(), getValueAsDef(), getValueAsInt(), getValueAsListInit(), getValueAsListOfDefs(), getValueAsListOfInts(), getValueAsListOfStrings(), getValueAsOptionalDef(), getValueAsOptionalString(), getValueAsString(), getValueInit(), llvm::PrintError(), llvm::PrintFatalError(), llvm::PrintFatalNote(), and resolveReferences().
|
inline |
Definition at line 1760 of file Record.h.
References llvm::cast().
Referenced by getFieldLoc(), llvm::logicalview::getRecordName(), getValueAsBit(), getValueAsBitOrUnset(), getValueAsBitsInit(), getValueAsDag(), getValueAsDef(), getValueAsInt(), getValueAsListInit(), getValueAsListOfDefs(), getValueAsListOfInts(), getValueAsListOfStrings(), getValueAsOptionalDef(), getValueAsOptionalString(), getValueAsString(), getValueInit(), llvm::LessRecord::operator()(), and llvm::LessRecordRegister::operator()().
Definition at line 1762 of file Record.h.
Referenced by llvm::ExistsOpInit::Fold(), llvm::UnOpInit::Fold(), getNameInitAsString(), QualifyName(), and resolveReferences().
|
inline |
Definition at line 1764 of file Record.h.
References llvm::Init::getAsUnquotedString(), and getNameInit().
Referenced by llvm::CondOpInit::Fold().
|
static |
Definition at line 2835 of file Record.cpp.
References llvm::RecordKeeper::getImpl(), and detail::RecordKeeperImpl::LastRecordID.
|
inline |
Definition at line 1977 of file Record.h.
Referenced by getValue(), QualifiedNameOfImplicitName(), QualifyName(), Record(), and removeValue().
Return all superclasses in post-order.
Definition at line 1836 of file Record.h.
References getSuperClasses().
Referenced by getSuperClasses().
Append all superclasses in post-order to Classes.
Definition at line 1828 of file Record.h.
References llvm::make_first_range(), and Record().
Return the template argument with the given name, or null if there is none.
Definition at line 1854 of file Record.h.
Referenced by addTemplateArg().
Return the template arguments of this class or multiclass.
Definition at line 1819 of file Record.h.
Referenced by checkUnusedTemplateArgs().
| const RecordRecTy * Record::getType | ( | ) | const |
Definition at line 2821 of file Record.cpp.
References llvm::RecordRecTy::get(), getDirectSuperClasses(), and llvm::make_first_range().
Referenced by llvm::codeview::computeTypeName(), and llvm::ExistsOpInit::Fold().
Return the field with the given name, or null if there is none.
Use getTemplateArg() to look up template arguments.
Definition at line 1868 of file Record.h.
Referenced by addValue(), getFieldLoc(), getValue(), getValueAsOptionalString(), and getValueInit().
Definition at line 1874 of file Record.h.
References llvm::StringInit::get(), getRecords(), and getValue().
This method looks up the specified field and returns its value as a bit, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 3073 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, and llvm::PrintFatalError().
This method looks up the specified field and returns its value as a bit.
If the field is unset, sets Unset to true and returns false.
Definition at line 3081 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, llvm::isa(), llvm::PrintFatalError(), and llvm::Unset.
This method looks up the specified field and returns its value as a BitsInit, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 2982 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, and llvm::PrintFatalError().
This method looks up the specified field and returns its value as an Dag, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 3094 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, and llvm::PrintFatalError().
This method looks up the specified field and returns its value as a Record, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 3055 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, llvm::PrintFatalError(), and Record().
| int64_t Record::getValueAsInt | ( | StringRef | FieldName | ) | const |
This method looks up the specified field and returns its value as an int64_t, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 3013 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, II, and llvm::PrintFatalError().
Referenced by llvm::LessRecordRegister::operator()().
This method looks up the specified field and returns its value as a ListInit, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 2990 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, and llvm::PrintFatalError().
Referenced by getValueAsListOfDefs(), getValueAsListOfInts(), and getValueAsListOfStrings().
This method looks up the specified field and returns its value as a vector of records, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 2999 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueAsListInit(), I, llvm::List, and llvm::PrintFatalError().
| std::vector< int64_t > Record::getValueAsListOfInts | ( | StringRef | FieldName | ) | const |
This method looks up the specified field and returns its value as a vector of integers, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 3024 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueAsListInit(), I, II, llvm::List, and llvm::PrintFatalError().
This method looks up the specified field and returns its value as a vector of strings, throwing an exception if the field does not exist or if the value is not the right type.
Definition at line 3040 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueAsListInit(), I, llvm::List, and llvm::PrintFatalError().
This method looks up the specified field and returns its value as a Record, returning null if the field exists but is "uninitialized" (i.e.
set to ?), and throwing an exception if the field does not exist or if its value is not the right type.
Definition at line 3063 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, llvm::isa(), llvm::PrintFatalError(), and Record().
This method looks up the specified field and returns its value as a string, throwing an exception if the value is not a string and std::nullopt if the field does not exist.
Definition at line 2967 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValue(), llvm::isa(), and llvm::PrintFatalError().
This method looks up the specified field and returns its value as a string, throwing an exception if the field does not exist or if the value is not a string.
Definition at line 2958 of file Record.cpp.
References llvm::dyn_cast(), getLoc(), getName(), getValueInit(), I, and llvm::PrintFatalError().
Referenced by llvm::LessRecordFieldName::operator()().
Return the initializer for a value with the specified name, or throw an exception if the field does not exist.
Definition at line 2950 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Referenced by getValueAsBit(), getValueAsBitOrUnset(), getValueAsBitsInit(), getValueAsDag(), getValueAsDef(), getValueAsInt(), getValueAsListInit(), getValueAsOptionalDef(), getValueAsString(), and isValueUnset().
Determine whether this record has the specified direct superclass.
Definition at line 1843 of file Record.h.
References llvm::is_contained(), llvm::make_first_range(), and Record().
|
inline |
Definition at line 1816 of file Record.h.
References RK_AnonymousDef.
|
inline |
|
inline |
Definition at line 1934 of file Record.h.
References llvm::make_first_range(), and Record().
Referenced by addDirectSuperClass(), and llvm::RecordRecTy::isSubClassOf().
Definition at line 1942 of file Record.h.
References llvm::dyn_cast(), llvm::make_first_range(), and Record().
Return true if the named field is unset.
Definition at line 1995 of file Record.h.
References getValueInit(), and llvm::isa().
Definition at line 1904 of file Record.h.
References llvm::find_if(), and llvm_unreachable.
Referenced by removeValue().
|
inline |
Definition at line 1912 of file Record.h.
References llvm::StringInit::get(), getRecords(), and removeValue().
If there are any field references that refer to fields that have been filled in, we can propagate the values now.
This is a final resolve: any error messages, e.g. due to undefined !cast references, are generated now.
Definition at line 2898 of file Record.cpp.
References resolveReferences().
Referenced by llvm::FieldInit::resolveReferences(), and resolveReferences().
Apply the resolver to the name of the record as well as to the initializers of all fields of the record except SkipVal.
The resolver should not resolve any of the fields itself, to avoid recursion / infinite loops.
Definition at line 2855 of file Record.cpp.
References llvm::concat(), llvm::dyn_cast(), llvm::Init::getAsUnquotedString(), getLoc(), getNameInit(), llvm::Value::getType(), llvm::PrintFatalError(), llvm::Init::resolveReferences(), and setName().
Definition at line 2839 of file Record.cpp.
Referenced by resolveReferences(), and llvm::logicalview::LVLogicalVisitor::visitKnownRecord().
| void Record::updateClassLoc | ( | SMLoc | Loc | ) |
Definition at line 2805 of file Record.cpp.
References assert().