clang 22.0.0git
Public Member Functions | Protected Attributes | List of all members
clang::CIRGen::CIRGenCXXABI Class Referenceabstract

Implements C++ ABI-specific code generation functions. More...

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

Public Member Functions

 CIRGenCXXABI (CIRGenModule &cgm)
 
virtual ~CIRGenCXXABI ()
 
void setCXXABIThisValue (CIRGenFunction &cgf, mlir::Value thisPtr)
 
virtual void initializeHiddenVirtualInheritanceMembers (CIRGenFunction &cgf, const CXXRecordDecl *rd)
 Emit the code to initialize hidden members required to handle virtual inheritance, if needed by the ABI.
 
virtual void emitCXXStructor (clang::GlobalDecl gd)=0
 Emit a single constructor/destructor with the gen type from a C++ constructor/destructor Decl.
 
clang::ImplicitParamDeclgetThisDecl (CIRGenFunction &cgf)
 
virtual void emitInstanceFunctionProlog (SourceLocation loc, CIRGenFunction &cgf)=0
 Emit the ABI-specific prolog for the function.
 
virtual void emitRethrow (CIRGenFunction &cgf, bool isNoReturn)=0
 
virtual const clang::CXXRecordDeclgetThisArgumentTypeForMethod (const clang::CXXMethodDecl *md)
 Get the type of the implicit "this" parameter used by a method.
 
virtual bool needsVTTParameter (clang::GlobalDecl gd)
 Return whether the given global decl needs a VTT (virtual table table) parameter.
 
virtual Address adjustThisArgumentForVirtualFunctionCall (CIRGenFunction &cgf, clang::GlobalDecl gd, Address thisPtr, bool virtualCall)
 Perform ABI-specific "this" argument adjustment required prior to a call of a virtual function.
 
void buildThisParam (CIRGenFunction &cgf, FunctionArgList &params)
 Build a parameter variable suitable for 'this'.
 
mlir::Value loadIncomingCXXThis (CIRGenFunction &cgf)
 Loads the incoming C++ this pointer as it was passed by the caller.
 
virtual void emitCXXConstructors (const clang::CXXConstructorDecl *d)=0
 Emit constructor variants required by this ABI.
 
virtual void emitCXXDestructors (const clang::CXXDestructorDecl *d)=0
 Emit dtor variants required by this ABI.
 
virtual void emitDestructorCall (CIRGenFunction &cgf, const CXXDestructorDecl *dd, CXXDtorType type, bool forVirtualBase, bool delegating, Address thisAddr, QualType thisTy)=0
 
virtual bool isVirtualOffsetNeededForVTableField (CIRGenFunction &cgf, CIRGenFunction::VPtr vptr)=0
 Checks if ABI requires extra virtual offset for vtable field.
 
virtual void emitVTableDefinitions (CIRGenVTables &cgvt, const CXXRecordDecl *rd)=0
 Emits the VTable definitions required for the given record type.
 
virtual void emitVirtualInheritanceTables (const CXXRecordDecl *rd)=0
 Emit any tables needed to implement virtual inheritance.
 
virtual bool useThunkForDtorVariant (const CXXDestructorDecl *dtor, CXXDtorType dt) const =0
 Returns true if the given destructor type should be emitted as a linkonce delegating thunk, regardless of whether the dtor is defined in this TU or not.
 
virtual cir::GlobalLinkageKind getCXXDestructorLinkage (GVALinkage linkage, const CXXDestructorDecl *dtor, CXXDtorType dt) const
 
virtual cir::GlobalOp getAddrOfVTable (const CXXRecordDecl *rd, CharUnits vptrOffset)=0
 Get the address of the vtable for the given record decl which should be used for the vptr at the given offset in RD.
 
virtual CIRGenCallee getVirtualFunctionPointer (CIRGenFunction &cgf, clang::GlobalDecl gd, Address thisAddr, mlir::Type ty, SourceLocation loc)=0
 Build a virtual function pointer in the ABI-specific way.
 
virtual mlir::Value getVTableAddressPoint (BaseSubobject base, const CXXRecordDecl *vtableClass)=0
 Get the address point of the vtable for the given base subobject.
 
virtual mlir::Value getVTableAddressPointInStructor (CIRGenFunction &cgf, const CXXRecordDecl *vtableClass, BaseSubobject base, const CXXRecordDecl *nearestVBase)=0
 Get the address point of the vtable for the given base subobject while building a constructor or a destructor.
 
virtual bool doStructorsInitializeVPtrs (const clang::CXXRecordDecl *vtableClass)=0
 Checks if ABI requires to initialize vptrs for given dynamic class.
 
virtual bool hasThisReturn (clang::GlobalDecl gd) const
 Returns true if the given constructor or destructor is one of the kinds that the ABI says returns 'this' (only applies when called non-virtually for destructors).
 
virtual bool hasMostDerivedReturn (clang::GlobalDecl gd) const
 
clang::MangleContextgetMangleContext ()
 Gets the mangle context.
 

Protected Attributes

CIRGenModulecgm
 
std::unique_ptr< clang::MangleContextmangleContext
 

Detailed Description

Implements C++ ABI-specific code generation functions.

Definition at line 26 of file CIRGenCXXABI.h.

Constructor & Destructor Documentation

◆ CIRGenCXXABI()

clang::CIRGen::CIRGenCXXABI::CIRGenCXXABI ( CIRGenModule cgm)
inline

Definition at line 34 of file CIRGenCXXABI.h.

◆ ~CIRGenCXXABI()

CIRGenCXXABI::~CIRGenCXXABI ( )
virtual

Definition at line 23 of file CIRGenCXXABI.cpp.

Member Function Documentation

◆ adjustThisArgumentForVirtualFunctionCall()

virtual Address clang::CIRGen::CIRGenCXXABI::adjustThisArgumentForVirtualFunctionCall ( CIRGenFunction cgf,
clang::GlobalDecl  gd,
Address  thisPtr,
bool  virtualCall 
)
inlinevirtual

Perform ABI-specific "this" argument adjustment required prior to a call of a virtual function.

The "VirtualCall" argument is true iff the call itself is virtual.

Definition at line 77 of file CIRGenCXXABI.h.

Referenced by clang::CIRGen::CIRGenFunction::emitCXXMemberOrOperatorMemberCallExpr().

◆ buildThisParam()

void CIRGenCXXABI::buildThisParam ( CIRGenFunction cgf,
FunctionArgList params 
)

◆ doStructorsInitializeVPtrs()

virtual bool clang::CIRGen::CIRGenCXXABI::doStructorsInitializeVPtrs ( const clang::CXXRecordDecl vtableClass)
pure virtual

Checks if ABI requires to initialize vptrs for given dynamic class.

Referenced by clang::CIRGen::CIRGenFunction::initializeVTablePointers().

◆ emitCXXConstructors()

virtual void clang::CIRGen::CIRGenCXXABI::emitCXXConstructors ( const clang::CXXConstructorDecl d)
pure virtual

Emit constructor variants required by this ABI.

Referenced by clang::CIRGen::CIRGenModule::emitTopLevelDecl().

◆ emitCXXDestructors()

virtual void clang::CIRGen::CIRGenCXXABI::emitCXXDestructors ( const clang::CXXDestructorDecl d)
pure virtual

Emit dtor variants required by this ABI.

Referenced by clang::CIRGen::CIRGenModule::emitTopLevelDecl().

◆ emitCXXStructor()

virtual void clang::CIRGen::CIRGenCXXABI::emitCXXStructor ( clang::GlobalDecl  gd)
pure virtual

Emit a single constructor/destructor with the gen type from a C++ constructor/destructor Decl.

◆ emitDestructorCall()

virtual void clang::CIRGen::CIRGenCXXABI::emitDestructorCall ( CIRGenFunction cgf,
const CXXDestructorDecl dd,
CXXDtorType  type,
bool  forVirtualBase,
bool  delegating,
Address  thisAddr,
QualType  thisTy 
)
pure virtual

◆ emitInstanceFunctionProlog()

virtual void clang::CIRGen::CIRGenCXXABI::emitInstanceFunctionProlog ( SourceLocation  loc,
CIRGenFunction cgf 
)
pure virtual

Emit the ABI-specific prolog for the function.

Referenced by clang::CIRGen::CIRGenFunction::startFunction().

◆ emitRethrow()

virtual void clang::CIRGen::CIRGenCXXABI::emitRethrow ( CIRGenFunction cgf,
bool  isNoReturn 
)
pure virtual

◆ emitVirtualInheritanceTables()

virtual void clang::CIRGen::CIRGenCXXABI::emitVirtualInheritanceTables ( const CXXRecordDecl rd)
pure virtual

Emit any tables needed to implement virtual inheritance.

For Itanium, this emits virtual table tables.

Referenced by clang::CIRGen::CIRGenVTables::generateClassData().

◆ emitVTableDefinitions()

virtual void clang::CIRGen::CIRGenCXXABI::emitVTableDefinitions ( CIRGenVTables cgvt,
const CXXRecordDecl rd 
)
pure virtual

Emits the VTable definitions required for the given record type.

Referenced by clang::CIRGen::CIRGenVTables::generateClassData().

◆ getAddrOfVTable()

virtual cir::GlobalOp clang::CIRGen::CIRGenCXXABI::getAddrOfVTable ( const CXXRecordDecl rd,
CharUnits  vptrOffset 
)
pure virtual

Get the address of the vtable for the given record decl which should be used for the vptr at the given offset in RD.

Referenced by clang::CIRGen::CIRGenVTables::getAddrOfVTT(), and getAddrOfVTTVTable().

◆ getCXXDestructorLinkage()

cir::GlobalLinkageKind CIRGenCXXABI::getCXXDestructorLinkage ( GVALinkage  linkage,
const CXXDestructorDecl dtor,
CXXDtorType  dt 
) const
virtual

◆ getMangleContext()

clang::MangleContext & clang::CIRGen::CIRGenCXXABI::getMangleContext ( )
inline

◆ getThisArgumentTypeForMethod()

virtual const clang::CXXRecordDecl * clang::CIRGen::CIRGenCXXABI::getThisArgumentTypeForMethod ( const clang::CXXMethodDecl md)
inlinevirtual

Get the type of the implicit "this" parameter used by a method.

May return zero if no specific type is applicable, e.g. if the ABI expects the "this" parameter to point to some artificial offset in a complete object due to vbases being reordered.

Definition at line 66 of file CIRGenCXXABI.h.

References clang::CXXMethodDecl::getParent().

Referenced by clang::CIRGen::CIRGenTypes::arrangeCXXMethodDeclaration(), and commonBuildCXXMemberOrOperatorCall().

◆ getThisDecl()

clang::ImplicitParamDecl * clang::CIRGen::CIRGenCXXABI::getThisDecl ( CIRGenFunction cgf)
inline

◆ getVirtualFunctionPointer()

virtual CIRGenCallee clang::CIRGen::CIRGenCXXABI::getVirtualFunctionPointer ( CIRGenFunction cgf,
clang::GlobalDecl  gd,
Address  thisAddr,
mlir::Type  ty,
SourceLocation  loc 
)
pure virtual

Build a virtual function pointer in the ABI-specific way.

Referenced by clang::CIRGen::CIRGenCallee::prepareConcreteCallee().

◆ getVTableAddressPoint()

virtual mlir::Value clang::CIRGen::CIRGenCXXABI::getVTableAddressPoint ( BaseSubobject  base,
const CXXRecordDecl vtableClass 
)
pure virtual

Get the address point of the vtable for the given base subobject.

◆ getVTableAddressPointInStructor()

virtual mlir::Value clang::CIRGen::CIRGenCXXABI::getVTableAddressPointInStructor ( CIRGenFunction cgf,
const CXXRecordDecl vtableClass,
BaseSubobject  base,
const CXXRecordDecl nearestVBase 
)
pure virtual

Get the address point of the vtable for the given base subobject while building a constructor or a destructor.

Referenced by clang::CIRGen::CIRGenFunction::initializeVTablePointer().

◆ hasMostDerivedReturn()

virtual bool clang::CIRGen::CIRGenCXXABI::hasMostDerivedReturn ( clang::GlobalDecl  gd) const
inlinevirtual

◆ hasThisReturn()

virtual bool clang::CIRGen::CIRGenCXXABI::hasThisReturn ( clang::GlobalDecl  gd) const
inlinevirtual

Returns true if the given constructor or destructor is one of the kinds that the ABI says returns 'this' (only applies when called non-virtually for destructors).

There currently is no way to indicate if a destructor returns 'this' when called virtually, and CIR generation does not support this case.

Definition at line 157 of file CIRGenCXXABI.h.

Referenced by clang::CIRGen::CIRGenTypes::arrangeCXXConstructorCall(), clang::CIRGen::CIRGenTypes::arrangeCXXStructorDeclaration(), and clang::CIRGen::CIRGenFunction::buildFunctionArgList().

◆ initializeHiddenVirtualInheritanceMembers()

virtual void clang::CIRGen::CIRGenCXXABI::initializeHiddenVirtualInheritanceMembers ( CIRGenFunction cgf,
const CXXRecordDecl rd 
)
inlinevirtual

Emit the code to initialize hidden members required to handle virtual inheritance, if needed by the ABI.

Definition at line 43 of file CIRGenCXXABI.h.

Referenced by clang::CIRGen::CIRGenFunction::initializeVTablePointers().

◆ isVirtualOffsetNeededForVTableField()

virtual bool clang::CIRGen::CIRGenCXXABI::isVirtualOffsetNeededForVTableField ( CIRGenFunction cgf,
CIRGenFunction::VPtr  vptr 
)
pure virtual

Checks if ABI requires extra virtual offset for vtable field.

Referenced by clang::CIRGen::CIRGenFunction::initializeVTablePointer().

◆ loadIncomingCXXThis()

mlir::Value CIRGenCXXABI::loadIncomingCXXThis ( CIRGenFunction cgf)

◆ needsVTTParameter()

virtual bool clang::CIRGen::CIRGenCXXABI::needsVTTParameter ( clang::GlobalDecl  gd)
inlinevirtual

Return whether the given global decl needs a VTT (virtual table table) parameter.

Definition at line 72 of file CIRGenCXXABI.h.

Referenced by clang::CIRGen::CIRGenFunction::emitDelegateCXXConstructorCall().

◆ setCXXABIThisValue()

void CIRGenCXXABI::setCXXABIThisValue ( CIRGenFunction cgf,
mlir::Value  thisPtr 
)

Initialize the 'this' slot.

Definition at line 58 of file CIRGenCXXABI.cpp.

References clang::CIRGen::CIRGenFunction::cxxabiThisValue, and getThisDecl().

◆ useThunkForDtorVariant()

virtual bool clang::CIRGen::CIRGenCXXABI::useThunkForDtorVariant ( const CXXDestructorDecl dtor,
CXXDtorType  dt 
) const
pure virtual

Returns true if the given destructor type should be emitted as a linkonce delegating thunk, regardless of whether the dtor is defined in this TU or not.

Member Data Documentation

◆ cgm

CIRGenModule& clang::CIRGen::CIRGenCXXABI::cgm
protected

Definition at line 28 of file CIRGenCXXABI.h.

Referenced by buildThisParam(), and getCXXDestructorLinkage().

◆ mangleContext

std::unique_ptr<clang::MangleContext> clang::CIRGen::CIRGenCXXABI::mangleContext
protected

Definition at line 29 of file CIRGenCXXABI.h.

Referenced by getMangleContext().


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