23 #ifndef LLVM_IR_INTRINSICINST_H 24 #define LLVM_IR_INTRINSICINST_H 58 return CF->isIntrinsic();
62 return isa<CallInst>(V) &&
classof(cast<CallInst>(V));
73 case Intrinsic::dbg_declare:
74 case Intrinsic::dbg_value:
75 case Intrinsic::dbg_addr:
76 case Intrinsic::dbg_label:
78 default:
return false;
82 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
93 Value *getVariableLocation(
bool AllowNullOp =
true)
const;
102 return cast<DILocalVariable>(getRawVariable());
106 return cast<DIExpression>(getRawExpression());
125 case Intrinsic::dbg_declare:
126 case Intrinsic::dbg_value:
127 case Intrinsic::dbg_addr:
129 default:
return false;
133 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
149 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
165 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
173 return getVariableLocation(
false);
182 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
191 return cast<DILabel>(getRawLabel());
204 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
213 bool isTernaryOp()
const;
220 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
232 case Intrinsic::experimental_constrained_fcmp:
233 case Intrinsic::experimental_constrained_fcmps:
235 default:
return false;
239 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
249 case Intrinsic::uadd_with_overflow:
250 case Intrinsic::sadd_with_overflow:
251 case Intrinsic::usub_with_overflow:
252 case Intrinsic::ssub_with_overflow:
253 case Intrinsic::umul_with_overflow:
254 case Intrinsic::smul_with_overflow:
255 case Intrinsic::uadd_sat:
256 case Intrinsic::sadd_sat:
257 case Intrinsic::usub_sat:
258 case Intrinsic::ssub_sat:
265 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
275 bool isSigned()
const;
278 unsigned getNoWrapKind()
const;
286 case Intrinsic::uadd_with_overflow:
287 case Intrinsic::sadd_with_overflow:
288 case Intrinsic::usub_with_overflow:
289 case Intrinsic::ssub_with_overflow:
290 case Intrinsic::umul_with_overflow:
291 case Intrinsic::smul_with_overflow:
298 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
307 case Intrinsic::uadd_sat:
308 case Intrinsic::sadd_sat:
309 case Intrinsic::usub_sat:
310 case Intrinsic::ssub_sat:
317 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
327 enum { ARG_DEST = 0, ARG_LENGTH = 2 };
348 return cast<PointerType>(getRawDest()->getType())->getAddressSpace();
359 "setDest called with pointer of wrong type!");
382 "setLength called with value of wrong type!");
391 enum { ARG_SOURCE = 1 };
396 return const_cast<Value *
>(BaseCL::getArgOperand(ARG_SOURCE));
399 return BaseCL::getArgOperandUse(ARG_SOURCE);
409 return cast<PointerType>(getRawSource()->getType())->getAddressSpace();
415 return BaseCL::getParamAlignment(ARG_SOURCE);
419 return BaseCL::getParamAlign(ARG_SOURCE);
424 "setSource called with pointer of wrong type!");
425 BaseCL::setArgOperand(ARG_SOURCE, Ptr);
434 BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
437 BaseCL::getContext(), *Alignment));
440 BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
442 BaseCL::getContext(), Alignment));
450 enum { ARG_VALUE = 1 };
454 return const_cast<Value *
>(BaseCL::getArgOperand(ARG_VALUE));
457 return BaseCL::getArgOperandUse(ARG_VALUE);
463 "setValue called with value of wrong type!");
464 BaseCL::setArgOperand(ARG_VALUE, Val);
472 enum { ARG_ELEMENTSIZE = 3 };
480 return cast<ConstantInt>(getRawElementSizeInBytes());
484 return getElementSizeInBytesCst()->getZExtValue();
489 "setElementSizeInBytes called with value of wrong type!");
495 case Intrinsic::memcpy_element_unordered_atomic:
496 case Intrinsic::memmove_element_unordered_atomic:
497 case Intrinsic::memset_element_unordered_atomic:
504 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
513 return I->
getIntrinsicID() == Intrinsic::memset_element_unordered_atomic;
516 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
526 case Intrinsic::memcpy_element_unordered_atomic:
527 case Intrinsic::memmove_element_unordered_atomic:
534 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
543 return I->
getIntrinsicID() == Intrinsic::memcpy_element_unordered_atomic;
546 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
555 return I->
getIntrinsicID() == Intrinsic::memmove_element_unordered_atomic;
558 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
565 enum { ARG_VOLATILE = 3 };
569 return cast<ConstantInt>(
574 return !getVolatileCst()->isZero();
582 case Intrinsic::memcpy:
583 case Intrinsic::memmove:
584 case Intrinsic::memset:
586 default:
return false;
590 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
602 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
615 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
627 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
639 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
651 if (
auto *
MI = dyn_cast<MemIntrinsic>(
this))
652 return MI->isVolatile();
658 case Intrinsic::memcpy:
659 case Intrinsic::memmove:
660 case Intrinsic::memset:
661 case Intrinsic::memcpy_element_unordered_atomic:
662 case Intrinsic::memmove_element_unordered_atomic:
663 case Intrinsic::memset_element_unordered_atomic:
670 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
681 case Intrinsic::memset:
682 case Intrinsic::memset_element_unordered_atomic:
689 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
700 case Intrinsic::memcpy:
701 case Intrinsic::memmove:
702 case Intrinsic::memcpy_element_unordered_atomic:
703 case Intrinsic::memmove_element_unordered_atomic:
710 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
721 case Intrinsic::memcpy:
722 case Intrinsic::memcpy_element_unordered_atomic:
729 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
740 case Intrinsic::memmove:
741 case Intrinsic::memmove_element_unordered_atomic:
748 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
759 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
772 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
785 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
799 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
803 return cast<GlobalVariable>(
819 Value *getStep()
const;
825 return I->
getIntrinsicID() == Intrinsic::instrprof_increment_step;
828 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
839 return isa<IntrinsicInst>(V) &&
classof(cast<IntrinsicInst>(V));
843 return cast<GlobalVariable>(
867 #endif // LLVM_IR_INTRINSICINST_H static bool classof(const Value *V)
static bool classof(const Value *V)
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.
This class represents lattice values for constants.
This represents the llvm.va_end intrinsic.
Represents an op.with.overflow intrinsic.
Value * getRawElementSizeInBytes() const
MaybeAlign getDestAlign() const
void setDestAlignment(Align Alignment)
This class represents a function call, abstracting a target machine's calling convention.
static bool classof(const CallInst *I)
unsigned getSourceAlignment() const
FIXME: Remove this function once transition to Align is over.
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.
static bool classof(const Value *V)
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)
void setArgOperand(unsigned i, Value *v)
static bool classof(const IntrinsicInst *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V)
This is the common base class for constrained floating point intrinsics.
Value * getLength() const
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
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 ...
Value * getArgOperand(unsigned i) const
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.
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
DILabel * getLabel() const
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
void setDestAlignment(MaybeAlign Alignment)
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
FIXME: Remove this function once transition to Align is over.
This class represents atomic memset intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
Constrained floating point compare intrinsics.
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 IntrinsicInst *I)
static bool classof(const Value *V)
This is the common base class for debug info intrinsics for variables.
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
MaybeAlign getParamAlign(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
static bool classof(const Value *V)
GlobalVariable * getName() const
ConstantInt * getNumCounters() const
static bool classof(const Value *V)
static bool classof(const Value *V)
static bool classof(const Value *V)
static bool classof(const Value *V)
const Use & getValueUse() const
ConstantInt * getHash() const
static bool classof(const Value *V)
This class represents the atomic memmove intrinsic i.e.
Metadata * getRawExpression() const
static bool classof(const Value *V)
static bool classof(const Value *V)
ConstantInt * getIndex() const
static bool classof(const IntrinsicInst *I)
Value * getAddress() const
This is an important base class in LLVM.
void setSourceAlignment(Align Alignment)
static bool classof(const IntrinsicInst *I)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool classof(const Value *V)
DIExpression * getExpression() const
Metadata * getRawLabel() const
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
static bool classof(const IntrinsicInst *I)
This class represents any memset intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
void setSourceAlignment(MaybeAlign Alignment)
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
This represents the llvm.dbg.addr instruction.
uint32_t getElementSizeInBytes() const
static bool classof(const IntrinsicInst *I)
Common base class for all memset intrinsics.
static bool classof(const IntrinsicInst *I)
void setDestAlignment(unsigned Alignment)
FIXME: Remove this function once transition to Align is over.
This struct is a compact representation of a valid (non-zero power of two) alignment.
ConstantInt * getVolatileCst() const
ConstantInt * getElementSizeInBytesCst() const
static bool classof(const IntrinsicInst *I)
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
static bool classof(const Value *V)
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
Predicate getPredicate(unsigned Condition, unsigned Hint)
Return predicate consisting of specified condition and hint bits.
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)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
static bool classof(const Value *V)
Metadata * getRawVariable() const
Represents a saturating add/sub intrinsic.
This is the common base class for debug info intrinsics.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
MaybeAlign getSourceAlign() const
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)
void setSourceAlignment(unsigned Alignment)
FIXME: Remove this function once transition to Align is over.
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)
static bool classof(const IntrinsicInst *I)
Value * getTargetValue() const
This represents the llvm.dbg.value instruction.
bool isAddressOfVariable() const
Does this describe the address of a local variable.
ConstantInt * getHash() const
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
This file contains the declarations of entities that describe floating point environment and related ...
static bool classof(const Value *V)
static bool classof(const Value *V)
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a call argument.
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
static bool classof(const IntrinsicInst *I)
static bool classof(const IntrinsicInst *I)
Common base class for all memory intrinsics.
DILocalVariable * getVariable() const
This class represents an intrinsic that is based on a binary operation.
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())
static bool classof(const Value *V)
LLVM Value Representation.
static bool classof(const IntrinsicInst *I)
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...
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
static bool classof(const IntrinsicInst *I)
static bool classof(const IntrinsicInst *I)
A wrapper class for inspecting calls to intrinsic functions.
Value * getAddress() const