LLVM 22.0.0git
InferAddressSpaces.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "infer-address-spaces"

Functions

 INITIALIZE_PASS_BEGIN (InferAddressSpaces, DEBUG_TYPE, "Infer address spaces", false, false) INITIALIZE_PASS_END(InferAddressSpaces
Infer address static false TypegetPtrOrVecOfPtrsWithNewAS (Type *Ty, unsigned NewAddrSpace)
static bool isNoopPtrIntCastPair (const Operator *I2P, const DataLayout &DL, const TargetTransformInfo *TTI)
static bool isAddressExpression (const Value &V, const DataLayout &DL, const TargetTransformInfo *TTI)
static SmallVector< Value *, 2 > getPointerOperands (const Value &V, const DataLayout &DL, const TargetTransformInfo *TTI)
static ValueoperandWithNewAddressSpaceOrCreatePoison (const Use &OperandUse, unsigned NewAddrSpace, const ValueToValueMapTy &ValueWithNewAddrSpace, const PredicatedAddrSpaceMapTy &PredicatedAS, SmallVectorImpl< const Use * > *PoisonUsesToFix)
static ValuecloneConstantExprWithNewAddressSpace (ConstantExpr *CE, unsigned NewAddrSpace, const ValueToValueMapTy &ValueWithNewAddrSpace, const DataLayout *DL, const TargetTransformInfo *TTI)
static bool replaceOperandIfSame (Instruction *Inst, unsigned OpIdx, Value *OldVal, Value *NewVal)
 Replace operand OpIdx in Inst, if the value is the same as OldVal with NewVal.
template<typename InstrType>
static bool replaceSimplePointerUse (const TargetTransformInfo &TTI, InstrType *MemInstr, unsigned AddrSpace, Value *OldV, Value *NewV)
static bool replaceIfSimplePointerUse (const TargetTransformInfo &TTI, User *Inst, unsigned AddrSpace, Value *OldV, Value *NewV)
 If OldV is used as the pointer operand of a compatible memory operation Inst, replaces the pointer operand with NewV.
static bool handleMemIntrinsicPtrUse (MemIntrinsic *MI, Value *OldV, Value *NewV)
 Update memory intrinsic uses that require more complex processing than simple memory instructions.
static Value::use_iterator skipToNextUser (Value::use_iterator I, Value::use_iterator End)

Variables

static cl::opt< boolAssumeDefaultIsFlatAddressSpace ("assume-default-is-flat-addrspace", cl::init(false), cl::ReallyHidden, cl::desc("The default address space is assumed as the flat address space. " "This is mainly for test purpose."))
static const unsigned UninitializedAddressSpace
 DEBUG_TYPE
Infer address spaces
Infer address false

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "infer-address-spaces"

Definition at line 135 of file InferAddressSpaces.cpp.

Function Documentation

◆ cloneConstantExprWithNewAddressSpace()

◆ getPointerOperands()

SmallVector< Value *, 2 > getPointerOperands ( const Value & V,
const DataLayout & DL,
const TargetTransformInfo * TTI )
static

◆ getPtrOrVecOfPtrsWithNewAS()

Infer address static false Type * getPtrOrVecOfPtrsWithNewAS ( Type * Ty,
unsigned NewAddrSpace )
static

◆ handleMemIntrinsicPtrUse()

bool handleMemIntrinsicPtrUse ( MemIntrinsic * MI,
Value * OldV,
Value * NewV )
static

Update memory intrinsic uses that require more complex processing than simple memory instructions.

These require re-mangling and may have multiple pointer operands.

Definition at line 1116 of file InferAddressSpaces.cpp.

References assert(), B(), llvm::dyn_cast(), llvm::isa(), llvm_unreachable, and MI.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( InferAddressSpaces ,
DEBUG_TYPE ,
"Infer address spaces" ,
false ,
false  )

◆ isAddressExpression()

bool isAddressExpression ( const Value & V,
const DataLayout & DL,
const TargetTransformInfo * TTI )
static

◆ isNoopPtrIntCastPair()

◆ operandWithNewAddressSpaceOrCreatePoison()

◆ replaceIfSimplePointerUse()

bool replaceIfSimplePointerUse ( const TargetTransformInfo & TTI,
User * Inst,
unsigned AddrSpace,
Value * OldV,
Value * NewV )
static

If OldV is used as the pointer operand of a compatible memory operation Inst, replaces the pointer operand with NewV.

This covers memory instructions with a single pointer operand that can have its address space changed by simply mutating the use to a new value.

returns true the user replacement was made.

Definition at line 1095 of file InferAddressSpaces.cpp.

References llvm::dyn_cast(), and replaceSimplePointerUse().

◆ replaceOperandIfSame()

bool replaceOperandIfSame ( Instruction * Inst,
unsigned OpIdx,
Value * OldVal,
Value * NewVal )
static

Replace operand OpIdx in Inst, if the value is the same as OldVal with NewVal.

Definition at line 1065 of file InferAddressSpaces.cpp.

References llvm::User::getOperandUse(), and OpIdx.

Referenced by replaceSimplePointerUse().

◆ replaceSimplePointerUse()

template<typename InstrType>
bool replaceSimplePointerUse ( const TargetTransformInfo & TTI,
InstrType * MemInstr,
unsigned AddrSpace,
Value * OldV,
Value * NewV )
static

Definition at line 1077 of file InferAddressSpaces.cpp.

References replaceOperandIfSame().

Referenced by replaceIfSimplePointerUse().

◆ skipToNextUser()

Value::use_iterator skipToNextUser ( Value::use_iterator I,
Value::use_iterator End )
static

Definition at line 1191 of file InferAddressSpaces.cpp.

References I.

Variable Documentation

◆ AssumeDefaultIsFlatAddressSpace

cl::opt< bool > AssumeDefaultIsFlatAddressSpace("assume-default-is-flat-addrspace", cl::init(false), cl::ReallyHidden, cl::desc("The default address space is assumed as the flat address space. " "This is mainly for test purpose.")) ( "assume-default-is-flat-addrspace" ,
cl::init(false) ,
cl::ReallyHidden ,
cl::desc("The default address space is assumed as the flat address space. " "This is mainly for test purpose.")  )
static

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 264 of file InferAddressSpaces.cpp.

◆ false

Infer address false

Definition at line 265 of file InferAddressSpaces.cpp.

◆ spaces

Infer address spaces

Definition at line 264 of file InferAddressSpaces.cpp.

◆ UninitializedAddressSpace

const unsigned UninitializedAddressSpace
static
Initial value:
=
std::numeric_limits<unsigned>::max()

Definition at line 144 of file InferAddressSpaces.cpp.

Referenced by llvm::InferAddressSpacesPass::InferAddressSpacesPass(), and isAddressExpression().