LLVM  14.0.0git
InstrTypes.h
Go to the documentation of this file.
1 //===- llvm/InstrTypes.h - Important Instruction subclasses -----*- 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 various meta classes of instructions that exist in the VM
10 // representation. Specific concrete subclasses of these may be found in the
11 // i*.h files...
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_INSTRTYPES_H
16 #define LLVM_IR_INSTRTYPES_H
17 
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/None.h"
20 #include "llvm/ADT/Optional.h"
21 #include "llvm/ADT/STLExtras.h"
22 #include "llvm/ADT/Sequence.h"
23 #include "llvm/ADT/StringMap.h"
24 #include "llvm/ADT/StringRef.h"
25 #include "llvm/ADT/Twine.h"
27 #include "llvm/IR/Attributes.h"
28 #include "llvm/IR/CallingConv.h"
29 #include "llvm/IR/Constants.h"
30 #include "llvm/IR/DerivedTypes.h"
31 #include "llvm/IR/Function.h"
32 #include "llvm/IR/Instruction.h"
33 #include "llvm/IR/LLVMContext.h"
34 #include "llvm/IR/OperandTraits.h"
35 #include "llvm/IR/Type.h"
36 #include "llvm/IR/User.h"
37 #include "llvm/IR/Value.h"
38 #include "llvm/Support/Casting.h"
40 #include <algorithm>
41 #include <cassert>
42 #include <cstddef>
43 #include <cstdint>
44 #include <iterator>
45 #include <string>
46 #include <vector>
47 
48 namespace llvm {
49 
50 namespace Intrinsic {
51 typedef unsigned ID;
52 }
53 
54 //===----------------------------------------------------------------------===//
55 // UnaryInstruction Class
56 //===----------------------------------------------------------------------===//
57 
58 class UnaryInstruction : public Instruction {
59 protected:
60  UnaryInstruction(Type *Ty, unsigned iType, Value *V,
61  Instruction *IB = nullptr)
62  : Instruction(Ty, iType, &Op<0>(), 1, IB) {
63  Op<0>() = V;
64  }
65  UnaryInstruction(Type *Ty, unsigned iType, Value *V, BasicBlock *IAE)
66  : Instruction(Ty, iType, &Op<0>(), 1, IAE) {
67  Op<0>() = V;
68  }
69 
70 public:
71  // allocate space for exactly one operand
72  void *operator new(size_t S) { return User::operator new(S, 1); }
73  void operator delete(void *Ptr) { User::operator delete(Ptr); }
74 
75  /// Transparently provide more efficient getOperand methods.
77 
78  // Methods for support type inquiry through isa, cast, and dyn_cast:
79  static bool classof(const Instruction *I) {
80  return I->isUnaryOp() ||
81  I->getOpcode() == Instruction::Alloca ||
82  I->getOpcode() == Instruction::Load ||
83  I->getOpcode() == Instruction::VAArg ||
84  I->getOpcode() == Instruction::ExtractValue ||
85  (I->getOpcode() >= CastOpsBegin && I->getOpcode() < CastOpsEnd);
86  }
87  static bool classof(const Value *V) {
88  return isa<Instruction>(V) && classof(cast<Instruction>(V));
89  }
90 };
91 
92 template <>
94  public FixedNumOperandTraits<UnaryInstruction, 1> {
95 };
96 
98 
99 //===----------------------------------------------------------------------===//
100 // UnaryOperator Class
101 //===----------------------------------------------------------------------===//
102 
104  void AssertOK();
105 
106 protected:
107  UnaryOperator(UnaryOps iType, Value *S, Type *Ty,
108  const Twine &Name, Instruction *InsertBefore);
109  UnaryOperator(UnaryOps iType, Value *S, Type *Ty,
110  const Twine &Name, BasicBlock *InsertAtEnd);
111 
112  // Note: Instruction needs to be a friend here to call cloneImpl.
113  friend class Instruction;
114 
115  UnaryOperator *cloneImpl() const;
116 
117 public:
118 
119  /// Construct a unary instruction, given the opcode and an operand.
120  /// Optionally (if InstBefore is specified) insert the instruction
121  /// into a BasicBlock right before the specified instruction. The specified
122  /// Instruction is allowed to be a dereferenced end iterator.
123  ///
124  static UnaryOperator *Create(UnaryOps Op, Value *S,
125  const Twine &Name = Twine(),
126  Instruction *InsertBefore = nullptr);
127 
128  /// Construct a unary instruction, given the opcode and an operand.
129  /// Also automatically insert this instruction to the end of the
130  /// BasicBlock specified.
131  ///
132  static UnaryOperator *Create(UnaryOps Op, Value *S,
133  const Twine &Name,
134  BasicBlock *InsertAtEnd);
135 
136  /// These methods just forward to Create, and are useful when you
137  /// statically know what type of instruction you're going to create. These
138  /// helpers just save some typing.
139 #define HANDLE_UNARY_INST(N, OPC, CLASS) \
140  static UnaryOperator *Create##OPC(Value *V, const Twine &Name = "") {\
141  return Create(Instruction::OPC, V, Name);\
142  }
143 #include "llvm/IR/Instruction.def"
144 #define HANDLE_UNARY_INST(N, OPC, CLASS) \
145  static UnaryOperator *Create##OPC(Value *V, const Twine &Name, \
146  BasicBlock *BB) {\
147  return Create(Instruction::OPC, V, Name, BB);\
148  }
149 #include "llvm/IR/Instruction.def"
150 #define HANDLE_UNARY_INST(N, OPC, CLASS) \
151  static UnaryOperator *Create##OPC(Value *V, const Twine &Name, \
152  Instruction *I) {\
153  return Create(Instruction::OPC, V, Name, I);\
154  }
155 #include "llvm/IR/Instruction.def"
156 
157  static UnaryOperator *
159  const Twine &Name = "",
160  Instruction *InsertBefore = nullptr) {
161  UnaryOperator *UO = Create(Opc, V, Name, InsertBefore);
162  UO->copyIRFlags(CopyO);
163  return UO;
164  }
165 
167  const Twine &Name = "",
168  Instruction *InsertBefore = nullptr) {
169  return CreateWithCopiedFlags(Instruction::FNeg, Op, FMFSource, Name,
170  InsertBefore);
171  }
172 
173  UnaryOps getOpcode() const {
174  return static_cast<UnaryOps>(Instruction::getOpcode());
175  }
176 
177  // Methods for support type inquiry through isa, cast, and dyn_cast:
178  static bool classof(const Instruction *I) {
179  return I->isUnaryOp();
180  }
181  static bool classof(const Value *V) {
182  return isa<Instruction>(V) && classof(cast<Instruction>(V));
183  }
184 };
185 
186 //===----------------------------------------------------------------------===//
187 // BinaryOperator Class
188 //===----------------------------------------------------------------------===//
189 
190 class BinaryOperator : public Instruction {
191  void AssertOK();
192 
193 protected:
194  BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
195  const Twine &Name, Instruction *InsertBefore);
196  BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
197  const Twine &Name, BasicBlock *InsertAtEnd);
198 
199  // Note: Instruction needs to be a friend here to call cloneImpl.
200  friend class Instruction;
201 
202  BinaryOperator *cloneImpl() const;
203 
204 public:
205  // allocate space for exactly two operands
206  void *operator new(size_t S) { return User::operator new(S, 2); }
207  void operator delete(void *Ptr) { User::operator delete(Ptr); }
208 
209  /// Transparently provide more efficient getOperand methods.
211 
212  /// Construct a binary instruction, given the opcode and the two
213  /// operands. Optionally (if InstBefore is specified) insert the instruction
214  /// into a BasicBlock right before the specified instruction. The specified
215  /// Instruction is allowed to be a dereferenced end iterator.
216  ///
217  static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
218  const Twine &Name = Twine(),
219  Instruction *InsertBefore = nullptr);
220 
221  /// Construct a binary instruction, given the opcode and the two
222  /// operands. Also automatically insert this instruction to the end of the
223  /// BasicBlock specified.
224  ///
225  static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
226  const Twine &Name, BasicBlock *InsertAtEnd);
227 
228  /// These methods just forward to Create, and are useful when you
229  /// statically know what type of instruction you're going to create. These
230  /// helpers just save some typing.
231 #define HANDLE_BINARY_INST(N, OPC, CLASS) \
232  static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
233  const Twine &Name = "") {\
234  return Create(Instruction::OPC, V1, V2, Name);\
235  }
236 #include "llvm/IR/Instruction.def"
237 #define HANDLE_BINARY_INST(N, OPC, CLASS) \
238  static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
239  const Twine &Name, BasicBlock *BB) {\
240  return Create(Instruction::OPC, V1, V2, Name, BB);\
241  }
242 #include "llvm/IR/Instruction.def"
243 #define HANDLE_BINARY_INST(N, OPC, CLASS) \
244  static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
245  const Twine &Name, Instruction *I) {\
246  return Create(Instruction::OPC, V1, V2, Name, I);\
247  }
248 #include "llvm/IR/Instruction.def"
249 
250  static BinaryOperator *
252  const Twine &Name = "",
253  Instruction *InsertBefore = nullptr) {
254  BinaryOperator *BO = Create(Opc, V1, V2, Name, InsertBefore);
255  BO->copyIRFlags(CopyO);
256  return BO;
257  }
258 
260  Instruction *FMFSource,
261  const Twine &Name = "") {
262  return CreateWithCopiedFlags(Instruction::FAdd, V1, V2, FMFSource, Name);
263  }
265  Instruction *FMFSource,
266  const Twine &Name = "") {
267  return CreateWithCopiedFlags(Instruction::FSub, V1, V2, FMFSource, Name);
268  }
270  Instruction *FMFSource,
271  const Twine &Name = "") {
272  return CreateWithCopiedFlags(Instruction::FMul, V1, V2, FMFSource, Name);
273  }
275  Instruction *FMFSource,
276  const Twine &Name = "") {
277  return CreateWithCopiedFlags(Instruction::FDiv, V1, V2, FMFSource, Name);
278  }
280  Instruction *FMFSource,
281  const Twine &Name = "") {
282  return CreateWithCopiedFlags(Instruction::FRem, V1, V2, FMFSource, Name);
283  }
284 
286  const Twine &Name = "") {
287  BinaryOperator *BO = Create(Opc, V1, V2, Name);
288  BO->setHasNoSignedWrap(true);
289  return BO;
290  }
292  const Twine &Name, BasicBlock *BB) {
293  BinaryOperator *BO = Create(Opc, V1, V2, Name, BB);
294  BO->setHasNoSignedWrap(true);
295  return BO;
296  }
298  const Twine &Name, Instruction *I) {
299  BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
300  BO->setHasNoSignedWrap(true);
301  return BO;
302  }
303 
305  const Twine &Name = "") {
306  BinaryOperator *BO = Create(Opc, V1, V2, Name);
307  BO->setHasNoUnsignedWrap(true);
308  return BO;
309  }
311  const Twine &Name, BasicBlock *BB) {
312  BinaryOperator *BO = Create(Opc, V1, V2, Name, BB);
313  BO->setHasNoUnsignedWrap(true);
314  return BO;
315  }
317  const Twine &Name, Instruction *I) {
318  BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
319  BO->setHasNoUnsignedWrap(true);
320  return BO;
321  }
322 
324  const Twine &Name = "") {
325  BinaryOperator *BO = Create(Opc, V1, V2, Name);
326  BO->setIsExact(true);
327  return BO;
328  }
330  const Twine &Name, BasicBlock *BB) {
331  BinaryOperator *BO = Create(Opc, V1, V2, Name, BB);
332  BO->setIsExact(true);
333  return BO;
334  }
336  const Twine &Name, Instruction *I) {
337  BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
338  BO->setIsExact(true);
339  return BO;
340  }
341 
342 #define DEFINE_HELPERS(OPC, NUWNSWEXACT) \
343  static BinaryOperator *Create##NUWNSWEXACT##OPC(Value *V1, Value *V2, \
344  const Twine &Name = "") { \
345  return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name); \
346  } \
347  static BinaryOperator *Create##NUWNSWEXACT##OPC( \
348  Value *V1, Value *V2, const Twine &Name, BasicBlock *BB) { \
349  return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, BB); \
350  } \
351  static BinaryOperator *Create##NUWNSWEXACT##OPC( \
352  Value *V1, Value *V2, const Twine &Name, Instruction *I) { \
353  return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, I); \
354  }
355 
356  DEFINE_HELPERS(Add, NSW) // CreateNSWAdd
357  DEFINE_HELPERS(Add, NUW) // CreateNUWAdd
358  DEFINE_HELPERS(Sub, NSW) // CreateNSWSub
359  DEFINE_HELPERS(Sub, NUW) // CreateNUWSub
360  DEFINE_HELPERS(Mul, NSW) // CreateNSWMul
361  DEFINE_HELPERS(Mul, NUW) // CreateNUWMul
362  DEFINE_HELPERS(Shl, NSW) // CreateNSWShl
363  DEFINE_HELPERS(Shl, NUW) // CreateNUWShl
364 
365  DEFINE_HELPERS(SDiv, Exact) // CreateExactSDiv
366  DEFINE_HELPERS(UDiv, Exact) // CreateExactUDiv
367  DEFINE_HELPERS(AShr, Exact) // CreateExactAShr
368  DEFINE_HELPERS(LShr, Exact) // CreateExactLShr
369 
370 #undef DEFINE_HELPERS
371 
372  /// Helper functions to construct and inspect unary operations (NEG and NOT)
373  /// via binary operators SUB and XOR:
374  ///
375  /// Create the NEG and NOT instructions out of SUB and XOR instructions.
376  ///
377  static BinaryOperator *CreateNeg(Value *Op, const Twine &Name = "",
378  Instruction *InsertBefore = nullptr);
379  static BinaryOperator *CreateNeg(Value *Op, const Twine &Name,
380  BasicBlock *InsertAtEnd);
381  static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name = "",
382  Instruction *InsertBefore = nullptr);
383  static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name,
384  BasicBlock *InsertAtEnd);
385  static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name = "",
386  Instruction *InsertBefore = nullptr);
387  static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name,
388  BasicBlock *InsertAtEnd);
389  static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
390  Instruction *InsertBefore = nullptr);
391  static BinaryOperator *CreateNot(Value *Op, const Twine &Name,
392  BasicBlock *InsertAtEnd);
393 
395  return static_cast<BinaryOps>(Instruction::getOpcode());
396  }
397 
398  /// Exchange the two operands to this instruction.
399  /// This instruction is safe to use on any binary instruction and
400  /// does not modify the semantics of the instruction. If the instruction
401  /// cannot be reversed (ie, it's a Div), then return true.
402  ///
403  bool swapOperands();
404 
405  // Methods for support type inquiry through isa, cast, and dyn_cast:
406  static bool classof(const Instruction *I) {
407  return I->isBinaryOp();
408  }
409  static bool classof(const Value *V) {
410  return isa<Instruction>(V) && classof(cast<Instruction>(V));
411  }
412 };
413 
414 template <>
416  public FixedNumOperandTraits<BinaryOperator, 2> {
417 };
418 
420 
421 //===----------------------------------------------------------------------===//
422 // CastInst Class
423 //===----------------------------------------------------------------------===//
424 
425 /// This is the base class for all instructions that perform data
426 /// casts. It is simply provided so that instruction category testing
427 /// can be performed with code like:
428 ///
429 /// if (isa<CastInst>(Instr)) { ... }
430 /// Base class of casting instructions.
431 class CastInst : public UnaryInstruction {
432 protected:
433  /// Constructor with insert-before-instruction semantics for subclasses
434  CastInst(Type *Ty, unsigned iType, Value *S,
435  const Twine &NameStr = "", Instruction *InsertBefore = nullptr)
436  : UnaryInstruction(Ty, iType, S, InsertBefore) {
437  setName(NameStr);
438  }
439  /// Constructor with insert-at-end-of-block semantics for subclasses
440  CastInst(Type *Ty, unsigned iType, Value *S,
441  const Twine &NameStr, BasicBlock *InsertAtEnd)
442  : UnaryInstruction(Ty, iType, S, InsertAtEnd) {
443  setName(NameStr);
444  }
445 
446 public:
447  /// Provides a way to construct any of the CastInst subclasses using an
448  /// opcode instead of the subclass's constructor. The opcode must be in the
449  /// CastOps category (Instruction::isCast(opcode) returns true). This
450  /// constructor has insert-before-instruction semantics to automatically
451  /// insert the new CastInst before InsertBefore (if it is non-null).
452  /// Construct any of the CastInst subclasses
453  static CastInst *Create(
454  Instruction::CastOps, ///< The opcode of the cast instruction
455  Value *S, ///< The value to be casted (operand 0)
456  Type *Ty, ///< The type to which cast should be made
457  const Twine &Name = "", ///< Name for the instruction
458  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
459  );
460  /// Provides a way to construct any of the CastInst subclasses using an
461  /// opcode instead of the subclass's constructor. The opcode must be in the
462  /// CastOps category. This constructor has insert-at-end-of-block semantics
463  /// to automatically insert the new CastInst at the end of InsertAtEnd (if
464  /// its non-null).
465  /// Construct any of the CastInst subclasses
466  static CastInst *Create(
467  Instruction::CastOps, ///< The opcode for the cast instruction
468  Value *S, ///< The value to be casted (operand 0)
469  Type *Ty, ///< The type to which operand is casted
470  const Twine &Name, ///< The name for the instruction
471  BasicBlock *InsertAtEnd ///< The block to insert the instruction into
472  );
473 
474  /// Create a ZExt or BitCast cast instruction
475  static CastInst *CreateZExtOrBitCast(
476  Value *S, ///< The value to be casted (operand 0)
477  Type *Ty, ///< The type to which cast should be made
478  const Twine &Name = "", ///< Name for the instruction
479  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
480  );
481 
482  /// Create a ZExt or BitCast cast instruction
483  static CastInst *CreateZExtOrBitCast(
484  Value *S, ///< The value to be casted (operand 0)
485  Type *Ty, ///< The type to which operand is casted
486  const Twine &Name, ///< The name for the instruction
487  BasicBlock *InsertAtEnd ///< The block to insert the instruction into
488  );
489 
490  /// Create a SExt or BitCast cast instruction
491  static CastInst *CreateSExtOrBitCast(
492  Value *S, ///< The value to be casted (operand 0)
493  Type *Ty, ///< The type to which cast should be made
494  const Twine &Name = "", ///< Name for the instruction
495  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
496  );
497 
498  /// Create a SExt or BitCast cast instruction
499  static CastInst *CreateSExtOrBitCast(
500  Value *S, ///< The value to be casted (operand 0)
501  Type *Ty, ///< The type to which operand is casted
502  const Twine &Name, ///< The name for the instruction
503  BasicBlock *InsertAtEnd ///< The block to insert the instruction into
504  );
505 
506  /// Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
507  static CastInst *CreatePointerCast(
508  Value *S, ///< The pointer value to be casted (operand 0)
509  Type *Ty, ///< The type to which operand is casted
510  const Twine &Name, ///< The name for the instruction
511  BasicBlock *InsertAtEnd ///< The block to insert the instruction into
512  );
513 
514  /// Create a BitCast, AddrSpaceCast or a PtrToInt cast instruction.
515  static CastInst *CreatePointerCast(
516  Value *S, ///< The pointer value to be casted (operand 0)
517  Type *Ty, ///< The type to which cast should be made
518  const Twine &Name = "", ///< Name for the instruction
519  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
520  );
521 
522  /// Create a BitCast or an AddrSpaceCast cast instruction.
523  static CastInst *CreatePointerBitCastOrAddrSpaceCast(
524  Value *S, ///< The pointer value to be casted (operand 0)
525  Type *Ty, ///< The type to which operand is casted
526  const Twine &Name, ///< The name for the instruction
527  BasicBlock *InsertAtEnd ///< The block to insert the instruction into
528  );
529 
530  /// Create a BitCast or an AddrSpaceCast cast instruction.
531  static CastInst *CreatePointerBitCastOrAddrSpaceCast(
532  Value *S, ///< The pointer value to be casted (operand 0)
533  Type *Ty, ///< The type to which cast should be made
534  const Twine &Name = "", ///< Name for the instruction
535  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
536  );
537 
538  /// Create a BitCast, a PtrToInt, or an IntToPTr cast instruction.
539  ///
540  /// If the value is a pointer type and the destination an integer type,
541  /// creates a PtrToInt cast. If the value is an integer type and the
542  /// destination a pointer type, creates an IntToPtr cast. Otherwise, creates
543  /// a bitcast.
544  static CastInst *CreateBitOrPointerCast(
545  Value *S, ///< The pointer value to be casted (operand 0)
546  Type *Ty, ///< The type to which cast should be made
547  const Twine &Name = "", ///< Name for the instruction
548  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
549  );
550 
551  /// Create a ZExt, BitCast, or Trunc for int -> int casts.
552  static CastInst *CreateIntegerCast(
553  Value *S, ///< The pointer value to be casted (operand 0)
554  Type *Ty, ///< The type to which cast should be made
555  bool isSigned, ///< Whether to regard S as signed or not
556  const Twine &Name = "", ///< Name for the instruction
557  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
558  );
559 
560  /// Create a ZExt, BitCast, or Trunc for int -> int casts.
561  static CastInst *CreateIntegerCast(
562  Value *S, ///< The integer value to be casted (operand 0)
563  Type *Ty, ///< The integer type to which operand is casted
564  bool isSigned, ///< Whether to regard S as signed or not
565  const Twine &Name, ///< The name for the instruction
566  BasicBlock *InsertAtEnd ///< The block to insert the instruction into
567  );
568 
569  /// Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
570  static CastInst *CreateFPCast(
571  Value *S, ///< The floating point value to be casted
572  Type *Ty, ///< The floating point type to cast to
573  const Twine &Name = "", ///< Name for the instruction
574  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
575  );
576 
577  /// Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
578  static CastInst *CreateFPCast(
579  Value *S, ///< The floating point value to be casted
580  Type *Ty, ///< The floating point type to cast to
581  const Twine &Name, ///< The name for the instruction
582  BasicBlock *InsertAtEnd ///< The block to insert the instruction into
583  );
584 
585  /// Create a Trunc or BitCast cast instruction
586  static CastInst *CreateTruncOrBitCast(
587  Value *S, ///< The value to be casted (operand 0)
588  Type *Ty, ///< The type to which cast should be made
589  const Twine &Name = "", ///< Name for the instruction
590  Instruction *InsertBefore = nullptr ///< Place to insert the instruction
591  );
592 
593  /// Create a Trunc or BitCast cast instruction
594  static CastInst *CreateTruncOrBitCast(
595  Value *S, ///< The value to be casted (operand 0)
596  Type *Ty, ///< The type to which operand is casted
597  const Twine &Name, ///< The name for the instruction
598  BasicBlock *InsertAtEnd ///< The block to insert the instruction into
599  );
600 
601  /// Check whether a bitcast between these types is valid
602  static bool isBitCastable(
603  Type *SrcTy, ///< The Type from which the value should be cast.
604  Type *DestTy ///< The Type to which the value should be cast.
605  );
606 
607  /// Check whether a bitcast, inttoptr, or ptrtoint cast between these
608  /// types is valid and a no-op.
609  ///
610  /// This ensures that any pointer<->integer cast has enough bits in the
611  /// integer and any other cast is a bitcast.
612  static bool isBitOrNoopPointerCastable(
613  Type *SrcTy, ///< The Type from which the value should be cast.
614  Type *DestTy, ///< The Type to which the value should be cast.
615  const DataLayout &DL);
616 
617  /// Returns the opcode necessary to cast Val into Ty using usual casting
618  /// rules.
619  /// Infer the opcode for cast operand and type
620  static Instruction::CastOps getCastOpcode(
621  const Value *Val, ///< The value to cast
622  bool SrcIsSigned, ///< Whether to treat the source as signed
623  Type *Ty, ///< The Type to which the value should be casted
624  bool DstIsSigned ///< Whether to treate the dest. as signed
625  );
626 
627  /// There are several places where we need to know if a cast instruction
628  /// only deals with integer source and destination types. To simplify that
629  /// logic, this method is provided.
630  /// @returns true iff the cast has only integral typed operand and dest type.
631  /// Determine if this is an integer-only cast.
632  bool isIntegerCast() const;
633 
634  /// A lossless cast is one that does not alter the basic value. It implies
635  /// a no-op cast but is more stringent, preventing things like int->float,
636  /// long->double, or int->ptr.
637  /// @returns true iff the cast is lossless.
638  /// Determine if this is a lossless cast.
639  bool isLosslessCast() const;
640 
641  /// A no-op cast is one that can be effected without changing any bits.
642  /// It implies that the source and destination types are the same size. The
643  /// DataLayout argument is to determine the pointer size when examining casts
644  /// involving Integer and Pointer types. They are no-op casts if the integer
645  /// is the same size as the pointer. However, pointer size varies with
646  /// platform. Note that a precondition of this method is that the cast is
647  /// legal - i.e. the instruction formed with these operands would verify.
648  static bool isNoopCast(
649  Instruction::CastOps Opcode, ///< Opcode of cast
650  Type *SrcTy, ///< SrcTy of cast
651  Type *DstTy, ///< DstTy of cast
652  const DataLayout &DL ///< DataLayout to get the Int Ptr type from.
653  );
654 
655  /// Determine if this cast is a no-op cast.
656  ///
657  /// \param DL is the DataLayout to determine pointer size.
658  bool isNoopCast(const DataLayout &DL) const;
659 
660  /// Determine how a pair of casts can be eliminated, if they can be at all.
661  /// This is a helper function for both CastInst and ConstantExpr.
662  /// @returns 0 if the CastInst pair can't be eliminated, otherwise
663  /// returns Instruction::CastOps value for a cast that can replace
664  /// the pair, casting SrcTy to DstTy.
665  /// Determine if a cast pair is eliminable
666  static unsigned isEliminableCastPair(
667  Instruction::CastOps firstOpcode, ///< Opcode of first cast
668  Instruction::CastOps secondOpcode, ///< Opcode of second cast
669  Type *SrcTy, ///< SrcTy of 1st cast
670  Type *MidTy, ///< DstTy of 1st cast & SrcTy of 2nd cast
671  Type *DstTy, ///< DstTy of 2nd cast
672  Type *SrcIntPtrTy, ///< Integer type corresponding to Ptr SrcTy, or null
673  Type *MidIntPtrTy, ///< Integer type corresponding to Ptr MidTy, or null
674  Type *DstIntPtrTy ///< Integer type corresponding to Ptr DstTy, or null
675  );
676 
677  /// Return the opcode of this CastInst
680  }
681 
682  /// Return the source type, as a convenience
683  Type* getSrcTy() const { return getOperand(0)->getType(); }
684  /// Return the destination type, as a convenience
685  Type* getDestTy() const { return getType(); }
686 
687  /// This method can be used to determine if a cast from SrcTy to DstTy using
688  /// Opcode op is valid or not.
689  /// @returns true iff the proposed cast is valid.
690  /// Determine if a cast is valid without creating one.
691  static bool castIsValid(Instruction::CastOps op, Type *SrcTy, Type *DstTy);
692  static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy) {
693  return castIsValid(op, S->getType(), DstTy);
694  }
695 
696  /// Methods for support type inquiry through isa, cast, and dyn_cast:
697  static bool classof(const Instruction *I) {
698  return I->isCast();
699  }
700  static bool classof(const Value *V) {
701  return isa<Instruction>(V) && classof(cast<Instruction>(V));
702  }
703 };
704 
705 //===----------------------------------------------------------------------===//
706 // CmpInst Class
707 //===----------------------------------------------------------------------===//
708 
709 /// This class is the base class for the comparison instructions.
710 /// Abstract base class of comparison instructions.
711 class CmpInst : public Instruction {
712 public:
713  /// This enumeration lists the possible predicates for CmpInst subclasses.
714  /// Values in the range 0-31 are reserved for FCmpInst, while values in the
715  /// range 32-64 are reserved for ICmpInst. This is necessary to ensure the
716  /// predicate values are not overlapping between the classes.
717  ///
718  /// Some passes (e.g. InstCombine) depend on the bit-wise characteristics of
719  /// FCMP_* values. Changing the bit patterns requires a potential change to
720  /// those passes.
721  enum Predicate : unsigned {
722  // Opcode U L G E Intuitive operation
723  FCMP_FALSE = 0, ///< 0 0 0 0 Always false (always folded)
724  FCMP_OEQ = 1, ///< 0 0 0 1 True if ordered and equal
725  FCMP_OGT = 2, ///< 0 0 1 0 True if ordered and greater than
726  FCMP_OGE = 3, ///< 0 0 1 1 True if ordered and greater than or equal
727  FCMP_OLT = 4, ///< 0 1 0 0 True if ordered and less than
728  FCMP_OLE = 5, ///< 0 1 0 1 True if ordered and less than or equal
729  FCMP_ONE = 6, ///< 0 1 1 0 True if ordered and operands are unequal
730  FCMP_ORD = 7, ///< 0 1 1 1 True if ordered (no nans)
731  FCMP_UNO = 8, ///< 1 0 0 0 True if unordered: isnan(X) | isnan(Y)
732  FCMP_UEQ = 9, ///< 1 0 0 1 True if unordered or equal
733  FCMP_UGT = 10, ///< 1 0 1 0 True if unordered or greater than
734  FCMP_UGE = 11, ///< 1 0 1 1 True if unordered, greater than, or equal
735  FCMP_ULT = 12, ///< 1 1 0 0 True if unordered or less than
736  FCMP_ULE = 13, ///< 1 1 0 1 True if unordered, less than, or equal
737  FCMP_UNE = 14, ///< 1 1 1 0 True if unordered or not equal
738  FCMP_TRUE = 15, ///< 1 1 1 1 Always true (always folded)
742  ICMP_EQ = 32, ///< equal
743  ICMP_NE = 33, ///< not equal
744  ICMP_UGT = 34, ///< unsigned greater than
745  ICMP_UGE = 35, ///< unsigned greater or equal
746  ICMP_ULT = 36, ///< unsigned less than
747  ICMP_ULE = 37, ///< unsigned less or equal
748  ICMP_SGT = 38, ///< signed greater than
749  ICMP_SGE = 39, ///< signed greater or equal
750  ICMP_SLT = 40, ///< signed less than
751  ICMP_SLE = 41, ///< signed less or equal
755  };
756  using PredicateField =
758 
759  /// Returns the sequence of all FCmp predicates.
760  static auto FCmpPredicates() {
761  return enum_seq_inclusive(Predicate::FIRST_FCMP_PREDICATE,
762  Predicate::LAST_FCMP_PREDICATE,
764  }
765 
766  /// Returns the sequence of all ICmp predicates.
767  static auto ICmpPredicates() {
768  return enum_seq_inclusive(Predicate::FIRST_ICMP_PREDICATE,
769  Predicate::LAST_ICMP_PREDICATE,
771  }
772 
773 protected:
775  Value *LHS, Value *RHS, const Twine &Name = "",
776  Instruction *InsertBefore = nullptr,
777  Instruction *FlagsSource = nullptr);
778 
780  Value *LHS, Value *RHS, const Twine &Name,
781  BasicBlock *InsertAtEnd);
782 
783 public:
784  // allocate space for exactly two operands
785  void *operator new(size_t S) { return User::operator new(S, 2); }
786  void operator delete(void *Ptr) { User::operator delete(Ptr); }
787 
788  /// Construct a compare instruction, given the opcode, the predicate and
789  /// the two operands. Optionally (if InstBefore is specified) insert the
790  /// instruction into a BasicBlock right before the specified instruction.
791  /// The specified Instruction is allowed to be a dereferenced end iterator.
792  /// Create a CmpInst
793  static CmpInst *Create(OtherOps Op,
794  Predicate predicate, Value *S1,
795  Value *S2, const Twine &Name = "",
796  Instruction *InsertBefore = nullptr);
797 
798  /// Construct a compare instruction, given the opcode, the predicate and the
799  /// two operands. Also automatically insert this instruction to the end of
800  /// the BasicBlock specified.
801  /// Create a CmpInst
802  static CmpInst *Create(OtherOps Op, Predicate predicate, Value *S1,
803  Value *S2, const Twine &Name, BasicBlock *InsertAtEnd);
804 
805  /// Get the opcode casted to the right type
806  OtherOps getOpcode() const {
807  return static_cast<OtherOps>(Instruction::getOpcode());
808  }
809 
810  /// Return the predicate for this instruction.
811  Predicate getPredicate() const { return getSubclassData<PredicateField>(); }
812 
813  /// Set the predicate for this instruction to the specified value.
814  void setPredicate(Predicate P) { setSubclassData<PredicateField>(P); }
815 
816  static bool isFPPredicate(Predicate P) {
817  static_assert(FIRST_FCMP_PREDICATE == 0,
818  "FIRST_FCMP_PREDICATE is required to be 0");
819  return P <= LAST_FCMP_PREDICATE;
820  }
821 
822  static bool isIntPredicate(Predicate P) {
824  }
825 
827 
828  bool isFPPredicate() const { return isFPPredicate(getPredicate()); }
829  bool isIntPredicate() const { return isIntPredicate(getPredicate()); }
830 
831  /// For example, EQ -> NE, UGT -> ULE, SLT -> SGE,
832  /// OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
833  /// @returns the inverse predicate for the instruction's current predicate.
834  /// Return the inverse of the instruction's predicate.
837  }
838 
839  /// For example, EQ -> NE, UGT -> ULE, SLT -> SGE,
840  /// OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
841  /// @returns the inverse predicate for predicate provided in \p pred.
842  /// Return the inverse of a given predicate
844 
845  /// For example, EQ->EQ, SLE->SGE, ULT->UGT,
846  /// OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
847  /// @returns the predicate that would be the result of exchanging the two
848  /// operands of the CmpInst instruction without changing the result
849  /// produced.
850  /// Return the predicate as if the operands were swapped
853  }
854 
855  /// This is a static version that you can use without an instruction
856  /// available.
857  /// Return the predicate as if the operands were swapped.
859 
860  /// This is a static version that you can use without an instruction
861  /// available.
862  /// @returns true if the comparison predicate is strict, false otherwise.
863  static bool isStrictPredicate(Predicate predicate);
864 
865  /// @returns true if the comparison predicate is strict, false otherwise.
866  /// Determine if this instruction is using an strict comparison predicate.
868 
869  /// This is a static version that you can use without an instruction
870  /// available.
871  /// @returns true if the comparison predicate is non-strict, false otherwise.
872  static bool isNonStrictPredicate(Predicate predicate);
873 
874  /// @returns true if the comparison predicate is non-strict, false otherwise.
875  /// Determine if this instruction is using an non-strict comparison predicate.
876  bool isNonStrictPredicate() const {
878  }
879 
880  /// For example, SGE -> SGT, SLE -> SLT, ULE -> ULT, UGE -> UGT.
881  /// Returns the strict version of non-strict comparisons.
884  }
885 
886  /// This is a static version that you can use without an instruction
887  /// available.
888  /// @returns the strict version of comparison provided in \p pred.
889  /// If \p pred is not a strict comparison predicate, returns \p pred.
890  /// Returns the strict version of non-strict comparisons.
892 
893  /// For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.
894  /// Returns the non-strict version of strict comparisons.
897  }
898 
899  /// This is a static version that you can use without an instruction
900  /// available.
901  /// @returns the non-strict version of comparison provided in \p pred.
902  /// If \p pred is not a strict comparison predicate, returns \p pred.
903  /// Returns the non-strict version of strict comparisons.
905 
906  /// This is a static version that you can use without an instruction
907  /// available.
908  /// Return the flipped strictness of predicate
910 
911  /// For predicate of kind "is X or equal to 0" returns the predicate "is X".
912  /// For predicate of kind "is X" returns the predicate "is X or equal to 0".
913  /// does not support other kind of predicates.
914  /// @returns the predicate that does not contains is equal to zero if
915  /// it had and vice versa.
916  /// Return the flipped strictness of predicate
919  }
920 
921  /// Provide more efficient getOperand methods.
923 
924  /// This is just a convenience that dispatches to the subclasses.
925  /// Swap the operands and adjust predicate accordingly to retain
926  /// the same comparison.
927  void swapOperands();
928 
929  /// This is just a convenience that dispatches to the subclasses.
930  /// Determine if this CmpInst is commutative.
931  bool isCommutative() const;
932 
933  /// Determine if this is an equals/not equals predicate.
934  /// This is a static version that you can use without an instruction
935  /// available.
936  static bool isEquality(Predicate pred);
937 
938  /// Determine if this is an equals/not equals predicate.
939  bool isEquality() const { return isEquality(getPredicate()); }
940 
941  /// Return true if the predicate is relational (not EQ or NE).
942  static bool isRelational(Predicate P) { return !isEquality(P); }
943 
944  /// Return true if the predicate is relational (not EQ or NE).
945  bool isRelational() const { return !isEquality(); }
946 
947  /// @returns true if the comparison is signed, false otherwise.
948  /// Determine if this instruction is using a signed comparison.
949  bool isSigned() const {
950  return isSigned(getPredicate());
951  }
952 
953  /// @returns true if the comparison is unsigned, false otherwise.
954  /// Determine if this instruction is using an unsigned comparison.
955  bool isUnsigned() const {
956  return isUnsigned(getPredicate());
957  }
958 
959  /// For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert
960  /// @returns the signed version of the unsigned predicate pred.
961  /// return the signed version of a predicate
963 
964  /// For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert
965  /// @returns the signed version of the predicate for this instruction (which
966  /// has to be an unsigned predicate).
967  /// return the signed version of a predicate
970  }
971 
972  /// For example, SLT->ULT, SLE->ULE, SGT->UGT, SGE->UGE, ULT->Failed assert
973  /// @returns the unsigned version of the signed predicate pred.
975 
976  /// For example, SLT->ULT, SLE->ULE, SGT->UGT, SGE->UGE, ULT->Failed assert
977  /// @returns the unsigned version of the predicate for this instruction (which
978  /// has to be an signed predicate).
979  /// return the unsigned version of a predicate
982  }
983 
984  /// For example, SLT->ULT, ULT->SLT, SLE->ULE, ULE->SLE, EQ->Failed assert
985  /// @returns the unsigned version of the signed predicate pred or
986  /// the signed version of the signed predicate pred.
988 
989  /// For example, SLT->ULT, ULT->SLT, SLE->ULE, ULE->SLE, EQ->Failed assert
990  /// @returns the unsigned version of the signed predicate pred or
991  /// the signed version of the signed predicate pred.
994  }
995 
996  /// This is just a convenience.
997  /// Determine if this is true when both operands are the same.
998  bool isTrueWhenEqual() const {
999  return isTrueWhenEqual(getPredicate());
1000  }
1001 
1002  /// This is just a convenience.
1003  /// Determine if this is false when both operands are the same.
1004  bool isFalseWhenEqual() const {
1005  return isFalseWhenEqual(getPredicate());
1006  }
1007 
1008  /// @returns true if the predicate is unsigned, false otherwise.
1009  /// Determine if the predicate is an unsigned operation.
1010  static bool isUnsigned(Predicate predicate);
1011 
1012  /// @returns true if the predicate is signed, false otherwise.
1013  /// Determine if the predicate is an signed operation.
1014  static bool isSigned(Predicate predicate);
1015 
1016  /// Determine if the predicate is an ordered operation.
1017  static bool isOrdered(Predicate predicate);
1018 
1019  /// Determine if the predicate is an unordered operation.
1020  static bool isUnordered(Predicate predicate);
1021 
1022  /// Determine if the predicate is true when comparing a value with itself.
1023  static bool isTrueWhenEqual(Predicate predicate);
1024 
1025  /// Determine if the predicate is false when comparing a value with itself.
1026  static bool isFalseWhenEqual(Predicate predicate);
1027 
1028  /// Determine if Pred1 implies Pred2 is true when two compares have matching
1029  /// operands.
1030  static bool isImpliedTrueByMatchingCmp(Predicate Pred1, Predicate Pred2);
1031 
1032  /// Determine if Pred1 implies Pred2 is false when two compares have matching
1033  /// operands.
1034  static bool isImpliedFalseByMatchingCmp(Predicate Pred1, Predicate Pred2);
1035 
1036  /// Methods for support type inquiry through isa, cast, and dyn_cast:
1037  static bool classof(const Instruction *I) {
1038  return I->getOpcode() == Instruction::ICmp ||
1039  I->getOpcode() == Instruction::FCmp;
1040  }
1041  static bool classof(const Value *V) {
1042  return isa<Instruction>(V) && classof(cast<Instruction>(V));
1043  }
1044 
1045  /// Create a result type for fcmp/icmp
1046  static Type* makeCmpResultType(Type* opnd_type) {
1047  if (VectorType* vt = dyn_cast<VectorType>(opnd_type)) {
1048  return VectorType::get(Type::getInt1Ty(opnd_type->getContext()),
1049  vt->getElementCount());
1050  }
1051  return Type::getInt1Ty(opnd_type->getContext());
1052  }
1053 
1054 private:
1055  // Shadow Value::setValueSubclassData with a private forwarding method so that
1056  // subclasses cannot accidentally use it.
1057  void setValueSubclassData(unsigned short D) {
1059  }
1060 };
1061 
1062 // FIXME: these are redundant if CmpInst < BinaryOperator
1063 template <>
1064 struct OperandTraits<CmpInst> : public FixedNumOperandTraits<CmpInst, 2> {
1065 };
1066 
1068 
1069 /// A lightweight accessor for an operand bundle meant to be passed
1070 /// around by value.
1073 
1074  OperandBundleUse() = default;
1076  : Inputs(Inputs), Tag(Tag) {}
1077 
1078  /// Return true if the operand at index \p Idx in this operand bundle
1079  /// has the attribute A.
1080  bool operandHasAttr(unsigned Idx, Attribute::AttrKind A) const {
1081  if (isDeoptOperandBundle())
1082  if (A == Attribute::ReadOnly || A == Attribute::NoCapture)
1083  return Inputs[Idx]->getType()->isPointerTy();
1084 
1085  // Conservative answer: no operands have any attributes.
1086  return false;
1087  }
1088 
1089  /// Return the tag of this operand bundle as a string.
1091  return Tag->getKey();
1092  }
1093 
1094  /// Return the tag of this operand bundle as an integer.
1095  ///
1096  /// Operand bundle tags are interned by LLVMContextImpl::getOrInsertBundleTag,
1097  /// and this function returns the unique integer getOrInsertBundleTag
1098  /// associated the tag of this operand bundle to.
1099  uint32_t getTagID() const {
1100  return Tag->getValue();
1101  }
1102 
1103  /// Return true if this is a "deopt" operand bundle.
1104  bool isDeoptOperandBundle() const {
1105  return getTagID() == LLVMContext::OB_deopt;
1106  }
1107 
1108  /// Return true if this is a "funclet" operand bundle.
1109  bool isFuncletOperandBundle() const {
1110  return getTagID() == LLVMContext::OB_funclet;
1111  }
1112 
1113  /// Return true if this is a "cfguardtarget" operand bundle.
1115  return getTagID() == LLVMContext::OB_cfguardtarget;
1116  }
1117 
1118 private:
1119  /// Pointer to an entry in LLVMContextImpl::getOrInsertBundleTag.
1121 };
1122 
1123 /// A container for an operand bundle being viewed as a set of values
1124 /// rather than a set of uses.
1125 ///
1126 /// Unlike OperandBundleUse, OperandBundleDefT owns the memory it carries, and
1127 /// so it is possible to create and pass around "self-contained" instances of
1128 /// OperandBundleDef and ConstOperandBundleDef.
1129 template <typename InputTy> class OperandBundleDefT {
1130  std::string Tag;
1131  std::vector<InputTy> Inputs;
1132 
1133 public:
1134  explicit OperandBundleDefT(std::string Tag, std::vector<InputTy> Inputs)
1135  : Tag(std::move(Tag)), Inputs(std::move(Inputs)) {}
1136  explicit OperandBundleDefT(std::string Tag, ArrayRef<InputTy> Inputs)
1137  : Tag(std::move(Tag)), Inputs(Inputs) {}
1138 
1139  explicit OperandBundleDefT(const OperandBundleUse &OBU) {
1140  Tag = std::string(OBU.getTagName());
1141  llvm::append_range(Inputs, OBU.Inputs);
1142  }
1143 
1144  ArrayRef<InputTy> inputs() const { return Inputs; }
1145 
1146  using input_iterator = typename std::vector<InputTy>::const_iterator;
1147 
1148  size_t input_size() const { return Inputs.size(); }
1149  input_iterator input_begin() const { return Inputs.begin(); }
1150  input_iterator input_end() const { return Inputs.end(); }
1151 
1152  StringRef getTag() const { return Tag; }
1153 };
1154 
1157 
1158 //===----------------------------------------------------------------------===//
1159 // CallBase Class
1160 //===----------------------------------------------------------------------===//
1161 
1162 /// Base class for all callable instructions (InvokeInst and CallInst)
1163 /// Holds everything related to calling a function.
1164 ///
1165 /// All call-like instructions are required to use a common operand layout:
1166 /// - Zero or more arguments to the call,
1167 /// - Zero or more operand bundles with zero or more operand inputs each
1168 /// bundle,
1169 /// - Zero or more subclass controlled operands
1170 /// - The called function.
1171 ///
1172 /// This allows this base class to easily access the called function and the
1173 /// start of the arguments without knowing how many other operands a particular
1174 /// subclass requires. Note that accessing the end of the argument list isn't
1175 /// as cheap as most other operations on the base class.
1176 class CallBase : public Instruction {
1177 protected:
1178  // The first two bits are reserved by CallInst for fast retrieval,
1180  using CallingConvField =
1183  static_assert(
1184  Bitfield::areContiguous<CallInstReservedField, CallingConvField>(),
1185  "Bitfields must be contiguous");
1186 
1187  /// The last operand is the called operand.
1188  static constexpr int CalledOperandOpEndIdx = -1;
1189 
1190  AttributeList Attrs; ///< parameter attributes for callable
1192 
1193  template <class... ArgsTy>
1194  CallBase(AttributeList const &A, FunctionType *FT, ArgsTy &&... Args)
1195  : Instruction(std::forward<ArgsTy>(Args)...), Attrs(A), FTy(FT) {}
1196 
1198 
1199  bool hasDescriptor() const { return Value::HasDescriptor; }
1200 
1201  unsigned getNumSubclassExtraOperands() const {
1202  switch (getOpcode()) {
1203  case Instruction::Call:
1204  return 0;
1205  case Instruction::Invoke:
1206  return 2;
1207  case Instruction::CallBr:
1209  }
1210  llvm_unreachable("Invalid opcode!");
1211  }
1212 
1213  /// Get the number of extra operands for instructions that don't have a fixed
1214  /// number of extra operands.
1215  unsigned getNumSubclassExtraOperandsDynamic() const;
1216 
1217 public:
1219 
1220  /// Create a clone of \p CB with a different set of operand bundles and
1221  /// insert it before \p InsertPt.
1222  ///
1223  /// The returned call instruction is identical \p CB in every way except that
1224  /// the operand bundles for the new instruction are set to the operand bundles
1225  /// in \p Bundles.
1226  static CallBase *Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
1227  Instruction *InsertPt = nullptr);
1228 
1229  /// Create a clone of \p CB with the operand bundle with the tag matching
1230  /// \p Bundle's tag replaced with Bundle, and insert it before \p InsertPt.
1231  ///
1232  /// The returned call instruction is identical \p CI in every way except that
1233  /// the specified operand bundle has been replaced.
1234  static CallBase *Create(CallBase *CB,
1235  OperandBundleDef Bundle,
1236  Instruction *InsertPt = nullptr);
1237 
1238  /// Create a clone of \p CB with operand bundle \p OB added.
1241  Instruction *InsertPt = nullptr);
1242 
1243  /// Create a clone of \p CB with operand bundle \p ID removed.
1245  Instruction *InsertPt = nullptr);
1246 
1247  static bool classof(const Instruction *I) {
1248  return I->getOpcode() == Instruction::Call ||
1249  I->getOpcode() == Instruction::Invoke ||
1250  I->getOpcode() == Instruction::CallBr;
1251  }
1252  static bool classof(const Value *V) {
1253  return isa<Instruction>(V) && classof(cast<Instruction>(V));
1254  }
1255 
1256  FunctionType *getFunctionType() const { return FTy; }
1257 
1260  this->FTy = FTy;
1261  }
1262 
1264 
1265  /// data_operands_begin/data_operands_end - Return iterators iterating over
1266  /// the call / invoke argument list and bundle operands. For invokes, this is
1267  /// the set of instruction operands except the invoke target and the two
1268  /// successor blocks; and for calls this is the set of instruction operands
1269  /// except the call target.
1272  return const_cast<CallBase *>(this)->data_operands_begin();
1273  }
1275  // Walk from the end of the operands over the called operand and any
1276  // subclass operands.
1277  return op_end() - getNumSubclassExtraOperands() - 1;
1278  }
1280  return const_cast<CallBase *>(this)->data_operands_end();
1281  }
1284  }
1287  }
1288  bool data_operands_empty() const {
1289  return data_operands_end() == data_operands_begin();
1290  }
1291  unsigned data_operands_size() const {
1292  return std::distance(data_operands_begin(), data_operands_end());
1293  }
1294 
1295  bool isDataOperand(const Use *U) const {
1296  assert(this == U->getUser() &&
1297  "Only valid to query with a use of this instruction!");
1298  return data_operands_begin() <= U && U < data_operands_end();
1299  }
1301  return isDataOperand(&UI.getUse());
1302  }
1303 
1304  /// Given a value use iterator, return the data operand corresponding to it.
1305  /// Iterator must actually correspond to a data operand.
1307  return getDataOperandNo(&UI.getUse());
1308  }
1309 
1310  /// Given a use for a data operand, get the data operand number that
1311  /// corresponds to it.
1312  unsigned getDataOperandNo(const Use *U) const {
1313  assert(isDataOperand(U) && "Data operand # out of range!");
1314  return U - data_operands_begin();
1315  }
1316 
1317  /// Return the iterator pointing to the beginning of the argument list.
1320  return const_cast<CallBase *>(this)->arg_begin();
1321  }
1322 
1323  /// Return the iterator pointing to the end of the argument list.
1325  // From the end of the data operands, walk backwards past the bundle
1326  // operands.
1328  }
1330  return const_cast<CallBase *>(this)->arg_end();
1331  }
1332 
1333  /// Iteration adapter for range-for loops.
1335  return make_range(arg_begin(), arg_end());
1336  }
1338  return make_range(arg_begin(), arg_end());
1339  }
1340  bool arg_empty() const { return arg_end() == arg_begin(); }
1341  unsigned arg_size() const { return arg_end() - arg_begin(); }
1342 
1343  Value *getArgOperand(unsigned i) const {
1344  assert(i < arg_size() && "Out of bounds!");
1345  return getOperand(i);
1346  }
1347 
1348  void setArgOperand(unsigned i, Value *v) {
1349  assert(i < arg_size() && "Out of bounds!");
1350  setOperand(i, v);
1351  }
1352 
1353  /// Wrappers for getting the \c Use of a call argument.
1354  const Use &getArgOperandUse(unsigned i) const {
1355  assert(i < arg_size() && "Out of bounds!");
1356  return User::getOperandUse(i);
1357  }
1358  Use &getArgOperandUse(unsigned i) {
1359  assert(i < arg_size() && "Out of bounds!");
1360  return User::getOperandUse(i);
1361  }
1362 
1363  bool isArgOperand(const Use *U) const {
1364  assert(this == U->getUser() &&
1365  "Only valid to query with a use of this instruction!");
1366  return arg_begin() <= U && U < arg_end();
1367  }
1369  return isArgOperand(&UI.getUse());
1370  }
1371 
1372  /// Given a use for a arg operand, get the arg operand number that
1373  /// corresponds to it.
1374  unsigned getArgOperandNo(const Use *U) const {
1375  assert(isArgOperand(U) && "Arg operand # out of range!");
1376  return U - arg_begin();
1377  }
1378 
1379  /// Given a value use iterator, return the arg operand number corresponding to
1380  /// it. Iterator must actually correspond to a data operand.
1382  return getArgOperandNo(&UI.getUse());
1383  }
1384 
1385  /// Returns true if this CallSite passes the given Value* as an argument to
1386  /// the called function.
1387  bool hasArgument(const Value *V) const {
1388  return llvm::is_contained(args(), V);
1389  }
1390 
1391  Value *getCalledOperand() const { return Op<CalledOperandOpEndIdx>(); }
1392 
1393  const Use &getCalledOperandUse() const { return Op<CalledOperandOpEndIdx>(); }
1394  Use &getCalledOperandUse() { return Op<CalledOperandOpEndIdx>(); }
1395 
1396  /// Returns the function called, or null if this is an
1397  /// indirect function invocation.
1399  return dyn_cast_or_null<Function>(getCalledOperand());
1400  }
1401 
1402  /// Return true if the callsite is an indirect call.
1403  bool isIndirectCall() const;
1404 
1405  /// Determine whether the passed iterator points to the callee operand's Use.
1407  return isCallee(&UI.getUse());
1408  }
1409 
1410  /// Determine whether this Use is the callee operand's Use.
1411  bool isCallee(const Use *U) const { return &getCalledOperandUse() == U; }
1412 
1413  /// Helper to get the caller (the parent function).
1414  Function *getCaller();
1415  const Function *getCaller() const {
1416  return const_cast<CallBase *>(this)->getCaller();
1417  }
1418 
1419  /// Tests if this call site must be tail call optimized. Only a CallInst can
1420  /// be tail call optimized.
1421  bool isMustTailCall() const;
1422 
1423  /// Tests if this call site is marked as a tail call.
1424  bool isTailCall() const;
1425 
1426  /// Returns the intrinsic ID of the intrinsic called or
1427  /// Intrinsic::not_intrinsic if the called function is not an intrinsic, or if
1428  /// this is an indirect call.
1429  Intrinsic::ID getIntrinsicID() const;
1430 
1431  void setCalledOperand(Value *V) { Op<CalledOperandOpEndIdx>() = V; }
1432 
1433  /// Sets the function called, including updating the function type.
1436  }
1437 
1438  /// Sets the function called, including updating the function type.
1441  }
1442 
1443  /// Sets the function called, including updating to the specified function
1444  /// type.
1446  this->FTy = FTy;
1447  assert(cast<PointerType>(Fn->getType())->isOpaqueOrPointeeTypeMatches(FTy));
1448  // This function doesn't mutate the return type, only the function
1449  // type. Seems broken, but I'm just gonna stick an assert in for now.
1450  assert(getType() == FTy->getReturnType());
1451  setCalledOperand(Fn);
1452  }
1453 
1455  return getSubclassData<CallingConvField>();
1456  }
1457 
1459  setSubclassData<CallingConvField>(CC);
1460  }
1461 
1462  /// Check if this call is an inline asm statement.
1463  bool isInlineAsm() const { return isa<InlineAsm>(getCalledOperand()); }
1464 
1465  /// \name Attribute API
1466  ///
1467  /// These methods access and modify attributes on this call (including
1468  /// looking through to the attributes on the called function when necessary).
1469  ///@{
1470 
1471  /// Return the parameter attributes for this call.
1472  ///
1473  AttributeList getAttributes() const { return Attrs; }
1474 
1475  /// Set the parameter attributes for this call.
1476  ///
1478 
1479  /// Determine whether this call has the given attribute. If it does not
1480  /// then determine if the called function has the attribute, but only if
1481  /// the attribute is allowed for the call.
1483  assert(Kind != Attribute::NoBuiltin &&
1484  "Use CallBase::isNoBuiltin() to check for Attribute::NoBuiltin");
1485  return hasFnAttrImpl(Kind);
1486  }
1487 
1488  /// Determine whether this call has the given attribute. If it does not
1489  /// then determine if the called function has the attribute, but only if
1490  /// the attribute is allowed for the call.
1491  bool hasFnAttr(StringRef Kind) const { return hasFnAttrImpl(Kind); }
1492 
1493  // TODO: remove non-AtIndex versions of these methods.
1494  /// adds the attribute to the list of attributes.
1497  }
1498 
1499  /// adds the attribute to the list of attributes.
1500  void addAttributeAtIndex(unsigned i, Attribute Attr) {
1502  }
1503 
1504  /// Adds the attribute to the function.
1507  }
1508 
1509  /// Adds the attribute to the function.
1510  void addFnAttr(Attribute Attr) {
1511  Attrs = Attrs.addFnAttribute(getContext(), Attr);
1512  }
1513 
1514  /// Adds the attribute to the return value.
1517  }
1518 
1519  /// Adds the attribute to the return value.
1520  void addRetAttr(Attribute Attr) {
1522  }
1523 
1524  /// Adds the attribute to the indicated argument
1525  void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) {
1526  assert(ArgNo < arg_size() && "Out of bounds");
1528  }
1529 
1530  /// Adds the attribute to the indicated argument
1531  void addParamAttr(unsigned ArgNo, Attribute Attr) {
1532  assert(ArgNo < arg_size() && "Out of bounds");
1533  Attrs = Attrs.addParamAttribute(getContext(), ArgNo, Attr);
1534  }
1535 
1536  /// removes the attribute from the list of attributes.
1539  }
1540 
1541  /// removes the attribute from the list of attributes.
1544  }
1545 
1546  /// Removes the attributes from the function
1547  void removeFnAttrs(const AttributeMask &AttrsToRemove) {
1548  Attrs = Attrs.removeFnAttributes(getContext(), AttrsToRemove);
1549  }
1550 
1551  /// Removes the attribute from the function
1554  }
1555 
1556  /// Removes the attribute from the return value
1559  }
1560 
1561  /// Removes the attributes from the return value
1562  void removeRetAttrs(const AttributeMask &AttrsToRemove) {
1563  Attrs = Attrs.removeRetAttributes(getContext(), AttrsToRemove);
1564  }
1565 
1566  /// Removes the attribute from the given argument
1567  void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) {
1568  assert(ArgNo < arg_size() && "Out of bounds");
1570  }
1571 
1572  /// Removes the attribute from the given argument
1573  void removeParamAttr(unsigned ArgNo, StringRef Kind) {
1574  assert(ArgNo < arg_size() && "Out of bounds");
1576  }
1577 
1578  /// Removes the attributes from the given argument
1579  void removeParamAttrs(unsigned ArgNo, const AttributeMask &AttrsToRemove) {
1580  Attrs = Attrs.removeParamAttributes(getContext(), ArgNo, AttrsToRemove);
1581  }
1582 
1583  /// adds the dereferenceable attribute to the list of attributes.
1584  void addDereferenceableParamAttr(unsigned i, uint64_t Bytes) {
1586  }
1587 
1588  /// adds the dereferenceable attribute to the list of attributes.
1591  }
1592 
1593  /// Determine whether the return value has the given attribute.
1595  return hasRetAttrImpl(Kind);
1596  }
1597  /// Determine whether the return value has the given attribute.
1598  bool hasRetAttr(StringRef Kind) const { return hasRetAttrImpl(Kind); }
1599 
1600  /// Determine whether the argument or parameter has the given attribute.
1601  bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const;
1602 
1603  /// Get the attribute of a given kind at a position.
1606  }
1607 
1608  /// Get the attribute of a given kind at a position.
1611  }
1612 
1613  /// Get the attribute of a given kind for the function.
1615  return getAttributes().getFnAttr(Kind);
1616  }
1617 
1618  /// Get the attribute of a given kind for the function.
1620  return getAttributes().getFnAttr(Kind);
1621  }
1622 
1623  /// Get the attribute of a given kind from a given arg
1625  assert(ArgNo < arg_size() && "Out of bounds");
1626  return getAttributes().getParamAttr(ArgNo, Kind);
1627  }
1628 
1629  /// Get the attribute of a given kind from a given arg
1630  Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const {
1631  assert(ArgNo < arg_size() && "Out of bounds");
1632  return getAttributes().getParamAttr(ArgNo, Kind);
1633  }
1634 
1635  /// Return true if the data operand at index \p i has the attribute \p
1636  /// A.
1637  ///
1638  /// Data operands include call arguments and values used in operand bundles,
1639  /// but does not include the callee operand.
1640  ///
1641  /// The index \p i is interpreted as
1642  ///
1643  /// \p i in [0, arg_size) -> argument number (\p i)
1644  /// \p i in [arg_size, data_operand_size) -> bundle operand at index
1645  /// (\p i) in the operand list.
1647  // Note that we have to add one because `i` isn't zero-indexed.
1649  "Data operand index out of bounds!");
1650 
1651  // The attribute A can either be directly specified, if the operand in
1652  // question is a call argument; or be indirectly implied by the kind of its
1653  // containing operand bundle, if the operand is a bundle operand.
1654 
1655  if (i < arg_size())
1656  return paramHasAttr(i, Kind);
1657 
1659  "Must be either a call argument or an operand bundle!");
1660  return bundleOperandHasAttr(i, Kind);
1661  }
1662 
1663  /// Determine whether this data operand is not captured.
1664  // FIXME: Once this API is no longer duplicated in `CallSite`, rename this to
1665  // better indicate that this may return a conservative answer.
1666  bool doesNotCapture(unsigned OpNo) const {
1667  return dataOperandHasImpliedAttr(OpNo, Attribute::NoCapture);
1668  }
1669 
1670  /// Determine whether this argument is passed by value.
1671  bool isByValArgument(unsigned ArgNo) const {
1672  return paramHasAttr(ArgNo, Attribute::ByVal);
1673  }
1674 
1675  /// Determine whether this argument is passed in an alloca.
1676  bool isInAllocaArgument(unsigned ArgNo) const {
1677  return paramHasAttr(ArgNo, Attribute::InAlloca);
1678  }
1679 
1680  /// Determine whether this argument is passed by value, in an alloca, or is
1681  /// preallocated.
1682  bool isPassPointeeByValueArgument(unsigned ArgNo) const {
1683  return paramHasAttr(ArgNo, Attribute::ByVal) ||
1684  paramHasAttr(ArgNo, Attribute::InAlloca) ||
1685  paramHasAttr(ArgNo, Attribute::Preallocated);
1686  }
1687 
1688  /// Determine whether passing undef to this argument is undefined behavior.
1689  /// If passing undef to this argument is UB, passing poison is UB as well
1690  /// because poison is more undefined than undef.
1691  bool isPassingUndefUB(unsigned ArgNo) const {
1692  return paramHasAttr(ArgNo, Attribute::NoUndef) ||
1693  // dereferenceable implies noundef.
1694  paramHasAttr(ArgNo, Attribute::Dereferenceable) ||
1695  // dereferenceable implies noundef, and null is a well-defined value.
1696  paramHasAttr(ArgNo, Attribute::DereferenceableOrNull);
1697  }
1698 
1699  /// Determine if there are is an inalloca argument. Only the last argument can
1700  /// have the inalloca attribute.
1701  bool hasInAllocaArgument() const {
1702  return !arg_empty() && paramHasAttr(arg_size() - 1, Attribute::InAlloca);
1703  }
1704 
1705  // FIXME: Once this API is no longer duplicated in `CallSite`, rename this to
1706  // better indicate that this may return a conservative answer.
1707  bool doesNotAccessMemory(unsigned OpNo) const {
1708  return dataOperandHasImpliedAttr(OpNo, Attribute::ReadNone);
1709  }
1710 
1711  // FIXME: Once this API is no longer duplicated in `CallSite`, rename this to
1712  // better indicate that this may return a conservative answer.
1713  bool onlyReadsMemory(unsigned OpNo) const {
1714  return dataOperandHasImpliedAttr(OpNo, Attribute::ReadOnly) ||
1715  dataOperandHasImpliedAttr(OpNo, Attribute::ReadNone);
1716  }
1717 
1718  // FIXME: Once this API is no longer duplicated in `CallSite`, rename this to
1719  // better indicate that this may return a conservative answer.
1720  bool onlyWritesMemory(unsigned OpNo) const {
1721  return dataOperandHasImpliedAttr(OpNo, Attribute::WriteOnly) ||
1722  dataOperandHasImpliedAttr(OpNo, Attribute::ReadNone);
1723  }
1724 
1725  /// Extract the alignment of the return value.
1727  if (auto Align = Attrs.getRetAlignment())
1728  return Align;
1729  if (const Function *F = getCalledFunction())
1730  return F->getAttributes().getRetAlignment();
1731  return None;
1732  }
1733 
1734  /// Extract the alignment for a call or parameter (0=unknown).
1735  MaybeAlign getParamAlign(unsigned ArgNo) const {
1736  return Attrs.getParamAlignment(ArgNo);
1737  }
1738 
1739  MaybeAlign getParamStackAlign(unsigned ArgNo) const {
1740  return Attrs.getParamStackAlignment(ArgNo);
1741  }
1742 
1743  /// Extract the byval type for a call or parameter.
1744  Type *getParamByValType(unsigned ArgNo) const {
1745  if (auto *Ty = Attrs.getParamByValType(ArgNo))
1746  return Ty;
1747  if (const Function *F = getCalledFunction())
1748  return F->getAttributes().getParamByValType(ArgNo);
1749  return nullptr;
1750  }
1751 
1752  /// Extract the preallocated type for a call or parameter.
1753  Type *getParamPreallocatedType(unsigned ArgNo) const {
1754  if (auto *Ty = Attrs.getParamPreallocatedType(ArgNo))
1755  return Ty;
1756  if (const Function *F = getCalledFunction())
1757  return F->getAttributes().getParamPreallocatedType(ArgNo);
1758  return nullptr;
1759  }
1760 
1761  /// Extract the preallocated type for a call or parameter.
1762  Type *getParamInAllocaType(unsigned ArgNo) const {
1763  if (auto *Ty = Attrs.getParamInAllocaType(ArgNo))
1764  return Ty;
1765  if (const Function *F = getCalledFunction())
1766  return F->getAttributes().getParamInAllocaType(ArgNo);
1767  return nullptr;
1768  }
1769 
1770  /// Extract the number of dereferenceable bytes for a call or
1771  /// parameter (0=unknown).
1774  }
1775 
1776  /// Extract the number of dereferenceable bytes for a call or
1777  /// parameter (0=unknown).
1780  }
1781 
1782  /// Extract the number of dereferenceable_or_null bytes for a call
1783  /// (0=unknown).
1786  }
1787 
1788  /// Extract the number of dereferenceable_or_null bytes for a
1789  /// parameter (0=unknown).
1792  }
1793 
1794  /// Return true if the return value is known to be not null.
1795  /// This may be because it has the nonnull attribute, or because at least
1796  /// one byte is dereferenceable and the pointer is in addrspace(0).
1797  bool isReturnNonNull() const;
1798 
1799  /// Determine if the return value is marked with NoAlias attribute.
1800  bool returnDoesNotAlias() const {
1801  return Attrs.hasRetAttr(Attribute::NoAlias);
1802  }
1803 
1804  /// If one of the arguments has the 'returned' attribute, returns its
1805  /// operand value. Otherwise, return nullptr.
1806  Value *getReturnedArgOperand() const;
1807 
1808  /// Return true if the call should not be treated as a call to a
1809  /// builtin.
1810  bool isNoBuiltin() const {
1811  return hasFnAttrImpl(Attribute::NoBuiltin) &&
1812  !hasFnAttrImpl(Attribute::Builtin);
1813  }
1814 
1815  /// Determine if the call requires strict floating point semantics.
1816  bool isStrictFP() const { return hasFnAttr(Attribute::StrictFP); }
1817 
1818  /// Return true if the call should not be inlined.
1819  bool isNoInline() const { return hasFnAttr(Attribute::NoInline); }
1820  void setIsNoInline() { addFnAttr(Attribute::NoInline); }
1821  /// Determine if the call does not access memory.
1822  bool doesNotAccessMemory() const { return hasFnAttr(Attribute::ReadNone); }
1823  void setDoesNotAccessMemory() { addFnAttr(Attribute::ReadNone); }
1824 
1825  /// Determine if the call does not access or only reads memory.
1826  bool onlyReadsMemory() const {
1827  return hasImpliedFnAttr(Attribute::ReadOnly);
1828  }
1829 
1830  void setOnlyReadsMemory() { addFnAttr(Attribute::ReadOnly); }
1831 
1832  /// Determine if the call does not access or only writes memory.
1833  bool onlyWritesMemory() const {
1834  return hasImpliedFnAttr(Attribute::WriteOnly);
1835  }
1836  void setOnlyWritesMemory() { addFnAttr(Attribute::WriteOnly); }
1837 
1838  /// Determine if the call can access memmory only using pointers based
1839  /// on its arguments.
1840  bool onlyAccessesArgMemory() const {
1841  return hasFnAttr(Attribute::ArgMemOnly);
1842  }
1843  void setOnlyAccessesArgMemory() { addFnAttr(Attribute::ArgMemOnly); }
1844 
1845  /// Determine if the function may only access memory that is
1846  /// inaccessible from the IR.
1848  return hasFnAttr(Attribute::InaccessibleMemOnly);
1849  }
1851  addFnAttr(Attribute::InaccessibleMemOnly);
1852  }
1853 
1854  /// Determine if the function may only access memory that is
1855  /// either inaccessible from the IR or pointed to by its arguments.
1857  return hasFnAttr(Attribute::InaccessibleMemOrArgMemOnly);
1858  }
1860  addFnAttr(Attribute::InaccessibleMemOrArgMemOnly);
1861  }
1862  /// Determine if the call cannot return.
1863  bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); }
1864  void setDoesNotReturn() { addFnAttr(Attribute::NoReturn); }
1865 
1866  /// Determine if the call should not perform indirect branch tracking.
1867  bool doesNoCfCheck() const { return hasFnAttr(Attribute::NoCfCheck); }
1868 
1869  /// Determine if the call cannot unwind.
1870  bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); }
1871  void setDoesNotThrow() { addFnAttr(Attribute::NoUnwind); }
1872 
1873  /// Determine if the invoke cannot be duplicated.
1874  bool cannotDuplicate() const { return hasFnAttr(Attribute::NoDuplicate); }
1875  void setCannotDuplicate() { addFnAttr(Attribute::NoDuplicate); }
1876 
1877  /// Determine if the call cannot be tail merged.
1878  bool cannotMerge() const { return hasFnAttr(Attribute::NoMerge); }
1879  void setCannotMerge() { addFnAttr(Attribute::NoMerge); }
1880 
1881  /// Determine if the invoke is convergent
1885 
1886  /// Determine if the call returns a structure through first
1887  /// pointer argument.
1888  bool hasStructRetAttr() const {
1889  if (arg_empty())
1890  return false;
1891 
1892  // Be friendly and also check the callee.
1893  return paramHasAttr(0, Attribute::StructRet);
1894  }
1895 
1896  /// Determine if any call argument is an aggregate passed by value.
1897  bool hasByValArgument() const {
1898  return Attrs.hasAttrSomewhere(Attribute::ByVal);
1899  }
1900 
1901  ///@{
1902  // End of attribute API.
1903 
1904  /// \name Operand Bundle API
1905  ///
1906  /// This group of methods provides the API to access and manipulate operand
1907  /// bundles on this call.
1908  /// @{
1909 
1910  /// Return the number of operand bundles associated with this User.
1911  unsigned getNumOperandBundles() const {
1912  return std::distance(bundle_op_info_begin(), bundle_op_info_end());
1913  }
1914 
1915  /// Return true if this User has any operand bundles.
1916  bool hasOperandBundles() const { return getNumOperandBundles() != 0; }
1917 
1918  /// Return the index of the first bundle operand in the Use array.
1919  unsigned getBundleOperandsStartIndex() const {
1920  assert(hasOperandBundles() && "Don't call otherwise!");
1921  return bundle_op_info_begin()->Begin;
1922  }
1923 
1924  /// Return the index of the last bundle operand in the Use array.
1925  unsigned getBundleOperandsEndIndex() const {
1926  assert(hasOperandBundles() && "Don't call otherwise!");
1927  return bundle_op_info_end()[-1].End;
1928  }
1929 
1930  /// Return true if the operand at index \p Idx is a bundle operand.
1931  bool isBundleOperand(unsigned Idx) const {
1932  return hasOperandBundles() && Idx >= getBundleOperandsStartIndex() &&
1933  Idx < getBundleOperandsEndIndex();
1934  }
1935 
1936  /// Return true if the operand at index \p Idx is a bundle operand that has
1937  /// tag ID \p ID.
1938  bool isOperandBundleOfType(uint32_t ID, unsigned Idx) const {
1939  return isBundleOperand(Idx) &&
1941  }
1942 
1943  /// Returns true if the use is a bundle operand.
1944  bool isBundleOperand(const Use *U) const {
1945  assert(this == U->getUser() &&
1946  "Only valid to query with a use of this instruction!");
1947  return hasOperandBundles() && isBundleOperand(U - op_begin());
1948  }
1950  return isBundleOperand(&UI.getUse());
1951  }
1952 
1953  /// Return the total number operands (not operand bundles) used by
1954  /// every operand bundle in this OperandBundleUser.
1955  unsigned getNumTotalBundleOperands() const {
1956  if (!hasOperandBundles())
1957  return 0;
1958 
1959  unsigned Begin = getBundleOperandsStartIndex();
1960  unsigned End = getBundleOperandsEndIndex();
1961 
1962  assert(Begin <= End && "Should be!");
1963  return End - Begin;
1964  }
1965 
1966  /// Return the operand bundle at a specific index.
1968  assert(Index < getNumOperandBundles() && "Index out of bounds!");
1970  }
1971 
1972  /// Return the number of operand bundles with the tag Name attached to
1973  /// this instruction.
1975  unsigned Count = 0;
1976  for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
1977  if (getOperandBundleAt(i).getTagName() == Name)
1978  Count++;
1979 
1980  return Count;
1981  }
1982 
1983  /// Return the number of operand bundles with the tag ID attached to
1984  /// this instruction.
1986  unsigned Count = 0;
1987  for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
1988  if (getOperandBundleAt(i).getTagID() == ID)
1989  Count++;
1990 
1991  return Count;
1992  }
1993 
1994  /// Return an operand bundle by name, if present.
1995  ///
1996  /// It is an error to call this for operand bundle types that may have
1997  /// multiple instances of them on the same instruction.
1999  assert(countOperandBundlesOfType(Name) < 2 && "Precondition violated!");
2000 
2001  for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
2003  if (U.getTagName() == Name)
2004  return U;
2005  }
2006 
2007  return None;
2008  }
2009 
2010  /// Return an operand bundle by tag ID, if present.
2011  ///
2012  /// It is an error to call this for operand bundle types that may have
2013  /// multiple instances of them on the same instruction.
2015  assert(countOperandBundlesOfType(ID) < 2 && "Precondition violated!");
2016 
2017  for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
2019  if (U.getTagID() == ID)
2020  return U;
2021  }
2022 
2023  return None;
2024  }
2025 
2026  /// Return the list of operand bundles attached to this instruction as
2027  /// a vector of OperandBundleDefs.
2028  ///
2029  /// This function copies the OperandBundeUse instances associated with this
2030  /// OperandBundleUser to a vector of OperandBundleDefs. Note:
2031  /// OperandBundeUses and OperandBundleDefs are non-trivially *different*
2032  /// representations of operand bundles (see documentation above).
2034 
2035  /// Return the operand bundle for the operand at index OpIdx.
2036  ///
2037  /// It is an error to call this with an OpIdx that does not correspond to an
2038  /// bundle operand.
2041  }
2042 
2043  /// Return true if this operand bundle user has operand bundles that
2044  /// may read from the heap.
2045  bool hasReadingOperandBundles() const;
2046 
2047  /// Return true if this operand bundle user has operand bundles that
2048  /// may write to the heap.
2050  for (auto &BOI : bundle_op_infos()) {
2051  if (BOI.Tag->second == LLVMContext::OB_deopt ||
2052  BOI.Tag->second == LLVMContext::OB_funclet)
2053  continue;
2054 
2055  // This instruction has an operand bundle that is not known to us.
2056  // Assume the worst.
2057  return true;
2058  }
2059 
2060  return false;
2061  }
2062 
2063  /// Return true if the bundle operand at index \p OpIdx has the
2064  /// attribute \p A.
2065  bool bundleOperandHasAttr(unsigned OpIdx, Attribute::AttrKind A) const {
2066  auto &BOI = getBundleOpInfoForOperand(OpIdx);
2067  auto OBU = operandBundleFromBundleOpInfo(BOI);
2068  return OBU.operandHasAttr(OpIdx - BOI.Begin, A);
2069  }
2070 
2071  /// Return true if \p Other has the same sequence of operand bundle
2072  /// tags with the same number of operands on each one of them as this
2073  /// OperandBundleUser.
2074  bool hasIdenticalOperandBundleSchema(const CallBase &Other) const {
2075  if (getNumOperandBundles() != Other.getNumOperandBundles())
2076  return false;
2077 
2079  Other.bundle_op_info_begin());
2080  }
2081 
2082  /// Return true if this operand bundle user contains operand bundles
2083  /// with tags other than those specified in \p IDs.
2085  for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
2087  if (!is_contained(IDs, ID))
2088  return true;
2089  }
2090  return false;
2091  }
2092 
2093  /// Is the function attribute S disallowed by some operand bundle on
2094  /// this operand bundle user?
2096  // Operand bundles only possibly disallow memory access attributes. All
2097  // String attributes are fine.
2098  return false;
2099  }
2100 
2101  /// Is the function attribute A disallowed by some operand bundle on
2102  /// this operand bundle user?
2104  switch (A) {
2105  default:
2106  return false;
2107 
2108  case Attribute::InaccessibleMemOrArgMemOnly:
2109  return hasReadingOperandBundles();
2110 
2111  case Attribute::InaccessibleMemOnly:
2112  return hasReadingOperandBundles();
2113 
2114  case Attribute::ArgMemOnly:
2115  return hasReadingOperandBundles();
2116 
2117  case Attribute::ReadNone:
2118  return hasReadingOperandBundles();
2119 
2120  case Attribute::ReadOnly:
2121  return hasClobberingOperandBundles();
2122 
2123  case Attribute::WriteOnly:
2124  return hasReadingOperandBundles();
2125  }
2126 
2127  llvm_unreachable("switch has a default case!");
2128  }
2129 
2130  /// Used to keep track of an operand bundle. See the main comment on
2131  /// OperandBundleUser above.
2132  struct BundleOpInfo {
2133  /// The operand bundle tag, interned by
2134  /// LLVMContextImpl::getOrInsertBundleTag.
2136 
2137  /// The index in the Use& vector where operands for this operand
2138  /// bundle starts.
2140 
2141  /// The index in the Use& vector where operands for this operand
2142  /// bundle ends.
2144 
2145  bool operator==(const BundleOpInfo &Other) const {
2146  return Tag == Other.Tag && Begin == Other.Begin && End == Other.End;
2147  }
2148  };
2149 
2150  /// Simple helper function to map a BundleOpInfo to an
2151  /// OperandBundleUse.
2154  auto begin = op_begin();
2155  ArrayRef<Use> Inputs(begin + BOI.Begin, begin + BOI.End);
2156  return OperandBundleUse(BOI.Tag, Inputs);
2157  }
2158 
2161 
2162  /// Return the start of the list of BundleOpInfo instances associated
2163  /// with this OperandBundleUser.
2164  ///
2165  /// OperandBundleUser uses the descriptor area co-allocated with the host User
2166  /// to store some meta information about which operands are "normal" operands,
2167  /// and which ones belong to some operand bundle.
2168  ///
2169  /// The layout of an operand bundle user is
2170  ///
2171  /// +-----------uint32_t End-------------------------------------+
2172  /// | |
2173  /// | +--------uint32_t Begin--------------------+ |
2174  /// | | | |
2175  /// ^ ^ v v
2176  /// |------|------|----|----|----|----|----|---------|----|---------|----|-----
2177  /// | BOI0 | BOI1 | .. | DU | U0 | U1 | .. | BOI0_U0 | .. | BOI1_U0 | .. | Un
2178  /// |------|------|----|----|----|----|----|---------|----|---------|----|-----
2179  /// v v ^ ^
2180  /// | | | |
2181  /// | +--------uint32_t Begin------------+ |
2182  /// | |
2183  /// +-----------uint32_t End-----------------------------+
2184  ///
2185  ///
2186  /// BOI0, BOI1 ... are descriptions of operand bundles in this User's use
2187  /// list. These descriptions are installed and managed by this class, and
2188  /// they're all instances of OperandBundleUser<T>::BundleOpInfo.
2189  ///
2190  /// DU is an additional descriptor installed by User's 'operator new' to keep
2191  /// track of the 'BOI0 ... BOIN' co-allocation. OperandBundleUser does not
2192  /// access or modify DU in any way, it's an implementation detail private to
2193  /// User.
2194  ///
2195  /// The regular Use& vector for the User starts at U0. The operand bundle
2196  /// uses are part of the Use& vector, just like normal uses. In the diagram
2197  /// above, the operand bundle uses start at BOI0_U0. Each instance of
2198  /// BundleOpInfo has information about a contiguous set of uses constituting
2199  /// an operand bundle, and the total set of operand bundle uses themselves
2200  /// form a contiguous set of uses (i.e. there are no gaps between uses
2201  /// corresponding to individual operand bundles).
2202  ///
2203  /// This class does not know the location of the set of operand bundle uses
2204  /// within the use list -- that is decided by the User using this class via
2205  /// the BeginIdx argument in populateBundleOperandInfos.
2206  ///
2207  /// Currently operand bundle users with hung-off operands are not supported.
2209  if (!hasDescriptor())
2210  return nullptr;
2211 
2212  uint8_t *BytesBegin = getDescriptor().begin();
2213  return reinterpret_cast<bundle_op_iterator>(BytesBegin);
2214  }
2215 
2216  /// Return the start of the list of BundleOpInfo instances associated
2217  /// with this OperandBundleUser.
2219  auto *NonConstThis = const_cast<CallBase *>(this);
2220  return NonConstThis->bundle_op_info_begin();
2221  }
2222 
2223  /// Return the end of the list of BundleOpInfo instances associated
2224  /// with this OperandBundleUser.
2226  if (!hasDescriptor())
2227  return nullptr;
2228 
2229  uint8_t *BytesEnd = getDescriptor().end();
2230  return reinterpret_cast<bundle_op_iterator>(BytesEnd);
2231  }
2232 
2233  /// Return the end of the list of BundleOpInfo instances associated
2234  /// with this OperandBundleUser.
2236  auto *NonConstThis = const_cast<CallBase *>(this);
2237  return NonConstThis->bundle_op_info_end();
2238  }
2239 
2240  /// Return the range [\p bundle_op_info_begin, \p bundle_op_info_end).
2243  }
2244 
2245  /// Return the range [\p bundle_op_info_begin, \p bundle_op_info_end).
2248  }
2249 
2250  /// Populate the BundleOpInfo instances and the Use& vector from \p
2251  /// Bundles. Return the op_iterator pointing to the Use& one past the last
2252  /// last bundle operand use.
2253  ///
2254  /// Each \p OperandBundleDef instance is tracked by a OperandBundleInfo
2255  /// instance allocated in this User's descriptor.
2257  const unsigned BeginIndex);
2258 
2259 public:
2260  /// Return the BundleOpInfo for the operand at index OpIdx.
2261  ///
2262  /// It is an error to call this with an OpIdx that does not correspond to an
2263  /// bundle operand.
2264  BundleOpInfo &getBundleOpInfoForOperand(unsigned OpIdx);
2265  const BundleOpInfo &getBundleOpInfoForOperand(unsigned OpIdx) const {
2266  return const_cast<CallBase *>(this)->getBundleOpInfoForOperand(OpIdx);
2267  }
2268 
2269 protected:
2270  /// Return the total number of values used in \p Bundles.
2272  unsigned Total = 0;
2273  for (auto &B : Bundles)
2274  Total += B.input_size();
2275  return Total;
2276  }
2277 
2278  /// @}
2279  // End of operand bundle API.
2280 
2281 private:
2282  bool hasFnAttrOnCalledFunction(Attribute::AttrKind Kind) const;
2283  bool hasFnAttrOnCalledFunction(StringRef Kind) const;
2284 
2285  template <typename AttrKind> bool hasFnAttrImpl(AttrKind Kind) const {
2286  if (Attrs.hasFnAttr(Kind))
2287  return true;
2288 
2289  // Operand bundles override attributes on the called function, but don't
2290  // override attributes directly present on the call instruction.
2292  return false;
2293 
2294  return hasFnAttrOnCalledFunction(Kind);
2295  }
2296 
2297  /// A specialized version of hasFnAttrImpl for when the caller wants to
2298  /// know if an attribute's semantics are implied, not whether the attribute
2299  /// is actually present. This distinction only exists when checking whether
2300  /// something is readonly or writeonly since readnone implies both. The case
2301  /// which motivates the specialized code is a callee with readnone, and an
2302  /// operand bundle on the call which disallows readnone but not either
2303  /// readonly or writeonly.
2304  bool hasImpliedFnAttr(Attribute::AttrKind Kind) const {
2305  assert((Kind == Attribute::ReadOnly || Kind == Attribute::WriteOnly) &&
2306  "use hasFnAttrImpl instead");
2307  if (Attrs.hasFnAttr(Kind) || Attrs.hasFnAttr(Attribute::ReadNone))
2308  return true;
2309 
2311  return false;
2312 
2313  return hasFnAttrOnCalledFunction(Kind) ||
2314  hasFnAttrOnCalledFunction(Attribute::ReadNone);
2315  }
2316 
2317  /// Determine whether the return value has the given attribute. Supports
2318  /// Attribute::AttrKind and StringRef as \p AttrKind types.
2319  template <typename AttrKind> bool hasRetAttrImpl(AttrKind Kind) const {
2320  if (Attrs.hasRetAttr(Kind))
2321  return true;
2322 
2323  // Look at the callee, if available.
2324  if (const Function *F = getCalledFunction())
2325  return F->getAttributes().hasRetAttr(Kind);
2326  return false;
2327  }
2328 };
2329 
2330 template <>
2331 struct OperandTraits<CallBase> : public VariadicOperandTraits<CallBase, 1> {};
2332 
2334 
2335 //===----------------------------------------------------------------------===//
2336 // FuncletPadInst Class
2337 //===----------------------------------------------------------------------===//
2338 class FuncletPadInst : public Instruction {
2339 private:
2340  FuncletPadInst(const FuncletPadInst &CPI);
2341 
2342  explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
2343  ArrayRef<Value *> Args, unsigned Values,
2344  const Twine &NameStr, Instruction *InsertBefore);
2345  explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
2346  ArrayRef<Value *> Args, unsigned Values,
2347  const Twine &NameStr, BasicBlock *InsertAtEnd);
2348 
2349  void init(Value *ParentPad, ArrayRef<Value *> Args, const Twine &NameStr);
2350 
2351 protected:
2352  // Note: Instruction needs to be a friend here to call cloneImpl.
2353  friend class Instruction;
2354  friend class CatchPadInst;
2355  friend class CleanupPadInst;
2356 
2357  FuncletPadInst *cloneImpl() const;
2358 
2359 public:
2360  /// Provide fast operand accessors
2362 
2363  /// getNumArgOperands - Return the number of funcletpad arguments.
2364  ///
2365  unsigned getNumArgOperands() const { return getNumOperands() - 1; }
2366 
2367  /// Convenience accessors
2368 
2369  /// Return the outer EH-pad this funclet is nested within.
2370  ///
2371  /// Note: This returns the associated CatchSwitchInst if this FuncletPadInst
2372  /// is a CatchPadInst.
2373  Value *getParentPad() const { return Op<-1>(); }
2374  void setParentPad(Value *ParentPad) {
2375  assert(ParentPad);
2376  Op<-1>() = ParentPad;
2377  }
2378 
2379  /// getArgOperand/setArgOperand - Return/set the i-th funcletpad argument.
2380  ///
2381  Value *getArgOperand(unsigned i) const { return getOperand(i); }
2382  void setArgOperand(unsigned i, Value *v) { setOperand(i, v); }
2383 
2384  /// arg_operands - iteration adapter for range-for loops.
2385  op_range arg_operands() { return op_range(op_begin(), op_end() - 1); }
2386 
2387  /// arg_operands - iteration adapter for range-for loops.
2389  return const_op_range(op_begin(), op_end() - 1);
2390  }
2391 
2392  // Methods for support type inquiry through isa, cast, and dyn_cast:
2393  static bool classof(const Instruction *I) { return I->isFuncletPad(); }
2394  static bool classof(const Value *V) {
2395  return isa<Instruction>(V) && classof(cast<Instruction>(V));
2396  }
2397 };
2398 
2399 template <>
2401  : public VariadicOperandTraits<FuncletPadInst, /*MINARITY=*/1> {};
2402 
2404 
2405 } // end namespace llvm
2406 
2407 #endif // LLVM_IR_INSTRTYPES_H
llvm::AttributeList::removeAttributeAtIndex
LLVM_NODISCARD AttributeList removeAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
Definition: Attributes.cpp:1256
llvm::CallBase::bundle_op_info_end
const_bundle_op_iterator bundle_op_info_end() const
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
Definition: InstrTypes.h:2235
llvm::AttributeList::removeRetAttribute
LLVM_NODISCARD AttributeList removeRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:621
llvm::AttributeList::getRetDereferenceableOrNullBytes
uint64_t getRetDereferenceableOrNullBytes() const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of the return value.
Definition: Attributes.cpp:1444
i
i
Definition: README.txt:29
llvm::AttributeList::getParamInAllocaType
Type * getParamInAllocaType(unsigned ArgNo) const
Return the inalloca type for the specified function parameter.
Definition: Attributes.cpp:1420
llvm::CallBase::getNumOperandBundles
unsigned getNumOperandBundles() const
Return the number of operand bundles associated with this User.
Definition: InstrTypes.h:1911
llvm::CmpInst::FCMP_ULE
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
Definition: InstrTypes.h:736
llvm::CallBase::hasStructRetAttr
bool hasStructRetAttr() const
Determine if the call returns a structure through first pointer argument.
Definition: InstrTypes.h:1888
llvm::CallBase::getRetDereferenceableBytes
uint64_t getRetDereferenceableBytes() const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
Definition: InstrTypes.h:1772
llvm::enum_seq_inclusive
auto enum_seq_inclusive(EnumT Begin, EnumT End)
Iterate over an enum type from Begin to End inclusive.
Definition: Sequence.h:355
llvm::CmpInst::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Provide more efficient getOperand methods.
llvm::CallBase::returnDoesNotAlias
bool returnDoesNotAlias() const
Determine if the return value is marked with NoAlias attribute.
Definition: InstrTypes.h:1800
llvm::CallBase::addAttributeAtIndex
void addAttributeAtIndex(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
Definition: InstrTypes.h:1495
llvm::Value::const_user_iterator
user_iterator_impl< const User > const_user_iterator
Definition: Value.h:391
llvm::OperandBundleDefT::inputs
ArrayRef< InputTy > inputs() const
Definition: InstrTypes.h:1144
llvm::CallBase::bundle_op_info_begin
const_bundle_op_iterator bundle_op_info_begin() const
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
Definition: InstrTypes.h:2218
llvm::BinaryOperator::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
llvm::CallBase::getOperandBundleForOperand
OperandBundleUse getOperandBundleForOperand(unsigned OpIdx) const
Return the operand bundle for the operand at index OpIdx.
Definition: InstrTypes.h:2039
llvm::CmpInst::getSwappedPredicate
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
Definition: InstrTypes.h:851
llvm::AttributeList::removeFnAttributes
LLVM_NODISCARD AttributeList removeFnAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:608
llvm::CallBase::arg_begin
User::const_op_iterator arg_begin() const
Definition: InstrTypes.h:1319
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:22
llvm::CallBase::isNoBuiltin
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
Definition: InstrTypes.h:1810
llvm::CallBase::getOperandBundlesAsDefs
void getOperandBundlesAsDefs(SmallVectorImpl< OperandBundleDef > &Defs) const
Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs.
Definition: Instructions.cpp:375
llvm::AttributeList::addDereferenceableParamAttr
LLVM_NODISCARD AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given arg index.
Definition: Attributes.cpp:1315
llvm::Type::getInt1Ty
static IntegerType * getInt1Ty(LLVMContext &C)
Definition: Type.cpp:238
llvm::CallBase::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
llvm::CmpInst::ICMP_EQ
@ ICMP_EQ
equal
Definition: InstrTypes.h:742
llvm::CallBase::getBundleOperandsEndIndex
unsigned getBundleOperandsEndIndex() const
Return the index of the last bundle operand in the Use array.
Definition: InstrTypes.h:1925
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::StringMapEntry< uint32_t >
llvm::CallBase::getOperandBundle
Optional< OperandBundleUse > getOperandBundle(StringRef Name) const
Return an operand bundle by name, if present.
Definition: InstrTypes.h:1998
llvm::AttributeList::addFnAttribute
LLVM_NODISCARD AttributeList addFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a function attribute to the list.
Definition: Attributes.h:490
Optional.h
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:113
llvm::Instruction::UnaryOps
UnaryOps
Definition: Instruction.h:782
llvm::CallBase::arg_end
User::const_op_iterator arg_end() const
Definition: InstrTypes.h:1329
llvm::CallBase::isBundleOperand
bool isBundleOperand(const Use *U) const
Returns true if the use is a bundle operand.
Definition: InstrTypes.h:1944
llvm::AttributeList::hasAttrSomewhere
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value.
Definition: Attributes.cpp:1377
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:721
llvm::CmpInst::getUnsignedPredicate
Predicate getUnsignedPredicate()
For example, SLT->ULT, SLE->ULE, SGT->UGT, SGE->UGE, ULT->Failed assert.
Definition: InstrTypes.h:980
llvm::CallBase::doesNotReturn
bool doesNotReturn() const
Determine if the call cannot return.
Definition: InstrTypes.h:1863
llvm::CallBase::removeFnAttr
void removeFnAttr(Attribute::AttrKind Kind)
Removes the attribute from the function.
Definition: InstrTypes.h:1552
llvm::CallBase::removeOperandBundle
static CallBase * removeOperandBundle(CallBase *CB, uint32_t ID, Instruction *InsertPt=nullptr)
Create a clone of CB with operand bundle ID removed.
Definition: Instructions.cpp:466
llvm::BinaryOperator::Instruction
friend class Instruction
Definition: InstrTypes.h:200
llvm::CallBase::getArgOperandUse
Use & getArgOperandUse(unsigned i)
Definition: InstrTypes.h:1358
llvm::Function
Definition: Function.h:62
llvm::CallBase::hasInAllocaArgument
bool hasInAllocaArgument() const
Determine if there are is an inalloca argument.
Definition: InstrTypes.h:1701
llvm::Attribute
Definition: Attributes.h:52
StringRef.h
llvm::CmpInst::swapOperands
void swapOperands()
This is just a convenience that dispatches to the subclasses.
Definition: Instructions.cpp:3853
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::CallBase::mutateFunctionType
void mutateFunctionType(FunctionType *FTy)
Definition: InstrTypes.h:1258
llvm::BinaryOperator::CreateWithCopiedFlags
static BinaryOperator * CreateWithCopiedFlags(BinaryOps Opc, Value *V1, Value *V2, Instruction *CopyO, const Twine &Name="", Instruction *InsertBefore=nullptr)
Definition: InstrTypes.h:251
llvm::VariadicOperandTraits
VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
Definition: OperandTraits.h:68
llvm::BinaryOperator::CreateNot
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Definition: Instructions.cpp:2806
llvm::CallBase::getCalledOperandUse
Use & getCalledOperandUse()
Definition: InstrTypes.h:1394
llvm::CallBase::removeParamAttrs
void removeParamAttrs(unsigned ArgNo, const AttributeMask &AttrsToRemove)
Removes the attributes from the given argument.
Definition: InstrTypes.h:1579
llvm::CallBase::BundleOpInfo::Tag
StringMapEntry< uint32_t > * Tag
The operand bundle tag, interned by LLVMContextImpl::getOrInsertBundleTag.
Definition: InstrTypes.h:2135
llvm::CallBase::setCalledFunction
void setCalledFunction(Function *Fn)
Sets the function called, including updating the function type.
Definition: InstrTypes.h:1434
llvm::BinaryOperator::CreateFRemFMF
static BinaryOperator * CreateFRemFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
Definition: InstrTypes.h:279
llvm::CallBase::getNumTotalBundleOperands
unsigned getNumTotalBundleOperands() const
Return the total number operands (not operand bundles) used by every operand bundle in this OperandBu...
Definition: InstrTypes.h:1955
llvm::AttributeList::getParamPreallocatedType
Type * getParamPreallocatedType(unsigned ArgNo) const
Return the preallocated type for the specified function parameter.
Definition: Attributes.cpp:1416
llvm::CallBase::setIsNoInline
void setIsNoInline()
Definition: InstrTypes.h:1820
llvm::UnaryInstruction::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
llvm::FuncletPadInst::getNumArgOperands
unsigned getNumArgOperands() const
getNumArgOperands - Return the number of funcletpad arguments.
Definition: InstrTypes.h:2365
op
#define op(i)
llvm::CmpInst::getFlippedSignednessPredicate
Predicate getFlippedSignednessPredicate()
For example, SLT->ULT, ULT->SLT, SLE->ULE, ULE->SLE, EQ->Failed assert.
Definition: InstrTypes.h:992
llvm::CmpInst::FCmpPredicates
static auto FCmpPredicates()
Returns the sequence of all FCmp predicates.
Definition: InstrTypes.h:760
llvm::AttributeList::addParamAttribute
LLVM_NODISCARD AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
Definition: Attributes.h:539
llvm::BinaryOperator::CreateFDivFMF
static BinaryOperator * CreateFDivFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
Definition: InstrTypes.h:274
llvm::CallBase::isInlineAsm
bool isInlineAsm() const
Check if this call is an inline asm statement.
Definition: InstrTypes.h:1463
llvm::CmpInst::FCMP_ONE
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
Definition: InstrTypes.h:729
llvm::CallBase::Attrs
AttributeList Attrs
parameter attributes for callable
Definition: InstrTypes.h:1190
ErrorHandling.h
llvm::CmpInst::makeCmpResultType
static Type * makeCmpResultType(Type *opnd_type)
Create a result type for fcmp/icmp.
Definition: InstrTypes.h:1046
llvm::CallBase::setNotConvergent
void setNotConvergent()
Definition: InstrTypes.h:1884
llvm::CmpInst::ICMP_NE
@ ICMP_NE
not equal
Definition: InstrTypes.h:743
llvm::CmpInst::getInversePredicate
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...
Definition: InstrTypes.h:835
llvm::CallBase::getAttributeAtIndex
Attribute getAttributeAtIndex(unsigned i, Attribute::AttrKind Kind) const
Get the attribute of a given kind at a position.
Definition: InstrTypes.h:1604
llvm::CmpInst::ICmpPredicates
static auto ICmpPredicates()
Returns the sequence of all ICmp predicates.
Definition: InstrTypes.h:767
llvm::BinaryOperator::CreateNSW
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
Definition: InstrTypes.h:291
llvm::BinaryOperator::DEFINE_HELPERS
DEFINE_HELPERS(Add, NSW) DEFINE_HELPERS(Add
llvm::CmpInst::isCommutative
bool isCommutative() const
This is just a convenience that dispatches to the subclasses.
Definition: Instructions.cpp:3860
llvm::CallBase::hasFnAttr
bool hasFnAttr(Attribute::AttrKind Kind) const
Determine whether this call has the given attribute.
Definition: InstrTypes.h:1482
llvm::CallBase::getArgOperandUse
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a call argument.
Definition: InstrTypes.h:1354
llvm::AttributeList::getParamByValType
Type * getParamByValType(unsigned ArgNo) const
Return the byval type for the specified function parameter.
Definition: Attributes.cpp:1404
llvm::CmpInst::getFlippedStrictnessPredicate
Predicate getFlippedStrictnessPredicate() const
For predicate of kind "is X or equal to 0" returns the predicate "is X".
Definition: InstrTypes.h:917
llvm::CallBase::addOperandBundle
static CallBase * addOperandBundle(CallBase *CB, uint32_t ID, OperandBundleDef OB, Instruction *InsertPt=nullptr)
Create a clone of CB with operand bundle OB added.
Definition: Instructions.cpp:454
llvm::CallBase::isStrictFP
bool isStrictFP() const
Determine if the call requires strict floating point semantics.
Definition: InstrTypes.h:1816
llvm::CmpInst::ICMP_SGT
@ ICMP_SGT
signed greater than
Definition: InstrTypes.h:748
llvm::CallBase::isInAllocaArgument
bool isInAllocaArgument(unsigned ArgNo) const
Determine whether this argument is passed in an alloca.
Definition: InstrTypes.h:1676
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::CmpInst::isFalseWhenEqual
bool isFalseWhenEqual() const
This is just a convenience.
Definition: InstrTypes.h:1004
llvm::CallBase::isPassingUndefUB
bool isPassingUndefUB(unsigned ArgNo) const
Determine whether passing undef to this argument is undefined behavior.
Definition: InstrTypes.h:1691
llvm::AttributeList
Definition: Attributes.h:403
llvm::AttributeMask
Definition: Attributes.h:936
llvm::AttributeList::addDereferenceableRetAttr
LLVM_NODISCARD AttributeList addDereferenceableRetAttr(LLVMContext &C, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
Definition: Attributes.cpp:1308
llvm::CallBase::getAttributes
AttributeList getAttributes() const
Return the parameter attributes for this call.
Definition: InstrTypes.h:1473
DEFINE_TRANSPARENT_OPERAND_ACCESSORS
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
Definition: OperandTraits.h:125
llvm::CallBase::isOperandBundleOfType
bool isOperandBundleOfType(uint32_t ID, unsigned Idx) const
Return true if the operand at index Idx is a bundle operand that has tag ID ID.
Definition: InstrTypes.h:1938
llvm::OperandBundleDefT
A container for an operand bundle being viewed as a set of values rather than a set of uses.
Definition: InstrTypes.h:1129
llvm::CallBase::getFunctionType
FunctionType * getFunctionType() const
Definition: InstrTypes.h:1256
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:227
llvm::CallBase::isCallee
bool isCallee(Value::const_user_iterator UI) const
Determine whether the passed iterator points to the callee operand's Use.
Definition: InstrTypes.h:1406
llvm::CallBase::bundle_op_infos
iterator_range< bundle_op_iterator > bundle_op_infos()
Return the range [bundle_op_info_begin, bundle_op_info_end).
Definition: InstrTypes.h:2241
llvm::CallBase::hasArgument
bool hasArgument(const Value *V) const
Returns true if this CallSite passes the given Value* as an argument to the called function.
Definition: InstrTypes.h:1387
llvm::CallBase::hasDescriptor
bool hasDescriptor() const
Definition: InstrTypes.h:1199
llvm::CallBase::getDataOperandNo
unsigned getDataOperandNo(const Use *U) const
Given a use for a data operand, get the data operand number that corresponds to it.
Definition: InstrTypes.h:1312
llvm::CallBase::addFnAttr
void addFnAttr(Attribute Attr)
Adds the attribute to the function.
Definition: InstrTypes.h:1510
llvm::CallBase::isMustTailCall
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
Definition: Instructions.cpp:298
llvm::Instruction::setHasNoUnsignedWrap
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
Definition: Instruction.cpp:124
llvm::Optional
Definition: APInt.h:33
llvm::BinaryOperator::CreateNUW
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
Definition: InstrTypes.h:310
llvm::MCID::Convergent
@ Convergent
Definition: MCInstrDesc.h:182
llvm::CastInst::CastInst
CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics for subclasses.
Definition: InstrTypes.h:434
llvm::CastInst::castIsValid
static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy)
Definition: InstrTypes.h:692
llvm::CmpInst::getOpcode
OtherOps getOpcode() const
Get the opcode casted to the right type.
Definition: InstrTypes.h:806
llvm::OperandBundleDefT::OperandBundleDefT
OperandBundleDefT(std::string Tag, std::vector< InputTy > Inputs)
Definition: InstrTypes.h:1134
llvm::CmpInst::ICMP_SLE
@ ICMP_SLE
signed less or equal
Definition: InstrTypes.h:751
llvm::CallBase::isByValArgument
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
Definition: InstrTypes.h:1671
STLExtras.h
llvm::CallBase::arg_begin
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
Definition: InstrTypes.h:1318
RHS
Value * RHS
Definition: X86PartialReduction.cpp:74
llvm::CmpInst::getPredicateName
static StringRef getPredicateName(Predicate P)
Definition: Instructions.cpp:3907
llvm::BinaryOperator::CreateNeg
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and...
Definition: Instructions.cpp:2766
llvm::UnaryOperator
Definition: InstrTypes.h:103
llvm::CallBase::setDoesNotThrow
void setDoesNotThrow()
Definition: InstrTypes.h:1871
llvm::Value::setValueSubclassData
void setValueSubclassData(unsigned short D)
Definition: Value.h:853
llvm::CallBase::isFnAttrDisallowedByOpBundle
bool isFnAttrDisallowedByOpBundle(StringRef S) const
Is the function attribute S disallowed by some operand bundle on this operand bundle user?
Definition: InstrTypes.h:2095
Sequence.h
llvm::CallBase::addParamAttr
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
Definition: InstrTypes.h:1525
llvm::Instruction::setIsExact
void setIsExact(bool b=true)
Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
Definition: Instruction.cpp:132
llvm::FuncletPadInst::arg_operands
op_range arg_operands()
arg_operands - iteration adapter for range-for loops.
Definition: InstrTypes.h:2385
llvm::CmpInst::FCMP_OGT
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
Definition: InstrTypes.h:725
llvm::CallBase::isCallee
bool isCallee(const Use *U) const
Determine whether this Use is the callee operand's Use.
Definition: InstrTypes.h:1411
llvm::CastInst::getDestTy
Type * getDestTy() const
Return the destination type, as a convenience.
Definition: InstrTypes.h:685
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::CallBase::setOnlyAccessesArgMemory
void setOnlyAccessesArgMemory()
Definition: InstrTypes.h:1843
llvm::CallBase::getOperandBundle
Optional< OperandBundleUse > getOperandBundle(uint32_t ID) const
Return an operand bundle by tag ID, if present.
Definition: InstrTypes.h:2014
llvm::CallBase::getFnAttr
Attribute getFnAttr(Attribute::AttrKind Kind) const
Get the attribute of a given kind for the function.
Definition: InstrTypes.h:1619
llvm::CallBase::getArgOperandNo
unsigned getArgOperandNo(Value::const_user_iterator UI) const
Given a value use iterator, return the arg operand number corresponding to it.
Definition: InstrTypes.h:1381
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::lltok::equal
@ equal
Definition: LLToken.h:25
llvm::CallBase::hasIdenticalOperandBundleSchema
bool hasIdenticalOperandBundleSchema(const CallBase &Other) const
Return true if Other has the same sequence of operand bundle tags with the same number of operands on...
Definition: InstrTypes.h:2074
llvm::CallBase::getParamStackAlign
MaybeAlign getParamStackAlign(unsigned ArgNo) const
Definition: InstrTypes.h:1739
llvm::AttributeList::getParamDereferenceableBytes
uint64_t getParamDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown) of an arg.
Definition: Attributes.cpp:1440
llvm::CmpInst::FCMP_ULT
@ FCMP_ULT
1 1 0 0 True if unordered or less than
Definition: InstrTypes.h:735
llvm::BinaryOperator::CreateNUW
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
Definition: InstrTypes.h:316
llvm::CallBase::setOnlyAccessesInaccessibleMemory
void setOnlyAccessesInaccessibleMemory()
Definition: InstrTypes.h:1850
llvm::User::getOperandUse
const Use & getOperandUse(unsigned i) const
Definition: User.h:182
Instruction.h
llvm::UnaryOperator::getOpcode
UnaryOps getOpcode() const
Definition: InstrTypes.h:173
llvm::CallBase::isDataOperand
bool isDataOperand(Value::const_user_iterator UI) const
Definition: InstrTypes.h:1300
llvm::AttributeList::getParamStackAlignment
MaybeAlign getParamStackAlignment(unsigned ArgNo) const
Return the stack alignment for the specified function parameter.
Definition: Attributes.cpp:1400
LHS
Value * LHS
Definition: X86PartialReduction.cpp:73
llvm::BinaryOperator::swapOperands
bool swapOperands()
Exchange the two operands to this instruction.
Definition: Instructions.cpp:2824
llvm::CallBase::getParamAttr
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Get the attribute of a given kind from a given arg.
Definition: InstrTypes.h:1624
llvm::FuncletPadInst::getArgOperand
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th funcletpad argument.
Definition: InstrTypes.h:2381
llvm::Intrinsic::getType
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
Definition: Function.cpp:1356
llvm::CallBase::removeParamAttr
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
Definition: InstrTypes.h:1567
llvm::Instruction::getOpcode
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
Definition: Instruction.h:160
llvm::CallBase::isFnAttrDisallowedByOpBundle
bool isFnAttrDisallowedByOpBundle(Attribute::AttrKind A) const
Is the function attribute A disallowed by some operand bundle on this operand bundle user?
Definition: InstrTypes.h:2103
llvm::CallBase::hasByValArgument
bool hasByValArgument() const
Determine if any call argument is an aggregate passed by value.
Definition: InstrTypes.h:1897
llvm::CallBase::data_operands_size
unsigned data_operands_size() const
Definition: InstrTypes.h:1291
llvm::CallBase::setDoesNotReturn
void setDoesNotReturn()
Definition: InstrTypes.h:1864
llvm::LLVMContext::OB_cfguardtarget
@ OB_cfguardtarget
Definition: LLVMContext.h:93
llvm::OperandTraits
Compile-time customization of User operands.
Definition: User.h:42
llvm::CmpInst::isFPPredicate
bool isFPPredicate() const
Definition: InstrTypes.h:828
Constants.h
llvm::CmpInst::FIRST_FCMP_PREDICATE
@ FIRST_FCMP_PREDICATE
Definition: InstrTypes.h:739
llvm::CmpInst::classof
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: InstrTypes.h:1037
llvm::OperandBundleUse::isDeoptOperandBundle
bool isDeoptOperandBundle() const
Return true if this is a "deopt" operand bundle.
Definition: InstrTypes.h:1104
llvm::CmpInst::getNonStrictPredicate
Predicate getNonStrictPredicate() const
For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.
Definition: InstrTypes.h:895
llvm::Instruction::setHasNoSignedWrap
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
Definition: Instruction.cpp:128
llvm::CallBase::getCalledOperandUse
const Use & getCalledOperandUse() const
Definition: InstrTypes.h:1393
llvm::CmpInst::isRelational
static bool isRelational(Predicate P)
Return true if the predicate is relational (not EQ or NE).
Definition: InstrTypes.h:942
llvm::CmpInst::getSignedPredicate
Predicate getSignedPredicate()
For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert.
Definition: InstrTypes.h:968
llvm::CallBase::removeFnAttrs
void removeFnAttrs(const AttributeMask &AttrsToRemove)
Removes the attributes from the function.
Definition: InstrTypes.h:1547
llvm::AttributeList::getParamDereferenceableOrNullBytes
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.
Definition: Attributes.cpp:1449
llvm::CmpInst::ICMP_ULE
@ ICMP_ULE
unsigned less or equal
Definition: InstrTypes.h:747
llvm::CallBase::getBundleOpInfoForOperand
BundleOpInfo & getBundleOpInfoForOperand(unsigned OpIdx)
Return the BundleOpInfo for the operand at index OpIdx.
Definition: Instructions.cpp:407
Twine.h
llvm::CallBase::getCalledFunction
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
Definition: InstrTypes.h:1398
llvm::OperandBundleDefT::input_iterator
typename std::vector< InputTy >::const_iterator input_iterator
Definition: InstrTypes.h:1146
llvm::CallBase::setAttributes
void setAttributes(AttributeList A)
Set the parameter attributes for this call.
Definition: InstrTypes.h:1477
llvm::BinaryOperator::CreateNSW
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
Definition: InstrTypes.h:285
llvm::BinaryOperator::BinaryOperator
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty, const Twine &Name, Instruction *InsertBefore)
Definition: Instructions.cpp:2656
llvm::CallBase::removeRetAttrs
void removeRetAttrs(const AttributeMask &AttrsToRemove)
Removes the attributes from the return value.
Definition: InstrTypes.h:1562
llvm::CmpInst::FIRST_ICMP_PREDICATE
@ FIRST_ICMP_PREDICATE
Definition: InstrTypes.h:752
llvm::CmpInst::FCMP_UGE
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
Definition: InstrTypes.h:734
llvm::Instruction::OtherOps
OtherOps
Definition: Instruction.h:817
llvm::CallingConv::MaxID
@ MaxID
The highest possible calling convention ID. Must be some 2^k - 1.
Definition: CallingConv.h:256
llvm::CmpInst::classof
static bool classof(const Value *V)
Definition: InstrTypes.h:1041
llvm::FuncletPadInst::classof
static bool classof(const Value *V)
Definition: InstrTypes.h:2394
llvm::BinaryOperator::CreateExact
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
Definition: InstrTypes.h:323
llvm::CallBase::isConvergent
bool isConvergent() const
Determine if the invoke is convergent.
Definition: InstrTypes.h:1882
llvm::CallBase::operandBundleFromBundleOpInfo
OperandBundleUse operandBundleFromBundleOpInfo(const BundleOpInfo &BOI) const
Simple helper function to map a BundleOpInfo to an OperandBundleUse.
Definition: InstrTypes.h:2153
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:109
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::CallBase::getAttributeAtIndex
Attribute getAttributeAtIndex(unsigned i, StringRef Kind) const
Get the attribute of a given kind at a position.
Definition: InstrTypes.h:1609
llvm::Instruction::CastOps
CastOps
Definition: Instruction.h:803
llvm::BinaryOperator::getOpcode
BinaryOps getOpcode() const
Definition: InstrTypes.h:394
llvm::CallBase::setDoesNotAccessMemory
void setDoesNotAccessMemory()
Definition: InstrTypes.h:1823
llvm::CmpInst::FCMP_UNO
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Definition: InstrTypes.h:731
llvm::Instruction
Definition: Instruction.h:45
llvm::AttributeList::hasFnAttr
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the function.
Definition: Attributes.cpp:1369
llvm::User::getDescriptor
ArrayRef< const uint8_t > getDescriptor() const
Returns the descriptor co-allocated with this User instance.
Definition: User.cpp:93
llvm::CallBase::BundleOpInfo::Begin
uint32_t Begin
The index in the Use& vector where operands for this operand bundle starts.
Definition: InstrTypes.h:2139
llvm::CallBase::addFnAttr
void addFnAttr(Attribute::AttrKind Kind)
Adds the attribute to the function.
Definition: InstrTypes.h:1505
llvm::AttributeList::getRetAlignment
MaybeAlign getRetAlignment() const
Return the alignment of the return value.
Definition: Attributes.cpp:1392
llvm::CallBase::isArgOperand
bool isArgOperand(Value::const_user_iterator UI) const
Definition: InstrTypes.h:1368
llvm::UnaryOperator::CreateWithCopiedFlags
static UnaryOperator * CreateWithCopiedFlags(UnaryOps Opc, Value *V, Instruction *CopyO, const Twine &Name="", Instruction *InsertBefore=nullptr)
Definition: InstrTypes.h:158
OperandTraits.h
llvm::CallBase::bundle_op_info_begin
bundle_op_iterator bundle_op_info_begin()
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
Definition: InstrTypes.h:2208
llvm::CallBase::getParamByValType
Type * getParamByValType(unsigned ArgNo) const
Extract the byval type for a call or parameter.
Definition: InstrTypes.h:1744
llvm::CallBase::data_operands_begin
User::const_op_iterator data_operands_begin() const
Definition: InstrTypes.h:1271
llvm::FunctionCallee::getFunctionType
FunctionType * getFunctionType()
Definition: DerivedTypes.h:182
llvm::CmpInst::FCMP_OEQ
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
Definition: InstrTypes.h:724
llvm::CallBase::BundleOpInfo
Used to keep track of an operand bundle.
Definition: InstrTypes.h:2132
llvm::CmpInst::FCMP_OLT
@ FCMP_OLT
0 1 0 0 True if ordered and less than
Definition: InstrTypes.h:727
llvm::AttributeList::removeParamAttribute
LLVM_NODISCARD AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:641
StringMap.h
llvm::CallBase::isDataOperand
bool isDataOperand(const Use *U) const
Definition: InstrTypes.h:1295
llvm::AttributeList::removeParamAttributes
LLVM_NODISCARD AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:657
Align
uint64_t Align
Definition: ELFObjHandler.cpp:82
llvm::CallBase::data_operands_end
User::op_iterator data_operands_end()
Definition: InstrTypes.h:1274
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::MCID::Call
@ Call
Definition: MCInstrDesc.h:153
llvm::CallBase::getParamDereferenceableBytes
uint64_t getParamDereferenceableBytes(unsigned i) const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
Definition: InstrTypes.h:1778
llvm::CastInst::getSrcTy
Type * getSrcTy() const
Return the source type, as a convenience.
Definition: InstrTypes.h:683
llvm::CallBase::getCallingConv
CallingConv::ID getCallingConv() const
Definition: InstrTypes.h:1454
llvm::BinaryOperator::CreateExact
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
Definition: InstrTypes.h:329
llvm::None
const NoneType None
Definition: None.h:23
llvm::UnaryInstruction::UnaryInstruction
UnaryInstruction(Type *Ty, unsigned iType, Value *V, BasicBlock *IAE)
Definition: InstrTypes.h:65
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::AttributeList::removeRetAttributes
LLVM_NODISCARD AttributeList removeRetAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:634
llvm::CallBase::onlyReadsMemory
bool onlyReadsMemory(unsigned OpNo) const
Definition: InstrTypes.h:1713
Type.h
llvm::codeview::ClassOptions::Intrinsic
@ Intrinsic
llvm::CallBase::getCaller
Function * getCaller()
Helper to get the caller (the parent function).
Definition: Instructions.cpp:282
llvm::UnaryInstruction
Definition: InstrTypes.h:58
llvm::OperandBundleUse::getTagID
uint32_t getTagID() const
Return the tag of this operand bundle as an integer.
Definition: InstrTypes.h:1099
llvm::BinaryOperator::CreateNSW
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
Definition: InstrTypes.h:297
llvm::CallBase::isBundleOperand
bool isBundleOperand(Value::const_user_iterator UI) const
Definition: InstrTypes.h:1949
llvm::CmpInst::FCMP_FALSE
@ FCMP_FALSE
0 0 0 0 Always false (always folded)
Definition: InstrTypes.h:723
llvm::CallBase::FTy
FunctionType * FTy
Definition: InstrTypes.h:1191
llvm::CmpInst::isStrictPredicate
bool isStrictPredicate() const
Definition: InstrTypes.h:867
llvm::CmpInst
This class is the base class for the comparison instructions.
Definition: InstrTypes.h:711
llvm::OperandBundleUse::isFuncletOperandBundle
bool isFuncletOperandBundle() const
Return true if this is a "funclet" operand bundle.
Definition: InstrTypes.h:1109
llvm::CallBase::getReturnedArgOperand
Value * getReturnedArgOperand() const
If one of the arguments has the 'returned' attribute, returns its operand value.
Definition: Instructions.cpp:328
llvm::BinaryOperator::classof
static bool classof(const Value *V)
Definition: InstrTypes.h:409
llvm::CallBase::bundleOperandHasAttr
bool bundleOperandHasAttr(unsigned OpIdx, Attribute::AttrKind A) const
Return true if the bundle operand at index OpIdx has the attribute A.
Definition: InstrTypes.h:2065
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:389
llvm::CallBase::getParamDereferenceableOrNullBytes
uint64_t getParamDereferenceableOrNullBytes(unsigned i) const
Extract the number of dereferenceable_or_null bytes for a parameter (0=unknown).
Definition: InstrTypes.h:1790
llvm::Value::Value
Value(Type *Ty, unsigned scid)
Definition: Value.cpp:53
llvm::CallBase::addDereferenceableRetAttr
void addDereferenceableRetAttr(uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
Definition: InstrTypes.h:1589
llvm::CleanupPadInst
Definition: Instructions.h:4452
llvm::CallBase::getBundleOperandsStartIndex
unsigned getBundleOperandsStartIndex() const
Return the index of the first bundle operand in the Use array.
Definition: InstrTypes.h:1919
llvm::OperandBundleDefT::input_end
input_iterator input_end() const
Definition: InstrTypes.h:1150
llvm::CallBase::addRetAttr
void addRetAttr(Attribute Attr)
Adds the attribute to the return value.
Definition: InstrTypes.h:1520
llvm::Value::mutateType
void mutateType(Type *Ty)
Mutate the type of this Value to be of the specified type.
Definition: Value.h:801
llvm::CallBase::getCaller
const Function * getCaller() const
Definition: InstrTypes.h:1415
llvm::CallBase::isTailCall
bool isTailCall() const
Tests if this call site is marked as a tail call.
Definition: Instructions.cpp:305
llvm::UnaryOperator::CreateFNegFMF
static UnaryOperator * CreateFNegFMF(Value *Op, Instruction *FMFSource, const Twine &Name="", Instruction *InsertBefore=nullptr)
Definition: InstrTypes.h:166
llvm::CallBase::doesNotAccessMemory
bool doesNotAccessMemory(unsigned OpNo) const
Definition: InstrTypes.h:1707
llvm::OperandBundleDefT::OperandBundleDefT
OperandBundleDefT(std::string Tag, ArrayRef< InputTy > Inputs)
Definition: InstrTypes.h:1136
llvm::CallBase::countOperandBundlesOfType
unsigned countOperandBundlesOfType(StringRef Name) const
Return the number of operand bundles with the tag Name attached to this instruction.
Definition: InstrTypes.h:1974
Index
uint32_t Index
Definition: ELFObjHandler.cpp:83
llvm::CallBase::getRetAlign
MaybeAlign getRetAlign() const
Extract the alignment of the return value.
Definition: InstrTypes.h:1726
llvm::CallBase::bundle_op_infos
iterator_range< const_bundle_op_iterator > bundle_op_infos() const
Return the range [bundle_op_info_begin, bundle_op_info_end).
Definition: InstrTypes.h:2246
llvm::BinaryOperator::CreateFMulFMF
static BinaryOperator * CreateFMulFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
Definition: InstrTypes.h:269
llvm::UnaryOperator::classof
static bool classof(const Value *V)
Definition: InstrTypes.h:181
uint64_t
llvm::OperandBundleUse::isCFGuardTargetOperandBundle
bool isCFGuardTargetOperandBundle() const
Return true if this is a "cfguardtarget" operand bundle.
Definition: InstrTypes.h:1114
llvm::FuncletPadInst::classof
static bool classof(const Instruction *I)
Definition: InstrTypes.h:2393
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::CmpInst::isIntPredicate
static bool isIntPredicate(Predicate P)
Definition: InstrTypes.h:822
llvm::CallBase::data_ops
iterator_range< User::op_iterator > data_ops()
Definition: InstrTypes.h:1282
llvm::OperandBundleDefT::input_size
size_t input_size() const
Definition: InstrTypes.h:1148
llvm::AttributeList::getRetDereferenceableBytes
uint64_t getRetDereferenceableBytes() const
Get the number of dereferenceable bytes (or zero if unknown) of the return value.
Definition: Attributes.cpp:1436
llvm::CmpInst::CmpInst
CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS, Value *RHS, const Twine &Name="", Instruction *InsertBefore=nullptr, Instruction *FlagsSource=nullptr)
Definition: Instructions.cpp:3795
llvm::OperandBundleUse::OperandBundleUse
OperandBundleUse(StringMapEntry< uint32_t > *Tag, ArrayRef< Use > Inputs)
Definition: InstrTypes.h:1075
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::CallBase::getNumSubclassExtraOperands
unsigned getNumSubclassExtraOperands() const
Definition: InstrTypes.h:1201
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::Attribute::AttrKind
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:71
llvm::CallBase::data_ops
iterator_range< User::const_op_iterator > data_ops() const
Definition: InstrTypes.h:1285
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:441
llvm::AttributeList::getParamAlignment
MaybeAlign getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
Definition: Attributes.cpp:1396
llvm::CallBase::cannotMerge
bool cannotMerge() const
Determine if the call cannot be tail merged.
Definition: InstrTypes.h:1878
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:1657
ArrayRef.h
llvm::CallBase::addRetAttr
void addRetAttr(Attribute::AttrKind Kind)
Adds the attribute to the return value.
Definition: InstrTypes.h:1515
llvm::CallBase::doesNotCapture
bool doesNotCapture(unsigned OpNo) const
Determine whether this data operand is not captured.
Definition: InstrTypes.h:1666
llvm::CallBase::addAttributeAtIndex
void addAttributeAtIndex(unsigned i, Attribute Attr)
adds the attribute to the list of attributes.
Definition: InstrTypes.h:1500
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::FuncletPadInst::setArgOperand
void setArgOperand(unsigned i, Value *v)
Definition: InstrTypes.h:2382
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1650
llvm::CallBase::hasOperandBundles
bool hasOperandBundles() const
Return true if this User has any operand bundles.
Definition: InstrTypes.h:1916
llvm::CmpInst::FCMP_OGE
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
Definition: InstrTypes.h:726
llvm::CmpInst::ICMP_UGE
@ ICMP_UGE
unsigned greater or equal
Definition: InstrTypes.h:745
iterator_range.h
llvm::CmpInst::BAD_ICMP_PREDICATE
@ BAD_ICMP_PREDICATE
Definition: InstrTypes.h:754
llvm::CallBase::getRetDereferenceableOrNullBytes
uint64_t getRetDereferenceableOrNullBytes() const
Extract the number of dereferenceable_or_null bytes for a call (0=unknown).
Definition: InstrTypes.h:1784
llvm::CallBase::getNumSubclassExtraOperandsDynamic
unsigned getNumSubclassExtraOperandsDynamic() const
Get the number of extra operands for instructions that don't have a fixed number of extra operands.
Definition: Instructions.cpp:284
llvm::CastInst::classof
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: InstrTypes.h:697
llvm::CallBase::Create
static CallBase * Create(CallBase *CB, ArrayRef< OperandBundleDef > Bundles, Instruction *InsertPt=nullptr)
Create a clone of CB with a different set of operand bundles and insert it before InsertPt.
Definition: Instructions.cpp:255
llvm::CallBase::getBundleOpInfoForOperand
const BundleOpInfo & getBundleOpInfoForOperand(unsigned OpIdx) const
Definition: InstrTypes.h:2265
llvm::CallBase::arg_end
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
Definition: InstrTypes.h:1324
llvm::User::setOperand
void setOperand(unsigned i, Value *Val)
Definition: User.h:174
llvm::Instruction::FuncletPadOps
FuncletPadOps
Definition: Instruction.h:810
llvm::CmpInst::ICMP_SLT
@ ICMP_SLT
signed less than
Definition: InstrTypes.h:750
llvm::CmpInst::isIntPredicate
bool isIntPredicate() const
Definition: InstrTypes.h:829
llvm::CallBase::getIntrinsicID
Intrinsic::ID getIntrinsicID() const
Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...
Definition: Instructions.cpp:311
llvm::CallBase::addParamAttr
void addParamAttr(unsigned ArgNo, Attribute Attr)
Adds the attribute to the indicated argument.
Definition: InstrTypes.h:1531
llvm::UnaryInstruction::UnaryInstruction
UnaryInstruction(Type *Ty, unsigned iType, Value *V, Instruction *IB=nullptr)
Definition: InstrTypes.h:60
llvm::CallBase::onlyAccessesArgMemory
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
Definition: InstrTypes.h:1840
llvm::CallBase::getFnAttr
Attribute getFnAttr(StringRef Kind) const
Get the attribute of a given kind for the function.
Definition: InstrTypes.h:1614
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::CallBase::classof
static bool classof(const Instruction *I)
Definition: InstrTypes.h:1247
llvm::BinaryOperator
Definition: InstrTypes.h:190
None.h
Mul
BinaryOperator * Mul
Definition: X86PartialReduction.cpp:68
llvm::CallBase::getParamAlign
MaybeAlign getParamAlign(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Definition: InstrTypes.h:1735
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::CallBase::getParamPreallocatedType
Type * getParamPreallocatedType(unsigned ArgNo) const
Extract the preallocated type for a call or parameter.
Definition: InstrTypes.h:1753
llvm::CallBase::getOperandBundleAt
OperandBundleUse getOperandBundleAt(unsigned Index) const
Return the operand bundle at a specific index.
Definition: InstrTypes.h:1967
llvm::CmpInst::ICMP_ULT
@ ICMP_ULT
unsigned less than
Definition: InstrTypes.h:746
llvm::CallBase::cannotDuplicate
bool cannotDuplicate() const
Determine if the invoke cannot be duplicated.
Definition: InstrTypes.h:1874
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:255
llvm::User::op_iterator
Use * op_iterator
Definition: User.h:229
llvm::CallBase::hasClobberingOperandBundles
bool hasClobberingOperandBundles() const
Return true if this operand bundle user has operand bundles that may write to the heap.
Definition: InstrTypes.h:2049
llvm::Bitfield::Element::NextBit
static constexpr unsigned NextBit
Definition: Bitfields.h:231
uint32_t
llvm::OperandBundleUse
A lightweight accessor for an operand bundle meant to be passed around by value.
Definition: InstrTypes.h:1071
llvm::append_range
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
Definition: STLExtras.h:1789
llvm::Value::getContext
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:991
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::BinaryOperator::classof
static bool classof(const Instruction *I)
Definition: InstrTypes.h:406
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::CastInst
This is the base class for all instructions that perform data casts.
Definition: InstrTypes.h:431
llvm::CallBase::BundleOpInfo::End
uint32_t End
The index in the Use& vector where operands for this operand bundle ends.
Definition: InstrTypes.h:2143
llvm::CallBase::hasFnAttr
bool hasFnAttr(StringRef Kind) const
Determine whether this call has the given attribute.
Definition: InstrTypes.h:1491
llvm::LLVMContext::OB_funclet
@ OB_funclet
Definition: LLVMContext.h:91
llvm::CallBase::hasRetAttr
bool hasRetAttr(Attribute::AttrKind Kind) const
Determine whether the return value has the given attribute.
Definition: InstrTypes.h:1594
llvm::CallBase::dataOperandHasImpliedAttr
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
Definition: InstrTypes.h:1646
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:127
llvm::CallBase::paramHasAttr
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
Definition: Instructions.cpp:341
llvm::CallBase::setArgOperand
void setArgOperand(unsigned i, Value *v)
Definition: InstrTypes.h:1348
llvm::CallBase::setConvergent
void setConvergent()
Definition: InstrTypes.h:1883
llvm::CallBase::onlyWritesMemory
bool onlyWritesMemory(unsigned OpNo) const
Definition: InstrTypes.h:1720
llvm::CallBase::doesNotThrow
bool doesNotThrow() const
Determine if the call cannot unwind.
Definition: InstrTypes.h:1870
llvm::OperandBundleUse::Inputs
ArrayRef< Use > Inputs
Definition: InstrTypes.h:1072
llvm::FunctionCallee::getCallee
Value * getCallee()
Definition: DerivedTypes.h:184
llvm::CallBase::hasOperandBundlesOtherThan
bool hasOperandBundlesOtherThan(ArrayRef< uint32_t > IDs) const
Return true if this operand bundle user contains operand bundles with tags other than those specified...
Definition: InstrTypes.h:2084
CallingConv.h
llvm::CmpInst::isRelational
bool isRelational() const
Return true if the predicate is relational (not EQ or NE).
Definition: InstrTypes.h:945
Attributes.h
llvm::CallBase::onlyAccessesInaccessibleMemory
bool onlyAccessesInaccessibleMemory() const
Determine if the function may only access memory that is inaccessible from the IR.
Definition: InstrTypes.h:1847
llvm::CmpInst::isImpliedFalseByMatchingCmp
static bool isImpliedFalseByMatchingCmp(Predicate Pred1, Predicate Pred2)
Determine if Pred1 implies Pred2 is false when two compares have matching operands.
Definition: Instructions.cpp:4275
llvm::CmpInst::FCMP_UGT
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
Definition: InstrTypes.h:733
llvm::NVPTX::PTXLdStInstCode::V2
@ V2
Definition: NVPTX.h:123
llvm::UnaryInstruction::classof
static bool classof(const Instruction *I)
Definition: InstrTypes.h:79
llvm::OperandBundleDefT::OperandBundleDefT
OperandBundleDefT(const OperandBundleUse &OBU)
Definition: InstrTypes.h:1139
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::CallBase::countOperandBundlesOfType
unsigned countOperandBundlesOfType(uint32_t ID) const
Return the number of operand bundles with the tag ID attached to this instruction.
Definition: InstrTypes.h:1985
llvm::Instruction::Instruction
Instruction(const Instruction &)=delete
llvm::CallBase::getParamAttr
Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const
Get the attribute of a given kind from a given arg.
Definition: InstrTypes.h:1630
llvm::CallBase::CountBundleInputs
static unsigned CountBundleInputs(ArrayRef< OperandBundleDef > Bundles)
Return the total number of values used in Bundles.
Definition: InstrTypes.h:2271
llvm::CmpInst::isImpliedTrueByMatchingCmp
static bool isImpliedTrueByMatchingCmp(Predicate Pred1, Predicate Pred2)
Determine if Pred1 implies Pred2 is true when two compares have matching operands.
Definition: Instructions.cpp:4250
llvm::CallBase::isBundleOperand
bool isBundleOperand(unsigned Idx) const
Return true if the operand at index Idx is a bundle operand.
Definition: InstrTypes.h:1931
llvm::CallBase::setCalledFunction
void setCalledFunction(FunctionCallee Fn)
Sets the function called, including updating the function type.
Definition: InstrTypes.h:1439
llvm::CallBase::CallBase
CallBase(AttributeList const &A, FunctionType *FT, ArgsTy &&... Args)
Definition: InstrTypes.h:1194
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
std
Definition: BitVector.h:850
llvm::CallBase::getDataOperandNo
unsigned getDataOperandNo(Value::const_user_iterator UI) const
Given a value use iterator, return the data operand corresponding to it.
Definition: InstrTypes.h:1306
llvm::OperandBundleDefT::getTag
StringRef getTag() const
Definition: InstrTypes.h:1152
llvm::CallBase::isArgOperand
bool isArgOperand(const Use *U) const
Definition: InstrTypes.h:1363
llvm::BinaryOperator::CreateFAddFMF
static BinaryOperator * CreateFAddFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
Definition: InstrTypes.h:259
llvm::CallBase::data_operands_empty
bool data_operands_empty() const
Definition: InstrTypes.h:1288
llvm::CmpInst::isNonStrictPredicate
bool isNonStrictPredicate() const
Definition: InstrTypes.h:876
llvm::CallBase::bundle_op_info_end
bundle_op_iterator bundle_op_info_end()
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
Definition: InstrTypes.h:2225
llvm::BinaryOperator::CreateNUW
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
Definition: InstrTypes.h:304
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:325
llvm::CallBase::isNoInline
bool isNoInline() const
Return true if the call should not be inlined.
Definition: InstrTypes.h:1819
llvm::CallBase::arg_size
unsigned arg_size() const
Definition: InstrTypes.h:1341
llvm::CallBase::setCannotMerge
void setCannotMerge()
Definition: InstrTypes.h:1879
llvm::CmpInst::isUnsigned
bool isUnsigned() const
Definition: InstrTypes.h:955
llvm::CallBase::data_operands_end
User::const_op_iterator data_operands_end() const
Definition: InstrTypes.h:1279
llvm::CallBase::isReturnNonNull
bool isReturnNonNull() const
Return true if the return value is known to be not null.
Definition: Instructions.cpp:317
Casting.h
llvm::OperandBundleDefT::input_begin
input_iterator input_begin() const
Definition: InstrTypes.h:1149
Function.h
llvm::BinaryOperator::CreateNSWNeg
static BinaryOperator * CreateNSWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Definition: Instructions.cpp:2782
llvm::CallBase::BundleOpInfo::operator==
bool operator==(const BundleOpInfo &Other) const
Definition: InstrTypes.h:2145
llvm::CallBase::classof
static bool classof(const Value *V)
Definition: InstrTypes.h:1252
llvm::CastInst::classof
static bool classof(const Value *V)
Definition: InstrTypes.h:700
llvm::CmpInst::isSigned
bool isSigned() const
Definition: InstrTypes.h:949
llvm::CallBase::isIndirectCall
bool isIndirectCall() const
Return true if the callsite is an indirect call.
Definition: Instructions.cpp:289
llvm::Value::HasDescriptor
unsigned HasDescriptor
Definition: Value.h:121
llvm::OperandBundleUse::operandHasAttr
bool operandHasAttr(unsigned Idx, Attribute::AttrKind A) const
Return true if the operand at index Idx in this operand bundle has the attribute A.
Definition: InstrTypes.h:1080
llvm::CallBase::removeAttributeAtIndex
void removeAttributeAtIndex(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
Definition: InstrTypes.h:1537
llvm::Function::getFunctionType
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Definition: Function.h:177
llvm::CallBase::arg_empty
bool arg_empty() const
Definition: InstrTypes.h:1340
llvm::AttributeList::addRetAttribute
LLVM_NODISCARD AttributeList addRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a return value attribute to the list.
Definition: Attributes.h:518
llvm::CmpInst::isEquality
bool isEquality() const
Determine if this is an equals/not equals predicate.
Definition: InstrTypes.h:939
llvm::AttributeList::getAttributeAtIndex
Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
Definition: Attributes.cpp:1382
llvm::CallBase::getArgOperandNo
unsigned getArgOperandNo(const Use *U) const
Given a use for a arg operand, get the arg operand number that corresponds to it.
Definition: InstrTypes.h:1374
llvm::Bitfield::Element
Describes an element of a Bitfield.
Definition: Bitfields.h:223
llvm::CmpInst::ICMP_SGE
@ ICMP_SGE
signed greater or equal
Definition: InstrTypes.h:749
llvm::CallBase::populateBundleOperandInfos
op_iterator populateBundleOperandInfos(ArrayRef< OperandBundleDef > Bundles, const unsigned BeginIndex)
Populate the BundleOpInfo instances and the Use& vector from Bundles.
Definition: Instructions.cpp:382
llvm::MCID::Add
@ Add
Definition: MCInstrDesc.h:183
llvm::CmpInst::setPredicate
void setPredicate(Predicate P)
Set the predicate for this instruction to the specified value.
Definition: InstrTypes.h:814
llvm::CallBase::setOnlyAccessesInaccessibleMemOrArgMem
void setOnlyAccessesInaccessibleMemOrArgMem()
Definition: InstrTypes.h:1859
llvm::CmpInst::getStrictPredicate
Predicate getStrictPredicate() const
For example, SGE -> SGT, SLE -> SLT, ULE -> ULT, UGE -> UGT.
Definition: InstrTypes.h:882
llvm::CallBase::getCalledOperand
Value * getCalledOperand() const
Definition: InstrTypes.h:1391
llvm::CallBase::doesNoCfCheck
bool doesNoCfCheck() const
Determine if the call should not perform indirect branch tracking.
Definition: InstrTypes.h:1867
llvm::CallBase::args
iterator_range< User::const_op_iterator > args() const
Definition: InstrTypes.h:1337
llvm::SPII::Load
@ Load
Definition: SparcInstrInfo.h:32
llvm::force_iteration_on_noniterable_enum
constexpr force_iteration_on_noniterable_enum_t force_iteration_on_noniterable_enum
Definition: Sequence.h:109
llvm::CmpInst::isTrueWhenEqual
bool isTrueWhenEqual() const
This is just a convenience.
Definition: InstrTypes.h:998
llvm::CallBase::setCalledOperand
void setCalledOperand(Value *V)
Definition: InstrTypes.h:1431
llvm::CmpInst::Create
static CmpInst * Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2, const Twine &Name="", Instruction *InsertBefore=nullptr)
Construct a compare instruction, given the opcode, the predicate and the two operands.
Definition: Instructions.cpp:3823
DECLARE_TRANSPARENT_OPERAND_ACCESSORS
#define DECLARE_TRANSPARENT_OPERAND_ACCESSORS(VALUECLASS)
Macro for generating in-class operand accessor declarations.
Definition: OperandTraits.h:110
llvm::CatchPadInst
Definition: Instructions.h:4493
Predicate
llvm::Instruction::BinaryOps
BinaryOps
Definition: Instruction.h:789
llvm::CmpInst::isFPPredicate
static bool isFPPredicate(Predicate P)
Definition: InstrTypes.h:816
llvm::CallBase::setOnlyWritesMemory
void setOnlyWritesMemory()
Definition: InstrTypes.h:1836
llvm::CallBase::removeAttributeAtIndex
void removeAttributeAtIndex(unsigned i, StringRef Kind)
removes the attribute from the list of attributes.
Definition: InstrTypes.h:1542
llvm::OperandBundleUse::getTagName
StringRef getTagName() const
Return the tag of this operand bundle as a string.
Definition: InstrTypes.h:1090
llvm::CallBase::hasRetAttr
bool hasRetAttr(StringRef Kind) const
Determine whether the return value has the given attribute.
Definition: InstrTypes.h:1598
llvm::FuncletPadInst
Definition: InstrTypes.h:2338
User.h
llvm::CmpInst::ICMP_UGT
@ ICMP_UGT
unsigned greater than
Definition: InstrTypes.h:744
llvm::User::op_begin
op_iterator op_begin()
Definition: User.h:234
llvm::UnaryInstruction::classof
static bool classof(const Value *V)
Definition: InstrTypes.h:87
llvm::CmpInst::FCMP_UNE
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
Definition: InstrTypes.h:737
llvm::CallBase::getArgOperand
Value * getArgOperand(unsigned i) const
Definition: InstrTypes.h:1343
llvm::CallBase::CalledOperandOpEndIdx
static constexpr int CalledOperandOpEndIdx
The last operand is the called operand.
Definition: InstrTypes.h:1188
llvm::CastInst::getOpcode
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
Definition: InstrTypes.h:678
llvm::AttributeList::hasRetAttr
bool hasRetAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the return value.
Definition: Attributes.h:744
llvm::CallBase::data_operands_begin
User::op_iterator data_operands_begin()
data_operands_begin/data_operands_end - Return iterators iterating over the call / invoke argument li...
Definition: InstrTypes.h:1270
llvm::AttributeList::removeFnAttribute
LLVM_NODISCARD AttributeList removeFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:594
llvm::CmpInst::getPredicate
Predicate getPredicate() const
Return the predicate for this instruction.
Definition: InstrTypes.h:811
llvm::X86II::OB
@ OB
Definition: X86BaseInfo.h:801
llvm::BinaryOperator::CreateNUWNeg
static BinaryOperator * CreateNUWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Definition: Instructions.cpp:2794
llvm::BinaryOperator::cloneImpl
BinaryOperator * cloneImpl() const
Definition: Instructions.cpp:4612
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::FunctionCallee
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Definition: DerivedTypes.h:165
llvm::FixedNumOperandTraits
FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
Definition: OperandTraits.h:30
llvm::CmpInst::isOrdered
static bool isOrdered(Predicate predicate)
Determine if the predicate is an ordered operation.
Definition: Instructions.cpp:4216
llvm::Instruction::copyIRFlags
void copyIRFlags(const Value *V, bool IncludeWrapFlags=true)
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this...
Definition: Instruction.cpp:299
llvm::AttributeList::addAttributeAtIndex
LLVM_NODISCARD AttributeList addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
Definition: Attributes.cpp:1184
llvm::CmpInst::FCMP_OLE
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
Definition: InstrTypes.h:728
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::CallBase::removeParamAttr
void removeParamAttr(unsigned ArgNo, StringRef Kind)
Removes the attribute from the given argument.
Definition: InstrTypes.h:1573
llvm::CmpInst::LAST_FCMP_PREDICATE
@ LAST_FCMP_PREDICATE
Definition: InstrTypes.h:740
llvm::CallBase::addDereferenceableParamAttr
void addDereferenceableParamAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
Definition: InstrTypes.h:1584
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1176
llvm::BinaryOperator::CreateExact
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
Definition: InstrTypes.h:335
DerivedTypes.h
llvm::CastInst::CastInst
CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr, BasicBlock *InsertAtEnd)
Constructor with insert-at-end-of-block semantics for subclasses.
Definition: InstrTypes.h:440
pred
hexagon gen pred
Definition: HexagonGenPredicate.cpp:134
llvm::CmpInst::isUnordered
static bool isUnordered(Predicate predicate)
Determine if the predicate is an unordered operation.
Definition: Instructions.cpp:4225
llvm::CallBase::isPassPointeeByValueArgument
bool isPassPointeeByValueArgument(unsigned ArgNo) const
Determine whether this argument is passed by value, in an alloca, or is preallocated.
Definition: InstrTypes.h:1682
llvm::CallBase::setCalledFunction
void setCalledFunction(FunctionType *FTy, Value *Fn)
Sets the function called, including updating to the specified function type.
Definition: InstrTypes.h:1445
llvm::CallBase::removeRetAttr
void removeRetAttr(Attribute::AttrKind Kind)
Removes the attribute from the return value.
Definition: InstrTypes.h:1557
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::User::Op
Use & Op()
Definition: User.h:133
llvm::CallBase::onlyAccessesInaccessibleMemOrArgMem
bool onlyAccessesInaccessibleMemOrArgMem() const
Determine if the function may only access memory that is either inaccessible from the IR or pointed t...
Definition: InstrTypes.h:1856
llvm::CallBase::onlyReadsMemory
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
Definition: InstrTypes.h:1826
LLVMContext.h
llvm::LLVMContext::OB_deopt
@ OB_deopt
Definition: LLVMContext.h:90
llvm::CallBase::getParamInAllocaType
Type * getParamInAllocaType(unsigned ArgNo) const
Extract the preallocated type for a call or parameter.
Definition: InstrTypes.h:1762
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::User::getOperand
Value * getOperand(unsigned i) const
Definition: User.h:169
llvm::FuncletPadInst::getParentPad
Value * getParentPad() const
Convenience accessors.
Definition: InstrTypes.h:2373
llvm::CallBase::setCannotDuplicate
void setCannotDuplicate()
Definition: InstrTypes.h:1875
llvm::CallBase::onlyWritesMemory
bool onlyWritesMemory() const
Determine if the call does not access or only writes memory.
Definition: InstrTypes.h:1833
llvm::BinaryOperator::Create
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
Definition: Instructions.cpp:2750
llvm::CmpInst::FCMP_TRUE
@ FCMP_TRUE
1 1 1 1 Always true (always folded)
Definition: InstrTypes.h:738
llvm::FuncletPadInst::setParentPad
void setParentPad(Value *ParentPad)
Definition: InstrTypes.h:2374
llvm::AttributeList::getFnAttr
Attribute getFnAttr(Attribute::AttrKind Kind) const
Return the attribute object that exists for the function.
Definition: Attributes.h:788
Value.h
llvm::FunctionType::getReturnType
Type * getReturnType() const
Definition: DerivedTypes.h:124
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::FuncletPadInst::arg_operands
const_op_range arg_operands() const
arg_operands - iteration adapter for range-for loops.
Definition: InstrTypes.h:2388
llvm::CallBase::hasReadingOperandBundles
bool hasReadingOperandBundles() const
Return true if this operand bundle user has operand bundles that may read from the heap.
Definition: Instructions.cpp:483
llvm::VectorType::get
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Definition: Type.cpp:670
llvm::CmpInst::PredicateField
Bitfield::Element< Predicate, 0, 6, LAST_ICMP_PREDICATE > PredicateField
Definition: InstrTypes.h:757
llvm::AttributeList::getParamAttr
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
Definition: Attributes.h:778
llvm::CmpInst::BAD_FCMP_PREDICATE
@ BAD_FCMP_PREDICATE
Definition: InstrTypes.h:741
llvm::UnaryOperator::classof
static bool classof(const Instruction *I)
Definition: InstrTypes.h:178
llvm::BinaryOperator::CreateFSubFMF
static BinaryOperator * CreateFSubFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
Definition: InstrTypes.h:264
llvm::Instruction::BasicBlock
friend class BasicBlock
Various leaf nodes.
Definition: Instruction.h:826
llvm::CmpInst::FCMP_ORD
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
Definition: InstrTypes.h:730
llvm::CallBase::args
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
Definition: InstrTypes.h:1334
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1198
llvm::CmpInst::FCMP_UEQ
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
Definition: InstrTypes.h:732
llvm::CallBase::setCallingConv
void setCallingConv(CallingConv::ID CC)
Definition: InstrTypes.h:1458
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:44
llvm::CallBase::doesNotAccessMemory
bool doesNotAccessMemory() const
Determine if the call does not access memory.
Definition: InstrTypes.h:1822
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::User::op_end
op_iterator op_end()
Definition: User.h:236
llvm::CallBase::setOnlyReadsMemory
void setOnlyReadsMemory()
Definition: InstrTypes.h:1830
llvm::CmpInst::LAST_ICMP_PREDICATE
@ LAST_ICMP_PREDICATE
Definition: InstrTypes.h:753