Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/IR/IntrinsicInst.h
Line
Count
Source (jump to first uncovered line)
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"
27
#include "llvm/IR/DerivedTypes.h"
28
#include "llvm/IR/Function.h"
29
#include "llvm/IR/GlobalVariable.h"
30
#include "llvm/IR/Instructions.h"
31
#include "llvm/IR/Intrinsics.h"
32
#include "llvm/IR/Metadata.h"
33
#include "llvm/IR/Value.h"
34
#include "llvm/Support/Casting.h"
35
#include <cassert>
36
#include <cstdint>
37
38
namespace llvm {
39
40
  /// A wrapper class for inspecting calls to intrinsic functions.
41
  /// This allows the standard isa/dyncast/cast functionality to work with calls
42
  /// to intrinsic functions.
43
  class IntrinsicInst : public CallInst {
44
  public:
45
    IntrinsicInst() = delete;
46
    IntrinsicInst(const IntrinsicInst &) = delete;
47
    IntrinsicInst &operator=(const IntrinsicInst &) = delete;
48
49
    /// Return the intrinsic ID of this intrinsic.
50
111M
    Intrinsic::ID getIntrinsicID() const {
51
111M
      return getCalledFunction()->getIntrinsicID();
52
111M
    }
53
54
    // Methods for support type inquiry through isa, cast, and dyn_cast:
55
512M
    static bool classof(const CallInst *I) {
56
512M
      if (const Function *CF = I->getCalledFunction())
57
489M
        return CF->isIntrinsic();
58
22.2M
      return false;
59
22.2M
    }
60
1.70G
    static bool classof(const Value *V) {
61
1.70G
      return isa<CallInst>(V) && 
classof(cast<CallInst>(V))478M
;
62
1.70G
    }
63
  };
64
65
  /// This is the common base class for debug info intrinsics.
66
  class DbgInfoIntrinsic : public IntrinsicInst {
67
  public:
68
    /// \name Casting methods
69
    /// @{
70
11.6M
    static bool classof(const IntrinsicInst *I) {
71
11.6M
      switch (I->getIntrinsicID()) {
72
11.6M
      case Intrinsic::dbg_declare:
73
25.2k
      case Intrinsic::dbg_value:
74
25.2k
      case Intrinsic::dbg_addr:
75
25.2k
      case Intrinsic::dbg_label:
76
25.2k
        return true;
77
11.6M
      default: return false;
78
11.6M
      }
79
11.6M
    }
80
497M
    static bool classof(const Value *V) {
81
497M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))10.7M
;
82
497M
    }
83
    /// @}
84
  };
85
86
  /// This is the common base class for debug info intrinsics for variables.
87
  class DbgVariableIntrinsic : public DbgInfoIntrinsic {
88
  public:
89
    /// Get the location corresponding to the variable referenced by the debug
90
    /// info intrinsic.  Depending on the intrinsic, this could be the
91
    /// variable's value or its address.
92
    Value *getVariableLocation(bool AllowNullOp = true) const;
93
94
    /// Does this describe the address of a local variable. True for dbg.addr
95
    /// and dbg.declare, but not dbg.value, which describes its value.
96
379
    bool isAddressOfVariable() const {
97
379
      return getIntrinsicID() != Intrinsic::dbg_value;
98
379
    }
99
100
73.7k
    DILocalVariable *getVariable() const {
101
73.7k
      return cast<DILocalVariable>(getRawVariable());
102
73.7k
    }
103
104
8.97k
    DIExpression *getExpression() const {
105
8.97k
      return cast<DIExpression>(getRawExpression());
106
8.97k
    }
107
108
139k
    Metadata *getRawVariable() const {
109
139k
      return cast<MetadataAsValue>(getArgOperand(1))->getMetadata();
110
139k
    }
111
112
74.5k
    Metadata *getRawExpression() const {
113
74.5k
      return cast<MetadataAsValue>(getArgOperand(2))->getMetadata();
114
74.5k
    }
115
116
    /// Get the size (in bits) of the variable, or fragment of the variable that
117
    /// is described.
118
    Optional<uint64_t> getFragmentSizeInBits() const;
119
120
    /// \name Casting methods
121
    /// @{
122
471k
    static bool classof(const IntrinsicInst *I) {
123
471k
      switch (I->getIntrinsicID()) {
124
471k
      case Intrinsic::dbg_declare:
125
33.4k
      case Intrinsic::dbg_value:
126
33.4k
      case Intrinsic::dbg_addr:
127
33.4k
        return true;
128
438k
      default: return false;
129
471k
      }
130
471k
    }
131
14.1M
    static bool classof(const Value *V) {
132
14.1M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))471k
;
133
14.1M
    }
134
    /// @}
135
  };
136
137
  /// This represents the llvm.dbg.declare instruction.
138
  class DbgDeclareInst : public DbgVariableIntrinsic {
139
  public:
140
1.65k
    Value *getAddress() const { return getVariableLocation(); }
141
142
    /// \name Casting methods
143
    /// @{
144
9.59M
    static bool classof(const IntrinsicInst *I) {
145
9.59M
      return I->getIntrinsicID() == Intrinsic::dbg_declare;
146
9.59M
    }
147
184M
    static bool classof(const Value *V) {
148
184M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))9.59M
;
149
184M
    }
150
    /// @}
151
  };
152
153
  /// This represents the llvm.dbg.addr instruction.
154
  class DbgAddrIntrinsic : public DbgVariableIntrinsic {
155
  public:
156
0
    Value *getAddress() const { return getVariableLocation(); }
157
158
    /// \name Casting methods
159
    /// @{
160
    static bool classof(const IntrinsicInst *I) {
161
      return I->getIntrinsicID() == Intrinsic::dbg_addr;
162
    }
163
0
    static bool classof(const Value *V) {
164
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
165
0
    }
166
  };
167
168
  /// This represents the llvm.dbg.value instruction.
169
  class DbgValueInst : public DbgVariableIntrinsic {
170
  public:
171
22.5k
    Value *getValue() const {
172
22.5k
      return getVariableLocation(/* AllowNullOp = */ false);
173
22.5k
    }
174
175
    /// \name Casting methods
176
    /// @{
177
7.51M
    static bool classof(const IntrinsicInst *I) {
178
7.51M
      return I->getIntrinsicID() == Intrinsic::dbg_value;
179
7.51M
    }
180
82.2M
    static bool classof(const Value *V) {
181
82.2M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))7.51M
;
182
82.2M
    }
183
    /// @}
184
  };
185
186
  /// This represents the llvm.dbg.label instruction.
187
  class DbgLabelInst : public DbgInfoIntrinsic {
188
  public:
189
134
    DILabel *getLabel() const {
190
134
      return cast<DILabel>(getRawLabel());
191
134
    }
192
193
239
    Metadata *getRawLabel() const {
194
239
      return cast<MetadataAsValue>(getArgOperand(0))->getMetadata();
195
239
    }
196
197
    /// Methods for support type inquiry through isa, cast, and dyn_cast:
198
    /// @{
199
7.10M
    static bool classof(const IntrinsicInst *I) {
200
7.10M
      return I->getIntrinsicID() == Intrinsic::dbg_label;
201
7.10M
    }
202
66.8M
    static bool classof(const Value *V) {
203
66.8M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))7.10M
;
204
66.8M
    }
205
    /// @}
206
  };
207
208
  /// This is the common base class for constrained floating point intrinsics.
209
  class ConstrainedFPIntrinsic : public IntrinsicInst {
210
  public:
211
    /// Specifies the rounding mode to be assumed. This is only used when
212
    /// when constrained floating point is enabled. See the LLVM Language
213
    /// Reference Manual for details.
214
    enum RoundingMode : uint8_t {
215
      rmDynamic,         ///< This corresponds to "fpround.dynamic".
216
      rmToNearest,       ///< This corresponds to "fpround.tonearest".
217
      rmDownward,        ///< This corresponds to "fpround.downward".
218
      rmUpward,          ///< This corresponds to "fpround.upward".
219
      rmTowardZero       ///< This corresponds to "fpround.tozero".
220
    };
221
222
    /// Specifies the required exception behavior. This is only used when
223
    /// when constrained floating point is used. See the LLVM Language
224
    /// Reference Manual for details.
225
    enum ExceptionBehavior : uint8_t {
226
      ebIgnore,          ///< This corresponds to "fpexcept.ignore".
227
      ebMayTrap,         ///< This corresponds to "fpexcept.maytrap".
228
      ebStrict           ///< This corresponds to "fpexcept.strict".
229
    };
230
231
    bool isUnaryOp() const;
232
    bool isTernaryOp() const;
233
    Optional<RoundingMode> getRoundingMode() const;
234
    Optional<ExceptionBehavior> getExceptionBehavior() const;
235
236
    /// Returns a valid RoundingMode enumerator when given a string
237
    /// that is valid as input in constrained intrinsic rounding mode
238
    /// metadata.
239
    static Optional<RoundingMode> StrToRoundingMode(StringRef);
240
241
    /// For any RoundingMode enumerator, returns a string valid as input in
242
    /// constrained intrinsic rounding mode metadata.
243
    static Optional<StringRef> RoundingModeToStr(RoundingMode);
244
245
    /// Returns a valid ExceptionBehavior enumerator when given a string
246
    /// valid as input in constrained intrinsic exception behavior metadata.
247
    static Optional<ExceptionBehavior> StrToExceptionBehavior(StringRef);
248
249
    /// For any ExceptionBehavior enumerator, returns a string valid as 
250
    /// input in constrained intrinsic exception behavior metadata.
251
    static Optional<StringRef> ExceptionBehaviorToStr(ExceptionBehavior);
252
253
    // Methods for support type inquiry through isa, cast, and dyn_cast:
254
    static bool classof(const IntrinsicInst *I) {
255
      switch (I->getIntrinsicID()) {
256
      case Intrinsic::experimental_constrained_fadd:
257
      case Intrinsic::experimental_constrained_fsub:
258
      case Intrinsic::experimental_constrained_fmul:
259
      case Intrinsic::experimental_constrained_fdiv:
260
      case Intrinsic::experimental_constrained_frem:
261
      case Intrinsic::experimental_constrained_fma:
262
      case Intrinsic::experimental_constrained_fptrunc:
263
      case Intrinsic::experimental_constrained_fpext:
264
      case Intrinsic::experimental_constrained_sqrt:
265
      case Intrinsic::experimental_constrained_pow:
266
      case Intrinsic::experimental_constrained_powi:
267
      case Intrinsic::experimental_constrained_sin:
268
      case Intrinsic::experimental_constrained_cos:
269
      case Intrinsic::experimental_constrained_exp:
270
      case Intrinsic::experimental_constrained_exp2:
271
      case Intrinsic::experimental_constrained_log:
272
      case Intrinsic::experimental_constrained_log10:
273
      case Intrinsic::experimental_constrained_log2:
274
      case Intrinsic::experimental_constrained_rint:
275
      case Intrinsic::experimental_constrained_nearbyint:
276
      case Intrinsic::experimental_constrained_maxnum:
277
      case Intrinsic::experimental_constrained_minnum:
278
      case Intrinsic::experimental_constrained_ceil:
279
      case Intrinsic::experimental_constrained_floor:
280
      case Intrinsic::experimental_constrained_round:
281
      case Intrinsic::experimental_constrained_trunc:
282
        return true;
283
      default: return false;
284
      }
285
    }
286
    static bool classof(const Value *V) {
287
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
288
    }
289
  };
290
291
  /// This class represents an intrinsic that is based on a binary operation.
292
  /// This includes op.with.overflow and saturating add/sub intrinsics.
293
  class BinaryOpIntrinsic : public IntrinsicInst {
294
  public:
295
0
    static bool classof(const IntrinsicInst *I) {
296
0
      switch (I->getIntrinsicID()) {
297
0
      case Intrinsic::uadd_with_overflow:
298
0
      case Intrinsic::sadd_with_overflow:
299
0
      case Intrinsic::usub_with_overflow:
300
0
      case Intrinsic::ssub_with_overflow:
301
0
      case Intrinsic::umul_with_overflow:
302
0
      case Intrinsic::smul_with_overflow:
303
0
      case Intrinsic::uadd_sat:
304
0
      case Intrinsic::sadd_sat:
305
0
      case Intrinsic::usub_sat:
306
0
      case Intrinsic::ssub_sat:
307
0
        return true;
308
0
      default:
309
0
        return false;
310
0
      }
311
0
    }
312
0
    static bool classof(const Value *V) {
313
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
314
0
    }
315
316
23.1k
    Value *getLHS() const { return const_cast<Value*>(getArgOperand(0)); }
317
20.3k
    Value *getRHS() const { return const_cast<Value*>(getArgOperand(1)); }
318
319
    /// Returns the binary operation underlying the intrinsic.
320
    Instruction::BinaryOps getBinaryOp() const;
321
322
    /// Whether the intrinsic is signed or unsigned.
323
    bool isSigned() const;
324
325
    /// Returns one of OBO::NoSignedWrap or OBO::NoUnsignedWrap.
326
    unsigned getNoWrapKind() const;
327
  };
328
329
  /// Represents an op.with.overflow intrinsic.
330
  class WithOverflowInst : public BinaryOpIntrinsic {
331
  public:
332
645k
    static bool classof(const IntrinsicInst *I) {
333
645k
      switch (I->getIntrinsicID()) {
334
645k
      case Intrinsic::uadd_with_overflow:
335
35.8k
      case Intrinsic::sadd_with_overflow:
336
35.8k
      case Intrinsic::usub_with_overflow:
337
35.8k
      case Intrinsic::ssub_with_overflow:
338
35.8k
      case Intrinsic::umul_with_overflow:
339
35.8k
      case Intrinsic::smul_with_overflow:
340
35.8k
        return true;
341
609k
      default:
342
609k
        return false;
343
645k
      }
344
645k
    }
345
5.54M
    static bool classof(const Value *V) {
346
5.54M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))645k
;
347
5.54M
    }
348
  };
349
350
  /// Represents a saturating add/sub intrinsic.
351
  class SaturatingInst : public BinaryOpIntrinsic {
352
  public:
353
580k
    static bool classof(const IntrinsicInst *I) {
354
580k
      switch (I->getIntrinsicID()) {
355
580k
      case Intrinsic::uadd_sat:
356
235
      case Intrinsic::sadd_sat:
357
235
      case Intrinsic::usub_sat:
358
235
      case Intrinsic::ssub_sat:
359
235
        return true;
360
580k
      default:
361
580k
        return false;
362
580k
      }
363
580k
    }
364
4.91M
    static bool classof(const Value *V) {
365
4.91M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))580k
;
366
4.91M
    }
367
  };
368
369
  /// Common base class for all memory intrinsics. Simply provides
370
  /// common methods.
371
  /// Written as CRTP to avoid a common base class amongst the
372
  /// three atomicity hierarchies.
373
  template <typename Derived> class MemIntrinsicBase : public IntrinsicInst {
374
  private:
375
    enum { ARG_DEST = 0, ARG_LENGTH = 2 };
376
377
  public:
378
2.05M
    Value *getRawDest() const {
379
2.05M
      return const_cast<Value *>(getArgOperand(ARG_DEST));
380
2.05M
    }
llvm::MemIntrinsicBase<llvm::MemIntrinsic>::getRawDest() const
Line
Count
Source
378
393k
    Value *getRawDest() const {
379
393k
      return const_cast<Value *>(getArgOperand(ARG_DEST));
380
393k
    }
llvm::MemIntrinsicBase<llvm::AnyMemIntrinsic>::getRawDest() const
Line
Count
Source
378
1.66M
    Value *getRawDest() const {
379
1.66M
      return const_cast<Value *>(getArgOperand(ARG_DEST));
380
1.66M
    }
llvm::MemIntrinsicBase<llvm::AtomicMemIntrinsic>::getRawDest() const
Line
Count
Source
378
102
    Value *getRawDest() const {
379
102
      return const_cast<Value *>(getArgOperand(ARG_DEST));
380
102
    }
381
    const Use &getRawDestUse() const { return getArgOperandUse(ARG_DEST); }
382
41.1k
    Use &getRawDestUse() { return getArgOperandUse(ARG_DEST); }
383
384
2.08M
    Value *getLength() const {
385
2.08M
      return const_cast<Value *>(getArgOperand(ARG_LENGTH));
386
2.08M
    }
llvm::MemIntrinsicBase<llvm::MemIntrinsic>::getLength() const
Line
Count
Source
384
342k
    Value *getLength() const {
385
342k
      return const_cast<Value *>(getArgOperand(ARG_LENGTH));
386
342k
    }
llvm::MemIntrinsicBase<llvm::AnyMemIntrinsic>::getLength() const
Line
Count
Source
384
1.73M
    Value *getLength() const {
385
1.73M
      return const_cast<Value *>(getArgOperand(ARG_LENGTH));
386
1.73M
    }
llvm::MemIntrinsicBase<llvm::AtomicMemIntrinsic>::getLength() const
Line
Count
Source
384
647
    Value *getLength() const {
385
647
      return const_cast<Value *>(getArgOperand(ARG_LENGTH));
386
647
    }
387
    const Use &getLengthUse() const { return getArgOperandUse(ARG_LENGTH); }
388
    Use &getLengthUse() { return getArgOperandUse(ARG_LENGTH); }
389
390
    /// This is just like getRawDest, but it strips off any cast
391
    /// instructions (including addrspacecast) that feed it, giving the
392
    /// original input.  The returned value is guaranteed to be a pointer.
393
1.19M
    Value *getDest() const { return getRawDest()->stripPointerCasts(); }
llvm::MemIntrinsicBase<llvm::MemIntrinsic>::getDest() const
Line
Count
Source
393
132k
    Value *getDest() const { return getRawDest()->stripPointerCasts(); }
llvm::MemIntrinsicBase<llvm::AnyMemIntrinsic>::getDest() const
Line
Count
Source
393
1.06M
    Value *getDest() const { return getRawDest()->stripPointerCasts(); }
394
395
69.7k
    unsigned getDestAddressSpace() const {
396
69.7k
      return cast<PointerType>(getRawDest()->getType())->getAddressSpace();
397
69.7k
    }
398
399
904k
    unsigned getDestAlignment() const { return getParamAlignment(ARG_DEST); }
llvm::MemIntrinsicBase<llvm::MemIntrinsic>::getDestAlignment() const
Line
Count
Source
399
117k
    unsigned getDestAlignment() const { return getParamAlignment(ARG_DEST); }
llvm::MemIntrinsicBase<llvm::AtomicMemIntrinsic>::getDestAlignment() const
Line
Count
Source
399
593
    unsigned getDestAlignment() const { return getParamAlignment(ARG_DEST); }
llvm::MemIntrinsicBase<llvm::AnyMemIntrinsic>::getDestAlignment() const
Line
Count
Source
399
786k
    unsigned getDestAlignment() const { return getParamAlignment(ARG_DEST); }
400
401
    /// Set the specified arguments of the instruction.
402
271
    void setDest(Value *Ptr) {
403
271
      assert(getRawDest()->getType() == Ptr->getType() &&
404
271
             "setDest called with pointer of wrong type!");
405
271
      setArgOperand(ARG_DEST, Ptr);
406
271
    }
llvm::MemIntrinsicBase<llvm::AnyMemIntrinsic>::setDest(llvm::Value*)
Line
Count
Source
402
254
    void setDest(Value *Ptr) {
403
254
      assert(getRawDest()->getType() == Ptr->getType() &&
404
254
             "setDest called with pointer of wrong type!");
405
254
      setArgOperand(ARG_DEST, Ptr);
406
254
    }
llvm::MemIntrinsicBase<llvm::MemIntrinsic>::setDest(llvm::Value*)
Line
Count
Source
402
17
    void setDest(Value *Ptr) {
403
17
      assert(getRawDest()->getType() == Ptr->getType() &&
404
17
             "setDest called with pointer of wrong type!");
405
17
      setArgOperand(ARG_DEST, Ptr);
406
17
    }
407
408
65.4k
    void setDestAlignment(unsigned Align) {
409
65.4k
      removeParamAttr(ARG_DEST, Attribute::Alignment);
410
65.4k
      if (Align > 0)
411
65.4k
        addParamAttr(ARG_DEST,
412
65.4k
                     Attribute::getWithAlignment(getContext(), Align));
413
65.4k
    }
llvm::MemIntrinsicBase<llvm::MemIntrinsic>::setDestAlignment(unsigned int)
Line
Count
Source
408
62.3k
    void setDestAlignment(unsigned Align) {
409
62.3k
      removeParamAttr(ARG_DEST, Attribute::Alignment);
410
62.3k
      if (Align > 0)
411
62.3k
        addParamAttr(ARG_DEST,
412
62.3k
                     Attribute::getWithAlignment(getContext(), Align));
413
62.3k
    }
llvm::MemIntrinsicBase<llvm::AtomicMemIntrinsic>::setDestAlignment(unsigned int)
Line
Count
Source
408
7
    void setDestAlignment(unsigned Align) {
409
7
      removeParamAttr(ARG_DEST, Attribute::Alignment);
410
7
      if (Align > 0)
411
7
        addParamAttr(ARG_DEST,
412
7
                     Attribute::getWithAlignment(getContext(), Align));
413
7
    }
llvm::MemIntrinsicBase<llvm::AnyMemIntrinsic>::setDestAlignment(unsigned int)
Line
Count
Source
408
3.07k
    void setDestAlignment(unsigned Align) {
409
3.07k
      removeParamAttr(ARG_DEST, Attribute::Alignment);
410
3.07k
      if (Align > 0)
411
3.07k
        addParamAttr(ARG_DEST,
412
3.07k
                     Attribute::getWithAlignment(getContext(), Align));
413
3.07k
    }
414
415
3.31k
    void setLength(Value *L) {
416
3.31k
      assert(getLength()->getType() == L->getType() &&
417
3.31k
             "setLength called with value of wrong type!");
418
3.31k
      setArgOperand(ARG_LENGTH, L);
419
3.31k
    }
llvm::MemIntrinsicBase<llvm::AnyMemIntrinsic>::setLength(llvm::Value*)
Line
Count
Source
415
3.30k
    void setLength(Value *L) {
416
3.30k
      assert(getLength()->getType() == L->getType() &&
417
3.30k
             "setLength called with value of wrong type!");
418
3.30k
      setArgOperand(ARG_LENGTH, L);
419
3.30k
    }
llvm::MemIntrinsicBase<llvm::MemIntrinsic>::setLength(llvm::Value*)
Line
Count
Source
415
12
    void setLength(Value *L) {
416
12
      assert(getLength()->getType() == L->getType() &&
417
12
             "setLength called with value of wrong type!");
418
12
      setArgOperand(ARG_LENGTH, L);
419
12
    }
420
  };
421
422
  /// Common base class for all memory transfer intrinsics. Simply provides
423
  /// common methods.
424
  template <class BaseCL> class MemTransferBase : public BaseCL {
425
  private:
426
    enum { ARG_SOURCE = 1 };
427
428
  public:
429
    /// Return the arguments to the instruction.
430
990k
    Value *getRawSource() const {
431
990k
      return const_cast<Value *>(BaseCL::getArgOperand(ARG_SOURCE));
432
990k
    }
llvm::MemTransferBase<llvm::MemIntrinsic>::getRawSource() const
Line
Count
Source
430
183k
    Value *getRawSource() const {
431
183k
      return const_cast<Value *>(BaseCL::getArgOperand(ARG_SOURCE));
432
183k
    }
llvm::MemTransferBase<llvm::AnyMemIntrinsic>::getRawSource() const
Line
Count
Source
430
806k
    Value *getRawSource() const {
431
806k
      return const_cast<Value *>(BaseCL::getArgOperand(ARG_SOURCE));
432
806k
    }
llvm::MemTransferBase<llvm::AtomicMemIntrinsic>::getRawSource() const
Line
Count
Source
430
56
    Value *getRawSource() const {
431
56
      return const_cast<Value *>(BaseCL::getArgOperand(ARG_SOURCE));
432
56
    }
433
    const Use &getRawSourceUse() const {
434
      return BaseCL::getArgOperandUse(ARG_SOURCE);
435
    }
436
    Use &getRawSourceUse() { return BaseCL::getArgOperandUse(ARG_SOURCE); }
437
438
    /// This is just like getRawSource, but it strips off any cast
439
    /// instructions that feed it, giving the original input.  The returned
440
    /// value is guaranteed to be a pointer.
441
356k
    Value *getSource() const { return getRawSource()->stripPointerCasts(); }
llvm::MemTransferBase<llvm::MemIntrinsic>::getSource() const
Line
Count
Source
441
106k
    Value *getSource() const { return getRawSource()->stripPointerCasts(); }
llvm::MemTransferBase<llvm::AnyMemIntrinsic>::getSource() const
Line
Count
Source
441
250k
    Value *getSource() const { return getRawSource()->stripPointerCasts(); }
442
443
23.3k
    unsigned getSourceAddressSpace() const {
444
23.3k
      return cast<PointerType>(getRawSource()->getType())->getAddressSpace();
445
23.3k
    }
446
447
301k
    unsigned getSourceAlignment() const {
448
301k
      return BaseCL::getParamAlignment(ARG_SOURCE);
449
301k
    }
llvm::MemTransferBase<llvm::MemIntrinsic>::getSourceAlignment() const
Line
Count
Source
447
59.7k
    unsigned getSourceAlignment() const {
448
59.7k
      return BaseCL::getParamAlignment(ARG_SOURCE);
449
59.7k
    }
llvm::MemTransferBase<llvm::AtomicMemIntrinsic>::getSourceAlignment() const
Line
Count
Source
447
384
    unsigned getSourceAlignment() const {
448
384
      return BaseCL::getParamAlignment(ARG_SOURCE);
449
384
    }
llvm::MemTransferBase<llvm::AnyMemIntrinsic>::getSourceAlignment() const
Line
Count
Source
447
241k
    unsigned getSourceAlignment() const {
448
241k
      return BaseCL::getParamAlignment(ARG_SOURCE);
449
241k
    }
450
451
13
    void setSource(Value *Ptr) {
452
13
      assert(getRawSource()->getType() == Ptr->getType() &&
453
13
             "setSource called with pointer of wrong type!");
454
13
      BaseCL::setArgOperand(ARG_SOURCE, Ptr);
455
13
    }
456
457
39.3k
    void setSourceAlignment(unsigned Align) {
458
39.3k
      BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
459
39.3k
      if (Align > 0)
460
39.3k
        BaseCL::addParamAttr(ARG_SOURCE, Attribute::getWithAlignment(
461
39.3k
                                             BaseCL::getContext(), Align));
462
39.3k
    }
llvm::MemTransferBase<llvm::MemIntrinsic>::setSourceAlignment(unsigned int)
Line
Count
Source
457
38.7k
    void setSourceAlignment(unsigned Align) {
458
38.7k
      BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
459
38.7k
      if (Align > 0)
460
38.7k
        BaseCL::addParamAttr(ARG_SOURCE, Attribute::getWithAlignment(
461
38.7k
                                             BaseCL::getContext(), Align));
462
38.7k
    }
llvm::MemTransferBase<llvm::AtomicMemIntrinsic>::setSourceAlignment(unsigned int)
Line
Count
Source
457
7
    void setSourceAlignment(unsigned Align) {
458
7
      BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
459
7
      if (Align > 0)
460
7
        BaseCL::addParamAttr(ARG_SOURCE, Attribute::getWithAlignment(
461
7
                                             BaseCL::getContext(), Align));
462
7
    }
llvm::MemTransferBase<llvm::AnyMemIntrinsic>::setSourceAlignment(unsigned int)
Line
Count
Source
457
520
    void setSourceAlignment(unsigned Align) {
458
520
      BaseCL::removeParamAttr(ARG_SOURCE, Attribute::Alignment);
459
520
      if (Align > 0)
460
520
        BaseCL::addParamAttr(ARG_SOURCE, Attribute::getWithAlignment(
461
520
                                             BaseCL::getContext(), Align));
462
520
    }
463
  };
464
465
  /// Common base class for all memset intrinsics. Simply provides
466
  /// common methods.
467
  template <class BaseCL> class MemSetBase : public BaseCL {
468
  private:
469
    enum { ARG_VALUE = 1 };
470
471
  public:
472
353k
    Value *getValue() const {
473
353k
      return const_cast<Value *>(BaseCL::getArgOperand(ARG_VALUE));
474
353k
    }
llvm::MemSetBase<llvm::MemIntrinsic>::getValue() const
Line
Count
Source
472
62.7k
    Value *getValue() const {
473
62.7k
      return const_cast<Value *>(BaseCL::getArgOperand(ARG_VALUE));
474
62.7k
    }
llvm::MemSetBase<llvm::AnyMemIntrinsic>::getValue() const
Line
Count
Source
472
290k
    Value *getValue() const {
473
290k
      return const_cast<Value *>(BaseCL::getArgOperand(ARG_VALUE));
474
290k
    }
llvm::MemSetBase<llvm::AtomicMemIntrinsic>::getValue() const
Line
Count
Source
472
23
    Value *getValue() const {
473
23
      return const_cast<Value *>(BaseCL::getArgOperand(ARG_VALUE));
474
23
    }
475
    const Use &getValueUse() const {
476
      return BaseCL::getArgOperandUse(ARG_VALUE);
477
    }
478
    Use &getValueUse() { return BaseCL::getArgOperandUse(ARG_VALUE); }
479
480
    void setValue(Value *Val) {
481
      assert(getValue()->getType() == Val->getType() &&
482
             "setValue called with value of wrong type!");
483
      BaseCL::setArgOperand(ARG_VALUE, Val);
484
    }
485
  };
486
487
  // The common base class for the atomic memset/memmove/memcpy intrinsics
488
  // i.e. llvm.element.unordered.atomic.memset/memcpy/memmove
489
  class AtomicMemIntrinsic : public MemIntrinsicBase<AtomicMemIntrinsic> {
490
  private:
491
    enum { ARG_ELEMENTSIZE = 3 };
492
493
  public:
494
1.14k
    Value *getRawElementSizeInBytes() const {
495
1.14k
      return const_cast<Value *>(getArgOperand(ARG_ELEMENTSIZE));
496
1.14k
    }
497
498
594
    ConstantInt *getElementSizeInBytesCst() const {
499
594
      return cast<ConstantInt>(getRawElementSizeInBytes());
500
594
    }
501
502
594
    uint32_t getElementSizeInBytes() const {
503
594
      return getElementSizeInBytesCst()->getZExtValue();
504
594
    }
505
506
0
    void setElementSizeInBytes(Constant *V) {
507
0
      assert(V->getType() == Type::getInt8Ty(getContext()) &&
508
0
             "setElementSizeInBytes called with value of wrong type!");
509
0
      setArgOperand(ARG_ELEMENTSIZE, V);
510
0
    }
511
512
352
    static bool classof(const IntrinsicInst *I) {
513
352
      switch (I->getIntrinsicID()) {
514
352
      case Intrinsic::memcpy_element_unordered_atomic:
515
17
      case Intrinsic::memmove_element_unordered_atomic:
516
17
      case Intrinsic::memset_element_unordered_atomic:
517
17
        return true;
518
335
      default:
519
335
        return false;
520
352
      }
521
352
    }
522
352
    static bool classof(const Value *V) {
523
352
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
524
352
    }
525
  };
526
527
  /// This class represents atomic memset intrinsic
528
  // i.e. llvm.element.unordered.atomic.memset
529
  class AtomicMemSetInst : public MemSetBase<AtomicMemIntrinsic> {
530
  public:
531
249k
    static bool classof(const IntrinsicInst *I) {
532
249k
      return I->getIntrinsicID() == Intrinsic::memset_element_unordered_atomic;
533
249k
    }
534
0
    static bool classof(const Value *V) {
535
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
536
0
    }
537
  };
538
539
  // This class wraps the atomic memcpy/memmove intrinsics
540
  // i.e. llvm.element.unordered.atomic.memcpy/memmove
541
  class AtomicMemTransferInst : public MemTransferBase<AtomicMemIntrinsic> {
542
  public:
543
5.49k
    static bool classof(const IntrinsicInst *I) {
544
5.49k
      switch (I->getIntrinsicID()) {
545
5.49k
      case Intrinsic::memcpy_element_unordered_atomic:
546
436
      case Intrinsic::memmove_element_unordered_atomic:
547
436
        return true;
548
5.05k
      default:
549
5.05k
        return false;
550
5.49k
      }
551
5.49k
    }
552
0
    static bool classof(const Value *V) {
553
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
554
0
    }
555
  };
556
557
  /// This class represents the atomic memcpy intrinsic
558
  /// i.e. llvm.element.unordered.atomic.memcpy
559
  class AtomicMemCpyInst : public AtomicMemTransferInst {
560
  public:
561
0
    static bool classof(const IntrinsicInst *I) {
562
0
      return I->getIntrinsicID() == Intrinsic::memcpy_element_unordered_atomic;
563
0
    }
564
0
    static bool classof(const Value *V) {
565
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
566
0
    }
567
  };
568
569
  /// This class represents the atomic memmove intrinsic
570
  /// i.e. llvm.element.unordered.atomic.memmove
571
  class AtomicMemMoveInst : public AtomicMemTransferInst {
572
  public:
573
5
    static bool classof(const IntrinsicInst *I) {
574
5
      return I->getIntrinsicID() == Intrinsic::memmove_element_unordered_atomic;
575
5
    }
576
0
    static bool classof(const Value *V) {
577
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
578
0
    }
579
  };
580
581
  /// This is the common base class for memset/memcpy/memmove.
582
  class MemIntrinsic : public MemIntrinsicBase<MemIntrinsic> {
583
  private:
584
    enum { ARG_VOLATILE = 3 };
585
586
  public:
587
2.78M
    ConstantInt *getVolatileCst() const {
588
2.78M
      return cast<ConstantInt>(
589
2.78M
          const_cast<Value *>(getArgOperand(ARG_VOLATILE)));
590
2.78M
    }
591
592
2.78M
    bool isVolatile() const {
593
2.78M
      return !getVolatileCst()->isZero();
594
2.78M
    }
595
596
0
    void setVolatile(Constant *V) { setArgOperand(ARG_VOLATILE, V); }
597
598
    // Methods for support type inquiry through isa, cast, and dyn_cast:
599
9.77M
    static bool classof(const IntrinsicInst *I) {
600
9.77M
      switch (I->getIntrinsicID()) {
601
9.77M
      case Intrinsic::memcpy:
602
2.45M
      case Intrinsic::memmove:
603
2.45M
      case Intrinsic::memset:
604
2.45M
        return true;
605
7.32M
      default: return false;
606
9.77M
      }
607
9.77M
    }
608
57.8M
    static bool classof(const Value *V) {
609
57.8M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))9.24M
;
610
57.8M
    }
611
  };
612
613
  /// This class wraps the llvm.memset intrinsic.
614
  class MemSetInst : public MemSetBase<MemIntrinsic> {
615
  public:
616
    // Methods for support type inquiry through isa, cast, and dyn_cast:
617
265k
    static bool classof(const IntrinsicInst *I) {
618
265k
      return I->getIntrinsicID() == Intrinsic::memset;
619
265k
    }
620
20.4M
    static bool classof(const Value *V) {
621
20.4M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))261k
;
622
20.4M
    }
623
  };
624
625
  /// This class wraps the llvm.memcpy/memmove intrinsics.
626
  class MemTransferInst : public MemTransferBase<MemIntrinsic> {
627
  public:
628
    // Methods for support type inquiry through isa, cast, and dyn_cast:
629
197k
    static bool classof(const IntrinsicInst *I) {
630
197k
      return I->getIntrinsicID() == Intrinsic::memcpy ||
631
197k
             
I->getIntrinsicID() == Intrinsic::memmove91.5k
;
632
197k
    }
633
8.70M
    static bool classof(const Value *V) {
634
8.70M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))107k
;
635
8.70M
    }
636
  };
637
638
  /// This class wraps the llvm.memcpy intrinsic.
639
  class MemCpyInst : public MemTransferInst {
640
  public:
641
    // Methods for support type inquiry through isa, cast, and dyn_cast:
642
226k
    static bool classof(const IntrinsicInst *I) {
643
226k
      return I->getIntrinsicID() == Intrinsic::memcpy;
644
226k
    }
645
11.6M
    static bool classof(const Value *V) {
646
11.6M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))226k
;
647
11.6M
    }
648
  };
649
650
  /// This class wraps the llvm.memmove intrinsic.
651
  class MemMoveInst : public MemTransferInst {
652
  public:
653
    // Methods for support type inquiry through isa, cast, and dyn_cast:
654
184k
    static bool classof(const IntrinsicInst *I) {
655
184k
      return I->getIntrinsicID() == Intrinsic::memmove;
656
184k
    }
657
11.5M
    static bool classof(const Value *V) {
658
11.5M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))184k
;
659
11.5M
    }
660
  };
661
662
  // The common base class for any memset/memmove/memcpy intrinsics;
663
  // whether they be atomic or non-atomic.
664
  // i.e. llvm.element.unordered.atomic.memset/memcpy/memmove
665
  //  and llvm.memset/memcpy/memmove
666
  class AnyMemIntrinsic : public MemIntrinsicBase<AnyMemIntrinsic> {
667
  public:
668
485
    bool isVolatile() const {
669
485
      // Only the non-atomic intrinsics can be volatile
670
485
      if (auto *MI = dyn_cast<MemIntrinsic>(this))
671
471
        return MI->isVolatile();
672
14
      return false;
673
14
    }
674
675
3.62M
    static bool classof(const IntrinsicInst *I) {
676
3.62M
      switch (I->getIntrinsicID()) {
677
3.62M
      case Intrinsic::memcpy:
678
604k
      case Intrinsic::memmove:
679
604k
      case Intrinsic::memset:
680
604k
      case Intrinsic::memcpy_element_unordered_atomic:
681
604k
      case Intrinsic::memmove_element_unordered_atomic:
682
604k
      case Intrinsic::memset_element_unordered_atomic:
683
604k
        return true;
684
3.01M
      default:
685
3.01M
        return false;
686
3.62M
      }
687
3.62M
    }
688
340k
    static bool classof(const Value *V) {
689
340k
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))152k
;
690
340k
    }
691
  };
692
693
  /// This class represents any memset intrinsic
694
  // i.e. llvm.element.unordered.atomic.memset
695
  // and  llvm.memset
696
  class AnyMemSetInst : public MemSetBase<AnyMemIntrinsic> {
697
  public:
698
419k
    static bool classof(const IntrinsicInst *I) {
699
419k
      switch (I->getIntrinsicID()) {
700
419k
      case Intrinsic::memset:
701
305k
      case Intrinsic::memset_element_unordered_atomic:
702
305k
        return true;
703
305k
      default:
704
113k
        return false;
705
419k
      }
706
419k
    }
707
10.7M
    static bool classof(const Value *V) {
708
10.7M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))127k
;
709
10.7M
    }
710
  };
711
712
  // This class wraps any memcpy/memmove intrinsics
713
  // i.e. llvm.element.unordered.atomic.memcpy/memmove
714
  // and  llvm.memcpy/memmove
715
  class AnyMemTransferInst : public MemTransferBase<AnyMemIntrinsic> {
716
  public:
717
1.20M
    static bool classof(const IntrinsicInst *I) {
718
1.20M
      switch (I->getIntrinsicID()) {
719
1.20M
      case Intrinsic::memcpy:
720
514k
      case Intrinsic::memmove:
721
514k
      case Intrinsic::memcpy_element_unordered_atomic:
722
514k
      case Intrinsic::memmove_element_unordered_atomic:
723
514k
        return true;
724
687k
      default:
725
687k
        return false;
726
1.20M
      }
727
1.20M
    }
728
10.8M
    static bool classof(const Value *V) {
729
10.8M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))132k
;
730
10.8M
    }
731
  };
732
733
  /// This class represents any memcpy intrinsic
734
  /// i.e. llvm.element.unordered.atomic.memcpy
735
  ///  and llvm.memcpy
736
  class AnyMemCpyInst : public AnyMemTransferInst {
737
  public:
738
1.33M
    static bool classof(const IntrinsicInst *I) {
739
1.33M
      switch (I->getIntrinsicID()) {
740
1.33M
      case Intrinsic::memcpy:
741
267k
      case Intrinsic::memcpy_element_unordered_atomic:
742
267k
        return true;
743
1.06M
      default:
744
1.06M
        return false;
745
1.33M
      }
746
1.33M
    }
747
8.02M
    static bool classof(const Value *V) {
748
8.02M
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))1.33M
;
749
8.02M
    }
750
  };
751
752
  /// This class represents any memmove intrinsic
753
  /// i.e. llvm.element.unordered.atomic.memmove
754
  ///  and llvm.memmove
755
  class AnyMemMoveInst : public AnyMemTransferInst {
756
  public:
757
534k
    static bool classof(const IntrinsicInst *I) {
758
534k
      switch (I->getIntrinsicID()) {
759
534k
      case Intrinsic::memmove:
760
7.77k
      case Intrinsic::memmove_element_unordered_atomic:
761
7.77k
        return true;
762
527k
      default:
763
527k
        return false;
764
534k
      }
765
534k
    }
766
0
    static bool classof(const Value *V) {
767
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
768
0
    }
769
  };
770
771
  /// This represents the llvm.va_start intrinsic.
772
  class VAStartInst : public IntrinsicInst {
773
  public:
774
0
    static bool classof(const IntrinsicInst *I) {
775
0
      return I->getIntrinsicID() == Intrinsic::vastart;
776
0
    }
777
0
    static bool classof(const Value *V) {
778
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
779
0
    }
780
781
0
    Value *getArgList() const { return const_cast<Value*>(getArgOperand(0)); }
782
  };
783
784
  /// This represents the llvm.va_end intrinsic.
785
  class VAEndInst : public IntrinsicInst {
786
  public:
787
0
    static bool classof(const IntrinsicInst *I) {
788
0
      return I->getIntrinsicID() == Intrinsic::vaend;
789
0
    }
790
0
    static bool classof(const Value *V) {
791
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
792
0
    }
793
794
0
    Value *getArgList() const { return const_cast<Value*>(getArgOperand(0)); }
795
  };
796
797
  /// This represents the llvm.va_copy intrinsic.
798
  class VACopyInst : public IntrinsicInst {
799
  public:
800
0
    static bool classof(const IntrinsicInst *I) {
801
0
      return I->getIntrinsicID() == Intrinsic::vacopy;
802
0
    }
803
0
    static bool classof(const Value *V) {
804
0
      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
805
0
    }
806
807
0
    Value *getDest() const { return const_cast<Value*>(getArgOperand(0)); }
808
0
    Value *getSrc() const { return const_cast<Value*>(getArgOperand(1)); }
809
  };
810
811
  /// This represents the llvm.instrprof_increment intrinsic.
812
  class InstrProfIncrementInst : public IntrinsicInst {
813
  public:
814
1.29k
    static bool classof(const IntrinsicInst *I) {
815
1.29k
      return I->getIntrinsicID() == Intrinsic::instrprof_increment;
816
1.29k
    }
817
8.79k
    static bool classof(const Value *V) {
818
8.79k
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))1.29k
;
819
8.79k
    }
820
821
2.50k
    GlobalVariable *getName() const {
822
2.50k
      return cast<GlobalVariable>(
823
2.50k
          const_cast<Value *>(getArgOperand(0))->stripPointerCasts());
824
2.50k
    }
825
826
406
    ConstantInt *getHash() const {
827
406
      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(1)));
828
406
    }
829
830
397
    ConstantInt *getNumCounters() const {
831
397
      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(2)));
832
397
    }
833
834
864
    ConstantInt *getIndex() const {
835
864
      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(3)));
836
864
    }
837
838
    Value *getStep() const;
839
  };
840
841
  class InstrProfIncrementInstStep : public InstrProfIncrementInst {
842
  public:
843
2.62k
    static bool classof(const IntrinsicInst *I) {
844
2.62k
      return I->getIntrinsicID() == Intrinsic::instrprof_increment_step;
845
2.62k
    }
846
6.82k
    static bool classof(const Value *V) {
847
6.82k
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))902
;
848
6.82k
    }
849
  };
850
851
  /// This represents the llvm.instrprof_value_profile intrinsic.
852
  class InstrProfValueProfileInst : public IntrinsicInst {
853
  public:
854
940
    static bool classof(const IntrinsicInst *I) {
855
940
      return I->getIntrinsicID() == Intrinsic::instrprof_value_profile;
856
940
    }
857
12.7k
    static bool classof(const Value *V) {
858
12.7k
      return isa<IntrinsicInst>(V) && 
classof(cast<IntrinsicInst>(V))940
;
859
12.7k
    }
860
861
36
    GlobalVariable *getName() const {
862
36
      return cast<GlobalVariable>(
863
36
          const_cast<Value *>(getArgOperand(0))->stripPointerCasts());
864
36
    }
865
866
0
    ConstantInt *getHash() const {
867
0
      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(1)));
868
0
    }
869
870
18
    Value *getTargetValue() const {
871
18
      return cast<Value>(const_cast<Value *>(getArgOperand(2)));
872
18
    }
873
874
54
    ConstantInt *getValueKind() const {
875
54
      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(3)));
876
54
    }
877
878
    // Returns the value site index.
879
36
    ConstantInt *getIndex() const {
880
36
      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(4)));
881
36
    }
882
  };
883
884
} // end namespace llvm
885
886
#endif // LLVM_IR_INTRINSICINST_H