LLVM  16.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
llvm::Record Class Reference

#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
 
InitgetNameInit () const
 
std::string getNameInitAsString () const
 
void setName (Init *Name)
 
ArrayRef< SMLocgetLoc () const
 
void appendLoc (SMLoc Loc)
 
ArrayRef< SMLocgetForwardDeclarationLocs () const
 
void updateClassLoc (SMLoc Loc)
 
RecordRecTygetType ()
 
DefInitgetDefInit ()
 get the corresponding DefInit. More...
 
bool isClass () const
 
ArrayRef< Init * > getTemplateArgs () const
 
ArrayRef< RecordValgetValues () const
 
ArrayRef< AssertionInfogetAssertions () 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 RecordValgetValue (const Init *Name) const
 
const RecordValgetValue (StringRef Name) const
 
RecordValgetValue (const Init *Name)
 
RecordValgetValue (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...
 
RecordKeepergetRecords () const
 
bool isAnonymous () const
 
void dump () const
 
SMLoc getFieldLoc (StringRef FieldName) const
 Return the source location for the named field. More...
 
InitgetValueInit (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< StringRefgetValueAsOptionalString (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...
 
BitsInitgetValueAsBitsInit (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...
 
ListInitgetValueAsListInit (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< StringRefgetValueAsListOfStrings (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...
 
RecordgetValueAsDef (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...
 
RecordgetValueAsOptionalDef (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...
 
DagInitgetValueAsDag (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)
 

Detailed Description

Definition at line 1543 of file Record.h.

Constructor & Destructor Documentation

◆ Record() [1/3]

llvm::Record::Record ( Init N,
ArrayRef< SMLoc locs,
RecordKeeper records,
bool  Anonymous = false,
bool  Class = false 
)
inlineexplicit

Definition at line 1586 of file Record.h.

◆ Record() [2/3]

llvm::Record::Record ( StringRef  N,
ArrayRef< SMLoc locs,
RecordKeeper records,
bool  Class = false 
)
inlineexplicit

Definition at line 1594 of file Record.h.

◆ Record() [3/3]

llvm::Record::Record ( const Record O)
inline

Definition at line 1601 of file Record.h.

Member Function Documentation

◆ addAssertion()

void llvm::Record::addAssertion ( SMLoc  Loc,
Init Condition,
Init Message 
)
inline

Definition at line 1705 of file Record.h.

◆ addSuperClass()

void llvm::Record::addSuperClass ( Record R,
SMRange  Range 
)
inline

Definition at line 1735 of file Record.h.

References assert(), and isSubClassOf().

◆ addTemplateArg()

void llvm::Record::addTemplateArg ( Init Name)
inline

Definition at line 1682 of file Record.h.

References assert(), and isTemplateArg().

◆ addValue()

void llvm::Record::addValue ( const RecordVal RV)
inline

Definition at line 1687 of file Record.h.

References assert(), llvm::RecordVal::getNameInit(), and getValue().

◆ appendAssertions()

void llvm::Record::appendAssertions ( const Record Rec)
inline

Definition at line 1709 of file Record.h.

References llvm::SmallVectorImpl< T >::append().

◆ appendLoc()

void llvm::Record::appendLoc ( SMLoc  Loc)
inline

Definition at line 1625 of file Record.h.

◆ checkRecordAssertions()

void Record::checkRecordAssertions ( )

◆ checkUnusedTemplateArgs()

void Record::checkUnusedTemplateArgs ( )

Definition at line 2799 of file Record.cpp.

References Arg, getTemplateArgs(), getValue(), llvm::PrintWarning(), and llvm::X86II::TA.

◆ dump()

LLVM_DUMP_METHOD void Record::dump ( ) const

Definition at line 2552 of file Record.cpp.

References llvm::errs().

Referenced by llvm::MultiClass::dump().

◆ getAssertions()

ArrayRef<AssertionInfo> llvm::Record::getAssertions ( ) const
inline

Definition at line 1648 of file Record.h.

Referenced by checkRecordAssertions().

◆ getDefInit()

DefInit * Record::getDefInit ( )

get the corresponding DefInit.

Definition at line 2449 of file Record.cpp.

References llvm::detail::RecordKeeperImpl::Allocator, and llvm::RecordKeeper::getImpl().

◆ getDirectSuperClasses()

void Record::getDirectSuperClasses ( SmallVectorImpl< Record * > &  Classes) const

Append the direct superclasses of this record to Classes.

Definition at line 2495 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().

◆ getFieldLoc()

SMLoc Record::getFieldLoc ( StringRef  FieldName) const

Return the source location for the named field.

Definition at line 2591 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

◆ getForwardDeclarationLocs()

ArrayRef<SMLoc> llvm::Record::getForwardDeclarationLocs ( ) const
inline

Definition at line 1627 of file Record.h.

◆ getID()

unsigned llvm::Record::getID ( ) const
inline

Definition at line 1610 of file Record.h.

◆ getLoc()

ArrayRef<SMLoc> llvm::Record::getLoc ( ) const
inline

◆ getName()

StringRef llvm::Record::getName ( ) const
inline

◆ getNameInit()

Init* llvm::Record::getNameInit ( ) const
inline

◆ getNameInitAsString()

std::string llvm::Record::getNameInitAsString ( ) const
inline

Definition at line 1618 of file Record.h.

References llvm::Init::getAsUnquotedString(), and getNameInit().

Referenced by llvm::VarDefInit::getAsString().

◆ getNewUID()

unsigned Record::getNewUID ( RecordKeeper RK)
static

◆ getRecords()

RecordKeeper& llvm::Record::getRecords ( ) const
inline

◆ getSuperClasses()

ArrayRef<std::pair<Record *, SMRange> > llvm::Record::getSuperClasses ( ) const
inline

Definition at line 1650 of file Record.h.

Referenced by llvm::SetTheory::expand(), getDirectSuperClasses(), and hasDirectSuperClass().

◆ getTemplateArgs()

ArrayRef<Init *> llvm::Record::getTemplateArgs ( ) const
inline

Definition at line 1642 of file Record.h.

Referenced by checkUnusedTemplateArgs().

◆ getType()

RecordRecTy * Record::getType ( )

Definition at line 2443 of file Record.cpp.

References llvm::RecordRecTy::get(), and getDirectSuperClasses().

Referenced by llvm::ExistsOpInit::Fold().

◆ getValue() [1/4]

RecordVal* llvm::Record::getValue ( const Init Name)
inline

Definition at line 1674 of file Record.h.

References getValue().

◆ getValue() [2/4]

const RecordVal* llvm::Record::getValue ( const Init Name) const
inline

◆ getValue() [3/4]

RecordVal* llvm::Record::getValue ( StringRef  Name)
inline

Definition at line 1678 of file Record.h.

References getValue().

◆ getValue() [4/4]

const RecordVal* llvm::Record::getValue ( StringRef  Name) const
inline

Definition at line 1670 of file Record.h.

References llvm::StringInit::get(), getRecords(), and getValue().

◆ getValueAsBit()

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 2742 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

Referenced by llvm::DirectiveLanguage::hasEnableBitmaskEnumInNamespace(), llvm::DirectiveLanguage::hasMakeEnumAvailableInNamespace(), and llvm::BaseRecord::isDefault().

◆ getValueAsBitOrUnset()

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 2754 of file Record.cpp.

References getLoc(), getName(), getValue(), llvm::PrintFatalError(), and llvm::StringRef::str().

◆ getValueAsBitsInit()

BitsInit * Record::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.

Definition at line 2631 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

◆ getValueAsDag()

DagInit * Record::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.

Definition at line 2771 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

◆ getValueAsDef()

Record * 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.

Definition at line 2715 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

◆ getValueAsInt()

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 2669 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

◆ getValueAsListInit()

ListInit * Record::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.

Definition at line 2643 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

Referenced by getValueAsListOfDefs(), getValueAsListOfInts(), and getValueAsListOfStrings().

◆ getValueAsListOfDefs()

std::vector< Record * > 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.

Definition at line 2656 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().

◆ getValueAsListOfInts()

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 2684 of file Record.cpp.

References getLoc(), getName(), getValueAsListInit(), I, List, and llvm::PrintFatalError().

◆ getValueAsListOfStrings()

std::vector< StringRef > Record::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.

Definition at line 2700 of file Record.cpp.

References getValueAsListInit(), and List.

◆ getValueAsOptionalDef()

Record * 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.

set to ?), and throwing an exception if the field does not exist or if its value is not the right type.

Definition at line 2727 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

◆ getValueAsOptionalString()

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 2616 of file Record.cpp.

References getLoc(), getName(), getValue(), llvm::PrintFatalError(), and SI.

Referenced by getValueAsString().

◆ getValueAsString()

StringRef Record::getValueAsString ( StringRef  FieldName) const

◆ getValueInit()

Init * Record::getValueInit ( StringRef  FieldName) const

Return the initializer for a value with the specified name, or throw an exception if the field does not exist.

Definition at line 2599 of file Record.cpp.

References getLoc(), getName(), getValue(), and llvm::PrintFatalError().

Referenced by isValueUnset().

◆ getValues()

ArrayRef<RecordVal> llvm::Record::getValues ( ) const
inline

Definition at line 1646 of file Record.h.

◆ hasDirectSuperClass()

bool Record::hasDirectSuperClass ( const Record SuperClass) const

Determine whether this record has the specified direct superclass.

Definition at line 2482 of file Record.cpp.

References getSuperClasses(), I, llvm::PPCISD::SC, and llvm::ArrayRef< T >::size().

◆ isAnonymous()

bool llvm::Record::isAnonymous ( ) const
inline

Definition at line 1760 of file Record.h.

◆ isClass()

bool llvm::Record::isClass ( ) const
inline

Definition at line 1640 of file Record.h.

◆ isSubClassOf() [1/2]

bool llvm::Record::isSubClassOf ( const Record R) const
inline

Definition at line 1716 of file Record.h.

Referenced by addSuperClass(), and llvm::RecordRecTy::isSubClassOf().

◆ isSubClassOf() [2/2]

bool llvm::Record::isSubClassOf ( StringRef  Name) const
inline

Definition at line 1723 of file Record.h.

References SI.

◆ isTemplateArg()

bool llvm::Record::isTemplateArg ( Init Name) const
inline

Definition at line 1660 of file Record.h.

References llvm::is_contained().

Referenced by addTemplateArg().

◆ isValueUnset()

bool llvm::Record::isValueUnset ( StringRef  FieldName) const
inline

Return true if the named field is unset.

Definition at line 1778 of file Record.h.

References getValueInit().

◆ removeValue() [1/2]

void llvm::Record::removeValue ( Init Name)
inline

Definition at line 1692 of file Record.h.

References llvm::numbers::e, llvm::SmallVectorImpl< T >::erase(), getNameInit(), i, and llvm_unreachable.

Referenced by removeValue().

◆ removeValue() [2/2]

void llvm::Record::removeValue ( StringRef  Name)
inline

Definition at line 1701 of file Record.h.

References llvm::StringInit::get(), getRecords(), and removeValue().

◆ resolveReferences() [1/2]

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 2544 of file Record.cpp.

◆ resolveReferences() [2/2]

void Record::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.

The resolver should not resolve any of the fields itself, to avoid recursion / infinite loops.

Definition at line 2505 of file Record.cpp.

References llvm::Init::getAsUnquotedString(), getLoc(), getNameInit(), llvm::Value::getType(), llvm::PrintFatalError(), llvm::Init::resolveReferences(), and setName().

◆ setName()

void Record::setName ( Init Name)

Definition at line 2461 of file Record.cpp.

Referenced by resolveReferences().

◆ updateClassLoc()

void Record::updateClassLoc ( SMLoc  Loc)

Definition at line 2427 of file Record.cpp.

References assert().


The documentation for this class was generated from the following files: