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