24 #ifndef LLVM_IR_INTRINSICINST_H 25 #define LLVM_IR_INTRINSICINST_H 58 return CF->isIntrinsic();
62 return isa<CallInst>(V) &&
classof(cast<CallInst>(V));
72 Value *getVariableLocation(
bool AllowNullOp =
true)
const;
81 return cast<DILocalVariable>(getRawVariable());
85 return cast<DIExpression>(getRawExpression());
104 case Intrinsic::dbg_declare:
105 case Intrinsic::dbg_value:
106 case Intrinsic::dbg_addr:
107 case Intrinsic::dbg_label:
109 default:
return false;
113 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
129 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
145 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
153 return getVariableLocation(
false);
162 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
171 return cast<DILabel>(getRawVariable());
188 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
212 bool isUnaryOp()
const;
213 bool isTernaryOp()
const;
220 case Intrinsic::experimental_constrained_fadd:
221 case Intrinsic::experimental_constrained_fsub:
222 case Intrinsic::experimental_constrained_fmul:
223 case Intrinsic::experimental_constrained_fdiv:
224 case Intrinsic::experimental_constrained_frem:
225 case Intrinsic::experimental_constrained_fma:
226 case Intrinsic::experimental_constrained_sqrt:
227 case Intrinsic::experimental_constrained_pow:
228 case Intrinsic::experimental_constrained_powi:
229 case Intrinsic::experimental_constrained_sin:
230 case Intrinsic::experimental_constrained_cos:
231 case Intrinsic::experimental_constrained_exp:
232 case Intrinsic::experimental_constrained_exp2:
233 case Intrinsic::experimental_constrained_log:
234 case Intrinsic::experimental_constrained_log10:
235 case Intrinsic::experimental_constrained_log2:
236 case Intrinsic::experimental_constrained_rint:
237 case Intrinsic::experimental_constrained_nearbyint:
239 default:
return false;
243 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
253 enum { ARG_DEST = 0, ARG_LENGTH = 2 };
274 return cast<PointerType>(getRawDest()->getType())->getAddressSpace();
282 "setDest called with pointer of wrong type!");
295 "setLength called with value of wrong type!");
304 enum { ARG_SOURCE = 1 };
309 return const_cast<Value *
>(BaseCL::getArgOperand(ARG_SOURCE));
312 return BaseCL::getArgOperandUse(ARG_SOURCE);
322 return cast<PointerType>(getRawSource()->getType())->getAddressSpace();
326 return BaseCL::getParamAlignment(ARG_SOURCE);
331 "setSource called with pointer of wrong type!");
332 BaseCL::setArgOperand(ARG_SOURCE, Ptr);
336 BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
339 BaseCL::getContext(), Align));
347 enum { ARG_VALUE = 1 };
351 return const_cast<Value *
>(BaseCL::getArgOperand(ARG_VALUE));
354 return BaseCL::getArgOperandUse(ARG_VALUE);
360 "setValue called with value of wrong type!");
361 BaseCL::setArgOperand(ARG_VALUE, Val);
369 enum { ARG_ELEMENTSIZE = 3 };
377 return cast<ConstantInt>(getRawElementSizeInBytes());
381 return getElementSizeInBytesCst()->getZExtValue();
386 "setElementSizeInBytes called with value of wrong type!");
392 case Intrinsic::memcpy_element_unordered_atomic:
393 case Intrinsic::memmove_element_unordered_atomic:
394 case Intrinsic::memset_element_unordered_atomic:
401 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
410 return I->
getIntrinsicID() == Intrinsic::memset_element_unordered_atomic;
413 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
423 case Intrinsic::memcpy_element_unordered_atomic:
424 case Intrinsic::memmove_element_unordered_atomic:
431 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
440 return I->
getIntrinsicID() == Intrinsic::memcpy_element_unordered_atomic;
443 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
452 return I->
getIntrinsicID() == Intrinsic::memmove_element_unordered_atomic;
455 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
462 enum { ARG_VOLATILE = 3 };
466 return cast<ConstantInt>(
471 return !getVolatileCst()->isZero();
479 case Intrinsic::memcpy:
480 case Intrinsic::memmove:
481 case Intrinsic::memset:
483 default:
return false;
487 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
499 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
512 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
524 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
536 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
548 if (
auto *
MI = dyn_cast<MemIntrinsic>(
this))
549 return MI->isVolatile();
555 case Intrinsic::memcpy:
556 case Intrinsic::memmove:
557 case Intrinsic::memset:
558 case Intrinsic::memcpy_element_unordered_atomic:
559 case Intrinsic::memmove_element_unordered_atomic:
560 case Intrinsic::memset_element_unordered_atomic:
567 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
578 case Intrinsic::memset:
579 case Intrinsic::memset_element_unordered_atomic:
586 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
597 case Intrinsic::memcpy:
598 case Intrinsic::memmove:
599 case Intrinsic::memcpy_element_unordered_atomic:
600 case Intrinsic::memmove_element_unordered_atomic:
607 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
618 case Intrinsic::memcpy:
619 case Intrinsic::memcpy_element_unordered_atomic:
626 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
637 case Intrinsic::memmove:
638 case Intrinsic::memmove_element_unordered_atomic:
645 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
656 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
669 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
682 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
696 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
700 return cast<GlobalVariable>(
716 Value *getStep()
const;
722 return I->
getIntrinsicID() == Intrinsic::instrprof_increment_step;
725 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
736 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
740 return cast<GlobalVariable>(
764 #endif // LLVM_IR_INTRINSICINST_H static bool classof(const Value *V)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
IntrinsicInst & operator=(const IntrinsicInst &)=delete
ConstantInt * getIndex() const
static bool classof(const IntrinsicInst *I)
static bool classof(const IntrinsicInst *I)
This represents the llvm.dbg.label instruction.
Compute iterated dominance frontiers using a linear time algorithm.
This represents the llvm.va_end intrinsic.
static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align)
Return a uniquified Attribute object that has the specific alignment set.
Value * getRawElementSizeInBytes() const
Metadata * getRawVariable() const
This class represents a function call, abstracting a target machine's calling convention.
static bool classof(const CallInst *I)
unsigned getSourceAlignment() const
static bool classof(const IntrinsicInst *I)
This class represents the atomic memcpy intrinsic i.e.
unsigned getSourceAddressSpace() const
static bool classof(const Value *V)
LLVMContext & getContext() const
All values hold a context through their type.
void setSource(Value *Ptr)
void setDest(Value *Ptr)
Set the specified arguments of the instruction.
This class wraps the llvm.memset intrinsic.
void setVolatile(Constant *V)
static bool classof(const IntrinsicInst *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V)
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
This is the common base class for constrained floating point intrinsics.
Value * getLength() const
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
Value * getArgList() const
static bool classof(const IntrinsicInst *I)
Value * getDest() const
This is just like getRawDest, but it strips off any cast instructions (including addrspacecast) that ...
static bool classof(const Value *V)
This class wraps the llvm.memmove intrinsic.
A Use represents the edge between a Value definition and its users.
DILabel * getLabel() const
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
unsigned getDestAlignment() const
This class represents atomic memset intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
Type * getType() const
All values are typed, get the type of this value.
This represents the llvm.va_start intrinsic.
const Use & getRawSourceUse() const
static bool classof(const Value *V)
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
static bool classof(const Value *V)
GlobalVariable * getName() const
ConstantInt * getNumCounters() const
static bool classof(const Value *V)
Metadata * getRawExpression() const
static bool classof(const Value *V)
Metadata * getRawExpression() const
static bool classof(const Value *V)
const Use & getValueUse() const
ConstantInt * getHash() const
This class represents the atomic memmove intrinsic i.e.
static bool classof(const Value *V)
static bool classof(const Value *V)
ConstantInt * getIndex() const
static bool classof(const IntrinsicInst *I)
bool isAddressOfVariable() const
Does this describe the address of a local variable.
Value * getAddress() const
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool classof(const Value *V)
DILocalVariable * getVariable() const
static bool classof(const IntrinsicInst *I)
This class represents any memset intrinsic.
static bool classof(const Value *V)
DIExpression * getExpression() const
void setArgOperand(unsigned i, Value *v)
static bool classof(const IntrinsicInst *I)
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
This represents the llvm.dbg.addr instruction.
uint32_t getElementSizeInBytes() const
static bool classof(const IntrinsicInst *I)
Common base class for all memset intrinsics.
ConstantInt * getVolatileCst() const
ConstantInt * getElementSizeInBytesCst() const
static bool classof(const IntrinsicInst *I)
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
This is the common base class for memset/memcpy/memmove.
const Use & getLengthUse() const
This is the shared class of boolean and integer constants.
Value * getArgList() const
void setValue(Value *Val)
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a call argument.
This is the common base class for debug info intrinsics.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
This class wraps the llvm.memcpy intrinsic.
Value * getRawSource() const
Return the arguments to the instruction.
static bool classof(const Value *V)
Common base class for all memory transfer intrinsics.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
static bool classof(const Value *V)
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
This represents the llvm.instrprof_increment intrinsic.
void setElementSizeInBytes(Constant *V)
This class wraps the llvm.memcpy/memmove intrinsics.
unsigned getDestAddressSpace() const
static bool classof(const IntrinsicInst *I)
Value * getTargetValue() const
This represents the llvm.dbg.value instruction.
ConstantInt * getHash() const
Metadata * getRawVariable() const
static bool classof(const Value *V)
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
static bool classof(const IntrinsicInst *I)
Common base class for all memory intrinsics.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
This represents the llvm.va_copy intrinsic.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
static bool classof(const Value *V)
LLVM Value Representation.
This class represents any memmove intrinsic i.e.
GlobalVariable * getName() const
ConstantInt * getValueKind() const
Value * getSource() const
This is just like getRawSource, but it strips off any cast instructions that feed it...
void setSourceAlignment(unsigned Align)
This class represents any memcpy intrinsic i.e.
This represents the llvm.instrprof_value_profile intrinsic.
This represents the llvm.dbg.declare instruction.
static bool classof(const IntrinsicInst *I)
static bool classof(const IntrinsicInst *I)
static IntegerType * getInt8Ty(LLVMContext &C)
Value * getRawDest() const
static bool classof(const IntrinsicInst *I)
const Use & getRawDestUse() const
void setDestAlignment(unsigned Align)
static bool classof(const IntrinsicInst *I)
static bool classof(const IntrinsicInst *I)
A wrapper class for inspecting calls to intrinsic functions.
Value * getAddress() const