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