14#include "llvm/IR/IntrinsicsARM.h" 
   21  OS << 
"LocationSize::";
 
   23    OS << 
"beforeOrAfterPointer";
 
   31    OS << 
"precise(" << 
getValue() << 
')';
 
   33    OS << 
"upperBound(" << 
getValue() << 
')';
 
 
   46  const auto &
DL = 
SI->getDataLayout();
 
   50                            SI->getValueOperand()->getType())),
 
 
   77std::optional<MemoryLocation>
 
   80  case Instruction::Load:
 
   82  case Instruction::Store:
 
   84  case Instruction::VAArg:
 
   86  case Instruction::AtomicCmpXchg:
 
   88  case Instruction::AtomicRMW:
 
 
  109  assert(
MI->getRawDest() == 
MI->getArgOperand(0));
 
 
  113std::optional<MemoryLocation>
 
  124  Value *UsedV = 
nullptr;
 
  125  std::optional<unsigned> UsedIdx;
 
  126  for (
unsigned i = 0; i < CB->
arg_size(); i++) {
 
  137    UsedIdx = std::nullopt;
 
 
  156static std::optional<FixedVectorType *>
 
  166  if (LaneMaskHi.
ule(LaneMaskLo))
 
  169  APInt NumElts = LaneMaskHi - LaneMaskLo;
 
  170  if (NumElts.
ugt(Ty->getElementCount().getKnownMinValue())) {
 
  175    NumElts = Ty->getElementCount().getKnownMinValue();
 
 
  185  const Value *Arg = 
Call->getArgOperand(ArgIdx);
 
  191    switch (
II->getIntrinsicID()) {
 
  194    case Intrinsic::memset:
 
  195    case Intrinsic::memcpy:
 
  196    case Intrinsic::memcpy_inline:
 
  197    case Intrinsic::memmove:
 
  198    case Intrinsic::memcpy_element_unordered_atomic:
 
  199    case Intrinsic::memmove_element_unordered_atomic:
 
  200    case Intrinsic::memset_element_unordered_atomic:
 
  201      assert((ArgIdx == 0 || ArgIdx == 1) &&
 
  202             "Invalid argument index for memory intrinsic");
 
  208    case Intrinsic::experimental_memset_pattern:
 
  209      assert((ArgIdx == 0 || ArgIdx == 1) &&
 
  210             "Invalid argument index for memory intrinsic");
 
  215                LenCI->getZExtValue() *
 
  216                DL.getTypeAllocSize(
II->getArgOperand(1)->getType())),
 
  220    case Intrinsic::lifetime_start:
 
  221    case Intrinsic::lifetime_end: {
 
  222      assert(ArgIdx == 0 && 
"Invalid argument index");
 
  228      std::optional<TypeSize> AllocSize =
 
  229          AI->getAllocationSize(
II->getDataLayout());
 
  236    case Intrinsic::invariant_start:
 
  237      assert(ArgIdx == 1 && 
"Invalid argument index");
 
  244    case Intrinsic::masked_load: {
 
  245      assert(ArgIdx == 0 && 
"Invalid argument index");
 
  254    case Intrinsic::masked_store: {
 
  255      assert(ArgIdx == 1 && 
"Invalid argument index");
 
  265    case Intrinsic::invariant_end:
 
  270      assert(ArgIdx == 2 && 
"Invalid argument index");
 
  277    case Intrinsic::arm_neon_vld1:
 
  278      assert(ArgIdx == 0 && 
"Invalid argument index");
 
  285    case Intrinsic::arm_neon_vst1:
 
  286      assert(ArgIdx == 0 && 
"Invalid argument index");
 
  289                                II->getArgOperand(1)->getType())),
 
  291    case Intrinsic::matrix_column_major_load:
 
  292    case Intrinsic::matrix_column_major_store: {
 
  293      bool IsLoad = 
II->getIntrinsicID() == Intrinsic::matrix_column_major_load;
 
  294      assert(ArgIdx == (IsLoad ? 0 : 1) && 
"Invalid argument index");
 
  306      uint64_t ConstStride = Stride->getZExtValue();
 
  308                                         : 
II->getArgOperand(0)->getType());
 
  309      assert(Cols != 0 && 
"Matrix cannot have 0 columns");
 
  311                      (ConstStride * (Cols - 1) + Rows);
 
  314      if (ConstStride == Rows)
 
  323        "all memory transfer intrinsics should be handled by the switch above");
 
  335    case LibFunc_strncat:
 
  336      assert((ArgIdx == 0 || ArgIdx == 1) && 
"Invalid argument index for str function");
 
  339    case LibFunc_memset_chk:
 
  340      assert(ArgIdx == 0 && 
"Invalid argument index for memset_chk");
 
  342    case LibFunc_memcpy_chk: {
 
  343      assert((ArgIdx == 0 || ArgIdx == 1) &&
 
  344             "Invalid argument index for memcpy_chk");
 
  354    case LibFunc_strncpy: {
 
  355      assert((ArgIdx == 0 || ArgIdx == 1) &&
 
  356             "Invalid argument index for strncpy");
 
  366    case LibFunc_memset_pattern16:
 
  367    case LibFunc_memset_pattern4:
 
  368    case LibFunc_memset_pattern8:
 
  369      assert((ArgIdx == 0 || ArgIdx == 1) &&
 
  370             "Invalid argument index for memset_pattern16");
 
  373        if (
F == LibFunc_memset_pattern4)
 
  375        else if (
F == LibFunc_memset_pattern8)
 
  386      assert((ArgIdx == 0 || ArgIdx == 1) &&
 
  387             "Invalid argument index for memcmp/bcmp");
 
  394      assert((ArgIdx == 0) && 
"Invalid argument index for memchr");
 
  400    case LibFunc_memccpy:
 
  401      assert((ArgIdx == 0 || ArgIdx == 1) &&
 
  402             "Invalid argument index for memccpy");
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
 
static std::optional< FixedVectorType * > getKnownTypeFromMaskedOp(Value *Mask, VectorType *Ty)
 
This file provides utility analysis objects describing memory locations.
 
uint64_t IntrinsicInst * II
 
Class for arbitrary precision integers.
 
uint64_t getZExtValue() const
Get zero extended value.
 
bool ugt(const APInt &RHS) const
Unsigned greater than comparison.
 
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
 
An instruction that atomically checks whether a specified value is in a memory location,...
 
Value * getCompareOperand()
 
Value * getPointerOperand()
 
an instruction that atomically reads a memory location, combines it with another value,...
 
Value * getPointerOperand()
 
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
 
LLVM_ABI MemoryEffects getMemoryEffects() const
 
bool onlyReadsMemory(unsigned OpNo) const
 
Value * getArgOperand(unsigned i) const
 
unsigned arg_size() const
 
bool hasOperandBundles() const
Return true if this User has any operand bundles.
 
This is the shared class of boolean and integer constants.
 
const APInt & getValue() const
Return the constant as an APInt value reference.
 
A parsed version of the target data layout string in and methods for querying it.
 
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
 
LLVM_ABI AAMDNodes getAAMetadata() const
Returns the AA metadata for this instruction.
 
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
 
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this instruction belongs to.
 
A wrapper class for inspecting calls to intrinsic functions.
 
An instruction for reading from memory.
 
Value * getPointerOperand()
 
static LocationSize precise(uint64_t Value)
 
static constexpr LocationSize mapEmpty()
 
static constexpr LocationSize beforeOrAfterPointer()
Any location before or after the base pointer (but still within the underlying object).
 
TypeSize getValue() const
 
LLVM_ABI void print(raw_ostream &OS) const
 
static constexpr LocationSize afterPointer()
Any location after the base pointer (but still within the underlying object).
 
static LocationSize upperBound(uint64_t Value)
 
static constexpr LocationSize mapTombstone()
 
This is the common base class for memset/memcpy/memmove.
 
Value * getRawSource() const
Return the arguments to the instruction.
 
This class wraps the llvm.memcpy/memmove intrinsics.
 
bool onlyAccessesArgPointees() const
Whether this function only (at most) accesses argument memory.
 
static MemoryEffectsBase writeOnly()
 
static LLVM_ABI MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
 
static LLVM_ABI MemoryLocation getForSource(const MemTransferInst *MTI)
Return a location representing the source of a memory transfer.
 
LocationSize Size
The maximum size of the location, in address-units, or UnknownSize if the size is not known.
 
static MemoryLocation getBeforeOrAfter(const Value *Ptr, const AAMDNodes &AATags=AAMDNodes())
Return a location that may access any location before or after Ptr, while remaining within the underl...
 
static MemoryLocation getAfter(const Value *Ptr, const AAMDNodes &AATags=AAMDNodes())
Return a location that may access any location after Ptr, while remaining within the underlying objec...
 
AAMDNodes AATags
The metadata nodes which describes the aliasing of the location (each member is null if that kind of ...
 
static LLVM_ABI MemoryLocation getForDest(const MemIntrinsic *MI)
Return a location representing the destination of a memory set or transfer.
 
static LLVM_ABI std::optional< MemoryLocation > getOrNone(const Instruction *Inst)
 
static LLVM_ABI MemoryLocation getForArgument(const CallBase *Call, unsigned ArgIdx, const TargetLibraryInfo *TLI)
Return a location representing a particular argument of a call.
 
An instruction for storing to memory.
 
Provides information about what library functions are available for the current target.
 
bool has(LibFunc F) const
Tests whether a library function is available.
 
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
 
bool isPointerTy() const
True if this is an instance of PointerType.
 
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
 
LLVM Value Representation.
 
Type * getType() const
All values are typed, get the type of this value.
 
This class implements an extremely fast bulk output stream that can only output to a stream.
 
bool match(Val *V, const Pattern &P)
 
class_match< ConstantInt > m_ConstantInt()
Match an arbitrary ConstantInt and ignore it.
 
IntrinsicID_match m_Intrinsic()
Match intrinsic calls like this: m_Intrinsic<Intrinsic::fabs>(m_Value(X))
 
This is an optimization pass for GlobalISel generic memory operations.
 
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
 
MemoryEffectsBase< IRMemLocation > MemoryEffects
Summary of how a function affects memory in the program.
 
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
 
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
 
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...