clang 22.0.0git
|
#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::ItaniumVTableContext & | getItaniumVTableContext () |
const clang::ItaniumVTableContext & | getItaniumVTableContext () 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. |
Definition at line 28 of file CIRGenVTables.h.
CIRGenVTables::CIRGenVTables | ( | CIRGenModule & | cgm | ) |
Definition at line 26 of file CIRGenVTables.cpp.
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().
void CIRGenVTables::emitThunks | ( | GlobalDecl | gd | ) |
Emit the associated thunks for the given global decl.
Definition at line 511 of file CIRGenVTables.cpp.
References clang::cast(), clang::Dtor_Base, clang::GlobalDecl::getDecl(), clang::GlobalDecl::getDtorType(), clang::FunctionDecl::getSourceRange(), and clang::isa().
Referenced by clang::CIRGen::CIRGenModule::emitGlobalDefinition().
void CIRGenVTables::emitVTTDefinition | ( | cir::GlobalOp | vttOp, |
cir::GlobalLinkageKind | linkage, | ||
const CXXRecordDecl * | rd ) |
Emit the definition of the given vtable.
Definition at line 404 of file CIRGenVTables.cpp.
References clang::VTableLayout::AddressPointLocation::AddressPointIndex, clang::ast_matchers::arrayType, clang::VTableLayout::getAddressPoint(), getAddrOfVTTVTable(), clang::VTTVTable::getBase(), getItaniumVTableContext(), clang::CIRGen::CIRGenModule::getMLIRVisibility(), clang::ItaniumVTableContext::getVTableLayout(), clang::VTTBuilder::getVTTComponents(), clang::VTTBuilder::getVTTVTables(), and clang::VTableLayout::AddressPointLocation::VTableIndex.
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().
cir::GlobalOp CIRGenVTables::generateConstructionVTable | ( | const CXXRecordDecl * | rd, |
const BaseSubobject & | base, | ||
bool | baseIsVirtual, | ||
cir::GlobalLinkageKind | linkage, | ||
VTableAddressPointsMapTy & | addressPoints ) |
Generate a construction vtable for the given base subobject.
Definition at line 220 of file CIRGenVTables.cpp.
References clang::cast(), createVTableInitializer(), clang::CharUnits::fromQuantity(), cir::MissingFeatures::generateDebugInfo(), clang::BaseSubobject::getBase(), clang::BaseSubobject::getBaseOffset(), getItaniumVTableContext(), clang::CharUnits::getQuantity(), clang::TagDecl::getSourceRange(), getVTableType(), cir::isLocalLinkage(), cir::MissingFeatures::opGlobalUnnamedAddr(), clang::out, cir::MissingFeatures::vtableEmitMetadata(), and cir::MissingFeatures::vtableRelativeLayout().
Referenced by getAddrOfVTTVTable().
cir::GlobalOp CIRGenVTables::getAddrOfVTT | ( | const CXXRecordDecl * | rd | ) |
Get the address of the VTT for the given record decl.
Definition at line 362 of file CIRGenVTables.cpp.
References clang::ast_matchers::arrayType, clang::cast(), clang::CharUnits::fromQuantity(), clang::CXXRecordDecl::getNumVBases(), clang::TagDecl::getSourceRange(), clang::VTTBuilder::getVTTComponents(), and clang::out.
|
inline |
Definition at line 66 of file CIRGenVTables.h.
Referenced by emitVTTDefinition(), and generateConstructionVTable().
|
inline |
Definition at line 70 of file CIRGenVTables.h.
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().
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().
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().
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.