LLVM  6.0.0svn
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
llvm::Init Class Referenceabstract

#include "llvm/TableGen/Record.h"

Inheritance diagram for llvm::Init:
Inheritance graph
[legend]
Collaboration diagram for llvm::Init:
Collaboration graph
[legend]

Public Member Functions

InitKind getKind () const
 
 Init (const Init &)=delete
 
Initoperator= (const Init &)=delete
 
virtual ~Init ()=default
 
virtual bool isComplete () const
 This virtual method should be overridden by values that may not be completely specified yet. More...
 
void print (raw_ostream &OS) const
 Print out this value. More...
 
virtual std::string getAsString () const =0
 Convert this value to a string form. More...
 
virtual std::string getAsUnquotedString () const
 Convert this value to a string form, without adding quote markers. More...
 
void dump () const
 Debugging method that may be called through a debugger, just invokes print on stderr. More...
 
virtual InitconvertInitializerTo (RecTy *Ty) const =0
 This virtual function converts to the appropriate Init based on the passed in type. More...
 
virtual InitconvertInitializerBitRange (ArrayRef< unsigned > Bits) const
 This method is used to implement the bitrange selection operator. More...
 
virtual InitconvertInitListSlice (ArrayRef< unsigned > Elements) const
 This method is used to implement the list slice selection operator. More...
 
virtual RecTygetFieldType (StringInit *FieldName) const
 This method is used to implement the FieldInit class. More...
 
virtual InitgetFieldInit (Record &R, const RecordVal *RV, StringInit *FieldName) const
 This method complements getFieldType to return the initializer for the specified field. More...
 
virtual InitresolveReferences (Record &R, const RecordVal *RV) const
 This method is used by classes that refer to other variables which may not be defined at the time the expression is formed. More...
 
virtual InitgetBit (unsigned Bit) const =0
 This method is used to return the initializer for the specified bit. More...
 
virtual InitgetBitVar () const
 This method is used to retrieve the initializer for bit reference. More...
 
virtual unsigned getBitNum () const
 This method is used to retrieve the bit number of a bit reference. More...
 

Protected Types

enum  InitKind : uint8_t {
  IK_BitInit, IK_FirstTypedInit, IK_BitsInit, IK_CodeInit,
  IK_DagInit, IK_DefInit, IK_FieldInit, IK_IntInit,
  IK_ListInit, IK_FirstOpInit, IK_BinOpInit, IK_TernOpInit,
  IK_UnOpInit, IK_LastOpInit, IK_StringInit, IK_VarInit,
  IK_VarListElementInit, IK_LastTypedInit, IK_UnsetInit, IK_VarBitInit
}
 Discriminator enum (for isa<>, dyn_cast<>, et al.) More...
 

Protected Member Functions

 Init (InitKind K, uint8_t Opc=0)
 

Protected Attributes

uint8_t Opc
 

Detailed Description

Definition at line 250 of file Record.h.

Member Enumeration Documentation

◆ InitKind

enum llvm::Init::InitKind : uint8_t
protected

Discriminator enum (for isa<>, dyn_cast<>, et al.)

This enum is laid out by a preorder traversal of the inheritance hierarchy, and does not contain an entry for abstract classes, as per the recommendation in docs/HowToSetUpLLVMStyleRTTI.rst.

We also explicitly include "first" and "last" values for each interior node of the inheritance tree, to make it easier to read the corresponding classof().

We could pack these a bit tighter by not having the IK_FirstXXXInit and IK_LastXXXInit be their own values, but that would degrade readability for really no benefit.

Enumerator
IK_BitInit 
IK_FirstTypedInit 
IK_BitsInit 
IK_CodeInit 
IK_DagInit 
IK_DefInit 
IK_FieldInit 
IK_IntInit 
IK_ListInit 
IK_FirstOpInit 
IK_BinOpInit 
IK_TernOpInit 
IK_UnOpInit 
IK_LastOpInit 
IK_StringInit 
IK_VarInit 
IK_VarListElementInit 
IK_LastTypedInit 
IK_UnsetInit 
IK_VarBitInit 

Definition at line 265 of file Record.h.

Constructor & Destructor Documentation

◆ Init() [1/2]

llvm::Init::Init ( InitKind  K,
uint8_t  Opc = 0 
)
inlineexplicitprotected

Definition at line 301 of file Record.h.

◆ Init() [2/2]

llvm::Init::Init ( const Init )
delete

◆ ~Init()

virtual llvm::Init::~Init ( )
virtualdefault

Member Function Documentation

◆ convertInitializerBitRange()

virtual Init* llvm::Init::convertInitializerBitRange ( ArrayRef< unsigned Bits) const
inlinevirtual

This method is used to implement the bitrange selection operator.

Given an initializer, it selects the specified bits out, returning them as a new init of bits type. If it is not legal to use the bit subscript operator on this initializer, return null.

Reimplemented in llvm::IntInit, llvm::BitsInit, and llvm::TypedInit.

Definition at line 335 of file Record.h.

Referenced by isObjectStart().

◆ convertInitializerTo()

virtual Init* llvm::Init::convertInitializerTo ( RecTy Ty) const
pure virtual

◆ convertInitListSlice()

virtual Init* llvm::Init::convertInitListSlice ( ArrayRef< unsigned Elements) const
inlinevirtual

This method is used to implement the list slice selection operator.

Given an initializer, it selects the specified list elements, returning them as a new init of list type. If it is not legal to take a slice of this, return null.

Reimplemented in llvm::ListInit, and llvm::TypedInit.

Definition at line 343 of file Record.h.

Referenced by isObjectStart().

◆ dump()

LLVM_DUMP_METHOD void Init::dump ( ) const

Debugging method that may be called through a debugger, just invokes print on stderr.

Definition at line 176 of file Record.cpp.

References llvm::errs(), and llvm::RecTy::print().

◆ getAsString()

virtual std::string llvm::Init::getAsString ( ) const
pure virtual

◆ getAsUnquotedString()

virtual std::string llvm::Init::getAsUnquotedString ( ) const
inlinevirtual

Convert this value to a string form, without adding quote markers.

This primaruly affects StringInits where we will not surround the string value with quotes.

Reimplemented in llvm::CodeInit, and llvm::StringInit.

Definition at line 321 of file Record.h.

References llvm::RecTy::dump(), and llvm::RecTy::getAsString().

Referenced by llvm::SubMultiClassReference::dump(), and llvm::Record::resolveReferencesTo().

◆ getBit()

virtual Init* llvm::Init::getBit ( unsigned  Bit) const
pure virtual

◆ getBitNum()

virtual unsigned llvm::Init::getBitNum ( ) const
inlinevirtual

This method is used to retrieve the bit number of a bit reference.

For non-VarBitInit, it simply returns 0.

Reimplemented in llvm::VarBitInit.

Definition at line 380 of file Record.h.

Referenced by llvm::BitsInit::resolveReferences().

◆ getBitVar()

virtual Init* llvm::Init::getBitVar ( ) const
inlinevirtual

This method is used to retrieve the initializer for bit reference.

For non-VarBitInit, it simply returns itself.

Reimplemented in llvm::VarBitInit.

Definition at line 376 of file Record.h.

Referenced by llvm::BitsInit::resolveReferences().

◆ getFieldInit()

virtual Init* llvm::Init::getFieldInit ( Record R,
const RecordVal RV,
StringInit FieldName 
) const
inlinevirtual

This method complements getFieldType to return the initializer for the specified field.

If getFieldType returns non-null this method should return non-null, otherwise it returns null.

Reimplemented in llvm::DefInit, and llvm::VarInit.

Definition at line 357 of file Record.h.

Referenced by llvm::VarInit::getFieldInit(), llvm::FieldInit::resolveListElementReference(), and llvm::FieldInit::resolveReferences().

◆ getFieldType()

virtual RecTy* llvm::Init::getFieldType ( StringInit FieldName) const
inlinevirtual

This method is used to implement the FieldInit class.

Implementors of this method should return the type of the named field if they are of record type.

Reimplemented in llvm::DefInit, llvm::VarInit, and llvm::TypedInit.

Definition at line 350 of file Record.h.

Referenced by isObjectStart().

◆ getKind()

InitKind llvm::Init::getKind ( ) const
inline

◆ isComplete()

virtual bool llvm::Init::isComplete ( ) const
inlinevirtual

This virtual method should be overridden by values that may not be completely specified yet.

Reimplemented in llvm::TernOpInit, llvm::BitsInit, and llvm::UnsetInit.

Definition at line 310 of file Record.h.

Referenced by llvm::SubMultiClassReference::dump(), isObjectStart(), and llvm::FieldInit::resolveReferences().

◆ operator=()

Init& llvm::Init::operator= ( const Init )
delete

◆ print()

void llvm::Init::print ( raw_ostream OS) const
inline

Print out this value.

Definition at line 313 of file Record.h.

References llvm::RecTy::getAsString().

Referenced by llvm::operator<<().

◆ resolveReferences()

virtual Init* llvm::Init::resolveReferences ( Record R,
const RecordVal RV 
) const
inlinevirtual

This method is used by classes that refer to other variables which may not be defined at the time the expression is formed.

If a value is set for the variable later, this method will be called on users of the value to allow the value to propagate out.

Reimplemented in llvm::DagInit, llvm::FieldInit, llvm::VarListElementInit, llvm::VarBitInit, llvm::VarInit, llvm::TernOpInit, llvm::BinOpInit, llvm::UnOpInit, llvm::ListInit, and llvm::BitsInit.

Definition at line 366 of file Record.h.

References llvm::tgtok::Bit.

Referenced by llvm::BitsInit::resolveReferences(), llvm::ListInit::resolveReferences(), llvm::UnOpInit::resolveReferences(), llvm::BinOpInit::resolveReferences(), llvm::TernOpInit::resolveReferences(), llvm::FieldInit::resolveReferences(), and llvm::Record::resolveReferencesTo().

Member Data Documentation

◆ Opc

uint8_t llvm::Init::Opc
protected

Definition at line 292 of file Record.h.


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