LLVM: lib/Transforms/Scalar/InferAddressSpaces.cpp File Reference (original) (raw)

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 Type * getPtrOrVecOfPtrsWithNewAS (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 Value * phiNodeOperandWithNewAddressSpace (AddrSpaceCastInst *NewI, Value *Operand)
static Value * operandWithNewAddressSpaceOrCreatePoison (const Use &OperandUse, unsigned NewAddrSpace, const ValueToValueMapTy &ValueWithNewAddrSpace, const PredicatedAddrSpaceMapTy &PredicatedAS, SmallVectorImpl< const Use * > *PoisonUsesToFix)
static Value * cloneConstantExprWithNewAddressSpace (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< 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."))
static const unsigned UninitializedAddressSpace
DEBUG_TYPE
Infer address spaces
Infer address false

DEBUG_TYPE

#define DEBUG_TYPE "infer-address-spaces"

cloneConstantExprWithNewAddressSpace()

Definition at line 805 of file InferAddressSpaces.cpp.

References assert(), llvm::cast(), cloneConstantExprWithNewAddressSpace(), DL, llvm::dyn_cast(), llvm::ConstantExpr::getAddrSpaceCast(), llvm::ConstantExpr::getBitCast(), llvm::User::getOperand(), getPtrOrVecOfPtrsWithNewAS(), isNoopPtrIntCastPair(), llvm::ValueMap< KeyT, ValueT, Config >::lookup(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

Referenced by cloneConstantExprWithNewAddressSpace().

getPointerOperands()

getPtrOrVecOfPtrsWithNewAS()

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

handleMemIntrinsicPtrUse()

INITIALIZE_PASS_BEGIN()

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

isAddressExpression()

isNoopPtrIntCastPair()

operandWithNewAddressSpaceOrCreatePoison()

Definition at line 658 of file InferAddressSpaces.cpp.

References llvm::CallingConv::C, llvm::cast(), llvm::dyn_cast(), llvm::PoisonValue::get(), llvm::Use::get(), llvm::ConstantExpr::getAddrSpaceCast(), llvm::Instruction::getDebugLoc(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getOpcode(), getPtrOrVecOfPtrsWithNewAS(), llvm::Value::getType(), llvm::Use::getUser(), I, LLVM_UNLIKELY, llvm::ValueMap< KeyT, ValueT, Config >::lookup(), phiNodeOperandWithNewAddressSpace(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

phiNodeOperandWithNewAddressSpace()

Definition at line 622 of file InferAddressSpaces.cpp.

References assert(), llvm::cast(), llvm::dyn_cast(), F, llvm::Instruction::getDebugLoc(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getOpcode(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::Instruction::insertAfter(), llvm::Instruction::insertBefore(), llvm::isa(), LLVM_UNLIKELY, and llvm::Instruction::setDebugLoc().

Referenced by operandWithNewAddressSpaceOrCreatePoison().

replaceIfSimplePointerUse()

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 1134 of file InferAddressSpaces.cpp.

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

replaceOperandIfSame()

replaceSimplePointerUse()

skipToNextUser()

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

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

false

spaces

UninitializedAddressSpace