13#ifndef CLANG_LIB_CIR_CODEGEN_CIRGENVTABLES_H
14#define CLANG_LIB_CIR_CODEGEN_CIRGENVTABLES_H
16#include "mlir/IR/Types.h"
35 using BaseSubobjectPairTy =
36 std::pair<const clang::CXXRecordDecl *, clang::BaseSubobject>;
37 using SubVTTIndiciesMapTy = llvm::DenseMap<BaseSubobjectPairTy, uint64_t>;
40 SubVTTIndiciesMapTy subVTTIndicies;
42 using SecondaryVirtualPointerIndicesMapTy =
43 llvm::DenseMap<BaseSubobjectPairTy, uint64_t>;
47 SecondaryVirtualPointerIndicesMapTy secondaryVirtualPointerIndices;
50 getVTableComponent(
const VTableLayout &layout,
unsigned componentIndex,
51 mlir::Attribute rtti,
unsigned &nextVTableThunkIndex,
52 unsigned vtableAddressPoint,
bool vtableHasLocalLinkage);
54 mlir::Type getVTableComponentType();
64 bool vtableHasLocalLinkage);
67 return *llvm::cast<clang::ItaniumVTableContext>(vtContext);
71 return *llvm::cast<clang::ItaniumVTableContext>(vtContext);
77 bool baseIsVirtual, cir::GlobalLinkageKind linkage,
78 VTableAddressPointsMapTy &addressPoints);
This class organizes the cross-function state that is used while generating CIR code.
cir::RecordType getVTableType(const clang::VTableLayout &layout)
Returns the type of a vtable with the given layout.
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.
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.
uint64_t getSubVTTIndex(const CXXRecordDecl *rd, BaseSubobject base)
Return the index of the sub-VTT for the base class of the given record decl.
void emitThunks(GlobalDecl gd)
Emit the associated thunks for the given global decl.
void emitVTTDefinition(cir::GlobalOp vttOp, cir::GlobalLinkageKind linkage, const CXXRecordDecl *rd)
Emit the definition of the given vtable.
CIRGenVTables(CIRGenModule &cgm)
const clang::ItaniumVTableContext & getItaniumVTableContext() const
void generateClassData(const CXXRecordDecl *rd)
Generate all the class data required to be generated upon definition of a KeyFunction.
cir::GlobalOp getAddrOfVTT(const CXXRecordDecl *rd)
Get the address of the VTT for the given record decl.
clang::ItaniumVTableContext & getItaniumVTableContext()
uint64_t getSecondaryVirtualPointerIndex(const CXXRecordDecl *rd, BaseSubobject base)
Return the index in the VTT where the virtual pointer for the given subobject is located.
Represents a C++ struct/union/class.
GlobalDecl - represents a global declaration.
llvm::DenseMap< BaseSubobject, AddressPointLocation > AddressPointsMapTy
The JSON file list parser is used to communicate input to InstallAPI.