clang 20.0.0git
|
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this class is possibly signed. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/Address.h"
Public Member Functions | |
Address (llvm::Value *pointer, llvm::Type *elementType, CharUnits alignment, KnownNonNull_t IsKnownNonNull=NotKnownNonNull) | |
Address (llvm::Value *BasePtr, llvm::Type *ElementType, CharUnits Alignment, CGPointerAuthInfo PtrAuthInfo, llvm::Value *Offset, KnownNonNull_t IsKnownNonNull=NotKnownNonNull) | |
Address (RawAddress RawAddr) | |
bool | isValid () const |
void | replaceBasePointer (llvm::Value *P) |
This function is used in situations where the caller is doing some sort of opaque "laundering" of the pointer. | |
CharUnits | getAlignment () const |
void | setAlignment (CharUnits Value) |
llvm::Value * | getBasePointer () const |
llvm::PointerType * | getType () const |
Return the type of the pointer value. | |
llvm::Type * | getElementType () const |
Return the type of the values stored in this address. | |
unsigned | getAddressSpace () const |
Return the address space that this address resides in. | |
llvm::StringRef | getName () const |
Return the IR name of the pointer value. | |
const CGPointerAuthInfo & | getPointerAuthInfo () const |
void | setPointerAuthInfo (const CGPointerAuthInfo &Info) |
void | setElementType (llvm::Type *Ty) |
bool | isSigned () const |
KnownNonNull_t | isKnownNonNull () const |
Whether the pointer is known not to be null. | |
Address | setKnownNonNull () |
bool | hasOffset () const |
llvm::Value * | getOffset () const |
Address | getResignedAddress (const CGPointerAuthInfo &NewInfo, CodeGenFunction &CGF) const |
llvm::Value * | emitRawPointer (CodeGenFunction &CGF) const |
Return the pointer contained in this class after authenticating it and adding offset to it if necessary. | |
Address | withPointer (llvm::Value *NewPointer, KnownNonNull_t IsKnownNonNull) const |
Return address with different pointer, but same element type and alignment. | |
Address | withAlignment (CharUnits NewAlignment) const |
Return address with different alignment, but same pointer and element type. | |
Address | withElementType (llvm::Type *ElemTy) const |
Return address with different element type, but same pointer and alignment. | |
Static Public Member Functions | |
static Address | invalid () |
Protected Member Functions | |
Address (std::nullptr_t) | |
Friends | |
class | CGBuilderTy |
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this class is possibly signed.
This is designed to be an IR-level abstraction, carrying just the information necessary to perform IR operations on an address like loads and stores. In particular, it doesn't carry C type information or allow the representation of things like bit-fields; clients working at that level should generally be using LValue
.
An address may be either raw, meaning that it's an ordinary machine pointer, or signed, meaning that the pointer carries an embedded pointer-authentication signature. Representing signed pointers directly in this abstraction allows the authentication to be delayed as long as possible without forcing IRGen to use totally different code paths for signed and unsigned values or to separately propagate signature information through every API that manipulates addresses. Pointer arithmetic on signed addresses (e.g. drilling down to a struct field) is accumulated into a separate offset which is applied when the address is finally accessed.
|
inlineprotected |
|
inline |
Definition at line 154 of file Address.h.
References clang::CharUnits::isZero().
|
inline |
|
inline |
|
inline |
Return the pointer contained in this class after authenticating it and adding offset to it if necessary.
Definition at line 251 of file Address.h.
References getBasePointer(), and isSigned().
Referenced by clang::CodeGen::ReductionCodeGen::adjustPrivateAddress(), clang::CodeGen::CGOpenMPRuntimeGPU::adjustTargetSpecificDataForLambdas(), ApplyNonVirtualAndVirtualOffset(), clang::CodeGen::CGObjCRuntime::canMessageReceiverBeNull(), castValueFromUintptr(), clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast(), clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg(), clang::CodeGen::CGBuilderTy::CreateAtomicRMW(), CreateCoercedLoad(), clang::CodeGen::CGBuilderTy::CreateGEP(), createLoadInstBefore(), createStoreInstBefore(), emitARCCopyOperation(), emitARCLoadOperation(), emitARCStoreOperation(), EmitArrayDelete(), emitArraySubscriptGEP(), clang::CodeGen::CGOpenMPRuntime::emitDestroyClause(), EmitDestroyingObjectDelete(), clang::CodeGen::CGOpenMPRuntime::emitDoacrossInit(), EmitDoacrossOrdered(), clang::CodeGen::CGOpenMPRuntime::emitForNext(), emitForStaticInitCall(), clang::CodeGen::CodeGenPGO::emitMCDCTestVectorBitmapUpdate(), clang::CodeGen::emitMergePHI(), emitNonZeroVLAInit(), EmitObjectDelete(), EmitOMPAggregateInit(), EmitOMPAggregateReduction(), emitOMPAtomicCompareExpr(), clang::CodeGen::CGOpenMPRuntime::emitParallelCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitProxyTaskFunction(), clang::CodeGen::LValue::emitRawPointer(), clang::CodeGen::AggValueSlot::emitRawPointer(), clang::CodeGen::CGOpenMPRuntimeGPU::emitReduction(), clang::CodeGen::CGOpenMPRuntime::emitSingleRegion(), emitStructGetterCall(), clang::CodeGen::CGOpenMPRuntime::emitTargetDataStandAloneCall(), clang::CodeGen::CGOpenMPRuntime::emitTaskCall(), clang::CodeGen::CGOpenMPRuntime::emitTaskInit(), clang::CodeGen::CGOpenMPRuntime::emitTaskwaitCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsCall(), clang::CodeGen::CGOpenMPRuntime::emitThreadPrivateVarInit(), clang::CodeGen::CGObjCRuntime::EmitTryCatchStmt(), clang::CodeGen::CodeGenFunction::EmitTypeCheck(), clang::CodeGen::CGOpenMPRuntime::emitUpdateClause(), clang::CodeGen::CGOpenMPRuntime::emitUsesAllocatorsInit(), clang::CodeGen::EmitVAArgInstr(), clang::CodeGen::emitVoidPtrDirectVAArg(), emitWritebackArg(), EnterNewDeleteCleanup(), clang::CodeGen::RValue::get(), clang::CodeGen::CGOpenMPRuntime::getAddressOfLocalVariable(), clang::CodeGen::CGOpenMPRuntime::getAddrOfThreadPrivate(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddrOfThreadPrivate(), getPointerAndSize(), clang::CodeGen::LValue::getRawBitFieldPointer(), clang::CodeGen::LValue::getRawExtVectorPointer(), clang::CodeGen::LValue::getRawVectorPointer(), InitCatchParam(), performTypeAdjustment(), pushTemporaryCleanup(), clang::CodeGen::CGCXXABI::ReadArrayCookie(), clang::CodeGen::DominatingLLVMValue::save(), clang::CodeGen::CodeGenFunction::setBeforeOutermostConditional(), clang::CodeGen::CodeGenFunction::OMPMapVars::setVarAddr(), and wrapWithBPFPreserveStaticOffset().
|
inline |
|
inline |
Definition at line 189 of file Address.h.
Referenced by ApplyNonVirtualAndVirtualOffset(), CheckAtomicAlignment(), clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast(), clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg(), clang::CodeGen::CGBuilderTy::CreateAtomicRMW(), CreateCoercedLoad(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateConstByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP(), clang::CodeGen::CGBuilderTy::CreateGEP(), clang::CodeGen::CGBuilderTy::CreateLoad(), createLoadInstBefore(), clang::CodeGen::CGBuilderTy::CreateMemCpy(), clang::CodeGen::CGBuilderTy::CreateMemCpyInline(), clang::CodeGen::CGBuilderTy::CreateMemMove(), clang::CodeGen::CGBuilderTy::CreateMemSet(), clang::CodeGen::CGBuilderTy::CreateMemSetInline(), clang::CodeGen::CGBuilderTy::CreatePreserveStructAccessIndex(), clang::CodeGen::CGBuilderTy::CreateStore(), createStoreInstBefore(), clang::CodeGen::CGBuilderTy::CreateStructGEP(), clang::CodeGen::CodeGenFunction::CXXDefaultInitExprScope::CXXDefaultInitExprScope(), EmitArrayDelete(), emitArraySubscriptGEP(), clang::CodeGen::emitMergePHI(), emitNonZeroVLAInit(), EmitNullBaseClassInitialization(), EmitOMPAggregateInit(), EmitOMPAggregateReduction(), clang::CodeGen::CGOpenMPRuntime::emitThreadPrivateVarDefinition(), clang::CodeGen::CGOpenMPRuntime::emitUserDefinedMapper(), clang::CodeGen::CodeGenFunction::ParamValue::forIndirect(), clang::CodeGen::CGOpenMPRuntime::getAddrOfThreadPrivate(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddrOfThreadPrivate(), clang::CodeGen::LValue::getAlignment(), clang::CodeGen::AggValueSlot::getAlignment(), getResignedAddress(), clang::CodeGen::CodeGenFunction::mergeAddressesInConditionalExpr(), clang::CodeGen::DominatingValue< Address >::save(), clang::CodeGen::CodeGenFunction::setBeforeOutermostConditional(), withElementType(), withPointer(), and wrapWithBPFPreserveStaticOffset().
|
inline |
Definition at line 193 of file Address.h.
References isValid(), and Pointer.
Referenced by clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateConstByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP(), clang::CodeGen::CGBuilderTy::CreateIsNull(), clang::CodeGen::CGBuilderTy::CreateLaunderInvariantGroup(), clang::CodeGen::CGBuilderTy::CreatePreserveUnionAccessIndex(), clang::CodeGen::CGBuilderTy::CreateStripInvariantGroup(), clang::CodeGen::CGBuilderTy::CreateStructGEP(), clang::CodeGen::CodeGenFunction::CXXDefaultInitExprScope::CXXDefaultInitExprScope(), emitRawPointer(), clang::CodeGen::LValue::emitResignedPointer(), emitWriteback(), emitWritebackArg(), findDominatingStoreToReturnValue(), clang::CodeGen::RValue::getAggregatePointer(), clang::CodeGen::CodeGenFunction::ParamValue::getAnyValue(), clang::CodeGen::CodeGenFunction::getAsNaturalPointerTo(), clang::CodeGen::LValue::getMatrixPointer(), getResignedAddress(), clang::CodeGen::LValue::getVectorPointer(), isProvablyNonNull(), clang::CodeGen::CodeGenFunction::mergeAddressesInConditionalExpr(), clang::CodeGen::DominatingValue< Address >::needsSaving(), clang::CodeGen::DominatingValue< Address >::save(), tryRemoveRetainOfSelf(), and withElementType().
|
inline |
Return the type of the values stored in this address.
Definition at line 207 of file Address.h.
References isValid().
Referenced by clang::CodeGen::ReductionCodeGen::adjustPrivateAddress(), CheckAtomicAlignment(), CreateCoercedLoad(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateConstByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP(), clang::CodeGen::CGBuilderTy::CreateGEP(), clang::CodeGen::CGBuilderTy::CreateInBoundsGEP(), clang::CodeGen::CGBuilderTy::CreateLoad(), createLoadInstBefore(), clang::CodeGen::CGBuilderTy::CreatePreserveStructAccessIndex(), clang::CodeGen::CGBuilderTy::CreateStructGEP(), emitARCStoreOperation(), EmitArrayDelete(), emitArraySubscriptGEP(), EmitCheckedMixedSignMultiply(), clang::CodeGen::CGOpenMPRuntime::emitDestroyClause(), clang::CodeGen::emitMergePHI(), emitNonZeroVLAInit(), EmitOMPAggregateInit(), EmitOMPAggregateReduction(), emitOMPArraySectionBase(), emitOMPAtomicCompareExpr(), clang::CodeGen::emitVoidPtrDirectVAArg(), emitWriteback(), EnterStructPointerForCoercedAccess(), findDominatingStoreToReturnValue(), clang::CodeGen::CGOpenMPRuntime::getAddrOfThreadPrivate(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddrOfThreadPrivate(), getNullForVariable(), getPointerAndSize(), getResignedAddress(), clang::CodeGen::DominatingValue< Address >::save(), tryEmitARCCopyWeakInit(), withAlignment(), withPointer(), and wrapWithBPFPreserveStaticOffset().
|
inline |
Return the IR name of the pointer value.
Definition at line 216 of file Address.h.
References Pointer.
Referenced by CreateCoercedLoad().
|
inline |
Definition at line 244 of file Address.h.
Referenced by clang::CodeGen::DominatingValue< Address >::needsSaving(), and clang::CodeGen::DominatingValue< Address >::save().
|
inline |
Definition at line 218 of file Address.h.
Referenced by clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast(), clang::CodeGen::LValue::getPointerAuthInfo(), getResignedAddress(), and withElementType().
Address Address::getResignedAddress | ( | const CGPointerAuthInfo & | NewInfo, |
CodeGenFunction & | CGF | ||
) | const |
Definition at line 576 of file CGPointerAuth.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::emitPointerAuthResign(), getAlignment(), getBasePointer(), getElementType(), getPointerAuthInfo(), getType(), hasOffset(), isKnownNonNull(), clang::CodeGen::CGPointerAuthInfo::isSigned(), and isValid().
|
inline |
Return the type of the pointer value.
Definition at line 199 of file Address.h.
References Pointer.
Referenced by clang::CodeGen::ReductionCodeGen::adjustPrivateAddress(), castToBase(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), emitARCCopyOperation(), clang::CodeGen::ReductionCodeGen::emitInitialization(), clang::CodeGen::emitMergePHI(), emitNonZeroVLAInit(), emitOutlinedFunctionPrologue(), EmitPointerWithAlignment(), emitPseudoObjectExpr(), clang::CodeGen::CGOpenMPRuntime::emitReduction(), getAddressSpace(), getResignedAddress(), clang::CodeGen::LValue::MakeAddr(), clang::CodeGen::CodeGenFunction::mergeAddressesInConditionalExpr(), and clang::CodeGen::DominatingValue< Address >::save().
|
inline |
Definition at line 242 of file Address.h.
Referenced by clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast(), clang::CodeGen::CGBuilderTy::CreateIsNull(), clang::CodeGen::CodeGenFunction::ParamValue::getAnyValue(), getResignedAddress(), setElementType(), and withElementType().
|
inlinestatic |
Definition at line 176 of file Address.h.
Referenced by castToBase(), emitDeclTargetVarDeclLValue(), clang::CodeGen::CGOpenMPRuntime::emitDependClause(), clang::CodeGen::CGOpenMPRuntime::emitDepobjDependClause(), EmitOMPAggregateInit(), emitOutlinedFunctionPrologue(), emitReduceInitFunction(), emitScanBasedDirective(), clang::CodeGen::CGOpenMPRuntime::emitSingleRegion(), clang::CodeGen::CGOpenMPRuntime::emitTaskCall(), emitTaskDupFunction(), clang::CodeGen::CGOpenMPRuntime::emitTaskInit(), clang::CodeGen::CGOpenMPRuntime::emitTaskwaitCall(), clang::CodeGen::emitVoidPtrDirectVAArg(), clang::CodeGen::CGOpenMPRuntime::getAddressOfLocalVariable(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddressOfLocalVariable(), clang::CodeGen::CGOpenMPSIMDRuntime::getAddressOfLocalVariable(), clang::CodeGen::CGOpenMPRuntimeGPU::getAddressOfLocalVariable(), clang::CodeGen::AggValueSlot::ignored(), clang::CodeGen::CGCXXABI::InitializeArrayCookie(), clang::CodeGen::CodeGenFunction::InlinedInheritingConstructorScope::InlinedInheritingConstructorScope(), clang::CodeGen::LValue::MakeGlobalReg(), and clang::CodeGen::CodeGenFunction::OMPMapVars::setVarAddr().
|
inline |
Whether the pointer is known not to be null.
Definition at line 231 of file Address.h.
References isValid(), and Pointer.
Referenced by clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP(), clang::CodeGen::CGBuilderTy::CreateInBoundsGEP(), clang::CodeGen::CGBuilderTy::CreateStructGEP(), getResignedAddress(), clang::CodeGen::LValue::isKnownNonNull(), withAlignment(), and withElementType().
|
inline |
Definition at line 228 of file Address.h.
References clang::CodeGen::CGPointerAuthInfo::isSigned().
Referenced by emitRawPointer().
|
inline |
Definition at line 177 of file Address.h.
References Pointer.
Referenced by castToBase(), CheckAggExprForMemSetUse(), EmitCleanup(), EmitGlobalVarDeclLValue(), emitPrivatesInit(), clang::CodeGen::LValue::emitRawPointer(), clang::CodeGen::AggValueSlot::emitRawPointer(), clang::CodeGen::CGOpenMPRuntime::emitSingleRegion(), clang::CodeGen::AggValueSlot::forAddr(), clang::CodeGen::CGOpenMPRuntime::getAddressOfLocalVariable(), getBasePointer(), getElementType(), getResignedAddress(), clang::CodeGen::EHCleanupScope::hasActiveFlag(), clang::CodeGen::AggValueSlot::isIgnored(), isKnownNonNull(), clang::CodeGen::ReturnValueSlot::isNull(), replaceBasePointer(), and setKnownNonNull().
|
inline |
This function is used in situations where the caller is doing some sort of opaque "laundering" of the pointer.
Definition at line 181 of file Address.h.
References isValid(), P, and Pointer.
Referenced by clang::CodeGen::CGBuilderTy::CreateLaunderInvariantGroup(), clang::CodeGen::CGBuilderTy::CreatePreserveUnionAccessIndex(), clang::CodeGen::CGBuilderTy::CreateStripInvariantGroup(), and clang::CodeGen::CodeGenFunction::mergeAddressesInConditionalExpr().
|
inline |
Definition at line 191 of file Address.h.
Referenced by EmitPointerWithAlignment(), clang::CodeGen::CodeGenFunction::mergeAddressesInConditionalExpr(), and clang::CodeGen::LValue::setAlignment().
|
inline |
Definition at line 222 of file Address.h.
References hasOffset().
|
inline |
Definition at line 236 of file Address.h.
References isValid(), clang::CodeGen::KnownNonNull, and Pointer.
Referenced by clang::CodeGen::AggValueSlot::forAddr(), and clang::CodeGen::LValue::setKnownNonNull().
|
inline |
Return address with different alignment, but same pointer and element type.
Definition at line 267 of file Address.h.
References getElementType(), isKnownNonNull(), and Pointer.
Referenced by CheckAtomicAlignment(), emitOutlinedFunctionPrologue(), and emitPrivatesInit().
|
inline |
Return address with different element type, but same pointer and alignment.
Definition at line 274 of file Address.h.
References getAlignment(), getBasePointer(), getPointerAuthInfo(), hasOffset(), and isKnownNonNull().
Referenced by castValueToType(), CheckAggExprForMemSetUse(), complexTempStructure(), CreateCoercedLoad(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), createUnnamedGlobalForMemcpyFrom(), emitAddressAtOffset(), EmitAsmStores(), EmitAtomicCmpXchg128ForMSIntrin(), clang::CodeGen::ReductionCodeGen::emitCleanups(), emitNonZeroVLAInit(), EmitNullBaseClassInitialization(), emitOMPArraySectionBase(), EmitPointerWithAlignment(), emitReduceCombFunction(), emitReduceInitFunction(), EmitThreadPrivateVarDeclLValue(), clang::CodeGen::emitVoidPtrDirectVAArg(), clang::CodeGen::CGOpenMPRuntime::getDepobjElements(), loadToBegin(), performTypeAdjustment(), clang::CodeGen::CGCXXABI::ReadArrayCookie(), and tryEmitARCCopyWeakInit().
|
inline |
Return address with different pointer, but same element type and alignment.
Definition at line 259 of file Address.h.
References getAlignment(), and getElementType().
Referenced by castToBase().
|
friend |