LLVM
8.0.1
|
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <cassert>
#include <iterator>
#include <limits>
#include <utility>
#include <vector>
Go to the source code of this file.
Namespaces | |
llvm | |
This class represents lattice values for constants. | |
Macros | |
#define | DEBUG_TYPE "infer-address-spaces" |
Functions | |
void | llvm::initializeInferAddressSpacesPass (PassRegistry &) |
INITIALIZE_PASS (InferAddressSpaces, DEBUG_TYPE, "Infer address spaces", false, false) static bool isAddressExpression(const Value &V) | |
static SmallVector< Value *, 2 > | getPointerOperands (const Value &V) |
static Value * | operandWithNewAddressSpaceOrCreateUndef (const Use &OperandUse, unsigned NewAddrSpace, const ValueToValueMapTy &ValueWithNewAddrSpace, SmallVectorImpl< const Use *> *UndefUsesToFix) |
static Value * | cloneInstructionWithNewAddressSpace (Instruction *I, unsigned NewAddrSpace, const ValueToValueMapTy &ValueWithNewAddrSpace, SmallVectorImpl< const Use *> *UndefUsesToFix) |
static Value * | cloneConstantExprWithNewAddressSpace (ConstantExpr *CE, unsigned NewAddrSpace, const ValueToValueMapTy &ValueWithNewAddrSpace) |
static bool | isSimplePointerUseValidToReplace (const TargetTransformInfo &TTI, Use &U, unsigned AddrSpace) |
returns true if U is the pointer operand of a memory instruction with a single pointer operand that can have its address space changed by simply mutating the use to a new value. More... | |
static bool | handleMemIntrinsicPtrUse (MemIntrinsic *MI, Value *OldV, Value *NewV) |
Update memory intrinsic uses that require more complex processing than simple memory instructions. More... | |
static Value::use_iterator | skipToNextUser (Value::use_iterator I, Value::use_iterator End) |
Variables | |
static const unsigned | UninitializedAddressSpace |
#define DEBUG_TYPE "infer-address-spaces" |
Definition at line 132 of file InferAddressSpaces.cpp.
|
static |
Definition at line 505 of file InferAddressSpaces.cpp.
References assert(), llvm::ArrayRef< T >::begin(), cloneInstructionWithNewAddressSpace(), llvm::dbgs(), llvm::dyn_cast(), llvm::ArrayRef< T >::end(), llvm::ConstantExpr::getAddrSpaceCast(), llvm::ConstantExpr::getBitCast(), llvm::TargetTransformInfo::getFlatAddressSpace(), llvm::User::getNumOperands(), llvm::Operator::getOpcode(), llvm::ConstantExpr::getOpcode(), llvm::User::getOperand(), llvm::Type::getPointerAddressSpace(), llvm::Type::getPointerElementType(), getPointerOperands(), llvm::Type::getPointerTo(), llvm::ConstantExpr::getSelect(), getType(), llvm::Value::getType(), llvm::Optional< T >::getValue(), llvm::ConstantExpr::getWithOperands(), llvm::Optional< T >::hasValue(), I, LLVM_DEBUG, llvm::ValueMap< KeyT, ValueT, Config >::lookup(), llvm::None, llvm::SmallVectorTemplateBase< T >::push_back(), runOnFunction(), llvm::MCID::Select, UninitializedAddressSpace, and llvm::Value::users().
|
static |
Definition at line 443 of file InferAddressSpaces.cpp.
References assert(), llvm::GetElementPtrInst::Create(), llvm::SelectInst::Create(), llvm::PHINode::Create(), GEP, llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::PHINode::getOperandNumForIncomingValue(), llvm::Type::getPointerAddressSpace(), llvm::Type::getPointerElementType(), llvm::Type::getPointerTo(), llvm::GetElementPtrInst::getSourceElementType(), llvm::Value::getType(), I, llvm::GetElementPtrInst::idx_begin(), llvm::GetElementPtrInst::idx_end(), llvm::GetElementPtrInst::isInBounds(), llvm::Type::isPointerTy(), llvm_unreachable, llvm::User::operands(), operandWithNewAddressSpaceOrCreateUndef(), llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::MCID::Select.
Referenced by cloneConstantExprWithNewAddressSpace().
|
static |
Definition at line 236 of file InferAddressSpaces.cpp.
References llvm::Intrinsic::amdgcn_atomic_dec, llvm::Intrinsic::amdgcn_atomic_inc, llvm::Intrinsic::amdgcn_ds_fadd, llvm::Intrinsic::amdgcn_ds_fmax, llvm::Intrinsic::amdgcn_ds_fmin, assert(), llvm::dyn_cast(), E, F(), GEP, llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::IntrinsicInst::getIntrinsicID(), llvm::User::getNumOperands(), llvm::Operator::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Type::getPointerAddressSpace(), llvm::Value::getType(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::instructions(), llvm::Type::isPointerTy(), llvm::AMDGPU::HSAMD::Kernel::Arg::Key::IsVolatile, llvm::ConstantInt::isZero(), LLVM_FALLTHROUGH, llvm_unreachable, MI, llvm::Intrinsic::objectsize, llvm::MCID::Select, llvm::CallBase::setArgOperand(), llvm::CallBase::setCalledFunction(), and SI.
Referenced by cloneConstantExprWithNewAddressSpace().
|
static |
Update memory intrinsic uses that require more complex processing than simple memory instructions.
Thse require re-mangling and may have multiple pointer operands.
Definition at line 779 of file InferAddressSpaces.cpp.
References assert(), B, C, llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), llvm::Instruction::eraseFromParent(), llvm::Instruction::getMetadata(), llvm::Type::getPointerAddressSpace(), llvm::Value::getType(), llvm_unreachable, llvm::LLVMContext::MD_alias_scope, llvm::LLVMContext::MD_noalias, llvm::LLVMContext::MD_tbaa, and llvm::LLVMContext::MD_tbaa_struct.
INITIALIZE_PASS | ( | InferAddressSpaces | , |
DEBUG_TYPE | , | ||
"Infer address spaces" | , | ||
false | , | ||
false | |||
) | const & |
Definition at line 211 of file InferAddressSpaces.cpp.
References getOpcode(), and llvm::MCID::Select.
|
static |
returns
true if U
is the pointer operand of a memory instruction with a single pointer operand that can have its address space changed by simply mutating the use to a new value.
If the memory instruction is volatile, return true only if the target allows the memory instruction to be volatile in the new address space.
Definition at line 749 of file InferAddressSpaces.cpp.
References llvm::Use::getOperandNo(), llvm::LoadInst::getPointerOperandIndex(), llvm::StoreInst::getPointerOperandIndex(), llvm::AtomicCmpXchgInst::getPointerOperandIndex(), llvm::AtomicRMWInst::getPointerOperandIndex(), llvm::Use::getUser(), llvm::TargetTransformInfo::hasVolatileVariant(), I, and SI.
|
static |
Definition at line 415 of file InferAddressSpaces.cpp.
References C, llvm::Use::get(), llvm::UndefValue::get(), llvm::ConstantExpr::getAddrSpaceCast(), llvm::Type::getPointerElementType(), llvm::Type::getPointerTo(), llvm::Value::getType(), llvm::ValueMap< KeyT, ValueT, Config >::lookup(), and llvm::SmallVectorTemplateBase< T >::push_back().
Referenced by cloneInstructionWithNewAddressSpace().
|
static |
Definition at line 854 of file InferAddressSpaces.cpp.
Definition at line 136 of file InferAddressSpaces.cpp.
Referenced by cloneConstantExprWithNewAddressSpace().