clang 22.0.0git
|
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::ImplicitParamDecl * | getThisDecl (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::CXXRecordDecl * | getThisArgumentTypeForMethod (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 ¶ms) |
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 ¶ms)=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::MangleContext & | getMangleContext () |
Gets the mangle context. | |
clang::ImplicitParamDecl *& | getStructorImplicitParamDecl (CIRGenFunction &cgf) |
mlir::Value | getStructorImplicitParamValue (CIRGenFunction &cgf) |
void | setStructorImplicitParamValue (CIRGenFunction &cgf, mlir::Value val) |
Protected Attributes | |
CIRGenModule & | cgm |
std::unique_ptr< clang::MangleContext > | mangleContext |
Implements C++ ABI-specific code generation functions.
Definition at line 26 of file CIRGenCXXABI.h.
|
inline |
Definition at line 34 of file CIRGenCXXABI.h.
References cgm, and mangleContext.
|
virtual |
Definition at line 23 of file CIRGenCXXABI.cpp.
CIRGenCXXABI::AddedStructorArgCounts CIRGenCXXABI::addImplicitConstructorArgs | ( | CIRGenFunction & | cgf, |
const CXXConstructorDecl * | d, | ||
CXXCtorType | type, | ||
bool | forVirtualBase, | ||
bool | delegating, | ||
CallArgList & | args ) |
|
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.
|
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.
|
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.
void CIRGenCXXABI::buildThisParam | ( | CIRGenFunction & | cgf, |
FunctionArgList & | params ) |
Build a parameter variable suitable for 'this'.
Definition at line 39 of file CIRGenCXXABI.cpp.
References clang::cast(), cgm, clang::ImplicitParamDecl::Create(), clang::CIRGen::CIRGenFunction::curGD, cir::MissingFeatures::cxxabiThisAlignment(), clang::CIRGen::CIRGenFunction::cxxabiThisDecl, clang::CXXThis, and clang::GlobalDecl::getDecl().
|
pure virtual |
Checks if ABI requires to initialize vptrs for given dynamic class.
|
pure virtual |
Emit constructor variants required by this ABI.
Referenced by clang::CIRGen::CIRGenModule::emitTopLevelDecl().
|
pure virtual |
Emit dtor variants required by this ABI.
Referenced by clang::CIRGen::CIRGenModule::emitTopLevelDecl().
|
pure virtual |
Emit a single constructor/destructor with the gen type from a C++ constructor/destructor Decl.
|
pure virtual |
References clang::ast_matchers::type.
|
pure virtual |
Emit the ABI-specific prolog for the function.
|
pure virtual |
|
pure virtual |
Emit any tables needed to implement virtual inheritance.
For Itanium, this emits virtual table tables.
|
pure virtual |
Emits the VTable definitions required for the given record type.
|
pure virtual |
Referenced by clang::CIRGen::CIRGenModule::getAddrOfRTTIDescriptor().
|
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().
|
virtual |
Definition at line 58 of file CIRGenCXXABI.cpp.
References cgm.
Referenced by clang::CIRGen::CIRGenModule::getFunctionLinkage().
|
pure virtual |
References clang::ast_matchers::type.
Referenced by addImplicitConstructorArgs().
|
inline |
Gets the mangle context.
Definition at line 234 of file CIRGenCXXABI.h.
References mangleContext.
Referenced by getMangledNameImpl().
|
inline |
Definition at line 236 of file CIRGenCXXABI.h.
References clang::CIRGen::CIRGenFunction::cxxStructorImplicitParamDecl.
|
inline |
Definition at line 240 of file CIRGenCXXABI.h.
References clang::CIRGen::CIRGenFunction::cxxStructorImplicitParamValue.
|
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().
|
inline |
Definition at line 102 of file CIRGenCXXABI.h.
References clang::CIRGen::CIRGenFunction::cxxabiThisDecl.
Referenced by loadIncomingCXXThis(), and setCXXABIThisValue().
|
pure virtual |
|
pure virtual |
Build a virtual function pointer in the ABI-specific way.
Referenced by clang::CIRGen::CIRGenCallee::prepareConcreteCallee().
|
pure virtual |
Get the address point of the vtable for the given base subobject.
|
pure virtual |
Get the address point of the vtable for the given base subobject while building a constructor or a destructor.
|
inlinevirtual |
Definition at line 229 of file CIRGenCXXABI.h.
|
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.
|
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.
|
pure virtual |
Checks if ABI requires extra virtual offset for vtable field.
mlir::Value CIRGenCXXABI::loadIncomingCXXThis | ( | CIRGenFunction & | cgf | ) |
Loads the incoming C++ this pointer as it was passed by the caller.
Definition at line 65 of file CIRGenCXXABI.cpp.
References clang::CIRGen::CIRGenFunction::getAddrOfLocalVar(), clang::CIRGen::CIRGenFunction::getBuilder(), clang::CIRGen::Address::getElementType(), clang::CIRGen::CIRGenFunction::getLoc(), clang::Decl::getLocation(), clang::CIRGen::Address::getPointer(), and getThisDecl().
|
inlinevirtual |
Return whether the given global decl needs a VTT (virtual table table) parameter.
Definition at line 131 of file CIRGenCXXABI.h.
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().
|
inline |
Definition at line 244 of file CIRGenCXXABI.h.
References clang::CIRGen::CIRGenFunction::cxxStructorImplicitParamValue.
|
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.
|
protected |
Definition at line 28 of file CIRGenCXXABI.h.
Referenced by buildThisParam(), CIRGenCXXABI(), and getCXXDestructorLinkage().
|
protected |
Definition at line 29 of file CIRGenCXXABI.h.
Referenced by CIRGenCXXABI(), and getMangleContext().