Go to the documentation of this file.
14 #include "llvm/IR/IntrinsicsARM.h"
20 OS <<
"LocationSize::";
22 OS <<
"beforeOrAfterPointer";
30 OS <<
"precise(" <<
getValue() <<
')';
32 OS <<
"upperBound(" <<
getValue() <<
')';
45 const auto &
DL =
SI->getModule()->getDataLayout();
49 SI->getValueOperand()->getType())),
79 return get(cast<LoadInst>(Inst));
81 return get(cast<StoreInst>(Inst));
82 case Instruction::VAArg:
83 return get(cast<VAArgInst>(Inst));
84 case Instruction::AtomicCmpXchg:
85 return get(cast<AtomicCmpXchgInst>(Inst));
86 case Instruction::AtomicRMW:
87 return get(cast<AtomicRMWInst>(Inst));
115 assert(
MI->getRawDest() ==
MI->getArgOperand(0));
128 Value *UsedV =
nullptr;
162 const Value *
Arg = Call->getArgOperand(ArgIdx);
165 if (
const IntrinsicInst *II = dyn_cast<IntrinsicInst>(Call)) {
166 const DataLayout &
DL = II->getModule()->getDataLayout();
168 switch (II->getIntrinsicID()) {
171 case Intrinsic::memset:
173 case Intrinsic::memcpy_inline:
174 case Intrinsic::memmove:
175 case Intrinsic::memcpy_element_unordered_atomic:
176 case Intrinsic::memmove_element_unordered_atomic:
177 case Intrinsic::memset_element_unordered_atomic:
178 assert((ArgIdx == 0 || ArgIdx == 1) &&
179 "Invalid argument index for memory intrinsic");
180 if (
ConstantInt *LenCI = dyn_cast<ConstantInt>(II->getArgOperand(2)))
185 case Intrinsic::lifetime_start:
186 case Intrinsic::lifetime_end:
187 case Intrinsic::invariant_start:
188 assert(ArgIdx == 1 &&
"Invalid argument index");
192 cast<ConstantInt>(II->getArgOperand(0))->getZExtValue()),
195 case Intrinsic::masked_load:
196 assert(ArgIdx == 0 &&
"Invalid argument index");
202 case Intrinsic::masked_store:
203 assert(ArgIdx == 1 &&
"Invalid argument index");
207 DL.getTypeStoreSize(II->getArgOperand(0)->getType())),
210 case Intrinsic::invariant_end:
215 assert(ArgIdx == 2 &&
"Invalid argument index");
219 cast<ConstantInt>(II->getArgOperand(1))->getZExtValue()),
222 case Intrinsic::arm_neon_vld1:
223 assert(ArgIdx == 0 &&
"Invalid argument index");
230 case Intrinsic::arm_neon_vst1:
231 assert(ArgIdx == 0 &&
"Invalid argument index");
234 II->getArgOperand(1)->getType())),
239 !isa<AnyMemTransferInst>(II) &&
240 "all memory transfer intrinsics should be handled by the switch above");
252 case LibFunc_strncat:
253 assert((ArgIdx == 0 || ArgIdx == 1) &&
"Invalid argument index for str function");
256 case LibFunc_memset_chk: {
257 assert(ArgIdx == 0 &&
"Invalid argument index for memset_chk");
259 if (
const auto *Len = dyn_cast<ConstantInt>(Call->getArgOperand(2))) {
266 case LibFunc_strncpy: {
267 assert((ArgIdx == 0 || ArgIdx == 1) &&
268 "Invalid argument index for strncpy");
270 if (
const auto *Len = dyn_cast<ConstantInt>(Call->getArgOperand(2))) {
278 case LibFunc_memset_pattern16:
279 case LibFunc_memset_pattern4:
280 case LibFunc_memset_pattern8:
281 assert((ArgIdx == 0 || ArgIdx == 1) &&
282 "Invalid argument index for memset_pattern16");
285 if (
F == LibFunc_memset_pattern4)
287 else if (
F == LibFunc_memset_pattern8)
292 dyn_cast<ConstantInt>(Call->getArgOperand(2)))
298 assert((ArgIdx == 0 || ArgIdx == 1) &&
299 "Invalid argument index for memcmp/bcmp");
301 dyn_cast<ConstantInt>(Call->getArgOperand(2)))
306 assert((ArgIdx == 0) &&
"Invalid argument index for memchr");
308 dyn_cast<ConstantInt>(Call->getArgOperand(2)))
312 case LibFunc_memccpy:
313 assert((ArgIdx == 0 || ArgIdx == 1) &&
314 "Invalid argument index for memccpy");
317 dyn_cast<ConstantInt>(Call->getArgOperand(3)))
void print(raw_ostream &OS) const
static MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
This is an optimization pass for GlobalISel generic memory operations.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
A parsed version of the target data layout string in and methods for querying it.
constexpr static LocationSize afterPointer()
Any location after the base pointer (but still within the underlying object).
bool isPointerTy() const
True if this is an instance of PointerType.
This class wraps the llvm.memcpy/memmove intrinsics.
static LocationSize upperBound(uint64_t Value)
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
LocationSize Size
The maximum size of the location, in address-units, or UnknownSize if the size is not known.
This is the common base class for memset/memcpy/memmove.
Value * getPointerOperand()
Value * getPointerOperand()
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
AAMDNodes AATags
The metadata nodes which describes the aliasing of the location (each member is null if that kind of ...
This is the shared class of boolean and integer constants.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
static MemoryLocation getForSource(const MemTransferInst *MTI)
Return a location representing the source of a memory transfer.
Value * getRawSource() const
Return the arguments to the instruction.
uint64_t getValue() const
constexpr static LocationSize mapTombstone()
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
This class implements an extremely fast bulk output stream that can only output to a stream.
static LocationSize precise(uint64_t Value)
AAMDNodes getAAMetadata() const
Returns the AA metadata for this instruction.
bool onlyReadsMemory(unsigned OpNo) const
An instruction for storing to memory.
static Optional< MemoryLocation > getOrNone(const Instruction *Inst)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static MemoryLocation getForArgument(const CallBase *Call, unsigned ArgIdx, const TargetLibraryInfo *TLI)
Return a location representing a particular argument of a call.
bool hasOperandBundles() const
Return true if this User has any operand bundles.
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
StandardInstrumentations SI(Debug, VerifyEach)
Value * getCompareOperand()
bool has(LibFunc F) const
Tests whether a library function is available.
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
Type * getType() const
All values are typed, get the type of this value.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
constexpr static LocationSize mapEmpty()
An instruction for reading from memory.
an instruction that atomically reads a memory location, combines it with another value,...
constexpr static LocationSize beforeOrAfterPointer()
Any location before or after the base pointer (but still within the underlying object).
unsigned arg_size() const
Value * getPointerOperand()
Provides information about what library functions are available for the current target.
A wrapper class for inspecting calls to intrinsic functions.
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...
Value * getArgOperand(unsigned i) const
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...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
static MemoryLocation getForDest(const MemIntrinsic *MI)
Return a location representing the destination of a memory set or transfer.
LLVM Value Representation.
An instruction that atomically checks whether a specified value is in a memory location,...
Representation for a specific memory location.