LLVM 20.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 | updateClassLoc (SMLoc Loc) |
const RecordRecTy * | getType () const |
DefInit * | getDefInit () const |
get the corresponding DefInit. | |
bool | isClass () const |
bool | isMultiClass () const |
bool | isAnonymous () const |
ArrayRef< const Init * > | getTemplateArgs () const |
ArrayRef< RecordVal > | getValues () const |
ArrayRef< AssertionInfo > | getAssertions () const |
ArrayRef< DumpInfo > | getDumps () const |
ArrayRef< std::pair< const Record *, SMRange > > | getSuperClasses () const |
bool | hasDirectSuperClass (const Record *SuperClass) const |
Determine whether this record has the specified direct superclass. | |
void | getDirectSuperClasses (SmallVectorImpl< const Record * > &Classes) const |
Append the direct superclasses of this record to Classes. | |
bool | isTemplateArg (const Init *Name) const |
const RecordVal * | getValue (const Init *Name) const |
const RecordVal * | getValue (StringRef Name) const |
RecordVal * | getValue (const Init *Name) |
RecordVal * | getValue (StringRef Name) |
void | addTemplateArg (const Init *Name) |
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 | addSuperClass (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 |
|
inlineexplicit |
Definition at line 1832 of file Record.h.
References llvm::SmallVectorTemplateBase< T, bool >::push_back().
Definition at line 1836 of file Record.h.
References llvm::SmallVectorTemplateBase< T, bool >::push_back().
Definition at line 1869 of file Record.h.
References assert(), isSubClassOf(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and Range.
Definition at line 1809 of file Record.h.
References assert(), and isTemplateArg().
Definition at line 1814 of file Record.h.
References assert(), llvm::RecordVal::getNameInit(), getValue(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Definition at line 1840 of file Record.h.
References llvm::SmallVectorImpl< T >::append().
Definition at line 1844 of file Record.h.
References llvm::SmallVectorImpl< T >::append().
|
inline |
Definition at line 1741 of file Record.h.
References llvm::SmallVectorTemplateBase< T, bool >::push_back().
|
inline |
Add a reference to this record value.
Definition at line 1748 of file Record.h.
References llvm::SmallVectorTemplateBase< T, bool >::push_back().
void Record::checkRecordAssertions | ( | ) |
Definition at line 3225 of file Record.cpp.
References llvm::CheckAssert(), getAssertions(), llvm::PrintError(), and llvm::Init::resolveReferences().
void Record::checkUnusedTemplateArgs | ( | ) |
Definition at line 3255 of file Record.cpp.
References llvm::RecordVal::getLoc(), llvm::RecordVal::getName(), getTemplateArgs(), getValue(), llvm::RecordVal::isUsed(), and llvm::PrintWarning().
LLVM_DUMP_METHOD void Record::dump | ( | ) | const |
Definition at line 2990 of file Record.cpp.
References llvm::errs().
Referenced by llvm::MultiClass::dump().
void Record::emitRecordDumps | ( | ) |
Definition at line 3244 of file Record.cpp.
References llvm::dumpMessage(), and getDumps().
|
inline |
Definition at line 1772 of file Record.h.
Referenced by checkRecordAssertions().
DefInit * Record::getDefInit | ( | ) | const |
get the corresponding DefInit.
Definition at line 2881 of file Record.cpp.
References llvm::detail::RecordKeeperImpl::Allocator, and llvm::RecordKeeper::getImpl().
Referenced by llvm::TernOpInit::Fold().
void Record::getDirectSuperClasses | ( | SmallVectorImpl< const Record * > & | Classes | ) | const |
Append the direct superclasses of this record to Classes.
Definition at line 2927 of file Record.cpp.
References llvm::ArrayRef< T >::back(), llvm::ArrayRef< T >::drop_back(), llvm::ArrayRef< T >::empty(), getSuperClasses(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by getType().
Definition at line 1773 of file Record.h.
Referenced by emitRecordDumps().
Return the source location for the named field.
Definition at line 3029 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Definition at line 1740 of file Record.h.
Referenced by llvm::BinOpInit::Fold(), llvm::TernOpInit::Fold(), llvm::CondOpInit::Fold(), llvm::FieldInit::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 1730 of file Record.h.
Referenced by llvm::DefInit::getAsString(), getFieldLoc(), llvm::pdb::NativeTypeEnum::getName(), llvm::BaseRecord::getRecordName(), 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 1732 of file Record.h.
Referenced by llvm::UnOpInit::Fold(), llvm::ExistsOpInit::Fold(), getNameInitAsString(), QualifyName(), removeValue(), and resolveReferences().
|
inline |
Definition at line 1734 of file Record.h.
References llvm::Init::getAsUnquotedString(), and getNameInit().
Referenced by llvm::CondOpInit::Fold(), and llvm::VarDefInit::getAsString().
|
static |
Definition at line 2889 of file Record.cpp.
References llvm::RecordKeeper::getImpl(), and llvm::detail::RecordKeeperImpl::LastRecordID.
|
inline |
Definition at line 1890 of file Record.h.
Referenced by getValue(), QualifiedNameOfImplicitName(), QualifyName(), and removeValue().
Definition at line 1775 of file Record.h.
Referenced by getDirectSuperClasses(), and hasDirectSuperClass().
Definition at line 1768 of file Record.h.
Referenced by checkUnusedTemplateArgs().
const RecordRecTy * Record::getType | ( | ) | const |
Definition at line 2875 of file Record.cpp.
References llvm::RecordRecTy::get(), and getDirectSuperClasses().
Referenced by llvm::ExistsOpInit::Fold().
Definition at line 1799 of file Record.h.
References getValue().
Definition at line 1789 of file Record.h.
Referenced by addValue(), checkUnusedTemplateArgs(), getFieldLoc(), llvm::DefInit::getFieldType(), getValue(), getValueAsBit(), getValueAsBitOrUnset(), getValueAsBitsInit(), getValueAsDag(), getValueAsDef(), getValueAsInt(), getValueAsListInit(), getValueAsOptionalDef(), getValueAsOptionalString(), getValueInit(), and llvm::TGVarScope::getVar().
Definition at line 1804 of file Record.h.
References getValue().
Definition at line 1795 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 3180 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Referenced by llvm::DirectiveLanguage::hasEnableBitmaskEnumInNamespace(), llvm::DirectiveLanguage::hasMakeEnumAvailableInNamespace(), and llvm::BaseRecord::isDefault().
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 3192 of file Record.cpp.
References getLoc(), getName(), getValue(), llvm::PrintFatalError(), and llvm::StringRef::str().
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 3069 of file Record.cpp.
References getLoc(), getName(), getValue(), 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 3209 of file Record.cpp.
References getLoc(), getName(), getValue(), 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 3154 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Referenced by llvm::Directive::getAssociation(), and llvm::Directive::getCategory().
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 3108 of file Record.cpp.
References getLoc(), getName(), getValue(), 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 3081 of file Record.cpp.
References getLoc(), getName(), getValue(), 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 3094 of file Record.cpp.
References getLoc(), getName(), getValueAsListInit(), I, llvm::List, and llvm::PrintFatalError().
Referenced by llvm::Directive::getAllowedClauses(), llvm::Directive::getAllowedExclusiveClauses(), llvm::Directive::getAllowedOnceClauses(), llvm::Directive::getLeafConstructs(), and llvm::Directive::getRequiredClauses().
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 3123 of file Record.cpp.
References 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 3139 of file Record.cpp.
References 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 3166 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
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 3054 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Referenced by getValueAsString().
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 3045 of file Record.cpp.
References getLoc(), getName(), getValueAsOptionalString(), and llvm::PrintFatalError().
Referenced by llvm::BaseRecord::getAlternativeName(), llvm::Clause::getClangClass(), llvm::DirectiveLanguage::getClauseEnumSetClass(), llvm::DirectiveLanguage::getClausePrefix(), llvm::DirectiveLanguage::getCppNamespace(), llvm::DirectiveLanguage::getDirectivePrefix(), llvm::Clause::getFlangClass(), llvm::DirectiveLanguage::getFlangClauseBaseClass(), llvm::BaseRecord::getFormattedName(), llvm::Clause::getFormattedParserClassName(), llvm::DirectiveLanguage::getName(), llvm::BaseRecord::getName(), and 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 3037 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Referenced by isValueUnset().
Determine whether this record has the specified direct superclass.
Definition at line 2914 of file Record.cpp.
References getSuperClasses(), I, and llvm::ArrayRef< T >::size().
|
inline |
Definition at line 1766 of file Record.h.
References RK_AnonymousDef.
|
inline |
Definition at line 1762 of file Record.h.
References RK_Class.
Referenced by llvm::TGVarScope::getVar().
|
inline |
Definition at line 1850 of file Record.h.
References _.
Referenced by addSuperClass(), and llvm::RecordRecTy::isSubClassOf().
Definition at line 1785 of file Record.h.
References llvm::is_contained().
Referenced by addTemplateArg(), and llvm::TGVarScope::getVar().
Return true if the named field is unset.
Definition at line 1908 of file Record.h.
References getValueInit().
Definition at line 1819 of file Record.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorImpl< T >::erase(), getNameInit(), llvm_unreachable, and llvm::SmallVectorBase< Size_T >::size().
Referenced by removeValue().
|
inline |
Definition at line 1828 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 2982 of file Record.cpp.
References resolveReferences().
Referenced by 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 2938 of file Record.cpp.
References llvm::Init::getAsUnquotedString(), getLoc(), getNameInit(), llvm::Value::getType(), llvm::PrintFatalError(), llvm::Init::resolveReferences(), and setName().
Definition at line 2893 of file Record.cpp.
Referenced by resolveReferences().
void Record::updateClassLoc | ( | SMLoc | Loc | ) |
Definition at line 2859 of file Record.cpp.
References assert().