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"
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::ImplicitParamDecl * | getThisDecl (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::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 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. | |
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.
|
virtual |
Definition at line 23 of file CIRGenCXXABI.cpp.
|
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().
void CIRGenCXXABI::buildThisParam | ( | CIRGenFunction & | cgf, |
FunctionArgList & | params | ||
) |
Build a parameter variable suitable for 'this'.
Definition at line 25 of file CIRGenCXXABI.cpp.
References cgm, clang::ImplicitParamDecl::Create(), clang::CIRGen::CIRGenFunction::curGD, cir::MissingFeatures::cxxabiThisAlignment(), clang::CIRGen::CIRGenFunction::cxxabiThisDecl, clang::CXXThis, clang::IdentifierTable::get(), clang::CIRGen::CIRGenModule::getASTContext(), clang::GlobalDecl::getDecl(), and clang::ASTContext::Idents.
Referenced by clang::CIRGen::CIRGenFunction::buildFunctionArgList().
|
pure virtual |
Checks if ABI requires to initialize vptrs for given dynamic class.
Referenced by clang::CIRGen::CIRGenFunction::initializeVTablePointers().
|
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 |
Referenced by clang::CIRGen::CIRGenFunction::emitCXXDestructorCall().
|
pure virtual |
Emit the ABI-specific prolog for the function.
Referenced by clang::CIRGen::CIRGenFunction::startFunction().
|
pure virtual |
Referenced by clang::CIRGen::CIRGenFunction::emitCXXThrowExpr().
|
pure virtual |
Emit any tables needed to implement virtual inheritance.
For Itanium, this emits virtual table tables.
Referenced by clang::CIRGen::CIRGenVTables::generateClassData().
|
pure virtual |
Emits the VTable definitions required for the given record type.
Referenced by clang::CIRGen::CIRGenVTables::generateClassData().
|
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().
|
virtual |
Definition at line 44 of file CIRGenCXXABI.cpp.
References cgm, and clang::CIRGen::CIRGenModule::getCIRLinkageForDeclarator().
Referenced by clang::CIRGen::CIRGenModule::getFunctionLinkage().
|
inline |
Gets the mangle context.
Definition at line 164 of file CIRGenCXXABI.h.
References mangleContext.
Referenced by clang::CIRGen::CIRGenVTables::generateConstructionVTable(), clang::CIRGen::CIRGenVTables::getAddrOfVTT(), and getMangledNameImpl().
|
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().
|
inline |
Definition at line 51 of file CIRGenCXXABI.h.
References clang::CIRGen::CIRGenFunction::cxxabiThisDecl.
Referenced by loadIncomingCXXThis(), and setCXXABIThisValue().
|
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.
Referenced by clang::CIRGen::CIRGenFunction::initializeVTablePointer().
|
inlinevirtual |
Definition at line 159 of file CIRGenCXXABI.h.
Referenced by clang::CIRGen::CIRGenTypes::arrangeCXXConstructorCall(), clang::CIRGen::CIRGenTypes::arrangeCXXStructorDeclaration(), and clang::CIRGen::CIRGenFunction::buildFunctionArgList().
|
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().
|
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().
|
pure virtual |
Checks if ABI requires extra virtual offset for vtable field.
Referenced by clang::CIRGen::CIRGenFunction::initializeVTablePointer().
mlir::Value CIRGenCXXABI::loadIncomingCXXThis | ( | CIRGenFunction & | cgf | ) |
Loads the incoming C++ this pointer as it was passed by the caller.
Definition at line 51 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 72 of file CIRGenCXXABI.h.
Referenced by clang::CIRGen::CIRGenFunction::emitDelegateCXXConstructorCall().
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().
|
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(), and getCXXDestructorLinkage().
|
protected |
Definition at line 29 of file CIRGenCXXABI.h.
Referenced by getMangleContext().