LLVM  13.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]
Collaboration diagram for llvm::Init:
Collaboration graph
[legend]

Public Member Functions

InitKind getKind () const
 Get the kind (type) of the value. More...
 
 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? More...
 
virtual bool isConcrete () const
 Is this a concrete and fully resolved value without any references or stuck operations? Unset values are concrete. More...
 
void print (raw_ostream &OS) const
 Print this value. More...
 
virtual std::string getAsString () const =0
 Convert this value to a literal form. More...
 
virtual std::string getAsUnquotedString () const
 Convert this value to a literal form, without adding quotes around a string. More...
 
void dump () const
 Debugging method that may be called through a debugger; just invokes print on stderr. More...
 
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. More...
 
virtual InitconvertInitializerTo (RecTy *Ty) const =0
 Convert to a value whose type is Ty, or return null if this is not possible. More...
 
virtual InitconvertInitializerBitRange (ArrayRef< unsigned > Bits) const
 This function is used to implement the bit range selection operator. More...
 
virtual InitconvertInitListSlice (ArrayRef< unsigned > Elements) const
 This function is used to implement the list slice selection operator. More...
 
virtual RecTygetFieldType (StringInit *FieldName) const
 This function is used to implement the FieldInit class. More...
 
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. More...
 
virtual InitgetBit (unsigned Bit) const =0
 Get the Init value of the specified bit. More...
 

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_AnonymousNameInit, IK_StringInit, IK_VarInit,
  IK_VarListElementInit, IK_VarBitInit, IK_VarDefInit, IK_LastTypedInit,
  IK_UnsetInit
}
 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 271 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_AnonymousNameInit 
IK_StringInit 
IK_VarInit 
IK_VarListElementInit 
IK_VarBitInit 
IK_VarDefInit 
IK_LastTypedInit 
IK_UnsetInit 

Definition at line 286 of file Record.h.

Constructor & Destructor Documentation

◆ Init() [1/2]

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

Definition at line 328 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::IntInit, llvm::BitsInit, and llvm::TypedInit.

Definition at line 370 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::DefInit, llvm::ListInit, llvm::StringInit, llvm::IntInit, llvm::BitsInit, llvm::BitInit, llvm::UnsetInit, and llvm::TypedInit.

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

◆ convertInitListSlice()

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

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

Given a value, it selects the specified list elements, returning them as a new Init of type list. If it is not legal to use the slice operator, null is returned.

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

Definition at line 378 of file Record.h.

◆ 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 283 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 350 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::UnsetInit, and llvm::TypedInit.

Referenced by llvm::RecordVal::setValue().

◆ 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::DefInit, and llvm::TypedInit.

Definition at line 385 of file Record.h.

◆ getKind()

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

Get the kind (type) of the value.

Definition at line 325 of file Record.h.

◆ isComplete()

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

Is this a complete value with no unset (uninitialized) subvalues?

Reimplemented in llvm::IsAOpInit, llvm::FoldOpInit, llvm::CondOpInit, llvm::TernOpInit, llvm::ListInit, llvm::BitsInit, and llvm::UnsetInit.

Definition at line 336 of file Record.h.

Referenced by llvm::BitsInit::allInComplete(), llvm::BitsInit::isComplete(), llvm::ListInit::isComplete(), and llvm::TernOpInit::isComplete().

◆ 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::DagInit, llvm::FieldInit, llvm::DefInit, llvm::CondOpInit, llvm::ListInit, llvm::StringInit, llvm::IntInit, llvm::BitsInit, llvm::BitInit, and llvm::UnsetInit.

Definition at line 340 of file Record.h.

Referenced by llvm::FieldInit::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 343 of file Record.h.

References getAsString().

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: