LLVM
15.0.0git
|
#include "llvm/TableGen/Record.h"
Classes | |
struct | AssertionInfo |
Public Member Functions | |
Record (Init *N, ArrayRef< SMLoc > locs, RecordKeeper &records, bool Anonymous=false, bool Class=false) | |
Record (StringRef N, ArrayRef< SMLoc > locs, RecordKeeper &records, bool Class=false) | |
Record (const Record &O) | |
unsigned | getID () const |
StringRef | getName () const |
Init * | getNameInit () const |
const std::string | getNameInitAsString () const |
void | setName (Init *Name) |
ArrayRef< SMLoc > | getLoc () const |
void | appendLoc (SMLoc Loc) |
RecordRecTy * | getType () |
DefInit * | getDefInit () |
get the corresponding DefInit. More... | |
bool | isClass () const |
ArrayRef< Init * > | getTemplateArgs () const |
ArrayRef< RecordVal > | getValues () const |
ArrayRef< AssertionInfo > | getAssertions () const |
ArrayRef< std::pair< Record *, SMRange > > | getSuperClasses () const |
bool | hasDirectSuperClass (const Record *SuperClass) const |
Determine whether this record has the specified direct superclass. More... | |
void | getDirectSuperClasses (SmallVectorImpl< Record * > &Classes) const |
Append the direct superclasses of this record to Classes. More... | |
bool | isTemplateArg (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 (Init *Name) |
void | addValue (const RecordVal &RV) |
void | removeValue (Init *Name) |
void | removeValue (StringRef Name) |
void | addAssertion (SMLoc Loc, Init *Condition, Init *Message) |
void | appendAssertions (const Record *Rec) |
void | checkRecordAssertions () |
void | checkUnusedTemplateArgs () |
bool | isSubClassOf (const Record *R) const |
bool | isSubClassOf (StringRef Name) const |
void | addSuperClass (Record *R, SMRange Range) |
void | resolveReferences (Init *NewName=nullptr) |
If there are any field references that refer to fields that have been filled in, we can propagate the values now. More... | |
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. More... | |
RecordKeeper & | getRecords () const |
bool | isAnonymous () const |
void | dump () const |
SMLoc | getFieldLoc (StringRef FieldName) const |
Return the source location for the named field. More... | |
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. More... | |
bool | isValueUnset (StringRef FieldName) const |
Return true if the named field is unset. More... | |
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. More... | |
llvm::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 llvm::Optional() if the field does not exist. More... | |
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. More... | |
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. More... | |
std::vector< 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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
bool | getValueAsBitOrUnset (StringRef FieldName, bool &Unset) const |
This method looks up the specified field and returns its value as a bit. More... | |
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. More... | |
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. More... | |
Static Public Member Functions | |
static unsigned | getNewUID (RecordKeeper &RK) |
|
inlineexplicit |
Definition at line 1727 of file Record.h.
References assert(), and isSubClassOf().
|
inline |
Definition at line 1674 of file Record.h.
References assert(), and isTemplateArg().
Definition at line 1679 of file Record.h.
References assert(), llvm::RecordVal::getNameInit(), and getValue().
Definition at line 1701 of file Record.h.
References llvm::SmallVectorImpl< T >::append().
void Record::checkRecordAssertions | ( | ) |
Definition at line 2779 of file Record.cpp.
References llvm::CheckAssert(), getAssertions(), and llvm::Init::resolveReferences().
void Record::checkUnusedTemplateArgs | ( | ) |
Definition at line 2791 of file Record.cpp.
References Arg, getTemplateArgs(), getValue(), llvm::PrintWarning(), and llvm::X86II::TA.
LLVM_DUMP_METHOD void Record::dump | ( | ) | const |
Definition at line 2544 of file Record.cpp.
References llvm::errs().
Referenced by llvm::MultiClass::dump().
|
inline |
Definition at line 1640 of file Record.h.
Referenced by checkRecordAssertions().
DefInit * Record::getDefInit | ( | ) |
get the corresponding DefInit.
Definition at line 2441 of file Record.cpp.
References llvm::detail::RecordKeeperImpl::Allocator, and llvm::RecordKeeper::getImpl().
void Record::getDirectSuperClasses | ( | SmallVectorImpl< Record * > & | Classes | ) | const |
Append the direct superclasses of this record to Classes.
Definition at line 2487 of file Record.cpp.
References llvm::ArrayRef< T >::back(), llvm::ArrayRef< T >::drop_back(), llvm::ArrayRef< T >::empty(), getSuperClasses(), and llvm::PPCISD::SC.
Referenced by getType().
Return the source location for the named field.
Definition at line 2583 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Definition at line 1623 of file Record.h.
Referenced by llvm::UnOpInit::Fold(), llvm::TernOpInit::Fold(), llvm::CondOpInit::Fold(), llvm::FieldInit::Fold(), getFieldLoc(), getValueAsBit(), getValueAsBitOrUnset(), getValueAsBitsInit(), getValueAsDag(), getValueAsDef(), getValueAsInt(), getValueAsListInit(), getValueAsListOfDefs(), getValueAsListOfInts(), getValueAsOptionalDef(), getValueAsOptionalString(), getValueAsString(), getValueInit(), llvm::PrintError(), llvm::PrintFatalError(), llvm::PrintFatalNote(), and resolveReferences().
|
inline |
Definition at line 1611 of file Record.h.
Referenced by llvm::CondOpInit::Fold(), llvm::DefInit::getAsString(), getFieldLoc(), llvm::pdb::NativeTypeEnum::getName(), llvm::BaseRecord::getRecordName(), getValueAsBit(), getValueAsBitOrUnset(), getValueAsBitsInit(), getValueAsDag(), getValueAsDef(), getValueAsInt(), getValueAsListInit(), getValueAsListOfDefs(), getValueAsListOfInts(), getValueAsOptionalDef(), getValueAsOptionalString(), getValueAsString(), getValueInit(), llvm::LessRecord::operator()(), and llvm::LessRecordRegister::operator()().
|
inline |
Definition at line 1613 of file Record.h.
Referenced by llvm::UnOpInit::Fold(), llvm::ExistsOpInit::Fold(), getNameInitAsString(), QualifyName(), removeValue(), and resolveReferences().
|
inline |
Definition at line 1617 of file Record.h.
References llvm::Init::getAsUnquotedString(), and getNameInit().
Referenced by llvm::VarDefInit::getAsString().
|
static |
Definition at line 2449 of file Record.cpp.
References llvm::RecordKeeper::getImpl(), and llvm::detail::RecordKeeperImpl::LastRecordID.
|
inline |
Definition at line 1748 of file Record.h.
Referenced by llvm::UnOpInit::Fold(), getValue(), QualifiedNameOfImplicitName(), QualifyName(), and removeValue().
Definition at line 1642 of file Record.h.
Referenced by llvm::SetTheory::expand(), getDirectSuperClasses(), and hasDirectSuperClass().
Definition at line 1634 of file Record.h.
Referenced by checkUnusedTemplateArgs().
RecordRecTy * Record::getType | ( | ) |
Definition at line 2435 of file Record.cpp.
References llvm::RecordRecTy::get(), and getDirectSuperClasses().
Referenced by llvm::ExistsOpInit::Fold().
Definition at line 1666 of file Record.h.
References getValue().
Definition at line 1656 of file Record.h.
Referenced by addValue(), checkUnusedTemplateArgs(), getFieldLoc(), llvm::DefInit::getFieldType(), getValue(), getValueAsBit(), getValueAsBitOrUnset(), getValueAsBitsInit(), getValueAsDag(), getValueAsDef(), getValueAsInt(), getValueAsListInit(), getValueAsOptionalDef(), getValueAsOptionalString(), and getValueInit().
Definition at line 1670 of file Record.h.
References getValue().
Definition at line 1662 of file Record.h.
References llvm::StringInit::get(), getRecords(), and getValue().
bool Record::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.
Definition at line 2734 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Referenced by llvm::DirectiveLanguage::hasEnableBitmaskEnumInNamespace(), llvm::DirectiveLanguage::hasMakeEnumAvailableInNamespace(), and llvm::BaseRecord::isDefault().
bool Record::getValueAsBitOrUnset | ( | StringRef | FieldName, |
bool & | Unset | ||
) | const |
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 2746 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 2623 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 2763 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 2707 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
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 2661 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
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 2635 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 2648 of file Record.cpp.
References getLoc(), getName(), getValueAsListInit(), I, List, and llvm::PrintFatalError().
Referenced by llvm::Directive::getAllowedClauses(), llvm::Directive::getAllowedExclusiveClauses(), llvm::Directive::getAllowedOnceClauses(), 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 2676 of file Record.cpp.
References getLoc(), getName(), getValueAsListInit(), I, 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 2692 of file Record.cpp.
References getValueAsListInit(), and List.
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 2719 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
llvm::Optional< StringRef > Record::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 llvm::Optional() if the field does not exist.
Definition at line 2608 of file Record.cpp.
References getLoc(), getName(), getValue(), llvm::PrintFatalError(), and SI.
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 2599 of file Record.cpp.
References getLoc(), getName(), getValueAsOptionalString(), llvm::PrintFatalError(), and S.
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 2591 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 2474 of file Record.cpp.
References getSuperClasses(), I, llvm::PPCISD::SC, and llvm::ArrayRef< T >::size().
Definition at line 1708 of file Record.h.
Referenced by addSuperClass(), and llvm::RecordRecTy::isSubClassOf().
|
inline |
|
inline |
Definition at line 1652 of file Record.h.
References llvm::is_contained().
Referenced by addTemplateArg().
|
inline |
Return true if the named field is unset.
Definition at line 1770 of file Record.h.
References getValueInit().
|
inline |
Definition at line 1684 of file Record.h.
References llvm::numbers::e, llvm::SmallVectorImpl< T >::erase(), getNameInit(), i, and llvm_unreachable.
Referenced by removeValue().
|
inline |
Definition at line 1693 of file Record.h.
References llvm::StringInit::get(), getRecords(), and removeValue().
void Record::resolveReferences | ( | Init * | NewName = nullptr | ) |
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 2536 of file Record.cpp.
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 2497 of file Record.cpp.
References llvm::Init::getAsUnquotedString(), getLoc(), getNameInit(), llvm::Value::getType(), llvm::PrintFatalError(), llvm::Init::resolveReferences(), and setName().
void Record::setName | ( | Init * | Name | ) |
Definition at line 2453 of file Record.cpp.
Referenced by resolveReferences().