LLVM 24.0.0git
IntrinsicInst.h
Go to the documentation of this file.
1//===-- llvm/IntrinsicInst.h - Intrinsic Instruction Wrappers ---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines classes that make it really easy to deal with intrinsic
10// functions with the isa/dyncast family of functions. In particular, this
11// allows you to do things like:
12//
13// if (MemCpyInst *MCI = dyn_cast<MemCpyInst>(Inst))
14// ... MCI->getDest() ... MCI->getSource() ...
15//
16// All intrinsic function calls are instances of the call instruction, so these
17// are all subclasses of the CallInst class. Note that none of these classes
18// has state or virtual methods, which is an important part of this gross/neat
19// hack working.
20//
21//===----------------------------------------------------------------------===//
22
23#ifndef LLVM_IR_INTRINSICINST_H
24#define LLVM_IR_INTRINSICINST_H
25
26#include "llvm/IR/Constants.h"
29#include "llvm/IR/FPEnv.h"
30#include "llvm/IR/Function.h"
33#include "llvm/IR/Intrinsics.h"
34#include "llvm/IR/Value.h"
38#include <cassert>
39#include <cstdint>
40#include <optional>
41
42namespace llvm {
43
44class Metadata;
45
46/// A wrapper class for inspecting calls to intrinsic functions.
47/// This allows the standard isa/dyncast/cast functionality to work with calls
48/// to intrinsic functions.
49class IntrinsicInst : public CallInst {
50public:
51 IntrinsicInst() = delete;
52 IntrinsicInst(const IntrinsicInst &) = delete;
54
55 /// Return the intrinsic ID of this intrinsic.
57 return cast<Function>(getCalledOperand())->getIntrinsicID();
58 }
59
60 bool isAssociative() const {
61 switch (getIntrinsicID()) {
62 case Intrinsic::smax:
63 case Intrinsic::smin:
64 case Intrinsic::umax:
65 case Intrinsic::umin:
66 return true;
67 default:
68 return false;
69 }
70 }
71
72 /// Return true if swapping the first two arguments to the intrinsic produces
73 /// the same result.
74 bool isCommutative() const {
75 switch (getIntrinsicID()) {
76 case Intrinsic::maxnum:
77 case Intrinsic::minnum:
78 case Intrinsic::maximum:
79 case Intrinsic::minimum:
80 case Intrinsic::maximumnum:
81 case Intrinsic::minimumnum:
82 case Intrinsic::smax:
83 case Intrinsic::smin:
84 case Intrinsic::umax:
85 case Intrinsic::umin:
86 case Intrinsic::sadd_sat:
87 case Intrinsic::uadd_sat:
88 case Intrinsic::sadd_with_overflow:
89 case Intrinsic::uadd_with_overflow:
90 case Intrinsic::smul_with_overflow:
91 case Intrinsic::umul_with_overflow:
92 case Intrinsic::smul_fix:
93 case Intrinsic::umul_fix:
94 case Intrinsic::smul_fix_sat:
95 case Intrinsic::umul_fix_sat:
96 case Intrinsic::smulh:
97 case Intrinsic::umulh:
98 case Intrinsic::fma:
99 case Intrinsic::fmuladd:
100 return true;
101 default:
102 return false;
103 }
104 }
105
106 /// Return true if the operand is commutable.
107 bool isCommutableOperand(unsigned Op) const {
108 constexpr unsigned NumCommutativeOps = 2;
109 return isCommutative() && Op < NumCommutativeOps;
110 }
111
112 /// Checks if the intrinsic is an annotation.
114 switch (getIntrinsicID()) {
115 default: break;
116 case Intrinsic::assume:
117 case Intrinsic::sideeffect:
118 case Intrinsic::pseudoprobe:
119 case Intrinsic::dbg_assign:
120 case Intrinsic::dbg_declare:
121 case Intrinsic::dbg_value:
122 case Intrinsic::dbg_label:
123 case Intrinsic::invariant_start:
124 case Intrinsic::invariant_end:
125 case Intrinsic::lifetime_start:
126 case Intrinsic::lifetime_end:
127 case Intrinsic::experimental_noalias_scope_decl:
128 case Intrinsic::objectsize:
129 case Intrinsic::ptr_annotation:
130 case Intrinsic::var_annotation:
131 return true;
132 }
133 return false;
134 }
135
136 /// Check if the intrinsic might lower into a regular function call in the
137 /// course of IR transformations
139
140 /// Methods for support type inquiry through isa, cast, and dyn_cast:
141 static bool classof(const CallInst *I) {
142 auto *F = dyn_cast_or_null<Function>(I->getCalledOperand());
143 return F && F->isIntrinsic();
144 }
145 static bool classof(const Value *V) {
146 return isa<CallInst>(V) && classof(cast<CallInst>(V));
147 }
148};
149
150/// Check if \p ID corresponds to a lifetime intrinsic.
151static inline bool isLifetimeIntrinsic(Intrinsic::ID ID) {
152 switch (ID) {
153 case Intrinsic::lifetime_start:
154 case Intrinsic::lifetime_end:
155 return true;
156 default:
157 return false;
158 }
159}
160
161/// This is the common base class for lifetime intrinsics.
163public:
164 /// \name Casting methods
165 /// @{
166 static bool classof(const IntrinsicInst *I) {
167 return isLifetimeIntrinsic(I->getIntrinsicID());
168 }
169 static bool classof(const Value *V) {
171 }
172 /// @}
173};
174
175/// Check if \p ID corresponds to a debug info intrinsic.
176static inline bool isDbgInfoIntrinsic(Intrinsic::ID ID) {
177 switch (ID) {
178 case Intrinsic::dbg_declare:
179 case Intrinsic::dbg_value:
180 case Intrinsic::dbg_label:
181 case Intrinsic::dbg_assign:
182 return true;
183 default:
184 return false;
185 }
186}
187
188/// This is the common base class for debug info intrinsics.
190public:
191 /// \name Casting methods
192 /// @{
193 static bool classof(const IntrinsicInst *I) {
194 return isDbgInfoIntrinsic(I->getIntrinsicID());
195 }
196 static bool classof(const Value *V) {
198 }
199 /// @}
200};
201
202// Iterator for ValueAsMetadata that internally uses direct pointer iteration
203// over either a ValueAsMetadata* or a ValueAsMetadata**, dereferencing to the
204// ValueAsMetadata .
206 : public iterator_facade_base<location_op_iterator,
207 std::bidirectional_iterator_tag, Value *> {
209
210public:
211 location_op_iterator(ValueAsMetadata *SingleIter) : I(SingleIter) {}
212 location_op_iterator(ValueAsMetadata **MultiIter) : I(MultiIter) {}
213
216 I = R.I;
217 return *this;
218 }
219 bool operator==(const location_op_iterator &RHS) const { return I == RHS.I; }
220 const Value *operator*() const {
224 return VAM->getValue();
225 };
234 I = cast<ValueAsMetadata *>(I) + 1;
235 else
236 I = cast<ValueAsMetadata **>(I) + 1;
237 return *this;
238 }
241 I = cast<ValueAsMetadata *>(I) - 1;
242 else
243 I = cast<ValueAsMetadata **>(I) - 1;
244 return *this;
245 }
246};
247
248/// Lightweight class that wraps the location operand metadata of a debug
249/// intrinsic. The raw location may be a ValueAsMetadata, an empty MDTuple,
250/// or a DIArgList.
252 Metadata *RawLocation = nullptr;
253
254public:
256 explicit RawLocationWrapper(Metadata *RawLocation)
257 : RawLocation(RawLocation) {
258 // Allow ValueAsMetadata, empty MDTuple, DIArgList.
259 assert(RawLocation && "unexpected null RawLocation");
260 assert(isa<ValueAsMetadata>(RawLocation) || isa<DIArgList>(RawLocation) ||
261 (isa<MDNode>(RawLocation) &&
262 !cast<MDNode>(RawLocation)->getNumOperands()));
263 }
264 Metadata *getRawLocation() const { return RawLocation; }
265 /// Get the locations corresponding to the variable referenced by the debug
266 /// info intrinsic. Depending on the intrinsic, this could be the
267 /// variable's value or its address.
269 LLVM_ABI Value *getVariableLocationOp(unsigned OpIdx) const;
270 unsigned getNumVariableLocationOps() const {
271 if (hasArgList())
272 return cast<DIArgList>(getRawLocation())->getArgs().size();
273 return 1;
274 }
275 bool hasArgList() const { return isa<DIArgList>(getRawLocation()); }
277 // Check for "kill" sentinel values.
278 // Non-variadic: empty metadata.
280 return true;
281 // Variadic: empty DIArgList with empty expression.
282 if (getNumVariableLocationOps() == 0 && !Expression->isComplex())
283 return true;
284 // Variadic and non-variadic: Interpret expressions using undef or poison
285 // values as kills.
286 return any_of(location_ops(), [](Value *V) { return isa<UndefValue>(V); });
287 }
288
289 friend bool operator==(const RawLocationWrapper &A,
290 const RawLocationWrapper &B) {
291 return A.RawLocation == B.RawLocation;
292 }
293 friend bool operator!=(const RawLocationWrapper &A,
294 const RawLocationWrapper &B) {
295 return !(A == B);
296 }
297 friend bool operator>(const RawLocationWrapper &A,
298 const RawLocationWrapper &B) {
299 return A.RawLocation > B.RawLocation;
300 }
301 friend bool operator>=(const RawLocationWrapper &A,
302 const RawLocationWrapper &B) {
303 return A.RawLocation >= B.RawLocation;
304 }
305 friend bool operator<(const RawLocationWrapper &A,
306 const RawLocationWrapper &B) {
307 return A.RawLocation < B.RawLocation;
308 }
309 friend bool operator<=(const RawLocationWrapper &A,
310 const RawLocationWrapper &B) {
311 return A.RawLocation <= B.RawLocation;
312 }
313};
314
315/// This is the common base class for debug info intrinsics for variables.
317public:
318 LLVM_ABI Value *getVariableLocationOp(unsigned OpIdx) const;
319
323
327
328 bool hasArgList() const { return getWrappedLocation().hasArgList(); }
329
330 bool isKillLocation() const {
332 }
333
337
341
343 return cast<MetadataAsValue>(getArgOperand(0))->getMetadata();
344 }
345
349
351 return cast<MetadataAsValue>(getArgOperand(1))->getMetadata();
352 }
353
355 return cast<MetadataAsValue>(getArgOperand(2))->getMetadata();
356 }
357
358 /// \name Casting methods
359 /// @{
360 static bool classof(const IntrinsicInst *I) {
361 switch (I->getIntrinsicID()) {
362 case Intrinsic::dbg_declare:
363 case Intrinsic::dbg_value:
364 case Intrinsic::dbg_assign:
365 return true;
366 default:
367 return false;
368 }
369 }
370 static bool classof(const Value *V) {
372 }
373 /// @}
374protected:
375 void setArgOperand(unsigned i, Value *v) {
377 }
378 void setOperand(unsigned i, Value *v) { DbgInfoIntrinsic::setOperand(i, v); }
379};
380
381/// This represents the llvm.dbg.declare instruction.
383public:
384 Value *getAddress() const {
386 "dbg.declare must have exactly 1 location operand.");
387 return getVariableLocationOp(0);
388 }
389
390 /// \name Casting methods
391 /// @{
392 static bool classof(const IntrinsicInst *I) {
393 return I->getIntrinsicID() == Intrinsic::dbg_declare;
394 }
395 static bool classof(const Value *V) {
397 }
398 /// @}
399};
400
401/// This represents the llvm.dbg.value instruction.
403public:
404 // The default argument should only be used in ISel, and the default option
405 // should be removed once ISel support for multiple location ops is complete.
406 Value *getValue(unsigned OpIdx = 0) const {
407 return getVariableLocationOp(OpIdx);
408 }
409
410 /// \name Casting methods
411 /// @{
412 static bool classof(const IntrinsicInst *I) {
413 return I->getIntrinsicID() == Intrinsic::dbg_value ||
414 I->getIntrinsicID() == Intrinsic::dbg_assign;
415 }
416 static bool classof(const Value *V) {
418 }
419 /// @}
420};
421
422/// This represents the llvm.dbg.assign instruction.
424 enum Operands {
425 OpValue,
426 OpVar,
427 OpExpr,
428 OpAssignID,
429 OpAddress,
430 OpAddressExpr,
431 };
432
433public:
435 return cast<MetadataAsValue>(getArgOperand(OpAddress))->getMetadata();
436 }
438 return cast<MetadataAsValue>(getArgOperand(OpAssignID))->getMetadata();
439 }
442 return cast<MetadataAsValue>(getArgOperand(OpAddressExpr))->getMetadata();
443 }
447 /// \name Casting methods
448 /// @{
449 static bool classof(const IntrinsicInst *I) {
450 return I->getIntrinsicID() == Intrinsic::dbg_assign;
451 }
452 static bool classof(const Value *V) {
454 }
455 /// @}
456};
457
458/// This represents the llvm.dbg.label instruction.
460public:
462
464 return cast<MetadataAsValue>(getArgOperand(0))->getMetadata();
465 }
466
467 /// Methods for support type inquiry through isa, cast, and dyn_cast:
468 /// @{
469 static bool classof(const IntrinsicInst *I) {
470 return I->getIntrinsicID() == Intrinsic::dbg_label;
471 }
472 static bool classof(const Value *V) {
474 }
475 /// @}
476};
477
478/// This is the common base class for vector predication intrinsics.
480public:
481 /// \brief Declares a llvm.vp.* intrinsic in \p M that matches the parameters
482 /// \p Params. Additionally, the load and gather intrinsics require
483 /// \p ReturnType to be specified.
484 LLVM_ABI static Function *
486 ArrayRef<Value *> Params);
487
488 LLVM_ABI static std::optional<unsigned>
489 getMaskParamPos(Intrinsic::ID IntrinsicID);
490 LLVM_ABI static std::optional<unsigned>
492
493 // Whether \p ID is a VP intrinsic ID.
495
496 /// \return The mask parameter or nullptr.
497 LLVM_ABI Value *getMaskParam() const;
499
500 /// \return The vector length parameter or nullptr.
503
504 /// \return Whether the vector length param can be ignored.
506
507 /// \return The static element count (vector number of elements) the vector
508 /// length parameter applies to.
510
511 /// \return The alignment of the pointer used by this load/store/gather or
512 /// scatter.
514 // MaybeAlign setPointerAlignment(Align NewAlign); // TODO
515
516 /// \return The pointer operand of this load,store, gather or scatter.
518 LLVM_ABI static std::optional<unsigned>
520
521 /// \return The data (payload) operand of this store or scatter.
523 LLVM_ABI static std::optional<unsigned> getMemoryDataParamPos(Intrinsic::ID);
524
525 // Methods for support type inquiry through isa, cast, and dyn_cast:
526 static bool classof(const IntrinsicInst *I) {
527 return isVPIntrinsic(I->getIntrinsicID());
528 }
529 static bool classof(const Value *V) {
531 }
532
533 // Equivalent non-predicated opcode
534 std::optional<unsigned> getFunctionalOpcode() const {
536 }
537
538 // Equivalent non-predicated intrinsic ID
539 std::optional<unsigned> getFunctionalIntrinsicID() const {
541 }
542
543 // Equivalent non-predicated opcode
544 LLVM_ABI static std::optional<unsigned>
546
547 // Equivalent non-predicated intrinsic ID
548 LLVM_ABI static std::optional<Intrinsic::ID>
550};
551
552/// This represents vector predication reduction intrinsics.
554public:
555 LLVM_ABI static bool isVPReduction(Intrinsic::ID ID);
556
557 LLVM_ABI unsigned getStartParamPos() const;
558 LLVM_ABI unsigned getVectorParamPos() const;
559
560 LLVM_ABI static std::optional<unsigned> getStartParamPos(Intrinsic::ID ID);
561 LLVM_ABI static std::optional<unsigned> getVectorParamPos(Intrinsic::ID ID);
562
563 /// Methods for support type inquiry through isa, cast, and dyn_cast:
564 /// @{
565 static bool classof(const IntrinsicInst *I) {
566 return VPReductionIntrinsic::isVPReduction(I->getIntrinsicID());
567 }
568 static bool classof(const Value *V) {
570 }
571 /// @}
572};
573
574/// This is the common base class for constrained floating point intrinsics.
576public:
577 LLVM_ABI unsigned getNonMetadataArgCount() const;
578 LLVM_ABI std::optional<RoundingMode> getRoundingMode() const;
579 LLVM_ABI std::optional<fp::ExceptionBehavior> getExceptionBehavior() const;
580 LLVM_ABI bool isDefaultFPEnvironment() const;
581
582 // Methods for support type inquiry through isa, cast, and dyn_cast:
583 LLVM_ABI static bool classof(const IntrinsicInst *I);
584 static bool classof(const Value *V) {
586 }
587};
588
589/// Constrained floating point compare intrinsics.
591public:
593 bool isSignaling() const {
594 return getIntrinsicID() == Intrinsic::experimental_constrained_fcmps;
595 }
596
597 // Methods for support type inquiry through isa, cast, and dyn_cast:
598 static bool classof(const IntrinsicInst *I) {
599 switch (I->getIntrinsicID()) {
600 case Intrinsic::experimental_constrained_fcmp:
601 case Intrinsic::experimental_constrained_fcmps:
602 return true;
603 default:
604 return false;
605 }
606 }
607 static bool classof(const Value *V) {
609 }
610};
611
612/// This class represents min/max intrinsics.
614public:
615 static bool classof(const IntrinsicInst *I) {
616 switch (I->getIntrinsicID()) {
617 case Intrinsic::umin:
618 case Intrinsic::umax:
619 case Intrinsic::smin:
620 case Intrinsic::smax:
621 return true;
622 default:
623 return false;
624 }
625 }
626 static bool classof(const Value *V) {
628 }
629
630 Value *getLHS() const { return getArgOperand(0); }
631 Value *getRHS() const { return getArgOperand(1); }
632
633 /// Returns the comparison predicate underlying the intrinsic.
635 switch (ID) {
636 case Intrinsic::umin:
638 case Intrinsic::umax:
640 case Intrinsic::smin:
642 case Intrinsic::smax:
644 default:
645 llvm_unreachable("Invalid intrinsic");
646 }
647 }
648
649 /// Returns the comparison predicate underlying the intrinsic.
653
654 /// Whether the intrinsic is signed or unsigned.
655 static bool isSigned(Intrinsic::ID ID) {
657 };
658
659 /// Whether the intrinsic is signed or unsigned.
660 bool isSigned() const { return isSigned(getIntrinsicID()); };
661
662 /// Whether the intrinsic is a smin or umin.
663 static bool isMin(Intrinsic::ID ID) {
664 switch (ID) {
665 case Intrinsic::umin:
666 case Intrinsic::smin:
667 return true;
668 case Intrinsic::umax:
669 case Intrinsic::smax:
670 return false;
671 default:
672 llvm_unreachable("Invalid intrinsic");
673 }
674 }
675
676 /// Whether the intrinsic is a smin or a umin.
677 bool isMin() const { return isMin(getIntrinsicID()); }
678
679 /// Whether the intrinsic is a smax or a umax.
680 bool isMax() const { return !isMin(getIntrinsicID()); }
681
682 /// Returns the identity value for this min/max intrinsic, such
683 /// that minmax(X, Identity) == X.
684 static APInt getIdentity(Intrinsic::ID ID, unsigned NumBits) {
685 switch (ID) {
686 case Intrinsic::umin:
687 return APInt::getMaxValue(NumBits);
688 case Intrinsic::umax:
689 return APInt::getMinValue(NumBits);
690 case Intrinsic::smin:
691 return APInt::getSignedMaxValue(NumBits);
692 case Intrinsic::smax:
693 return APInt::getSignedMinValue(NumBits);
694 default:
695 llvm_unreachable("Invalid intrinsic");
696 }
697 }
698
699 /// Returns the identity value for this min/max intrinsic, such
700 /// that minmax(X, Identity) == X.
704
705 /// Min/max intrinsics are monotonic, they operate on a fixed-bitwidth values,
706 /// so there is a certain threshold value, upon reaching which,
707 /// their value can no longer change. Return said threshold.
708 static APInt getSaturationPoint(Intrinsic::ID ID, unsigned numBits) {
709 switch (ID) {
710 case Intrinsic::umin:
711 return APInt::getMinValue(numBits);
712 case Intrinsic::umax:
713 return APInt::getMaxValue(numBits);
714 case Intrinsic::smin:
715 return APInt::getSignedMinValue(numBits);
716 case Intrinsic::smax:
717 return APInt::getSignedMaxValue(numBits);
718 default:
719 llvm_unreachable("Invalid intrinsic");
720 }
721 }
722
723 /// Min/max intrinsics are monotonic, they operate on a fixed-bitwidth values,
724 /// so there is a certain threshold value, upon reaching which,
725 /// their value can no longer change. Return said threshold.
726 APInt getSaturationPoint(unsigned numBits) const {
727 return getSaturationPoint(getIntrinsicID(), numBits);
728 }
729
730 /// Min/max intrinsics are monotonic, they operate on a fixed-bitwidth values,
731 /// so there is a certain threshold value, upon reaching which,
732 /// their value can no longer change. Return said threshold.
735 Ty, getSaturationPoint(ID, Ty->getScalarSizeInBits()));
736 }
737
738 /// Min/max intrinsics are monotonic, they operate on a fixed-bitwidth values,
739 /// so there is a certain threshold value, upon reaching which,
740 /// their value can no longer change. Return said threshold.
743 }
744};
745
746/// This class represents a ucmp/scmp intrinsic
748public:
749 static bool classof(const IntrinsicInst *I) {
750 switch (I->getIntrinsicID()) {
751 case Intrinsic::scmp:
752 case Intrinsic::ucmp:
753 return true;
754 default:
755 return false;
756 }
757 }
758 static bool classof(const Value *V) {
760 }
761
762 Value *getLHS() const { return getArgOperand(0); }
763 Value *getRHS() const { return getArgOperand(1); }
764
765 static bool isSigned(Intrinsic::ID ID) { return ID == Intrinsic::scmp; }
766 bool isSigned() const { return isSigned(getIntrinsicID()); }
767
774
781};
782
783/// This class represents an intrinsic that is based on a binary operation.
784/// This includes op.with.overflow and saturating add/sub intrinsics.
786public:
787 static bool classof(const IntrinsicInst *I) {
788 switch (I->getIntrinsicID()) {
789 case Intrinsic::uadd_with_overflow:
790 case Intrinsic::sadd_with_overflow:
791 case Intrinsic::usub_with_overflow:
792 case Intrinsic::ssub_with_overflow:
793 case Intrinsic::umul_with_overflow:
794 case Intrinsic::smul_with_overflow:
795 case Intrinsic::uadd_sat:
796 case Intrinsic::sadd_sat:
797 case Intrinsic::usub_sat:
798 case Intrinsic::ssub_sat:
799 return true;
800 default:
801 return false;
802 }
803 }
804 static bool classof(const Value *V) {
806 }
807
808 Value *getLHS() const { return getArgOperand(0); }
809 Value *getRHS() const { return getArgOperand(1); }
810
811 /// Returns the binary operation underlying the intrinsic.
813
814 /// Whether the intrinsic is signed or unsigned.
815 LLVM_ABI bool isSigned() const;
816
817 /// Returns one of OBO::NoSignedWrap or OBO::NoUnsignedWrap.
818 LLVM_ABI unsigned getNoWrapKind() const;
819};
820
821/// Represents an op.with.overflow intrinsic.
823public:
824 static bool classof(const IntrinsicInst *I) {
825 switch (I->getIntrinsicID()) {
826 case Intrinsic::uadd_with_overflow:
827 case Intrinsic::sadd_with_overflow:
828 case Intrinsic::usub_with_overflow:
829 case Intrinsic::ssub_with_overflow:
830 case Intrinsic::umul_with_overflow:
831 case Intrinsic::smul_with_overflow:
832 return true;
833 default:
834 return false;
835 }
836 }
837 static bool classof(const Value *V) {
839 }
840};
841
842/// Represents a saturating add/sub intrinsic.
844public:
845 static bool classof(const IntrinsicInst *I) {
846 switch (I->getIntrinsicID()) {
847 case Intrinsic::uadd_sat:
848 case Intrinsic::sadd_sat:
849 case Intrinsic::usub_sat:
850 case Intrinsic::ssub_sat:
851 return true;
852 default:
853 return false;
854 }
855 }
856 static bool classof(const Value *V) {
858 }
859};
860
861/// Common base class for all memory intrinsics. Simply provides
862/// common methods.
863/// Written as CRTP to avoid a common base class amongst the
864/// three atomicity hierarchies.
865template <typename Derived> class MemIntrinsicBase : public IntrinsicInst {
866private:
867 enum { ARG_DEST = 0, ARG_LENGTH = 2 };
868
869public:
870 Value *getRawDest() const {
871 return const_cast<Value *>(getArgOperand(ARG_DEST));
872 }
873 const Use &getRawDestUse() const { return getArgOperandUse(ARG_DEST); }
874 Use &getRawDestUse() { return getArgOperandUse(ARG_DEST); }
875
876 Value *getLength() const {
877 return const_cast<Value *>(getArgOperand(ARG_LENGTH));
878 }
879 const Use &getLengthUse() const { return getArgOperandUse(ARG_LENGTH); }
880 Use &getLengthUse() { return getArgOperandUse(ARG_LENGTH); }
881
882 std::optional<APInt> getLengthInBytes() const {
884 if (!C)
885 return std::nullopt;
886 return C->getValue();
887 }
888
889 /// This is just like getRawDest, but it strips off any cast
890 /// instructions (including addrspacecast) that feed it, giving the
891 /// original input. The returned value is guaranteed to be a pointer.
892 Value *getDest() const { return getRawDest()->stripPointerCasts(); }
893
894 unsigned getDestAddressSpace() const {
895 return cast<PointerType>(getRawDest()->getType())->getAddressSpace();
896 }
897
898 MaybeAlign getDestAlign() const { return getParamAlign(ARG_DEST); }
899
900 /// Set the specified arguments of the instruction.
901 void setDest(Value *Ptr) {
902 assert(getRawDest()->getType() == Ptr->getType() &&
903 "setDest called with pointer of wrong type!");
904 setArgOperand(ARG_DEST, Ptr);
905 }
906
907 void setDestAlignment(MaybeAlign Alignment) {
908 removeParamAttr(ARG_DEST, Attribute::Alignment);
909 if (Alignment)
910 addParamAttr(ARG_DEST,
912 }
913 void setDestAlignment(Align Alignment) {
914 removeParamAttr(ARG_DEST, Attribute::Alignment);
915 addParamAttr(ARG_DEST,
917 }
918
919 void setLength(Value *L) {
920 assert(getLength()->getType() == L->getType() &&
921 "setLength called with value of wrong type!");
922 setArgOperand(ARG_LENGTH, L);
923 }
924
926 setLength(ConstantInt::get(getLength()->getType(), L));
927 }
928};
929
930/// Common base class for all memory transfer intrinsics. Simply provides
931/// common methods.
932template <class BaseCL> class MemTransferBase : public BaseCL {
933private:
934 enum { ARG_SOURCE = 1 };
935
936public:
937 /// Return the arguments to the instruction.
939 return const_cast<Value *>(BaseCL::getArgOperand(ARG_SOURCE));
940 }
941 const Use &getRawSourceUse() const {
942 return BaseCL::getArgOperandUse(ARG_SOURCE);
943 }
944 Use &getRawSourceUse() { return BaseCL::getArgOperandUse(ARG_SOURCE); }
945
946 /// This is just like getRawSource, but it strips off any cast
947 /// instructions that feed it, giving the original input. The returned
948 /// value is guaranteed to be a pointer.
950
951 unsigned getSourceAddressSpace() const {
952 return cast<PointerType>(getRawSource()->getType())->getAddressSpace();
953 }
954
956 return BaseCL::getParamAlign(ARG_SOURCE);
957 }
958
959 void setSource(Value *Ptr) {
960 assert(getRawSource()->getType() == Ptr->getType() &&
961 "setSource called with pointer of wrong type!");
962 BaseCL::setArgOperand(ARG_SOURCE, Ptr);
963 }
964
966 BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
967 if (Alignment)
968 BaseCL::addParamAttr(ARG_SOURCE, Attribute::getWithAlignment(
969 BaseCL::getContext(), *Alignment));
970 }
971
972 void setSourceAlignment(Align Alignment) {
973 BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
974 BaseCL::addParamAttr(ARG_SOURCE, Attribute::getWithAlignment(
975 BaseCL::getContext(), Alignment));
976 }
977};
978
979/// Common base class for all memset intrinsics. Simply provides
980/// common methods.
981template <class BaseCL> class MemSetBase : public BaseCL {
982private:
983 enum { ARG_VALUE = 1 };
984
985public:
986 Value *getValue() const {
987 return const_cast<Value *>(BaseCL::getArgOperand(ARG_VALUE));
988 }
989 const Use &getValueUse() const { return BaseCL::getArgOperandUse(ARG_VALUE); }
990 Use &getValueUse() { return BaseCL::getArgOperandUse(ARG_VALUE); }
991
992 void setValue(Value *Val) {
993 assert(getValue()->getType() == Val->getType() &&
994 "setValue called with value of wrong type!");
995 BaseCL::setArgOperand(ARG_VALUE, Val);
996 }
997};
998
999/// This is the common base class for memset/memcpy/memmove.
1000class MemIntrinsic : public MemIntrinsicBase<MemIntrinsic> {
1001private:
1002 enum { ARG_VOLATILE = 3 };
1003
1004public:
1006 return cast<ConstantInt>(getArgOperand(ARG_VOLATILE));
1007 }
1008
1009 bool isVolatile() const { return !getVolatileCst()->isZero(); }
1010
1011 void setVolatile(Constant *V) { setArgOperand(ARG_VOLATILE, V); }
1012
1013 bool isForceInlined() const {
1014 switch (getIntrinsicID()) {
1015 case Intrinsic::memset_inline:
1016 case Intrinsic::memcpy_inline:
1017 return true;
1018 default:
1019 return false;
1020 }
1021 }
1022
1023 // Methods for support type inquiry through isa, cast, and dyn_cast:
1024 static bool classof(const IntrinsicInst *I) {
1025 switch (I->getIntrinsicID()) {
1026 case Intrinsic::memcpy:
1027 case Intrinsic::memmove:
1028 case Intrinsic::memset:
1029 case Intrinsic::memset_inline:
1030 case Intrinsic::memcpy_inline:
1031 return true;
1032 default:
1033 return false;
1034 }
1035 }
1036 static bool classof(const Value *V) {
1038 }
1039};
1040
1041/// This class wraps the llvm.memset and llvm.memset.inline intrinsics.
1042class MemSetInst : public MemSetBase<MemIntrinsic> {
1043public:
1044 // Methods for support type inquiry through isa, cast, and dyn_cast:
1045 static bool classof(const IntrinsicInst *I) {
1046 switch (I->getIntrinsicID()) {
1047 case Intrinsic::memset:
1048 case Intrinsic::memset_inline:
1049 return true;
1050 default:
1051 return false;
1052 }
1053 }
1054 static bool classof(const Value *V) {
1056 }
1057};
1058
1059/// This class wraps the llvm.experimental.memset.pattern intrinsic.
1060/// Note that despite the inheritance, this is not part of the
1061/// MemIntrinsic hierachy in terms of isa/cast.
1062class MemSetPatternInst : public MemSetBase<MemIntrinsic> {
1063private:
1064 enum { ARG_VOLATILE = 3 };
1065
1066public:
1068 return cast<ConstantInt>(getArgOperand(ARG_VOLATILE));
1069 }
1070
1071 bool isVolatile() const { return !getVolatileCst()->isZero(); }
1072
1073 void setVolatile(Constant *V) { setArgOperand(ARG_VOLATILE, V); }
1074
1075 // Methods for support type inquiry through isa, cast, and dyn_cast:
1076 static bool classof(const IntrinsicInst *I) {
1077 return I->getIntrinsicID() == Intrinsic::experimental_memset_pattern;
1078 }
1079 static bool classof(const Value *V) {
1081 }
1082};
1083
1084/// This class wraps the llvm.memcpy/memmove intrinsics.
1085class MemTransferInst : public MemTransferBase<MemIntrinsic> {
1086public:
1087 // Methods for support type inquiry through isa, cast, and dyn_cast:
1088 static bool classof(const IntrinsicInst *I) {
1089 switch (I->getIntrinsicID()) {
1090 case Intrinsic::memcpy:
1091 case Intrinsic::memmove:
1092 case Intrinsic::memcpy_inline:
1093 return true;
1094 default:
1095 return false;
1096 }
1097 }
1098 static bool classof(const Value *V) {
1100 }
1101};
1102
1103/// This class wraps the llvm.memcpy intrinsic.
1105public:
1106 // Methods for support type inquiry through isa, cast, and dyn_cast:
1107 static bool classof(const IntrinsicInst *I) {
1108 return I->getIntrinsicID() == Intrinsic::memcpy ||
1109 I->getIntrinsicID() == Intrinsic::memcpy_inline;
1110 }
1111 static bool classof(const Value *V) {
1113 }
1114};
1115
1116/// This class wraps the llvm.memmove intrinsic.
1118public:
1119 // Methods for support type inquiry through isa, cast, and dyn_cast:
1120 static bool classof(const IntrinsicInst *I) {
1121 return I->getIntrinsicID() == Intrinsic::memmove;
1122 }
1123 static bool classof(const Value *V) {
1125 }
1126};
1127
1128// The common base class for any memset/memmove/memcpy intrinsics;
1129// whether they be atomic or non-atomic.
1130// i.e. llvm.element.unordered.atomic.memset/memcpy/memmove
1131// and llvm.memset/memcpy/memmove
1132class AnyMemIntrinsic : public MemIntrinsicBase<AnyMemIntrinsic> {
1133private:
1134 enum { ARG_ELEMENTSIZE = 3 };
1135
1136public:
1137 bool isVolatile() const {
1138 // Only the non-atomic intrinsics can be volatile
1139 if (auto *MI = dyn_cast<MemIntrinsic>(this))
1140 return MI->isVolatile();
1141 return false;
1142 }
1143
1144 bool isAtomic() const {
1145 switch (getIntrinsicID()) {
1146 case Intrinsic::memcpy_element_unordered_atomic:
1147 case Intrinsic::memmove_element_unordered_atomic:
1148 case Intrinsic::memset_element_unordered_atomic:
1149 return true;
1150 default:
1151 return false;
1152 }
1153 }
1154
1155 static bool classof(const IntrinsicInst *I) {
1156 switch (I->getIntrinsicID()) {
1157 case Intrinsic::memcpy:
1158 case Intrinsic::memcpy_inline:
1159 case Intrinsic::memmove:
1160 case Intrinsic::memset:
1161 case Intrinsic::memset_inline:
1162 case Intrinsic::memcpy_element_unordered_atomic:
1163 case Intrinsic::memmove_element_unordered_atomic:
1164 case Intrinsic::memset_element_unordered_atomic:
1165 return true;
1166 default:
1167 return false;
1168 }
1169 }
1170 static bool classof(const Value *V) {
1172 }
1173
1175 assert(isAtomic());
1176 return getArgOperand(ARG_ELEMENTSIZE);
1177 }
1178
1180 assert(isAtomic());
1181 return cast<ConstantInt>(getRawElementSizeInBytes())->getZExtValue();
1182 }
1183};
1184
1185/// This class represents any memset intrinsic
1186// i.e. llvm.element.unordered.atomic.memset
1187// and llvm.memset
1188class AnyMemSetInst : public MemSetBase<AnyMemIntrinsic> {
1189public:
1190 static bool classof(const IntrinsicInst *I) {
1191 switch (I->getIntrinsicID()) {
1192 case Intrinsic::memset:
1193 case Intrinsic::memset_inline:
1194 case Intrinsic::memset_element_unordered_atomic:
1195 return true;
1196 default:
1197 return false;
1198 }
1199 }
1200 static bool classof(const Value *V) {
1202 }
1203};
1204
1205// This class wraps any memcpy/memmove intrinsics
1206// i.e. llvm.element.unordered.atomic.memcpy/memmove
1207// and llvm.memcpy/memmove
1208class AnyMemTransferInst : public MemTransferBase<AnyMemIntrinsic> {
1209public:
1210 static bool classof(const IntrinsicInst *I) {
1211 switch (I->getIntrinsicID()) {
1212 case Intrinsic::memcpy:
1213 case Intrinsic::memcpy_inline:
1214 case Intrinsic::memmove:
1215 case Intrinsic::memcpy_element_unordered_atomic:
1216 case Intrinsic::memmove_element_unordered_atomic:
1217 return true;
1218 default:
1219 return false;
1220 }
1221 }
1222 static bool classof(const Value *V) {
1224 }
1225};
1226
1227/// This class represents any memcpy intrinsic
1228/// i.e. llvm.element.unordered.atomic.memcpy
1229/// and llvm.memcpy
1231public:
1232 static bool classof(const IntrinsicInst *I) {
1233 switch (I->getIntrinsicID()) {
1234 case Intrinsic::memcpy:
1235 case Intrinsic::memcpy_inline:
1236 case Intrinsic::memcpy_element_unordered_atomic:
1237 return true;
1238 default:
1239 return false;
1240 }
1241 }
1242 static bool classof(const Value *V) {
1244 }
1245};
1246
1247/// This class represents any memmove intrinsic
1248/// i.e. llvm.element.unordered.atomic.memmove
1249/// and llvm.memmove
1251public:
1252 static bool classof(const IntrinsicInst *I) {
1253 switch (I->getIntrinsicID()) {
1254 case Intrinsic::memmove:
1255 case Intrinsic::memmove_element_unordered_atomic:
1256 return true;
1257 default:
1258 return false;
1259 }
1260 }
1261 static bool classof(const Value *V) {
1263 }
1264};
1265
1266/// This represents the llvm.va_start intrinsic.
1268public:
1269 static bool classof(const IntrinsicInst *I) {
1270 return I->getIntrinsicID() == Intrinsic::vastart;
1271 }
1272 static bool classof(const Value *V) {
1274 }
1275
1276 Value *getArgList() const { return getArgOperand(0); }
1277};
1278
1279/// This represents the llvm.va_end intrinsic.
1280class VAEndInst : public IntrinsicInst {
1281public:
1282 static bool classof(const IntrinsicInst *I) {
1283 return I->getIntrinsicID() == Intrinsic::vaend;
1284 }
1285 static bool classof(const Value *V) {
1287 }
1288
1289 Value *getArgList() const { return getArgOperand(0); }
1290};
1291
1292/// This represents the llvm.va_copy intrinsic.
1294public:
1295 static bool classof(const IntrinsicInst *I) {
1296 return I->getIntrinsicID() == Intrinsic::vacopy;
1297 }
1298 static bool classof(const Value *V) {
1300 }
1301
1302 Value *getDest() const { return getArgOperand(0); }
1303 Value *getSrc() const { return getArgOperand(1); }
1304};
1305
1306/// A base class for all instrprof intrinsics.
1308protected:
1309 static bool isCounterBase(const IntrinsicInst &I) {
1310 switch (I.getIntrinsicID()) {
1311 case Intrinsic::instrprof_cover:
1312 case Intrinsic::instrprof_increment:
1313 case Intrinsic::instrprof_increment_step:
1314 case Intrinsic::instrprof_callsite:
1315 case Intrinsic::instrprof_timestamp:
1316 case Intrinsic::instrprof_value_profile:
1317 return true;
1318 }
1319 return false;
1320 }
1321 static bool isMCDCBitmapBase(const IntrinsicInst &I) {
1322 switch (I.getIntrinsicID()) {
1323 case Intrinsic::instrprof_mcdc_parameters:
1324 case Intrinsic::instrprof_mcdc_tvbitmap_update:
1325 return true;
1326 }
1327 return false;
1328 }
1329
1330public:
1331 static bool classof(const Value *V) {
1332 if (const auto *Instr = dyn_cast<IntrinsicInst>(V))
1333 return isCounterBase(*Instr) || isMCDCBitmapBase(*Instr);
1334 return false;
1335 }
1336
1337 // The name of the instrumented function, assuming it is a global variable.
1340 }
1341
1342 // The "name" operand of the profile instrumentation instruction - this is the
1343 // operand that can be used to relate the instruction to the function it
1344 // belonged to at instrumentation time.
1346
1348
1349 // The hash of the CFG for the instrumented function.
1351};
1352
1353/// A base class for all instrprof counter intrinsics.
1355public:
1356 static bool classof(const Value *V) {
1357 if (const auto *Instr = dyn_cast<IntrinsicInst>(V))
1358 return InstrProfInstBase::isCounterBase(*Instr);
1359 return false;
1360 }
1361
1362 // The number of counters for the instrumented function.
1364 // The index of the counter that this instruction acts on.
1365 LLVM_ABI ConstantInt *getIndex() const;
1366 LLVM_ABI void setIndex(uint32_t Idx);
1367};
1368
1369/// This represents the llvm.instrprof.cover intrinsic.
1371public:
1372 static bool classof(const IntrinsicInst *I) {
1373 return I->getIntrinsicID() == Intrinsic::instrprof_cover;
1374 }
1375 static bool classof(const Value *V) {
1377 }
1378};
1379
1380/// This represents the llvm.instrprof.increment intrinsic.
1382public:
1383 static bool classof(const IntrinsicInst *I) {
1384 return I->getIntrinsicID() == Intrinsic::instrprof_increment ||
1385 I->getIntrinsicID() == Intrinsic::instrprof_increment_step;
1386 }
1387 static bool classof(const Value *V) {
1389 }
1390 LLVM_ABI Value *getStep() const;
1391};
1392
1393/// This represents the llvm.instrprof.increment.step intrinsic.
1395public:
1396 static bool classof(const IntrinsicInst *I) {
1397 return I->getIntrinsicID() == Intrinsic::instrprof_increment_step;
1398 }
1399 static bool classof(const Value *V) {
1401 }
1402};
1403
1404/// This represents the llvm.instrprof.callsite intrinsic.
1405/// It is structurally like the increment or step counters, hence the
1406/// inheritance relationship, albeit somewhat tenuous (it's not 'counting' per
1407/// se)
1409public:
1410 static bool classof(const IntrinsicInst *I) {
1411 return I->getIntrinsicID() == Intrinsic::instrprof_callsite;
1412 }
1413 static bool classof(const Value *V) {
1415 }
1416 // We instrument direct calls (but not to intrinsics), or indirect calls.
1417 static bool canInstrumentCallsite(const CallBase &CB) {
1418 return !CB.isInlineAsm() &&
1419 (CB.isIndirectCall() ||
1421 }
1422 LLVM_ABI Value *getCallee() const;
1423 LLVM_ABI void setCallee(Value *Callee);
1424};
1425
1426/// This represents the llvm.instrprof.timestamp intrinsic.
1428public:
1429 static bool classof(const IntrinsicInst *I) {
1430 return I->getIntrinsicID() == Intrinsic::instrprof_timestamp;
1431 }
1432 static bool classof(const Value *V) {
1434 }
1435};
1436
1437/// This represents the llvm.instrprof.value.profile intrinsic.
1439public:
1440 static bool classof(const IntrinsicInst *I) {
1441 return I->getIntrinsicID() == Intrinsic::instrprof_value_profile;
1442 }
1443 static bool classof(const Value *V) {
1445 }
1446
1448
1451 }
1452
1453 // Returns the value site index.
1455};
1456
1457/// A base class for instrprof mcdc intrinsics that require global bitmap bytes.
1459public:
1460 static bool classof(const IntrinsicInst *I) {
1462 }
1463 static bool classof(const Value *V) {
1465 }
1466
1467 /// \return The number of bits used for the MCDC bitmaps for the instrumented
1468 /// function.
1472
1473 /// \return The number of bytes used for the MCDC bitmaps for the instrumented
1474 /// function.
1475 auto getNumBitmapBytes() const {
1476 return alignTo(getNumBitmapBits()->getZExtValue(), CHAR_BIT) / CHAR_BIT;
1477 }
1478};
1479
1480/// This represents the llvm.instrprof.mcdc.parameters intrinsic.
1482public:
1483 static bool classof(const IntrinsicInst *I) {
1484 return I->getIntrinsicID() == Intrinsic::instrprof_mcdc_parameters;
1485 }
1486 static bool classof(const Value *V) {
1488 }
1489};
1490
1491/// This represents the llvm.instrprof.mcdc.tvbitmap.update intrinsic.
1493public:
1494 static bool classof(const IntrinsicInst *I) {
1495 return I->getIntrinsicID() == Intrinsic::instrprof_mcdc_tvbitmap_update;
1496 }
1497 static bool classof(const Value *V) {
1499 }
1500
1501 /// \return The index of the TestVector Bitmap upon which this intrinsic
1502 /// acts.
1505 }
1506
1507 /// \return The address of the corresponding condition bitmap containing
1508 /// the index of the TestVector to update within the TestVector Bitmap.
1510};
1511
1513public:
1514 static bool classof(const IntrinsicInst *I) {
1515 return I->getIntrinsicID() == Intrinsic::pseudoprobe;
1516 }
1517
1518 static bool classof(const Value *V) {
1520 }
1521
1524 }
1525
1527
1530 }
1531
1533};
1534
1536public:
1537 static bool classof(const IntrinsicInst *I) {
1538 return I->getIntrinsicID() == Intrinsic::experimental_noalias_scope_decl;
1539 }
1540
1541 static bool classof(const Value *V) {
1543 }
1544
1546 auto *MV =
1548 return cast<MDNode>(MV->getMetadata());
1549 }
1550
1555};
1556
1557/// Common base class for representing values projected from a statepoint.
1558/// Currently, the only projections available are gc.result and gc.relocate.
1560public:
1561 static bool classof(const IntrinsicInst *I) {
1562 return I->getIntrinsicID() == Intrinsic::experimental_gc_relocate ||
1563 I->getIntrinsicID() == Intrinsic::experimental_gc_result;
1564 }
1565
1566 static bool classof(const Value *V) {
1568 }
1569
1570 /// Return true if this relocate is tied to the invoke statepoint.
1571 /// This includes relocates which are on the unwinding path.
1572 bool isTiedToInvoke() const {
1573 const Value *Token = getArgOperand(0);
1574
1575 return isa<LandingPadInst>(Token) || isa<InvokeInst>(Token);
1576 }
1577
1578 /// The statepoint with which this gc.relocate is associated.
1579 LLVM_ABI const Value *getStatepoint() const;
1580};
1581
1582/// Represents calls to the gc.relocate intrinsic.
1584public:
1585 static bool classof(const IntrinsicInst *I) {
1586 return I->getIntrinsicID() == Intrinsic::experimental_gc_relocate;
1587 }
1588
1589 static bool classof(const Value *V) {
1591 }
1592
1593 /// The index into the associate statepoint's argument list
1594 /// which contains the base pointer of the pointer whose
1595 /// relocation this gc.relocate describes.
1596 unsigned getBasePtrIndex() const {
1597 return cast<ConstantInt>(getArgOperand(1))->getZExtValue();
1598 }
1599
1600 /// The index into the associate statepoint's argument list which
1601 /// contains the pointer whose relocation this gc.relocate describes.
1602 unsigned getDerivedPtrIndex() const {
1603 return cast<ConstantInt>(getArgOperand(2))->getZExtValue();
1604 }
1605
1606 LLVM_ABI Value *getBasePtr() const;
1607 LLVM_ABI Value *getDerivedPtr() const;
1608};
1609
1610/// Represents calls to the gc.result intrinsic.
1612public:
1613 static bool classof(const IntrinsicInst *I) {
1614 return I->getIntrinsicID() == Intrinsic::experimental_gc_result;
1615 }
1616
1617 static bool classof(const Value *V) {
1619 }
1620};
1621
1622
1623/// This represents the llvm.assume intrinsic.
1625public:
1626 static bool classof(const IntrinsicInst *I) {
1627 return I->getIntrinsicID() == Intrinsic::assume;
1628 }
1629 static bool classof(const Value *V) {
1631 }
1632};
1633
1634/// Check if \p ID corresponds to a convergence control intrinsic.
1635static inline bool isConvergenceControlIntrinsic(unsigned IntrinsicID) {
1636 switch (IntrinsicID) {
1637 default:
1638 return false;
1639 case Intrinsic::experimental_convergence_anchor:
1640 case Intrinsic::experimental_convergence_entry:
1641 case Intrinsic::experimental_convergence_loop:
1642 return true;
1643 }
1644}
1645
1646/// Represents calls to the llvm.experimintal.convergence.* intrinsics.
1648public:
1649 static bool classof(const IntrinsicInst *I) {
1650 return isConvergenceControlIntrinsic(I->getIntrinsicID());
1651 }
1652
1653 static bool classof(const Value *V) {
1655 }
1656
1657 bool isAnchor() const {
1658 return getIntrinsicID() == Intrinsic::experimental_convergence_anchor;
1659 }
1660 bool isEntry() const {
1661 return getIntrinsicID() == Intrinsic::experimental_convergence_entry;
1662 }
1663 bool isLoop() const {
1664 return getIntrinsicID() == Intrinsic::experimental_convergence_loop;
1665 }
1666
1671};
1672
1674public:
1675 static bool classof(const IntrinsicInst *I) {
1676 return I->getIntrinsicID() == Intrinsic::structured_alloca;
1677 }
1678
1679 static bool classof(const Value *V) {
1681 }
1682
1684 return getRetAttr(Attribute::ElementType).getValueAsType();
1685 }
1686};
1687
1689public:
1690 static bool classof(const IntrinsicInst *I) {
1691 return I->getIntrinsicID() == Intrinsic::structured_gep;
1692 }
1693
1694 static bool classof(const Value *V) {
1696 }
1697
1698 static unsigned getPointerOperandIndex() { return 0; }
1699
1703
1705 return getParamAttr(0, Attribute::ElementType).getValueAsType();
1706 }
1707
1708 unsigned getNumIndices() const { return arg_size() - 1; }
1709
1710 Value *getIndexOperand(size_t Index) const {
1711 assert(Index < getNumIndices());
1712 return getOperand(Index + 1);
1713 }
1714
1716 return make_range(op_begin() + 1, op_begin() + 1 + getNumIndices());
1717 }
1718
1720 Type *CurrentType = getBaseType();
1721 for (unsigned I = 0; I < getNumIndices(); I++) {
1722 if (ArrayType *AT = dyn_cast<ArrayType>(CurrentType)) {
1723 CurrentType = AT->getElementType();
1724 } else if (VectorType *VT = dyn_cast<VectorType>(CurrentType)) {
1725 CurrentType = VT->getElementType();
1726 } else if (StructType *ST = dyn_cast<StructType>(CurrentType)) {
1728 CurrentType = ST->getElementType(CI->getZExtValue());
1729 } else {
1730 // FIXME(Keenuts): add testing reaching those places once initial
1731 // implementation has landed.
1732 llvm_unreachable("unimplemented");
1733 }
1734 }
1735
1736 return CurrentType;
1737 }
1738};
1739
1740} // end namespace llvm
1741
1742#endif // LLVM_IR_INTRINSICINST_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:215
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file contains the declarations of entities that describe floating point environment and related ...
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
static unsigned getScalarSizeInBits(Type *Ty)
static SymbolRef::Type getType(const Symbol *Sym)
Definition TapiFile.cpp:39
Value * RHS
Class for arbitrary precision integers.
Definition APInt.h:78
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
Definition APInt.h:202
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
Definition APInt.h:205
static APInt getMinValue(unsigned numBits)
Gets minimum unsigned value of APInt for a specific bit width.
Definition APInt.h:212
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
Definition APInt.h:215
This class represents any memcpy intrinsic i.e.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
static bool classof(const Value *V)
Value * getRawElementSizeInBytes() const
uint32_t getElementSizeInBytes() const
static bool classof(const IntrinsicInst *I)
This class represents any memmove intrinsic i.e.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
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)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Class to represent array types.
This represents the llvm.assume intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
static LLVM_ABI Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
LLVM_ABI Type * getValueAsType() const
Return the attribute's value as a Type.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
This class represents an intrinsic that is based on a binary operation.
static bool classof(const Value *V)
LLVM_ABI unsigned getNoWrapKind() const
Returns one of OBO::NoSignedWrap or OBO::NoUnsignedWrap.
LLVM_ABI bool isSigned() const
Whether the intrinsic is signed or unsigned.
static bool classof(const IntrinsicInst *I)
LLVM_ABI Instruction::BinaryOps getBinaryOp() const
Returns the binary operation underlying the intrinsic.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
bool isInlineAsm() const
Check if this call is an inline asm statement.
Attribute getRetAttr(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind for the return value.
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Get the attribute of a given kind from a given arg.
LLVM_ABI bool isIndirectCall() const
Return true if the callsite is an indirect call.
MaybeAlign getParamAlign(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Value * getCalledOperand() const
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a call argument.
Value * getArgOperand(unsigned i) const
void setArgOperand(unsigned i, Value *v)
LLVM_ABI Intrinsic::ID getIntrinsicID() const
Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...
unsigned arg_size() const
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:740
@ ICMP_SLT
signed less than
Definition InstrTypes.h:769
@ ICMP_UGT
unsigned greater than
Definition InstrTypes.h:763
@ ICMP_SGT
signed greater than
Definition InstrTypes.h:767
@ ICMP_ULT
unsigned less than
Definition InstrTypes.h:765
bool isSigned() const
Definition InstrTypes.h:993
This class represents a ucmp/scmp intrinsic.
static CmpInst::Predicate getGTPredicate(Intrinsic::ID ID)
Value * getRHS() const
CmpInst::Predicate getLTPredicate() const
static CmpInst::Predicate getLTPredicate(Intrinsic::ID ID)
static bool classof(const IntrinsicInst *I)
static bool isSigned(Intrinsic::ID ID)
bool isSigned() const
CmpInst::Predicate getGTPredicate() const
Value * getLHS() const
static bool classof(const Value *V)
This is the shared class of boolean and integer constants.
Definition Constants.h:87
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
Definition Constants.h:219
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
Definition Constants.h:168
This is an important base class in LLVM.
Definition Constant.h:43
static LLVM_ABI Constant * getIntegerValue(Type *Ty, const APInt &V)
Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value...
Constrained floating point compare intrinsics.
LLVM_ABI FCmpInst::Predicate getPredicate() const
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
This is the common base class for constrained floating point intrinsics.
LLVM_ABI std::optional< fp::ExceptionBehavior > getExceptionBehavior() const
LLVM_ABI std::optional< RoundingMode > getRoundingMode() const
LLVM_ABI unsigned getNonMetadataArgCount() const
static LLVM_ABI bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
LLVM_ABI bool isDefaultFPEnvironment() const
Represents calls to the llvm.experimintal.convergence.* intrinsics.
static bool classof(const Value *V)
static LLVM_ABI ConvergenceControlInst * CreateAnchor(BasicBlock &BB)
static LLVM_ABI ConvergenceControlInst * CreateLoop(BasicBlock &BB, ConvergenceControlInst *Parent)
static LLVM_ABI ConvergenceControlInst * CreateEntry(BasicBlock &BB)
static bool classof(const IntrinsicInst *I)
DWARF expression.
This represents the llvm.dbg.assign instruction.
DIAssignID * getAssignID() const
static bool classof(const Value *V)
Metadata * getRawAddress() const
DIExpression * getAddressExpression() const
static bool classof(const IntrinsicInst *I)
Metadata * getRawAddressExpression() const
Metadata * getRawAssignID() const
This represents the llvm.dbg.declare instruction.
static bool classof(const Value *V)
Value * getAddress() const
static bool classof(const IntrinsicInst *I)
This is the common base class for debug info intrinsics.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
This represents the llvm.dbg.label instruction.
Metadata * getRawLabel() const
static bool classof(const IntrinsicInst *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
DILabel * getLabel() const
static bool classof(const Value *V)
This represents the llvm.dbg.value instruction.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
Value * getValue(unsigned OpIdx=0) const
This is the common base class for debug info intrinsics for variables.
LLVM_ABI Value * getVariableLocationOp(unsigned OpIdx) const
static bool classof(const Value *V)
void setExpression(DIExpression *NewExpr)
Metadata * getRawLocation() const
DILocalVariable * getVariable() const
unsigned getNumVariableLocationOps() const
void setOperand(unsigned i, Value *v)
Metadata * getRawVariable() const
static bool classof(const IntrinsicInst *I)
DIExpression * getExpression() const
void setArgOperand(unsigned i, Value *v)
Metadata * getRawExpression() const
RawLocationWrapper getWrappedLocation() const
Class representing an expression and its matching format.
Common base class for representing values projected from a statepoint.
LLVM_ABI const Value * getStatepoint() const
The statepoint with which this gc.relocate is associated.
bool isTiedToInvoke() const
Return true if this relocate is tied to the invoke statepoint.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
Represents calls to the gc.relocate intrinsic.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
LLVM_ABI Value * getBasePtr() const
unsigned getBasePtrIndex() const
The index into the associate statepoint's argument list which contains the base pointer of the pointe...
LLVM_ABI Value * getDerivedPtr() const
unsigned getDerivedPtrIndex() const
The index into the associate statepoint's argument list which contains the pointer whose relocation t...
Represents calls to the gc.result intrinsic.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
This represents the llvm.instrprof.callsite intrinsic.
LLVM_ABI void setCallee(Value *Callee)
LLVM_ABI Value * getCallee() const
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
static bool canInstrumentCallsite(const CallBase &CB)
A base class for all instrprof counter intrinsics.
static bool classof(const Value *V)
LLVM_ABI ConstantInt * getIndex() const
LLVM_ABI void setIndex(uint32_t Idx)
LLVM_ABI ConstantInt * getNumCounters() const
This represents the llvm.instrprof.cover intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
This represents the llvm.instrprof.increment.step intrinsic.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
This represents the llvm.instrprof.increment intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
LLVM_ABI Value * getStep() const
A base class for all instrprof intrinsics.
static bool classof(const Value *V)
void setNameValue(Value *V)
GlobalVariable * getName() const
ConstantInt * getHash() const
Value * getNameValue() const
static bool isCounterBase(const IntrinsicInst &I)
static bool isMCDCBitmapBase(const IntrinsicInst &I)
A base class for instrprof mcdc intrinsics that require global bitmap bytes.
ConstantInt * getNumBitmapBits() const
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
This represents the llvm.instrprof.mcdc.parameters intrinsic.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
This represents the llvm.instrprof.mcdc.tvbitmap.update intrinsic.
ConstantInt * getBitmapIndex() const
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
This represents the llvm.instrprof.timestamp intrinsic.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
This represents the llvm.instrprof.value.profile intrinsic.
ConstantInt * getIndex() const
static bool classof(const IntrinsicInst *I)
ConstantInt * getValueKind() const
static bool classof(const Value *V)
A wrapper class for inspecting calls to intrinsic functions.
bool isAssumeLikeIntrinsic() const
Checks if the intrinsic is an annotation.
static LLVM_ABI bool mayLowerToFunctionCall(Intrinsic::ID IID)
Check if the intrinsic might lower into a regular function call in the course of IR transformations.
IntrinsicInst(const IntrinsicInst &)=delete
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
bool isCommutative() const
Return true if swapping the first two arguments to the intrinsic produces the same result.
bool isCommutableOperand(unsigned Op) const
Return true if the operand is commutable.
static bool classof(const Value *V)
IntrinsicInst & operator=(const IntrinsicInst &)=delete
static bool classof(const CallInst *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
bool isAssociative() const
This is the common base class for lifetime intrinsics.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
Metadata node.
Definition Metadata.h:1081
This class wraps the llvm.memcpy intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
Common base class for all memory intrinsics.
const Use & getRawDestUse() const
Value * getLength() const
Value * getRawDest() const
void setDestAlignment(Align Alignment)
void setLength(Value *L)
Value * getDest() const
This is just like getRawDest, but it strips off any cast instructions (including addrspacecast) that ...
void setDestAlignment(MaybeAlign Alignment)
void setLength(uint64_t L)
void setDest(Value *Ptr)
Set the specified arguments of the instruction.
MaybeAlign getDestAlign() const
const Use & getLengthUse() const
unsigned getDestAddressSpace() const
std::optional< APInt > getLengthInBytes() const
This is the common base class for memset/memcpy/memmove.
ConstantInt * getVolatileCst() const
void setVolatile(Constant *V)
bool isForceInlined() const
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
bool isVolatile() const
This class wraps the llvm.memmove intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
Common base class for all memset intrinsics.
void setValue(Value *Val)
const Use & getValueUse() const
Value * getValue() const
This class wraps the llvm.memset and llvm.memset.inline intrinsics.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
This class wraps the llvm.experimental.memset.pattern intrinsic.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
ConstantInt * getVolatileCst() const
void setVolatile(Constant *V)
Common base class for all memory transfer intrinsics.
void setSource(Value *Ptr)
Value * getRawSource() const
Return the arguments to the instruction.
unsigned getSourceAddressSpace() const
MaybeAlign getSourceAlign() const
Value * getSource() const
This is just like getRawSource, but it strips off any cast instructions that feed it,...
void setSourceAlignment(MaybeAlign Alignment)
void setSourceAlignment(Align Alignment)
const Use & getRawSourceUse() const
This class wraps the llvm.memcpy/memmove intrinsics.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
static LLVM_ABI MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition Metadata.cpp:107
Root of the metadata hierarchy.
Definition Metadata.h:64
This class represents min/max intrinsics.
static bool classof(const Value *V)
static Constant * getSaturationPoint(Intrinsic::ID ID, Type *Ty)
Min/max intrinsics are monotonic, they operate on a fixed-bitwidth values, so there is a certain thre...
APInt getSaturationPoint(unsigned numBits) const
Min/max intrinsics are monotonic, they operate on a fixed-bitwidth values, so there is a certain thre...
static APInt getSaturationPoint(Intrinsic::ID ID, unsigned numBits)
Min/max intrinsics are monotonic, they operate on a fixed-bitwidth values, so there is a certain thre...
Value * getLHS() const
APInt getIdentity() const
Returns the identity value for this min/max intrinsic, such that minmax(X, Identity) == X.
Value * getRHS() const
bool isMin() const
Whether the intrinsic is a smin or a umin.
static ICmpInst::Predicate getPredicate(Intrinsic::ID ID)
Returns the comparison predicate underlying the intrinsic.
ICmpInst::Predicate getPredicate() const
Returns the comparison predicate underlying the intrinsic.
static bool isMin(Intrinsic::ID ID)
Whether the intrinsic is a smin or umin.
static bool isSigned(Intrinsic::ID ID)
Whether the intrinsic is signed or unsigned.
static APInt getIdentity(Intrinsic::ID ID, unsigned NumBits)
Returns the identity value for this min/max intrinsic, such that minmax(X, Identity) == X.
bool isMax() const
Whether the intrinsic is a smax or a umax.
static bool classof(const IntrinsicInst *I)
bool isSigned() const
Whether the intrinsic is signed or unsigned.
Constant * getSaturationPoint(Type *Ty) const
Min/max intrinsics are monotonic, they operate on a fixed-bitwidth values, so there is a certain thre...
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
static bool classof(const IntrinsicInst *I)
void setScopeList(MDNode *ScopeList)
static bool classof(const Value *V)
MDNode * getScopeList() const
A discriminated union of two or more pointer types, with the discriminator in the low bits of the poi...
ConstantInt * getAttributes() const
ConstantInt * getIndex() const
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
ConstantInt * getFactor() const
ConstantInt * getFuncGuid() const
Lightweight class that wraps the location operand metadata of a debug intrinsic.
friend bool operator<=(const RawLocationWrapper &A, const RawLocationWrapper &B)
Metadata * getRawLocation() const
friend bool operator>(const RawLocationWrapper &A, const RawLocationWrapper &B)
RawLocationWrapper(Metadata *RawLocation)
friend bool operator<(const RawLocationWrapper &A, const RawLocationWrapper &B)
friend bool operator==(const RawLocationWrapper &A, const RawLocationWrapper &B)
LLVM_ABI iterator_range< location_op_iterator > location_ops() const
Get the locations corresponding to the variable referenced by the debug info intrinsic.
LLVM_ABI Value * getVariableLocationOp(unsigned OpIdx) const
bool isKillLocation(const DIExpression *Expression) const
friend bool operator!=(const RawLocationWrapper &A, const RawLocationWrapper &B)
unsigned getNumVariableLocationOps() const
friend bool operator>=(const RawLocationWrapper &A, const RawLocationWrapper &B)
Represents a saturating add/sub intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
Class to represent struct types.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
iterator_range< op_iterator > indices()
unsigned getNumIndices() const
static unsigned getPointerOperandIndex()
static bool classof(const Value *V)
Value * getPointerOperand() const
Type * getResultElementType() const
Value * getIndexOperand(size_t Index) const
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
A Use represents the edge between a Value definition and its users.
Definition Use.h:35
op_iterator op_begin()
Definition User.h:259
void setOperand(unsigned i, Value *Val)
Definition User.h:212
Value * getOperand(unsigned i) const
Definition User.h:207
This represents the llvm.va_copy intrinsic.
Value * getSrc() const
static bool classof(const Value *V)
Value * getDest() const
static bool classof(const IntrinsicInst *I)
This represents the llvm.va_end intrinsic.
Value * getArgList() const
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
This represents the llvm.va_start intrinsic.
static bool classof(const IntrinsicInst *I)
static bool classof(const Value *V)
Value * getArgList() const
This is the common base class for vector predication intrinsics.
std::optional< unsigned > getFunctionalIntrinsicID() const
static bool classof(const Value *V)
static LLVM_ABI std::optional< unsigned > getMaskParamPos(Intrinsic::ID IntrinsicID)
LLVM_ABI bool canIgnoreVectorLengthParam() const
LLVM_ABI void setMaskParam(Value *)
static LLVM_ABI std::optional< unsigned > getFunctionalOpcodeForVP(Intrinsic::ID ID)
static LLVM_ABI std::optional< unsigned > getMemoryDataParamPos(Intrinsic::ID)
LLVM_ABI Value * getVectorLengthParam() const
static bool classof(const IntrinsicInst *I)
static LLVM_ABI std::optional< Intrinsic::ID > getFunctionalIntrinsicIDForVP(Intrinsic::ID ID)
LLVM_ABI void setVectorLengthParam(Value *)
static LLVM_ABI std::optional< unsigned > getVectorLengthParamPos(Intrinsic::ID IntrinsicID)
static LLVM_ABI Function * getOrInsertDeclarationForParams(Module *M, Intrinsic::ID, Type *ReturnType, ArrayRef< Value * > Params)
Declares a llvm.vp.
static LLVM_ABI std::optional< unsigned > getMemoryPointerParamPos(Intrinsic::ID)
static LLVM_ABI bool isVPIntrinsic(Intrinsic::ID)
LLVM_ABI Value * getMemoryDataParam() const
LLVM_ABI Value * getMemoryPointerParam() const
LLVM_ABI MaybeAlign getPointerAlignment() const
LLVM_ABI Value * getMaskParam() const
LLVM_ABI ElementCount getStaticVectorLength() const
std::optional< unsigned > getFunctionalOpcode() const
This represents vector predication reduction intrinsics.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static LLVM_ABI bool isVPReduction(Intrinsic::ID ID)
LLVM_ABI unsigned getStartParamPos() const
LLVM_ABI unsigned getVectorParamPos() const
Value wrapper in the Metadata hierarchy.
Definition Metadata.h:471
Value * getValue() const
Definition Metadata.h:510
LLVM Value Representation.
Definition Value.h:75
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:257
LLVM_ABI const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
Definition Value.cpp:712
Base class of all SIMD vector types.
Represents an op.with.overflow intrinsic.
static bool classof(const Value *V)
static bool classof(const IntrinsicInst *I)
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition iterator.h:80
A range adaptor for a pair of iterators.
bool operator==(const location_op_iterator &RHS) const
location_op_iterator & operator=(const location_op_iterator &R)
location_op_iterator(ValueAsMetadata **MultiIter)
location_op_iterator(const location_op_iterator &R)
location_op_iterator & operator++()
location_op_iterator(ValueAsMetadata *SingleIter)
location_op_iterator & operator--()
const Value * operator*() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static const int NoAliasScopeDeclScopeArg
Definition Intrinsics.h:44
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.
Definition Casting.h:643
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
auto dyn_cast_or_null(const Y &Val)
Definition Casting.h:753
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1762
static bool isLifetimeIntrinsic(Intrinsic::ID ID)
Check if ID corresponds to a lifetime intrinsic.
static bool isDbgInfoIntrinsic(Intrinsic::ID ID)
Check if ID corresponds to a debug info intrinsic.
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition Alignment.h:149
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...
Definition Casting.h:547
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
static bool isConvergenceControlIntrinsic(unsigned IntrinsicID)
Check if ID corresponds to a convergence control intrinsic.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition Alignment.h:111