LLVM 22.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 |
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. | |
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 | 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 1685 of file Record.h.
References getNewUID(), N, and RK_Def.
Referenced by addDirectSuperClass(), appendAssertions(), appendDumps(), getSuperClasses(), getValue(), getValue(), getValueAsDef(), getValueAsOptionalDef(), hasDirectSuperClass(), isSubClassOf(), isSubClassOf(), Record(), and Record().
|
inlineexplicit |
Definition at line 1699 of file Record.h.
References getNewUID(), getRecords(), and Record().
Definition at line 1804 of file Record.h.
References assert(), and isTemplateArg().
Definition at line 1809 of file Record.h.
References assert(), llvm::RecordVal::getNameInit(), and getValue().
|
inline |
void Record::checkRecordAssertions | ( | ) |
Definition at line 3237 of file Record.cpp.
References llvm::CheckAssert(), getAssertions(), llvm::PrintError(), and llvm::Init::resolveReferences().
void Record::checkUnusedTemplateArgs | ( | ) |
Definition at line 3267 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 3035 of file Record.cpp.
References llvm::errs(), and LLVM_DUMP_METHOD.
void Record::emitRecordDumps | ( | ) |
Definition at line 3256 of file Record.cpp.
References llvm::dumpMessage(), and getDumps().
|
inline |
Definition at line 1752 of file Record.h.
Referenced by checkRecordAssertions().
DefInit * Record::getDefInit | ( | ) | const |
get the corresponding DefInit.
Definition at line 2955 of file Record.cpp.
Referenced by llvm::TernOpInit::Fold().
Definition at line 1753 of file Record.h.
Referenced by emitRecordDumps().
Return the source location for the named field.
Definition at line 3073 of file Record.cpp.
References getLoc(), getName(), getValue(), and llvm::PrintFatalError().
Definition at line 1720 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 1710 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 1712 of file Record.h.
Referenced by llvm::ExistsOpInit::Fold(), llvm::UnOpInit::Fold(), getNameInitAsString(), QualifyName(), and resolveReferences().
|
inline |
Definition at line 1714 of file Record.h.
References llvm::Init::getAsUnquotedString(), and getNameInit().
Referenced by llvm::CondOpInit::Fold().
|
static |
Definition at line 2963 of file Record.cpp.
References llvm::RecordKeeper::getImpl(), and llvm::detail::RecordKeeperImpl::LastRecordID.
|
inline |
Definition at line 1887 of file Record.h.
Referenced by getValue(), QualifiedNameOfImplicitName(), QualifyName(), Record(), and removeValue().
Return all superclasses in post-order.
Definition at line 1764 of file Record.h.
References getSuperClasses().
Referenced by getSuperClasses().
Append all superclasses in post-order to Classes
.
Definition at line 1756 of file Record.h.
References llvm::make_first_range(), and Record().
Definition at line 1748 of file Record.h.
Referenced by checkUnusedTemplateArgs().
const RecordRecTy * Record::getType | ( | ) | const |
Definition at line 2949 of file Record.cpp.
References llvm::RecordRecTy::get(), getDirectSuperClasses(), and llvm::make_first_range().
Referenced by llvm::codeview::computeTypeName(), and llvm::ExistsOpInit::Fold().
Definition at line 1784 of file Record.h.
Referenced by addValue(), checkUnusedTemplateArgs(), getFieldLoc(), getValue(), getValueAsOptionalString(), getValueInit(), and llvm::TGVarScope::getVar().
Definition at line 1790 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 3204 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 3212 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 3113 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 3225 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 3186 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 3144 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 3121 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 3130 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 3155 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 3171 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 3194 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 3098 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 3089 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 3081 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 1771 of file Record.h.
References llvm::is_contained(), llvm::make_first_range(), and Record().
|
inline |
Definition at line 1746 of file Record.h.
References RK_AnonymousDef.
|
inline |
|
inline |
Definition at line 1844 of file Record.h.
References llvm::make_first_range(), and Record().
Referenced by addDirectSuperClass(), and llvm::RecordRecTy::isSubClassOf().
Definition at line 1852 of file Record.h.
References llvm::dyn_cast(), llvm::make_first_range(), and Record().
Definition at line 1780 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 1905 of file Record.h.
References getValueInit(), and llvm::isa().
Definition at line 1814 of file Record.h.
References llvm::find_if(), and llvm_unreachable.
Referenced by removeValue().
|
inline |
Definition at line 1822 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 3027 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 2983 of file Record.cpp.
References llvm::dyn_cast(), llvm::Init::getAsUnquotedString(), getLoc(), getNameInit(), llvm::Value::getType(), llvm::PrintFatalError(), llvm::Init::resolveReferences(), and setName().
Definition at line 2967 of file Record.cpp.
Referenced by resolveReferences(), and llvm::logicalview::LVLogicalVisitor::visitKnownRecord().
void Record::updateClassLoc | ( | SMLoc | Loc | ) |
Definition at line 2933 of file Record.cpp.
References assert().