LLVM 19.0.0git
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]

Public Member Functions

InitKind getKind () const
 Get the kind (type) of the value.
 
RecordKeepergetRecordKeeper () const
 Get the record keeper that initialized this Init.
 
 Init (const Init &)=delete
 
Initoperator= (const Init &)=delete
 
virtual ~Init ()=default
 
virtual bool isComplete () const
 Is this a complete value with no unset (uninitialized) subvalues?
 
virtual bool isConcrete () const
 Is this a concrete and fully resolved value without any references or stuck operations? Unset values are concrete.
 
void print (raw_ostream &OS) const
 Print this value.
 
virtual std::string getAsString () const =0
 Convert this value to a literal form.
 
virtual std::string getAsUnquotedString () const
 Convert this value to a literal form, without adding quotes around a string.
 
void dump () const
 Debugging method that may be called through a debugger; just invokes print on stderr.
 
virtual InitgetCastTo (RecTy *Ty) const =0
 If this value is convertible to type Ty, return a value whose type is Ty, generating a !cast operation if required.
 
virtual InitconvertInitializerTo (RecTy *Ty) const =0
 Convert to a value whose type is Ty, or return null if this is not possible.
 
virtual InitconvertInitializerBitRange (ArrayRef< unsigned > Bits) const
 This function is used to implement the bit range selection operator.
 
virtual RecTygetFieldType (StringInit *FieldName) const
 This function is used to implement the FieldInit class.
 
virtual InitresolveReferences (Resolver &R) const
 This function is used by classes that refer to other variables which may not be defined at the time the expression is formed.
 
virtual InitgetBit (unsigned Bit) const =0
 Get the Init value of the specified bit.
 

Protected Types

enum  InitKind : uint8_t {
  IK_First , IK_FirstTypedInit , IK_BitInit , IK_BitsInit ,
  IK_DagInit , IK_DefInit , IK_FieldInit , IK_IntInit ,
  IK_ListInit , IK_FirstOpInit , IK_BinOpInit , IK_TernOpInit ,
  IK_UnOpInit , IK_LastOpInit , IK_CondOpInit , IK_FoldOpInit ,
  IK_IsAOpInit , IK_ExistsOpInit , IK_AnonymousNameInit , IK_StringInit ,
  IK_VarInit , IK_VarBitInit , IK_VarDefInit , IK_LastTypedInit ,
  IK_UnsetInit , IK_ArgumentInit
}
 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 281 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_First 
IK_FirstTypedInit 
IK_BitInit 
IK_BitsInit 
IK_DagInit 
IK_DefInit 
IK_FieldInit 
IK_IntInit 
IK_ListInit 
IK_FirstOpInit 
IK_BinOpInit 
IK_TernOpInit 
IK_UnOpInit 
IK_LastOpInit 
IK_CondOpInit 
IK_FoldOpInit 
IK_IsAOpInit 
IK_ExistsOpInit 
IK_AnonymousNameInit 
IK_StringInit 
IK_VarInit 
IK_VarBitInit 
IK_VarDefInit 
IK_LastTypedInit 
IK_UnsetInit 
IK_ArgumentInit 

Definition at line 296 of file Record.h.

Constructor & Destructor Documentation

◆ Init() [1/2]

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

Definition at line 342 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 function is used to implement the bit range selection operator.

Given a value, it selects the specified bits, returning them as a new Init of type bits. If it is not legal to use the bit selection operator on this value, null is returned.

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

Definition at line 384 of file Record.h.

◆ convertInitializerTo()

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

Convert to a value whose type is Ty, or return null if this is not possible.

This can happen if the value's type is convertible to Ty, but there are unresolved references.

Implemented in llvm::TypedInit, llvm::UnsetInit, llvm::ArgumentInit, llvm::BitInit, llvm::BitsInit, llvm::IntInit, llvm::StringInit, llvm::ListInit, and llvm::DefInit.

Referenced by llvm::CheckAssert(), llvm::BinOpInit::Fold(), llvm::TernOpInit::Fold(), llvm::CondOpInit::Fold(), llvm::UnOpInit::Fold(), and llvm::TernOpInit::resolveReferences().

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

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

Referenced by llvm::ExecutionEngine::InitializeMemory().

◆ getAsString()

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

◆ getAsUnquotedString()

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

Convert this value to a literal form, without adding quotes around a string.

Reimplemented in llvm::StringInit.

Definition at line 364 of file Record.h.

References getAsString().

Referenced by llvm::TernOpInit::getAsString(), llvm::FoldOpInit::getAsString(), llvm::VarInit::getNameInitAsString(), llvm::RecordVal::getNameInitAsString(), llvm::Record::getNameInitAsString(), and llvm::Record::resolveReferences().

◆ getBit()

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

◆ getCastTo()

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

If this value is convertible to type Ty, return a value whose type is Ty, generating a !cast operation if required.

Otherwise, return null.

Implemented in llvm::TypedInit, llvm::UnsetInit, and llvm::ArgumentInit.

◆ getFieldType()

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

This function is used to implement the FieldInit class.

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

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

Definition at line 391 of file Record.h.

◆ getKind()

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

Get the kind (type) of the value.

Definition at line 336 of file Record.h.

◆ getRecordKeeper()

RecordKeeper & Init::getRecordKeeper ( ) const

Get the record keeper that initialized this Init.

Definition at line 350 of file Record.cpp.

Referenced by llvm::CheckAssert(), llvm::IsAOpInit::get(), llvm::ExistsOpInit::get(), and llvm::BinOpInit::getStrConcat().

◆ isComplete()

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

◆ isConcrete()

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

Is this a concrete and fully resolved value without any references or stuck operations? Unset values are concrete.

Reimplemented in llvm::UnsetInit, llvm::ArgumentInit, llvm::BitInit, llvm::BitsInit, llvm::IntInit, llvm::StringInit, llvm::ListInit, llvm::CondOpInit, llvm::DefInit, llvm::FieldInit, and llvm::DagInit.

Definition at line 354 of file Record.h.

Referenced by llvm::FieldInit::Fold(), llvm::UnOpInit::Fold(), llvm::ListInit::isConcrete(), llvm::FieldInit::isConcrete(), and llvm::DagInit::isConcrete().

◆ operator=()

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

◆ print()

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

Print this value.

Definition at line 357 of file Record.h.

References getAsString(), and OS.

Referenced by dump().

◆ resolveReferences()

virtual Init * llvm::Init::resolveReferences ( Resolver R) const
inlinevirtual

Member Data Documentation

◆ Opc

uint8_t llvm::Init::Opc
protected

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