clang 22.0.0git
clang::CIRGen::CIRGenVTables Class Reference

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CIR/CodeGen/CIRGenVTables.h"

Public Member Functions

 CIRGenVTables (CIRGenModule &cgm)
void createVTableInitializer (cir::GlobalOp &vtable, const clang::VTableLayout &layout, mlir::Attribute rtti, bool vtableHasLocalLinkage)
 Add vtable components for the given vtable layout to the given global initializer.
clang::ItaniumVTableContextgetItaniumVTableContext ()
const clang::ItaniumVTableContextgetItaniumVTableContext () const
cir::GlobalOp generateConstructionVTable (const CXXRecordDecl *rd, const BaseSubobject &base, bool baseIsVirtual, cir::GlobalLinkageKind linkage, VTableAddressPointsMapTy &addressPoints)
 Generate a construction vtable for the given base subobject.
cir::GlobalOp getAddrOfVTT (const CXXRecordDecl *rd)
 Get the address of the VTT for the given record decl.
void emitVTTDefinition (cir::GlobalOp vttOp, cir::GlobalLinkageKind linkage, const CXXRecordDecl *rd)
 Emit the definition of the given vtable.
uint64_t getSubVTTIndex (const CXXRecordDecl *rd, BaseSubobject base)
 Return the index of the sub-VTT for the base class of the given record decl.
uint64_t getSecondaryVirtualPointerIndex (const CXXRecordDecl *rd, BaseSubobject base)
 Return the index in the VTT where the virtual pointer for the given subobject is located.
void emitThunks (GlobalDecl gd)
 Emit the associated thunks for the given global decl.
void generateClassData (const CXXRecordDecl *rd)
 Generate all the class data required to be generated upon definition of a KeyFunction.
bool isVTableExternal (const clang::CXXRecordDecl *rd)
 At this point in the translation unit, does it appear that can we rely on the vtable being defined elsewhere in the program?
cir::RecordType getVTableType (const clang::VTableLayout &layout)
 Returns the type of a vtable with the given layout.

Detailed Description

Definition at line 28 of file CIRGenVTables.h.

Constructor & Destructor Documentation

◆ CIRGenVTables()

CIRGenVTables::CIRGenVTables ( CIRGenModule & cgm)

Definition at line 26 of file CIRGenVTables.cpp.

Member Function Documentation

◆ createVTableInitializer()

void CIRGenVTables::createVTableInitializer ( cir::GlobalOp & vtable,
const clang::VTableLayout & layout,
mlir::Attribute rtti,
bool vtableHasLocalLinkage )

Add vtable components for the given vtable layout to the given global initializer.

Definition at line 179 of file CIRGenVTables.cpp.

References clang::VTableLayout::getAddressPointIndices(), clang::VTableLayout::getVTableOffset(), and clang::VTableLayout::getVTableSize().

Referenced by generateConstructionVTable().

◆ emitThunks()

void CIRGenVTables::emitThunks ( GlobalDecl gd)

◆ emitVTTDefinition()

◆ generateClassData()

void CIRGenVTables::generateClassData ( const CXXRecordDecl * rd)

Generate all the class data required to be generated upon definition of a KeyFunction.

This includes the vtable, the RTTI data structure (if RTTI is enabled) and the VTT (if the class has virtual bases).

Definition at line 103 of file CIRGenVTables.cpp.

References cir::MissingFeatures::generateDebugInfo(), and clang::CXXRecordDecl::getNumVBases().

◆ generateConstructionVTable()

◆ getAddrOfVTT()

cir::GlobalOp CIRGenVTables::getAddrOfVTT ( const CXXRecordDecl * rd)

◆ getItaniumVTableContext() [1/2]

clang::ItaniumVTableContext & clang::CIRGen::CIRGenVTables::getItaniumVTableContext ( )
inline

Definition at line 66 of file CIRGenVTables.h.

Referenced by emitVTTDefinition(), and generateConstructionVTable().

◆ getItaniumVTableContext() [2/2]

const clang::ItaniumVTableContext & clang::CIRGen::CIRGenVTables::getItaniumVTableContext ( ) const
inline

Definition at line 70 of file CIRGenVTables.h.

◆ getSecondaryVirtualPointerIndex()

uint64_t CIRGenVTables::getSecondaryVirtualPointerIndex ( const CXXRecordDecl * rd,
BaseSubobject base )

Return the index in the VTT where the virtual pointer for the given subobject is located.

Definition at line 488 of file CIRGenVTables.cpp.

References clang::VTTBuilder::getSecondaryVirtualPointerIndices().

◆ getSubVTTIndex()

uint64_t CIRGenVTables::getSubVTTIndex ( const CXXRecordDecl * rd,
BaseSubobject base )

Return the index of the sub-VTT for the base class of the given record decl.

Definition at line 465 of file CIRGenVTables.cpp.

References clang::VTTBuilder::getSubVTTIndices().

◆ getVTableType()

cir::RecordType CIRGenVTables::getVTableType ( const clang::VTableLayout & layout)

Returns the type of a vtable with the given layout.

Normally a struct of arrays of pointers, with one struct element for each vtable in the vtable group.

Definition at line 39 of file CIRGenVTables.cpp.

References clang::VTableLayout::getNumVTables(), and clang::VTableLayout::getVTableSize().

Referenced by generateConstructionVTable().

◆ isVTableExternal()

bool CIRGenVTables::isVTableExternal ( const clang::CXXRecordDecl * rd)

At this point in the translation unit, does it appear that can we rely on the vtable being defined elsewhere in the program?

The response is really only definitive when called at the end of the translation unit.

The only semantic restriction here is that the object file should not contain a vtable definition when that vtable is defined strongly elsewhere. Otherwise, we'd just like to avoid emitting vtables when unnecessary. TODO(cir): this should be merged into common AST helper for codegen.

Definition at line 61 of file CIRGenVTables.cpp.

References clang::Decl::getASTContext(), clang::ASTContext::getCurrentKeyFunction(), clang::CXXRecordDecl::getTemplateSpecializationKind(), clang::FunctionDecl::hasBody(), clang::CXXRecordDecl::isDynamicClass(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ImplicitInstantiation.


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