clang 20.0.0git
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
clang::CodeGen::Address Class Reference

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 CGPointerAuthInfogetPointerAuthInfo () 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
 

Detailed Description

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.

Definition at line 128 of file Address.h.

Constructor & Destructor Documentation

◆ Address() [1/4]

clang::CodeGen::Address::Address ( std::nullptr_t  )
inlineprotected

Definition at line 151 of file Address.h.

◆ Address() [2/4]

clang::CodeGen::Address::Address ( llvm::Value *  pointer,
llvm::Type *  elementType,
CharUnits  alignment,
KnownNonNull_t  IsKnownNonNull = NotKnownNonNull 
)
inline

Definition at line 154 of file Address.h.

References clang::CharUnits::isZero().

◆ Address() [3/4]

clang::CodeGen::Address::Address ( llvm::Value *  BasePtr,
llvm::Type *  ElementType,
CharUnits  Alignment,
CGPointerAuthInfo  PtrAuthInfo,
llvm::Value *  Offset,
KnownNonNull_t  IsKnownNonNull = NotKnownNonNull 
)
inline

Definition at line 163 of file Address.h.

◆ Address() [4/4]

clang::CodeGen::Address::Address ( RawAddress  RawAddr)
inline

Definition at line 169 of file Address.h.

Member Function Documentation

◆ emitRawPointer()

llvm::Value * clang::CodeGen::Address::emitRawPointer ( CodeGenFunction CGF) const
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(), CreateCoercedStore(), 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().

◆ getAddressSpace()

unsigned clang::CodeGen::Address::getAddressSpace ( ) const
inline

Return the address space that this address resides in.

Definition at line 213 of file Address.h.

References getType().

◆ getAlignment()

CharUnits clang::CodeGen::Address::getAlignment ( ) const
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(), CreateCoercedStore(), 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().

◆ getBasePointer()

llvm::Value * clang::CodeGen::Address::getBasePointer ( ) const
inline

◆ getElementType()

llvm::Type * clang::CodeGen::Address::getElementType ( ) const
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(), CreateCoercedStore(), 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().

◆ getName()

llvm::StringRef clang::CodeGen::Address::getName ( ) const
inline

Return the IR name of the pointer value.

Definition at line 216 of file Address.h.

References Pointer.

Referenced by CreateCoercedLoad().

◆ getOffset()

llvm::Value * clang::CodeGen::Address::getOffset ( ) const
inline

◆ getPointerAuthInfo()

const CGPointerAuthInfo & clang::CodeGen::Address::getPointerAuthInfo ( ) const
inline

◆ getResignedAddress()

Address Address::getResignedAddress ( const CGPointerAuthInfo NewInfo,
CodeGenFunction CGF 
) const

◆ getType()

llvm::PointerType * clang::CodeGen::Address::getType ( ) const
inline

◆ hasOffset()

bool clang::CodeGen::Address::hasOffset ( ) const
inline

◆ invalid()

static Address clang::CodeGen::Address::invalid ( )
inlinestatic

◆ isKnownNonNull()

KnownNonNull_t clang::CodeGen::Address::isKnownNonNull ( ) const
inline

◆ isSigned()

bool clang::CodeGen::Address::isSigned ( ) const
inline

Definition at line 228 of file Address.h.

References clang::CodeGen::CGPointerAuthInfo::isSigned().

Referenced by emitRawPointer().

◆ isValid()

bool clang::CodeGen::Address::isValid ( ) const
inline

◆ replaceBasePointer()

void clang::CodeGen::Address::replaceBasePointer ( llvm::Value *  P)
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().

◆ setAlignment()

void clang::CodeGen::Address::setAlignment ( CharUnits  Value)
inline

◆ setElementType()

void clang::CodeGen::Address::setElementType ( llvm::Type *  Ty)
inline

Definition at line 222 of file Address.h.

References hasOffset().

◆ setKnownNonNull()

Address clang::CodeGen::Address::setKnownNonNull ( )
inline

◆ setPointerAuthInfo()

void clang::CodeGen::Address::setPointerAuthInfo ( const CGPointerAuthInfo Info)
inline

Definition at line 219 of file Address.h.

◆ withAlignment()

Address clang::CodeGen::Address::withAlignment ( CharUnits  NewAlignment) const
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().

◆ withElementType()

Address clang::CodeGen::Address::withElementType ( llvm::Type *  ElemTy) const
inline

◆ withPointer()

Address clang::CodeGen::Address::withPointer ( llvm::Value *  NewPointer,
KnownNonNull_t  IsKnownNonNull 
) const
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().

Friends And Related Function Documentation

◆ CGBuilderTy

friend class CGBuilderTy
friend

Definition at line 129 of file Address.h.


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