clang 22.0.0git
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"

Classes

struct  AddedStructorArgCounts
 Similar to AddedStructorArgs, but only notes the number of additional arguments. More...
struct  AddedStructorArgs
 Additional implicit arguments to add to the beginning (Prefix) and end (Suffix) of a constructor / destructor arg list. More...

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.
virtual mlir::Value getVirtualBaseClassOffset (mlir::Location loc, CIRGenFunction &cgf, Address thisAddr, const CXXRecordDecl *classDecl, const CXXRecordDecl *baseClassDecl)=0
virtual AddedStructorArgCounts buildStructorSignature (GlobalDecl gd, llvm::SmallVectorImpl< CanQualType > &argTys)=0
 Build the signature of the given constructor or destructor vairant by adding any required parameters.
AddedStructorArgCounts addImplicitConstructorArgs (CIRGenFunction &cgf, const CXXConstructorDecl *d, CXXCtorType type, bool forVirtualBase, bool delegating, CallArgList &args)
clang::ImplicitParamDeclgetThisDecl (CIRGenFunction &cgf)
virtual AddedStructorArgs getImplicitConstructorArgs (CIRGenFunction &cgf, const CXXConstructorDecl *d, CXXCtorType type, bool forVirtualBase, bool delegating)=0
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 mlir::Attribute getAddrOfRTTIDescriptor (mlir::Location loc, QualType ty)=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 void addImplicitStructorParams (CIRGenFunction &cgf, clang::QualType &resTy, FunctionArgList &params)=0
 Insert any ABI-specific implicit parameters into the parameter list for a function.
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.
clang::ImplicitParamDecl *& getStructorImplicitParamDecl (CIRGenFunction &cgf)
mlir::Value getStructorImplicitParamValue (CIRGenFunction &cgf)
void setStructorImplicitParamValue (CIRGenFunction &cgf, mlir::Value val)

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.

References cgm, and mangleContext.

◆ ~CIRGenCXXABI()

CIRGenCXXABI::~CIRGenCXXABI ( )
virtual

Definition at line 23 of file CIRGenCXXABI.cpp.

Member Function Documentation

◆ addImplicitConstructorArgs()

◆ addImplicitStructorParams()

virtual void clang::CIRGen::CIRGenCXXABI::addImplicitStructorParams ( CIRGenFunction & cgf,
clang::QualType & resTy,
FunctionArgList & params )
pure virtual

Insert any ABI-specific implicit parameters into the parameter list for a function.

This generally involves extra data for constructors and destructors.

ABIs may also choose to override the return type, which has been initialized with the type of 'this' if HasThisReturn(CGF.CurGD) is true or the formal return type of the function otherwise.

◆ 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 136 of file CIRGenCXXABI.h.

◆ buildStructorSignature()

virtual AddedStructorArgCounts clang::CIRGen::CIRGenCXXABI::buildStructorSignature ( GlobalDecl gd,
llvm::SmallVectorImpl< CanQualType > & argTys )
pure virtual

Build the signature of the given constructor or destructor vairant by adding any required parameters.

For convenience, ArgTys has been initialized with the type of 'this'.

References clang::ast_matchers::type.

◆ buildThisParam()

◆ doStructorsInitializeVPtrs()

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

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

◆ 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.

◆ 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.

◆ emitVTableDefinitions()

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

Emits the VTable definitions required for the given record type.

◆ getAddrOfRTTIDescriptor()

virtual mlir::Attribute clang::CIRGen::CIRGenCXXABI::getAddrOfRTTIDescriptor ( mlir::Location loc,
QualType ty )
pure virtual

◆ 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 getAddrOfVTTVTable().

◆ getCXXDestructorLinkage()

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

Definition at line 58 of file CIRGenCXXABI.cpp.

References cgm.

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

◆ getImplicitConstructorArgs()

virtual AddedStructorArgs clang::CIRGen::CIRGenCXXABI::getImplicitConstructorArgs ( CIRGenFunction & cgf,
const CXXConstructorDecl * d,
CXXCtorType type,
bool forVirtualBase,
bool delegating )
pure virtual

◆ getMangleContext()

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

Gets the mangle context.

Definition at line 234 of file CIRGenCXXABI.h.

References mangleContext.

Referenced by getMangledNameImpl().

◆ getStructorImplicitParamDecl()

clang::ImplicitParamDecl *& clang::CIRGen::CIRGenCXXABI::getStructorImplicitParamDecl ( CIRGenFunction & cgf)
inline

◆ getStructorImplicitParamValue()

mlir::Value clang::CIRGen::CIRGenCXXABI::getStructorImplicitParamValue ( CIRGenFunction & cgf)
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 125 of file CIRGenCXXABI.h.

References clang::CXXMethodDecl::getParent().

Referenced by commonBuildCXXMemberOrOperatorCall().

◆ getThisDecl()

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

◆ getVirtualBaseClassOffset()

virtual mlir::Value clang::CIRGen::CIRGenCXXABI::getVirtualBaseClassOffset ( mlir::Location loc,
CIRGenFunction & cgf,
Address thisAddr,
const CXXRecordDecl * classDecl,
const CXXRecordDecl * baseClassDecl )
pure virtual

◆ 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.

◆ hasMostDerivedReturn()

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

Definition at line 229 of file CIRGenCXXABI.h.

◆ 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 227 of file CIRGenCXXABI.h.

◆ 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.

◆ isVirtualOffsetNeededForVTableField()

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

Checks if ABI requires extra virtual offset for vtable field.

◆ loadIncomingCXXThis()

◆ 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 131 of file CIRGenCXXABI.h.

◆ setCXXABIThisValue()

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

Initialize the 'this' slot.

Definition at line 72 of file CIRGenCXXABI.cpp.

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

◆ setStructorImplicitParamValue()

void clang::CIRGen::CIRGenCXXABI::setStructorImplicitParamValue ( CIRGenFunction & cgf,
mlir::Value val )
inline

◆ 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(), CIRGenCXXABI(), and getCXXDestructorLinkage().

◆ mangleContext

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

Definition at line 29 of file CIRGenCXXABI.h.

Referenced by CIRGenCXXABI(), and getMangleContext().


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