Movatterモバイル変換


[0]ホーム

URL:


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

Generated on Thu Jul 17 2025 10:05:16 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp