LLVM  14.0.0git
IRBuilder.h
Go to the documentation of this file.
1 //===- llvm/IRBuilder.h - Builder for LLVM Instructions ---------*- 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 the IRBuilder class, which is used as a convenient way
10 // to create LLVM instructions with a consistent and simplified interface.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_IR_IRBUILDER_H
15 #define LLVM_IR_IRBUILDER_H
16 
17 #include "llvm-c/Types.h"
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/None.h"
20 #include "llvm/ADT/STLExtras.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/ADT/Twine.h"
23 #include "llvm/IR/BasicBlock.h"
24 #include "llvm/IR/Constant.h"
25 #include "llvm/IR/ConstantFolder.h"
26 #include "llvm/IR/Constants.h"
27 #include "llvm/IR/DataLayout.h"
29 #include "llvm/IR/DebugLoc.h"
30 #include "llvm/IR/DerivedTypes.h"
31 #include "llvm/IR/Function.h"
32 #include "llvm/IR/GlobalVariable.h"
33 #include "llvm/IR/InstrTypes.h"
34 #include "llvm/IR/Instruction.h"
35 #include "llvm/IR/Instructions.h"
36 #include "llvm/IR/IntrinsicInst.h"
37 #include "llvm/IR/LLVMContext.h"
38 #include "llvm/IR/Module.h"
39 #include "llvm/IR/Operator.h"
40 #include "llvm/IR/Type.h"
41 #include "llvm/IR/Value.h"
42 #include "llvm/IR/ValueHandle.h"
45 #include "llvm/Support/Casting.h"
46 #include <cassert>
47 #include <cstddef>
48 #include <cstdint>
49 #include <functional>
50 #include <utility>
51 
52 namespace llvm {
53 
54 class APInt;
55 class MDNode;
56 class Use;
57 
58 /// This provides the default implementation of the IRBuilder
59 /// 'InsertHelper' method that is called whenever an instruction is created by
60 /// IRBuilder and needs to be inserted.
61 ///
62 /// By default, this inserts the instruction at the insertion point.
64 public:
65  virtual ~IRBuilderDefaultInserter();
66 
67  virtual void InsertHelper(Instruction *I, const Twine &Name,
68  BasicBlock *BB,
69  BasicBlock::iterator InsertPt) const {
70  if (BB) BB->getInstList().insert(InsertPt, I);
71  I->setName(Name);
72  }
73 };
74 
75 /// Provides an 'InsertHelper' that calls a user-provided callback after
76 /// performing the default insertion.
78  std::function<void(Instruction *)> Callback;
79 
80 public:
82 
84  : Callback(std::move(Callback)) {}
85 
87  BasicBlock *BB,
88  BasicBlock::iterator InsertPt) const override {
90  Callback(I);
91  }
92 };
93 
94 /// Common base class shared among various IRBuilders.
96  /// Pairs of (metadata kind, MDNode *) that should be added to all newly
97  /// created instructions, like !dbg metadata.
99 
100  /// Add or update the an entry (Kind, MD) to MetadataToCopy, if \p MD is not
101  /// null. If \p MD is null, remove the entry with \p Kind.
102  void AddOrRemoveMetadataToCopy(unsigned Kind, MDNode *MD) {
103  if (!MD) {
104  erase_if(MetadataToCopy, [Kind](const std::pair<unsigned, MDNode *> &KV) {
105  return KV.first == Kind;
106  });
107  return;
108  }
109 
110  for (auto &KV : MetadataToCopy)
111  if (KV.first == Kind) {
112  KV.second = MD;
113  return;
114  }
115 
116  MetadataToCopy.emplace_back(Kind, MD);
117  }
118 
119 protected:
125 
128 
132 
134 
135 public:
138  MDNode *FPMathTag, ArrayRef<OperandBundleDef> OpBundles)
139  : Context(context), Folder(Folder), Inserter(Inserter),
143  DefaultOperandBundles(OpBundles) {
145  }
146 
147  /// Insert and return the specified instruction.
148  template<typename InstTy>
149  InstTy *Insert(InstTy *I, const Twine &Name = "") const {
152  return I;
153  }
154 
155  /// No-op overload to handle constants.
156  Constant *Insert(Constant *C, const Twine& = "") const {
157  return C;
158  }
159 
160  Value *Insert(Value *V, const Twine &Name = "") const {
161  if (Instruction *I = dyn_cast<Instruction>(V))
162  return Insert(I, Name);
163  assert(isa<Constant>(V));
164  return V;
165  }
166 
167  //===--------------------------------------------------------------------===//
168  // Builder configuration methods
169  //===--------------------------------------------------------------------===//
170 
171  /// Clear the insertion point: created instructions will not be
172  /// inserted into a block.
174  BB = nullptr;
176  }
177 
178  BasicBlock *GetInsertBlock() const { return BB; }
180  LLVMContext &getContext() const { return Context; }
181 
182  /// This specifies that created instructions should be appended to the
183  /// end of the specified block.
184  void SetInsertPoint(BasicBlock *TheBB) {
185  BB = TheBB;
186  InsertPt = BB->end();
187  }
188 
189  /// This specifies that created instructions should be inserted before
190  /// the specified instruction.
192  BB = I->getParent();
193  InsertPt = I->getIterator();
194  assert(InsertPt != BB->end() && "Can't read debug loc from end()");
195  SetCurrentDebugLocation(I->getDebugLoc());
196  }
197 
198  /// This specifies that created instructions should be inserted at the
199  /// specified point.
201  BB = TheBB;
202  InsertPt = IP;
203  if (IP != TheBB->end())
204  SetCurrentDebugLocation(IP->getDebugLoc());
205  }
206 
207  /// Set location information used by debugging information.
209  AddOrRemoveMetadataToCopy(LLVMContext::MD_dbg, L.getAsMDNode());
210  }
211 
212  /// Collect metadata with IDs \p MetadataKinds from \p Src which should be
213  /// added to all created instructions. Entries present in MedataDataToCopy but
214  /// not on \p Src will be dropped from MetadataToCopy.
216  ArrayRef<unsigned> MetadataKinds) {
217  for (unsigned K : MetadataKinds)
218  AddOrRemoveMetadataToCopy(K, Src->getMetadata(K));
219  }
220 
221  /// Get location information used by debugging information.
223  for (auto &KV : MetadataToCopy)
224  if (KV.first == LLVMContext::MD_dbg)
225  return {cast<DILocation>(KV.second)};
226 
227  return {};
228  }
229 
230  /// If this builder has a current debug location, set it on the
231  /// specified instruction.
233  for (const auto &KV : MetadataToCopy)
234  if (KV.first == LLVMContext::MD_dbg) {
235  I->setDebugLoc(DebugLoc(KV.second));
236  return;
237  }
238  }
239 
240  /// Add all entries in MetadataToCopy to \p I.
242  for (auto &KV : MetadataToCopy)
243  I->setMetadata(KV.first, KV.second);
244  }
245 
246  /// Get the return type of the current function that we're emitting
247  /// into.
249 
250  /// InsertPoint - A saved insertion point.
251  class InsertPoint {
252  BasicBlock *Block = nullptr;
253  BasicBlock::iterator Point;
254 
255  public:
256  /// Creates a new insertion point which doesn't point to anything.
257  InsertPoint() = default;
258 
259  /// Creates a new insertion point at the given location.
261  : Block(InsertBlock), Point(InsertPoint) {}
262 
263  /// Returns true if this insert point is set.
264  bool isSet() const { return (Block != nullptr); }
265 
266  BasicBlock *getBlock() const { return Block; }
267  BasicBlock::iterator getPoint() const { return Point; }
268  };
269 
270  /// Returns the current insert point.
271  InsertPoint saveIP() const {
273  }
274 
275  /// Returns the current insert point, clearing it in the process.
279  return IP;
280  }
281 
282  /// Sets the current insert point to a previously-saved location.
284  if (IP.isSet())
285  SetInsertPoint(IP.getBlock(), IP.getPoint());
286  else
288  }
289 
290  /// Get the floating point math metadata being used.
292 
293  /// Get the flags to be applied to created floating point ops
294  FastMathFlags getFastMathFlags() const { return FMF; }
295 
297 
298  /// Clear the fast-math flags.
300 
301  /// Set the floating point math metadata to be used.
302  void setDefaultFPMathTag(MDNode *FPMathTag) { DefaultFPMathTag = FPMathTag; }
303 
304  /// Set the fast-math flags to be used with generated fp-math operators
305  void setFastMathFlags(FastMathFlags NewFMF) { FMF = NewFMF; }
306 
307  /// Enable/Disable use of constrained floating point math. When
308  /// enabled the CreateF<op>() calls instead create constrained
309  /// floating point intrinsic calls. Fast math flags are unaffected
310  /// by this setting.
311  void setIsFPConstrained(bool IsCon) { IsFPConstrained = IsCon; }
312 
313  /// Query for the use of constrained floating point math
315 
316  /// Set the exception handling to be used with constrained floating point
318 #ifndef NDEBUG
319  Optional<StringRef> ExceptStr = ExceptionBehaviorToStr(NewExcept);
320  assert(ExceptStr.hasValue() && "Garbage strict exception behavior!");
321 #endif
322  DefaultConstrainedExcept = NewExcept;
323  }
324 
325  /// Set the rounding mode handling to be used with constrained floating point
327 #ifndef NDEBUG
328  Optional<StringRef> RoundingStr = RoundingModeToStr(NewRounding);
329  assert(RoundingStr.hasValue() && "Garbage strict rounding mode!");
330 #endif
331  DefaultConstrainedRounding = NewRounding;
332  }
333 
334  /// Get the exception handling used with constrained floating point
337  }
338 
339  /// Get the rounding mode handling used with constrained floating point
342  }
343 
345  assert(BB && "Must have a basic block to set any function attributes!");
346 
347  Function *F = BB->getParent();
348  if (!F->hasFnAttribute(Attribute::StrictFP)) {
349  F->addFnAttr(Attribute::StrictFP);
350  }
351  }
352 
354  I->addAttribute(AttributeList::FunctionIndex, Attribute::StrictFP);
355  }
356 
358  DefaultOperandBundles = OpBundles;
359  }
360 
361  //===--------------------------------------------------------------------===//
362  // RAII helpers.
363  //===--------------------------------------------------------------------===//
364 
365  // RAII object that stores the current insertion point and restores it
366  // when the object is destroyed. This includes the debug location.
368  IRBuilderBase &Builder;
370  BasicBlock::iterator Point;
371  DebugLoc DbgLoc;
372 
373  public:
375  : Builder(B), Block(B.GetInsertBlock()), Point(B.GetInsertPoint()),
376  DbgLoc(B.getCurrentDebugLocation()) {}
377 
378  InsertPointGuard(const InsertPointGuard &) = delete;
379  InsertPointGuard &operator=(const InsertPointGuard &) = delete;
380 
382  Builder.restoreIP(InsertPoint(Block, Point));
383  Builder.SetCurrentDebugLocation(DbgLoc);
384  }
385  };
386 
387  // RAII object that stores the current fast math settings and restores
388  // them when the object is destroyed.
390  IRBuilderBase &Builder;
391  FastMathFlags FMF;
392  MDNode *FPMathTag;
393  bool IsFPConstrained;
394  fp::ExceptionBehavior DefaultConstrainedExcept;
395  RoundingMode DefaultConstrainedRounding;
396 
397  public:
399  : Builder(B), FMF(B.FMF), FPMathTag(B.DefaultFPMathTag),
400  IsFPConstrained(B.IsFPConstrained),
401  DefaultConstrainedExcept(B.DefaultConstrainedExcept),
402  DefaultConstrainedRounding(B.DefaultConstrainedRounding) {}
403 
404  FastMathFlagGuard(const FastMathFlagGuard &) = delete;
405  FastMathFlagGuard &operator=(const FastMathFlagGuard &) = delete;
406 
408  Builder.FMF = FMF;
409  Builder.DefaultFPMathTag = FPMathTag;
410  Builder.IsFPConstrained = IsFPConstrained;
411  Builder.DefaultConstrainedExcept = DefaultConstrainedExcept;
412  Builder.DefaultConstrainedRounding = DefaultConstrainedRounding;
413  }
414  };
415 
416  // RAII object that stores the current default operand bundles and restores
417  // them when the object is destroyed.
419  IRBuilderBase &Builder;
420  ArrayRef<OperandBundleDef> DefaultOperandBundles;
421 
422  public:
424  : Builder(B), DefaultOperandBundles(B.DefaultOperandBundles) {}
425 
426  OperandBundlesGuard(const OperandBundlesGuard &) = delete;
428 
430  Builder.DefaultOperandBundles = DefaultOperandBundles;
431  }
432  };
433 
434 
435  //===--------------------------------------------------------------------===//
436  // Miscellaneous creation methods.
437  //===--------------------------------------------------------------------===//
438 
439  /// Make a new global variable with initializer type i8*
440  ///
441  /// Make a new global variable with an initializer that has array of i8 type
442  /// filled in with the null terminated string value specified. The new global
443  /// variable will be marked mergable with any others of the same contents. If
444  /// Name is specified, it is the name of the global variable created.
445  ///
446  /// If no module is given via \p M, it is take from the insertion point basic
447  /// block.
449  unsigned AddressSpace = 0,
450  Module *M = nullptr);
451 
452  /// Get a constant value representing either true or false.
453  ConstantInt *getInt1(bool V) {
454  return ConstantInt::get(getInt1Ty(), V);
455  }
456 
457  /// Get the constant value for i1 true.
460  }
461 
462  /// Get the constant value for i1 false.
465  }
466 
467  /// Get a constant 8-bit value.
468  ConstantInt *getInt8(uint8_t C) {
469  return ConstantInt::get(getInt8Ty(), C);
470  }
471 
472  /// Get a constant 16-bit value.
474  return ConstantInt::get(getInt16Ty(), C);
475  }
476 
477  /// Get a constant 32-bit value.
479  return ConstantInt::get(getInt32Ty(), C);
480  }
481 
482  /// Get a constant 64-bit value.
483  ConstantInt *getInt64(uint64_t C) {
484  return ConstantInt::get(getInt64Ty(), C);
485  }
486 
487  /// Get a constant N-bit value, zero extended or truncated from
488  /// a 64-bit value.
489  ConstantInt *getIntN(unsigned N, uint64_t C) {
490  return ConstantInt::get(getIntNTy(N), C);
491  }
492 
493  /// Get a constant integer value.
494  ConstantInt *getInt(const APInt &AI) {
495  return ConstantInt::get(Context, AI);
496  }
497 
498  //===--------------------------------------------------------------------===//
499  // Type creation methods
500  //===--------------------------------------------------------------------===//
501 
502  /// Fetch the type representing a single bit
504  return Type::getInt1Ty(Context);
505  }
506 
507  /// Fetch the type representing an 8-bit integer.
509  return Type::getInt8Ty(Context);
510  }
511 
512  /// Fetch the type representing a 16-bit integer.
514  return Type::getInt16Ty(Context);
515  }
516 
517  /// Fetch the type representing a 32-bit integer.
519  return Type::getInt32Ty(Context);
520  }
521 
522  /// Fetch the type representing a 64-bit integer.
524  return Type::getInt64Ty(Context);
525  }
526 
527  /// Fetch the type representing a 128-bit integer.
529 
530  /// Fetch the type representing an N-bit integer.
531  IntegerType *getIntNTy(unsigned N) {
532  return Type::getIntNTy(Context, N);
533  }
534 
535  /// Fetch the type representing a 16-bit floating point value.
537  return Type::getHalfTy(Context);
538  }
539 
540  /// Fetch the type representing a 16-bit brain floating point value.
542  return Type::getBFloatTy(Context);
543  }
544 
545  /// Fetch the type representing a 32-bit floating point value.
547  return Type::getFloatTy(Context);
548  }
549 
550  /// Fetch the type representing a 64-bit floating point value.
552  return Type::getDoubleTy(Context);
553  }
554 
555  /// Fetch the type representing void.
557  return Type::getVoidTy(Context);
558  }
559 
560  /// Fetch the type representing a pointer to an 8-bit integer value.
561  PointerType *getInt8PtrTy(unsigned AddrSpace = 0) {
562  return Type::getInt8PtrTy(Context, AddrSpace);
563  }
564 
565  /// Fetch the type representing a pointer to an integer value.
566  IntegerType *getIntPtrTy(const DataLayout &DL, unsigned AddrSpace = 0) {
567  return DL.getIntPtrType(Context, AddrSpace);
568  }
569 
570  //===--------------------------------------------------------------------===//
571  // Intrinsic creation methods
572  //===--------------------------------------------------------------------===//
573 
574  /// Create and insert a memset to the specified pointer and the
575  /// specified value.
576  ///
577  /// If the pointer isn't an i8*, it will be converted. If a TBAA tag is
578  /// specified, it will be added to the instruction. Likewise with alias.scope
579  /// and noalias tags.
580  CallInst *CreateMemSet(Value *Ptr, Value *Val, uint64_t Size,
581  MaybeAlign Align, bool isVolatile = false,
582  MDNode *TBAATag = nullptr, MDNode *ScopeTag = nullptr,
583  MDNode *NoAliasTag = nullptr) {
584  return CreateMemSet(Ptr, Val, getInt64(Size), Align, isVolatile,
585  TBAATag, ScopeTag, NoAliasTag);
586  }
587 
589  bool isVolatile = false, MDNode *TBAATag = nullptr,
590  MDNode *ScopeTag = nullptr,
591  MDNode *NoAliasTag = nullptr);
592 
593  /// Create and insert an element unordered-atomic memset of the region of
594  /// memory starting at the given pointer to the given value.
595  ///
596  /// If the pointer isn't an i8*, it will be converted. If a TBAA tag is
597  /// specified, it will be added to the instruction. Likewise with alias.scope
598  /// and noalias tags.
600  uint64_t Size, Align Alignment,
601  uint32_t ElementSize,
602  MDNode *TBAATag = nullptr,
603  MDNode *ScopeTag = nullptr,
604  MDNode *NoAliasTag = nullptr) {
606  Align(Alignment), ElementSize,
607  TBAATag, ScopeTag, NoAliasTag);
608  }
609 
611  Value *Size, Align Alignment,
612  uint32_t ElementSize,
613  MDNode *TBAATag = nullptr,
614  MDNode *ScopeTag = nullptr,
615  MDNode *NoAliasTag = nullptr);
616 
617  /// Create and insert a memcpy between the specified pointers.
618  ///
619  /// If the pointers aren't i8*, they will be converted. If a TBAA tag is
620  /// specified, it will be added to the instruction. Likewise with alias.scope
621  /// and noalias tags.
622  CallInst *CreateMemCpy(Value *Dst, MaybeAlign DstAlign, Value *Src,
623  MaybeAlign SrcAlign, uint64_t Size,
624  bool isVolatile = false, MDNode *TBAATag = nullptr,
625  MDNode *TBAAStructTag = nullptr,
626  MDNode *ScopeTag = nullptr,
627  MDNode *NoAliasTag = nullptr) {
628  return CreateMemCpy(Dst, DstAlign, Src, SrcAlign, getInt64(Size),
629  isVolatile, TBAATag, TBAAStructTag, ScopeTag,
630  NoAliasTag);
631  }
632 
634  Intrinsic::ID IntrID, Value *Dst, MaybeAlign DstAlign, Value *Src,
635  MaybeAlign SrcAlign, Value *Size, bool isVolatile = false,
636  MDNode *TBAATag = nullptr, MDNode *TBAAStructTag = nullptr,
637  MDNode *ScopeTag = nullptr, MDNode *NoAliasTag = nullptr);
638 
639  CallInst *CreateMemCpy(Value *Dst, MaybeAlign DstAlign, Value *Src,
640  MaybeAlign SrcAlign, Value *Size,
641  bool isVolatile = false, MDNode *TBAATag = nullptr,
642  MDNode *TBAAStructTag = nullptr,
643  MDNode *ScopeTag = nullptr,
644  MDNode *NoAliasTag = nullptr) {
645  return CreateMemTransferInst(Intrinsic::memcpy, Dst, DstAlign, Src,
646  SrcAlign, Size, isVolatile, TBAATag,
647  TBAAStructTag, ScopeTag, NoAliasTag);
648  }
649 
650  CallInst *
651  CreateMemCpyInline(Value *Dst, MaybeAlign DstAlign, Value *Src,
652  MaybeAlign SrcAlign, Value *Size, bool IsVolatile = false,
653  MDNode *TBAATag = nullptr, MDNode *TBAAStructTag = nullptr,
654  MDNode *ScopeTag = nullptr, MDNode *NoAliasTag = nullptr);
655 
656  /// Create and insert an element unordered-atomic memcpy between the
657  /// specified pointers.
658  ///
659  /// DstAlign/SrcAlign are the alignments of the Dst/Src pointers, respectively.
660  ///
661  /// If the pointers aren't i8*, they will be converted. If a TBAA tag is
662  /// specified, it will be added to the instruction. Likewise with alias.scope
663  /// and noalias tags.
665  Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size,
666  uint32_t ElementSize, MDNode *TBAATag = nullptr,
667  MDNode *TBAAStructTag = nullptr, MDNode *ScopeTag = nullptr,
668  MDNode *NoAliasTag = nullptr);
669 
670  CallInst *CreateMemMove(Value *Dst, MaybeAlign DstAlign, Value *Src,
671  MaybeAlign SrcAlign, uint64_t Size,
672  bool isVolatile = false, MDNode *TBAATag = nullptr,
673  MDNode *ScopeTag = nullptr,
674  MDNode *NoAliasTag = nullptr) {
675  return CreateMemMove(Dst, DstAlign, Src, SrcAlign, getInt64(Size),
676  isVolatile, TBAATag, ScopeTag, NoAliasTag);
677  }
678 
679  CallInst *CreateMemMove(Value *Dst, MaybeAlign DstAlign, Value *Src,
680  MaybeAlign SrcAlign, Value *Size,
681  bool isVolatile = false, MDNode *TBAATag = nullptr,
682  MDNode *ScopeTag = nullptr,
683  MDNode *NoAliasTag = nullptr);
684 
685  /// \brief Create and insert an element unordered-atomic memmove between the
686  /// specified pointers.
687  ///
688  /// DstAlign/SrcAlign are the alignments of the Dst/Src pointers,
689  /// respectively.
690  ///
691  /// If the pointers aren't i8*, they will be converted. If a TBAA tag is
692  /// specified, it will be added to the instruction. Likewise with alias.scope
693  /// and noalias tags.
695  Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size,
696  uint32_t ElementSize, MDNode *TBAATag = nullptr,
697  MDNode *TBAAStructTag = nullptr, MDNode *ScopeTag = nullptr,
698  MDNode *NoAliasTag = nullptr);
699 
700  /// Create a vector fadd reduction intrinsic of the source vector.
701  /// The first parameter is a scalar accumulator value for ordered reductions.
702  CallInst *CreateFAddReduce(Value *Acc, Value *Src);
703 
704  /// Create a vector fmul reduction intrinsic of the source vector.
705  /// The first parameter is a scalar accumulator value for ordered reductions.
706  CallInst *CreateFMulReduce(Value *Acc, Value *Src);
707 
708  /// Create a vector int add reduction intrinsic of the source vector.
710 
711  /// Create a vector int mul reduction intrinsic of the source vector.
713 
714  /// Create a vector int AND reduction intrinsic of the source vector.
716 
717  /// Create a vector int OR reduction intrinsic of the source vector.
719 
720  /// Create a vector int XOR reduction intrinsic of the source vector.
722 
723  /// Create a vector integer max reduction intrinsic of the source
724  /// vector.
725  CallInst *CreateIntMaxReduce(Value *Src, bool IsSigned = false);
726 
727  /// Create a vector integer min reduction intrinsic of the source
728  /// vector.
729  CallInst *CreateIntMinReduce(Value *Src, bool IsSigned = false);
730 
731  /// Create a vector float max reduction intrinsic of the source
732  /// vector.
734 
735  /// Create a vector float min reduction intrinsic of the source
736  /// vector.
738 
739  /// Create a lifetime.start intrinsic.
740  ///
741  /// If the pointer isn't i8* it will be converted.
743 
744  /// Create a lifetime.end intrinsic.
745  ///
746  /// If the pointer isn't i8* it will be converted.
747  CallInst *CreateLifetimeEnd(Value *Ptr, ConstantInt *Size = nullptr);
748 
749  /// Create a call to invariant.start intrinsic.
750  ///
751  /// If the pointer isn't i8* it will be converted.
753 
754  /// Create a call to Masked Load intrinsic
755  CallInst *CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment, Value *Mask,
756  Value *PassThru = nullptr, const Twine &Name = "");
757 
758  /// Create a call to Masked Store intrinsic
759  CallInst *CreateMaskedStore(Value *Val, Value *Ptr, Align Alignment,
760  Value *Mask);
761 
762  /// Create a call to Masked Gather intrinsic
763  CallInst *CreateMaskedGather(Type *Ty, Value *Ptrs, Align Alignment,
764  Value *Mask = nullptr, Value *PassThru = nullptr,
765  const Twine &Name = "");
766 
767  /// Create a call to Masked Scatter intrinsic
768  CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, Align Alignment,
769  Value *Mask = nullptr);
770 
771  /// Create an assume intrinsic call that allows the optimizer to
772  /// assume that the provided condition will be true.
773  ///
774  /// The optional argument \p OpBundles specifies operand bundles that are
775  /// added to the call instruction.
778 
779  /// Create a llvm.experimental.noalias.scope.decl intrinsic call.
783  MetadataAsValue::get(Context, ScopeTag));
784  }
785 
786  /// Create a call to the experimental.gc.statepoint intrinsic to
787  /// start a new statepoint sequence.
788  CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
789  Value *ActualCallee,
790  ArrayRef<Value *> CallArgs,
791  Optional<ArrayRef<Value *>> DeoptArgs,
792  ArrayRef<Value *> GCArgs,
793  const Twine &Name = "");
794 
795  /// Create a call to the experimental.gc.statepoint intrinsic to
796  /// start a new statepoint sequence.
797  CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
798  Value *ActualCallee, uint32_t Flags,
799  ArrayRef<Value *> CallArgs,
800  Optional<ArrayRef<Use>> TransitionArgs,
801  Optional<ArrayRef<Use>> DeoptArgs,
802  ArrayRef<Value *> GCArgs,
803  const Twine &Name = "");
804 
805  /// Conveninence function for the common case when CallArgs are filled
806  /// in using makeArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be
807  /// .get()'ed to get the Value pointer.
808  CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
809  Value *ActualCallee, ArrayRef<Use> CallArgs,
810  Optional<ArrayRef<Value *>> DeoptArgs,
811  ArrayRef<Value *> GCArgs,
812  const Twine &Name = "");
813 
814  /// Create an invoke to the experimental.gc.statepoint intrinsic to
815  /// start a new statepoint sequence.
816  InvokeInst *
817  CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
818  Value *ActualInvokee, BasicBlock *NormalDest,
819  BasicBlock *UnwindDest, ArrayRef<Value *> InvokeArgs,
820  Optional<ArrayRef<Value *>> DeoptArgs,
821  ArrayRef<Value *> GCArgs, const Twine &Name = "");
822 
823  /// Create an invoke to the experimental.gc.statepoint intrinsic to
824  /// start a new statepoint sequence.
826  uint64_t ID, uint32_t NumPatchBytes, Value *ActualInvokee,
827  BasicBlock *NormalDest, BasicBlock *UnwindDest, uint32_t Flags,
828  ArrayRef<Value *> InvokeArgs, Optional<ArrayRef<Use>> TransitionArgs,
829  Optional<ArrayRef<Use>> DeoptArgs, ArrayRef<Value *> GCArgs,
830  const Twine &Name = "");
831 
832  // Convenience function for the common case when CallArgs are filled in using
833  // makeArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be .get()'ed to
834  // get the Value *.
835  InvokeInst *
836  CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
837  Value *ActualInvokee, BasicBlock *NormalDest,
838  BasicBlock *UnwindDest, ArrayRef<Use> InvokeArgs,
839  Optional<ArrayRef<Value *>> DeoptArgs,
840  ArrayRef<Value *> GCArgs, const Twine &Name = "");
841 
842  /// Create a call to the experimental.gc.result intrinsic to extract
843  /// the result from a call wrapped in a statepoint.
844  CallInst *CreateGCResult(Instruction *Statepoint,
845  Type *ResultType,
846  const Twine &Name = "");
847 
848  /// Create a call to the experimental.gc.relocate intrinsics to
849  /// project the relocated value of one pointer from the statepoint.
851  int BaseOffset,
852  int DerivedOffset,
853  Type *ResultType,
854  const Twine &Name = "");
855 
856  /// Create a call to the experimental.gc.pointer.base intrinsic to get the
857  /// base pointer for the specified derived pointer.
858  CallInst *CreateGCGetPointerBase(Value *DerivedPtr, const Twine &Name = "");
859 
860  /// Create a call to the experimental.gc.get.pointer.offset intrinsic to get
861  /// the offset of the specified derived pointer from its base.
862  CallInst *CreateGCGetPointerOffset(Value *DerivedPtr, const Twine &Name = "");
863 
864  /// Create a call to llvm.vscale, multiplied by \p Scaling. The type of VScale
865  /// will be the same type as that of \p Scaling.
866  Value *CreateVScale(Constant *Scaling, const Twine &Name = "");
867 
868  /// Creates a vector of type \p DstType with the linear sequence <0, 1, ...>
869  Value *CreateStepVector(Type *DstType, const Twine &Name = "");
870 
871  /// Create a call to intrinsic \p ID with 1 operand which is mangled on its
872  /// type.
874  Instruction *FMFSource = nullptr,
875  const Twine &Name = "");
876 
877  /// Create a call to intrinsic \p ID with 2 operands which is mangled on the
878  /// first type.
880  Instruction *FMFSource = nullptr,
881  const Twine &Name = "");
882 
883  /// Create a call to intrinsic \p ID with \p args, mangled using \p Types. If
884  /// \p FMFSource is provided, copy fast-math-flags from that instruction to
885  /// the intrinsic.
888  Instruction *FMFSource = nullptr,
889  const Twine &Name = "");
890 
891  /// Create call to the minnum intrinsic.
892  CallInst *CreateMinNum(Value *LHS, Value *RHS, const Twine &Name = "") {
893  return CreateBinaryIntrinsic(Intrinsic::minnum, LHS, RHS, nullptr, Name);
894  }
895 
896  /// Create call to the maxnum intrinsic.
897  CallInst *CreateMaxNum(Value *LHS, Value *RHS, const Twine &Name = "") {
898  return CreateBinaryIntrinsic(Intrinsic::maxnum, LHS, RHS, nullptr, Name);
899  }
900 
901  /// Create call to the minimum intrinsic.
902  CallInst *CreateMinimum(Value *LHS, Value *RHS, const Twine &Name = "") {
903  return CreateBinaryIntrinsic(Intrinsic::minimum, LHS, RHS, nullptr, Name);
904  }
905 
906  /// Create call to the maximum intrinsic.
907  CallInst *CreateMaximum(Value *LHS, Value *RHS, const Twine &Name = "") {
908  return CreateBinaryIntrinsic(Intrinsic::maximum, LHS, RHS, nullptr, Name);
909  }
910 
911  /// Create a call to the arithmetic_fence intrinsic.
913  const Twine &Name = "") {
914  return CreateIntrinsic(Intrinsic::arithmetic_fence, DstType, Val, nullptr,
915  Name);
916  }
917 
918  /// Create a call to the experimental.vector.extract intrinsic.
919  CallInst *CreateExtractVector(Type *DstType, Value *SrcVec, Value *Idx,
920  const Twine &Name = "") {
921  return CreateIntrinsic(Intrinsic::experimental_vector_extract,
922  {DstType, SrcVec->getType()}, {SrcVec, Idx}, nullptr,
923  Name);
924  }
925 
926  /// Create a call to the experimental.vector.insert intrinsic.
927  CallInst *CreateInsertVector(Type *DstType, Value *SrcVec, Value *SubVec,
928  Value *Idx, const Twine &Name = "") {
929  return CreateIntrinsic(Intrinsic::experimental_vector_insert,
930  {DstType, SubVec->getType()}, {SrcVec, SubVec, Idx},
931  nullptr, Name);
932  }
933 
934 private:
935  /// Create a call to a masked intrinsic with given Id.
936  CallInst *CreateMaskedIntrinsic(Intrinsic::ID Id, ArrayRef<Value *> Ops,
937  ArrayRef<Type *> OverloadedTypes,
938  const Twine &Name = "");
939 
940  Value *getCastedInt8PtrValue(Value *Ptr);
941 
942  //===--------------------------------------------------------------------===//
943  // Instruction creation methods: Terminators
944  //===--------------------------------------------------------------------===//
945 
946 private:
947  /// Helper to add branch weight and unpredictable metadata onto an
948  /// instruction.
949  /// \returns The annotated instruction.
950  template <typename InstTy>
951  InstTy *addBranchMetadata(InstTy *I, MDNode *Weights, MDNode *Unpredictable) {
952  if (Weights)
953  I->setMetadata(LLVMContext::MD_prof, Weights);
954  if (Unpredictable)
955  I->setMetadata(LLVMContext::MD_unpredictable, Unpredictable);
956  return I;
957  }
958 
959 public:
960  /// Create a 'ret void' instruction.
963  }
964 
965  /// Create a 'ret <val>' instruction.
967  return Insert(ReturnInst::Create(Context, V));
968  }
969 
970  /// Create a sequence of N insertvalue instructions,
971  /// with one Value from the retVals array each, that build a aggregate
972  /// return value one value at a time, and a ret instruction to return
973  /// the resulting aggregate value.
974  ///
975  /// This is a convenience function for code that uses aggregate return values
976  /// as a vehicle for having multiple return values.
977  ReturnInst *CreateAggregateRet(Value *const *retVals, unsigned N) {
979  for (unsigned i = 0; i != N; ++i)
980  V = CreateInsertValue(V, retVals[i], i, "mrv");
981  return Insert(ReturnInst::Create(Context, V));
982  }
983 
984  /// Create an unconditional 'br label X' instruction.
986  return Insert(BranchInst::Create(Dest));
987  }
988 
989  /// Create a conditional 'br Cond, TrueDest, FalseDest'
990  /// instruction.
992  MDNode *BranchWeights = nullptr,
993  MDNode *Unpredictable = nullptr) {
994  return Insert(addBranchMetadata(BranchInst::Create(True, False, Cond),
995  BranchWeights, Unpredictable));
996  }
997 
998  /// Create a conditional 'br Cond, TrueDest, FalseDest'
999  /// instruction. Copy branch meta data if available.
1001  Instruction *MDSrc) {
1002  BranchInst *Br = BranchInst::Create(True, False, Cond);
1003  if (MDSrc) {
1004  unsigned WL[4] = {LLVMContext::MD_prof, LLVMContext::MD_unpredictable,
1005  LLVMContext::MD_make_implicit, LLVMContext::MD_dbg};
1006  Br->copyMetadata(*MDSrc, makeArrayRef(&WL[0], 4));
1007  }
1008  return Insert(Br);
1009  }
1010 
1011  /// Create a switch instruction with the specified value, default dest,
1012  /// and with a hint for the number of cases that will be added (for efficient
1013  /// allocation).
1014  SwitchInst *CreateSwitch(Value *V, BasicBlock *Dest, unsigned NumCases = 10,
1015  MDNode *BranchWeights = nullptr,
1016  MDNode *Unpredictable = nullptr) {
1017  return Insert(addBranchMetadata(SwitchInst::Create(V, Dest, NumCases),
1018  BranchWeights, Unpredictable));
1019  }
1020 
1021  /// Create an indirect branch instruction with the specified address
1022  /// operand, with an optional hint for the number of destinations that will be
1023  /// added (for efficient allocation).
1024  IndirectBrInst *CreateIndirectBr(Value *Addr, unsigned NumDests = 10) {
1025  return Insert(IndirectBrInst::Create(Addr, NumDests));
1026  }
1027 
1028  /// Create an invoke instruction.
1030  BasicBlock *NormalDest, BasicBlock *UnwindDest,
1032  ArrayRef<OperandBundleDef> OpBundles,
1033  const Twine &Name = "") {
1034  InvokeInst *II =
1035  InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args, OpBundles);
1036  if (IsFPConstrained)
1038  return Insert(II, Name);
1039  }
1041  BasicBlock *NormalDest, BasicBlock *UnwindDest,
1043  const Twine &Name = "") {
1044  InvokeInst *II =
1045  InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args);
1046  if (IsFPConstrained)
1048  return Insert(II, Name);
1049  }
1050 
1052  BasicBlock *UnwindDest, ArrayRef<Value *> Args,
1053  ArrayRef<OperandBundleDef> OpBundles,
1054  const Twine &Name = "") {
1055  return CreateInvoke(Callee.getFunctionType(), Callee.getCallee(),
1056  NormalDest, UnwindDest, Args, OpBundles, Name);
1057  }
1058 
1060  BasicBlock *UnwindDest,
1062  const Twine &Name = "") {
1063  return CreateInvoke(Callee.getFunctionType(), Callee.getCallee(),
1064  NormalDest, UnwindDest, Args, Name);
1065  }
1066 
1067  /// \brief Create a callbr instruction.
1069  BasicBlock *DefaultDest,
1070  ArrayRef<BasicBlock *> IndirectDests,
1072  const Twine &Name = "") {
1073  return Insert(CallBrInst::Create(Ty, Callee, DefaultDest, IndirectDests,
1074  Args), Name);
1075  }
1077  BasicBlock *DefaultDest,
1078  ArrayRef<BasicBlock *> IndirectDests,
1080  ArrayRef<OperandBundleDef> OpBundles,
1081  const Twine &Name = "") {
1082  return Insert(
1083  CallBrInst::Create(Ty, Callee, DefaultDest, IndirectDests, Args,
1084  OpBundles), Name);
1085  }
1086 
1088  ArrayRef<BasicBlock *> IndirectDests,
1090  const Twine &Name = "") {
1091  return CreateCallBr(Callee.getFunctionType(), Callee.getCallee(),
1092  DefaultDest, IndirectDests, Args, Name);
1093  }
1095  ArrayRef<BasicBlock *> IndirectDests,
1097  ArrayRef<OperandBundleDef> OpBundles,
1098  const Twine &Name = "") {
1099  return CreateCallBr(Callee.getFunctionType(), Callee.getCallee(),
1100  DefaultDest, IndirectDests, Args, Name);
1101  }
1102 
1104  return Insert(ResumeInst::Create(Exn));
1105  }
1106 
1108  BasicBlock *UnwindBB = nullptr) {
1109  return Insert(CleanupReturnInst::Create(CleanupPad, UnwindBB));
1110  }
1111 
1113  unsigned NumHandlers,
1114  const Twine &Name = "") {
1115  return Insert(CatchSwitchInst::Create(ParentPad, UnwindBB, NumHandlers),
1116  Name);
1117  }
1118 
1120  const Twine &Name = "") {
1121  return Insert(CatchPadInst::Create(ParentPad, Args), Name);
1122  }
1123 
1126  const Twine &Name = "") {
1127  return Insert(CleanupPadInst::Create(ParentPad, Args), Name);
1128  }
1129 
1131  return Insert(CatchReturnInst::Create(CatchPad, BB));
1132  }
1133 
1135  return Insert(new UnreachableInst(Context));
1136  }
1137 
1138  //===--------------------------------------------------------------------===//
1139  // Instruction creation methods: Binary Operators
1140  //===--------------------------------------------------------------------===//
1141 private:
1142  BinaryOperator *CreateInsertNUWNSWBinOp(BinaryOperator::BinaryOps Opc,
1143  Value *LHS, Value *RHS,
1144  const Twine &Name,
1145  bool HasNUW, bool HasNSW) {
1146  BinaryOperator *BO = Insert(BinaryOperator::Create(Opc, LHS, RHS), Name);
1147  if (HasNUW) BO->setHasNoUnsignedWrap();
1148  if (HasNSW) BO->setHasNoSignedWrap();
1149  return BO;
1150  }
1151 
1152  Instruction *setFPAttrs(Instruction *I, MDNode *FPMD,
1153  FastMathFlags FMF) const {
1154  if (!FPMD)
1155  FPMD = DefaultFPMathTag;
1156  if (FPMD)
1157  I->setMetadata(LLVMContext::MD_fpmath, FPMD);
1158  I->setFastMathFlags(FMF);
1159  return I;
1160  }
1161 
1162  Value *foldConstant(Instruction::BinaryOps Opc, Value *L,
1163  Value *R, const Twine &Name) const {
1164  auto *LC = dyn_cast<Constant>(L);
1165  auto *RC = dyn_cast<Constant>(R);
1166  return (LC && RC) ? Insert(Folder.CreateBinOp(Opc, LC, RC), Name) : nullptr;
1167  }
1168 
1169  Value *getConstrainedFPRounding(Optional<RoundingMode> Rounding) {
1171 
1172  if (Rounding.hasValue())
1173  UseRounding = Rounding.getValue();
1174 
1175  Optional<StringRef> RoundingStr = RoundingModeToStr(UseRounding);
1176  assert(RoundingStr.hasValue() && "Garbage strict rounding mode!");
1177  auto *RoundingMDS = MDString::get(Context, RoundingStr.getValue());
1178 
1179  return MetadataAsValue::get(Context, RoundingMDS);
1180  }
1181 
1182  Value *getConstrainedFPExcept(Optional<fp::ExceptionBehavior> Except) {
1184 
1185  if (Except.hasValue())
1186  UseExcept = Except.getValue();
1187 
1188  Optional<StringRef> ExceptStr = ExceptionBehaviorToStr(UseExcept);
1189  assert(ExceptStr.hasValue() && "Garbage strict exception behavior!");
1190  auto *ExceptMDS = MDString::get(Context, ExceptStr.getValue());
1191 
1192  return MetadataAsValue::get(Context, ExceptMDS);
1193  }
1194 
1195  Value *getConstrainedFPPredicate(CmpInst::Predicate Predicate) {
1199  "Invalid constrained FP comparison predicate!");
1200 
1201  StringRef PredicateStr = CmpInst::getPredicateName(Predicate);
1202  auto *PredicateMDS = MDString::get(Context, PredicateStr);
1203 
1204  return MetadataAsValue::get(Context, PredicateMDS);
1205  }
1206 
1207 public:
1208  Value *CreateAdd(Value *LHS, Value *RHS, const Twine &Name = "",
1209  bool HasNUW = false, bool HasNSW = false) {
1210  if (auto *LC = dyn_cast<Constant>(LHS))
1211  if (auto *RC = dyn_cast<Constant>(RHS))
1212  return Insert(Folder.CreateAdd(LC, RC, HasNUW, HasNSW), Name);
1213  return CreateInsertNUWNSWBinOp(Instruction::Add, LHS, RHS, Name,
1214  HasNUW, HasNSW);
1215  }
1216 
1217  Value *CreateNSWAdd(Value *LHS, Value *RHS, const Twine &Name = "") {
1218  return CreateAdd(LHS, RHS, Name, false, true);
1219  }
1220 
1221  Value *CreateNUWAdd(Value *LHS, Value *RHS, const Twine &Name = "") {
1222  return CreateAdd(LHS, RHS, Name, true, false);
1223  }
1224 
1225  Value *CreateSub(Value *LHS, Value *RHS, const Twine &Name = "",
1226  bool HasNUW = false, bool HasNSW = false) {
1227  if (auto *LC = dyn_cast<Constant>(LHS))
1228  if (auto *RC = dyn_cast<Constant>(RHS))
1229  return Insert(Folder.CreateSub(LC, RC, HasNUW, HasNSW), Name);
1230  return CreateInsertNUWNSWBinOp(Instruction::Sub, LHS, RHS, Name,
1231  HasNUW, HasNSW);
1232  }
1233 
1234  Value *CreateNSWSub(Value *LHS, Value *RHS, const Twine &Name = "") {
1235  return CreateSub(LHS, RHS, Name, false, true);
1236  }
1237 
1238  Value *CreateNUWSub(Value *LHS, Value *RHS, const Twine &Name = "") {
1239  return CreateSub(LHS, RHS, Name, true, false);
1240  }
1241 
1242  Value *CreateMul(Value *LHS, Value *RHS, const Twine &Name = "",
1243  bool HasNUW = false, bool HasNSW = false) {
1244  if (auto *LC = dyn_cast<Constant>(LHS))
1245  if (auto *RC = dyn_cast<Constant>(RHS))
1246  return Insert(Folder.CreateMul(LC, RC, HasNUW, HasNSW), Name);
1247  return CreateInsertNUWNSWBinOp(Instruction::Mul, LHS, RHS, Name,
1248  HasNUW, HasNSW);
1249  }
1250 
1251  Value *CreateNSWMul(Value *LHS, Value *RHS, const Twine &Name = "") {
1252  return CreateMul(LHS, RHS, Name, false, true);
1253  }
1254 
1255  Value *CreateNUWMul(Value *LHS, Value *RHS, const Twine &Name = "") {
1256  return CreateMul(LHS, RHS, Name, true, false);
1257  }
1258 
1259  Value *CreateUDiv(Value *LHS, Value *RHS, const Twine &Name = "",
1260  bool isExact = false) {
1261  if (auto *LC = dyn_cast<Constant>(LHS))
1262  if (auto *RC = dyn_cast<Constant>(RHS))
1263  return Insert(Folder.CreateUDiv(LC, RC, isExact), Name);
1264  if (!isExact)
1265  return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name);
1266  return Insert(BinaryOperator::CreateExactUDiv(LHS, RHS), Name);
1267  }
1268 
1269  Value *CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name = "") {
1270  return CreateUDiv(LHS, RHS, Name, true);
1271  }
1272 
1273  Value *CreateSDiv(Value *LHS, Value *RHS, const Twine &Name = "",
1274  bool isExact = false) {
1275  if (auto *LC = dyn_cast<Constant>(LHS))
1276  if (auto *RC = dyn_cast<Constant>(RHS))
1277  return Insert(Folder.CreateSDiv(LC, RC, isExact), Name);
1278  if (!isExact)
1279  return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name);
1280  return Insert(BinaryOperator::CreateExactSDiv(LHS, RHS), Name);
1281  }
1282 
1283  Value *CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name = "") {
1284  return CreateSDiv(LHS, RHS, Name, true);
1285  }
1286 
1287  Value *CreateURem(Value *LHS, Value *RHS, const Twine &Name = "") {
1288  if (Value *V = foldConstant(Instruction::URem, LHS, RHS, Name)) return V;
1289  return Insert(BinaryOperator::CreateURem(LHS, RHS), Name);
1290  }
1291 
1292  Value *CreateSRem(Value *LHS, Value *RHS, const Twine &Name = "") {
1293  if (Value *V = foldConstant(Instruction::SRem, LHS, RHS, Name)) return V;
1294  return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name);
1295  }
1296 
1297  Value *CreateShl(Value *LHS, Value *RHS, const Twine &Name = "",
1298  bool HasNUW = false, bool HasNSW = false) {
1299  if (auto *LC = dyn_cast<Constant>(LHS))
1300  if (auto *RC = dyn_cast<Constant>(RHS))
1301  return Insert(Folder.CreateShl(LC, RC, HasNUW, HasNSW), Name);
1302  return CreateInsertNUWNSWBinOp(Instruction::Shl, LHS, RHS, Name,
1303  HasNUW, HasNSW);
1304  }
1305 
1306  Value *CreateShl(Value *LHS, const APInt &RHS, const Twine &Name = "",
1307  bool HasNUW = false, bool HasNSW = false) {
1308  return CreateShl(LHS, ConstantInt::get(LHS->getType(), RHS), Name,
1309  HasNUW, HasNSW);
1310  }
1311 
1312  Value *CreateShl(Value *LHS, uint64_t RHS, const Twine &Name = "",
1313  bool HasNUW = false, bool HasNSW = false) {
1314  return CreateShl(LHS, ConstantInt::get(LHS->getType(), RHS), Name,
1315  HasNUW, HasNSW);
1316  }
1317 
1318  Value *CreateLShr(Value *LHS, Value *RHS, const Twine &Name = "",
1319  bool isExact = false) {
1320  if (auto *LC = dyn_cast<Constant>(LHS))
1321  if (auto *RC = dyn_cast<Constant>(RHS))
1322  return Insert(Folder.CreateLShr(LC, RC, isExact), Name);
1323  if (!isExact)
1324  return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name);
1325  return Insert(BinaryOperator::CreateExactLShr(LHS, RHS), Name);
1326  }
1327 
1328  Value *CreateLShr(Value *LHS, const APInt &RHS, const Twine &Name = "",
1329  bool isExact = false) {
1330  return CreateLShr(LHS, ConstantInt::get(LHS->getType(), RHS), Name,isExact);
1331  }
1332 
1333  Value *CreateLShr(Value *LHS, uint64_t RHS, const Twine &Name = "",
1334  bool isExact = false) {
1335  return CreateLShr(LHS, ConstantInt::get(LHS->getType(), RHS), Name,isExact);
1336  }
1337 
1338  Value *CreateAShr(Value *LHS, Value *RHS, const Twine &Name = "",
1339  bool isExact = false) {
1340  if (auto *LC = dyn_cast<Constant>(LHS))
1341  if (auto *RC = dyn_cast<Constant>(RHS))
1342  return Insert(Folder.CreateAShr(LC, RC, isExact), Name);
1343  if (!isExact)
1344  return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name);
1345  return Insert(BinaryOperator::CreateExactAShr(LHS, RHS), Name);
1346  }
1347 
1348  Value *CreateAShr(Value *LHS, const APInt &RHS, const Twine &Name = "",
1349  bool isExact = false) {
1350  return CreateAShr(LHS, ConstantInt::get(LHS->getType(), RHS), Name,isExact);
1351  }
1352 
1353  Value *CreateAShr(Value *LHS, uint64_t RHS, const Twine &Name = "",
1354  bool isExact = false) {
1355  return CreateAShr(LHS, ConstantInt::get(LHS->getType(), RHS), Name,isExact);
1356  }
1357 
1358  Value *CreateAnd(Value *LHS, Value *RHS, const Twine &Name = "") {
1359  if (auto *RC = dyn_cast<Constant>(RHS)) {
1360  if (isa<ConstantInt>(RC) && cast<ConstantInt>(RC)->isMinusOne())
1361  return LHS; // LHS & -1 -> LHS
1362  if (auto *LC = dyn_cast<Constant>(LHS))
1363  return Insert(Folder.CreateAnd(LC, RC), Name);
1364  }
1365  return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);
1366  }
1367 
1368  Value *CreateAnd(Value *LHS, const APInt &RHS, const Twine &Name = "") {
1369  return CreateAnd(LHS, ConstantInt::get(LHS->getType(), RHS), Name);
1370  }
1371 
1372  Value *CreateAnd(Value *LHS, uint64_t RHS, const Twine &Name = "") {
1373  return CreateAnd(LHS, ConstantInt::get(LHS->getType(), RHS), Name);
1374  }
1375 
1377  assert(!Ops.empty());
1378  Value *Accum = Ops[0];
1379  for (unsigned i = 1; i < Ops.size(); i++)
1380  Accum = CreateAnd(Accum, Ops[i]);
1381  return Accum;
1382  }
1383 
1384  Value *CreateOr(Value *LHS, Value *RHS, const Twine &Name = "") {
1385  if (auto *RC = dyn_cast<Constant>(RHS)) {
1386  if (RC->isNullValue())
1387  return LHS; // LHS | 0 -> LHS
1388  if (auto *LC = dyn_cast<Constant>(LHS))
1389  return Insert(Folder.CreateOr(LC, RC), Name);
1390  }
1391  return Insert(BinaryOperator::CreateOr(LHS, RHS), Name);
1392  }
1393 
1394  Value *CreateOr(Value *LHS, const APInt &RHS, const Twine &Name = "") {
1395  return CreateOr(LHS, ConstantInt::get(LHS->getType(), RHS), Name);
1396  }
1397 
1398  Value *CreateOr(Value *LHS, uint64_t RHS, const Twine &Name = "") {
1399  return CreateOr(LHS, ConstantInt::get(LHS->getType(), RHS), Name);
1400  }
1401 
1403  assert(!Ops.empty());
1404  Value *Accum = Ops[0];
1405  for (unsigned i = 1; i < Ops.size(); i++)
1406  Accum = CreateOr(Accum, Ops[i]);
1407  return Accum;
1408  }
1409 
1410  Value *CreateXor(Value *LHS, Value *RHS, const Twine &Name = "") {
1411  if (Value *V = foldConstant(Instruction::Xor, LHS, RHS, Name)) return V;
1412  return Insert(BinaryOperator::CreateXor(LHS, RHS), Name);
1413  }
1414 
1415  Value *CreateXor(Value *LHS, const APInt &RHS, const Twine &Name = "") {
1416  return CreateXor(LHS, ConstantInt::get(LHS->getType(), RHS), Name);
1417  }
1418 
1419  Value *CreateXor(Value *LHS, uint64_t RHS, const Twine &Name = "") {
1420  return CreateXor(LHS, ConstantInt::get(LHS->getType(), RHS), Name);
1421  }
1422 
1423  Value *CreateFAdd(Value *L, Value *R, const Twine &Name = "",
1424  MDNode *FPMD = nullptr) {
1425  if (IsFPConstrained)
1426  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_fadd,
1427  L, R, nullptr, Name, FPMD);
1428 
1429  if (Value *V = foldConstant(Instruction::FAdd, L, R, Name)) return V;
1430  Instruction *I = setFPAttrs(BinaryOperator::CreateFAdd(L, R), FPMD, FMF);
1431  return Insert(I, Name);
1432  }
1433 
1434  /// Copy fast-math-flags from an instruction rather than using the builder's
1435  /// default FMF.
1437  const Twine &Name = "") {
1438  if (IsFPConstrained)
1439  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_fadd,
1440  L, R, FMFSource, Name);
1441 
1442  if (Value *V = foldConstant(Instruction::FAdd, L, R, Name)) return V;
1443  Instruction *I = setFPAttrs(BinaryOperator::CreateFAdd(L, R), nullptr,
1444  FMFSource->getFastMathFlags());
1445  return Insert(I, Name);
1446  }
1447 
1448  Value *CreateFSub(Value *L, Value *R, const Twine &Name = "",
1449  MDNode *FPMD = nullptr) {
1450  if (IsFPConstrained)
1451  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_fsub,
1452  L, R, nullptr, Name, FPMD);
1453 
1454  if (Value *V = foldConstant(Instruction::FSub, L, R, Name)) return V;
1455  Instruction *I = setFPAttrs(BinaryOperator::CreateFSub(L, R), FPMD, FMF);
1456  return Insert(I, Name);
1457  }
1458 
1459  /// Copy fast-math-flags from an instruction rather than using the builder's
1460  /// default FMF.
1462  const Twine &Name = "") {
1463  if (IsFPConstrained)
1464  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_fsub,
1465  L, R, FMFSource, Name);
1466 
1467  if (Value *V = foldConstant(Instruction::FSub, L, R, Name)) return V;
1468  Instruction *I = setFPAttrs(BinaryOperator::CreateFSub(L, R), nullptr,
1469  FMFSource->getFastMathFlags());
1470  return Insert(I, Name);
1471  }
1472 
1473  Value *CreateFMul(Value *L, Value *R, const Twine &Name = "",
1474  MDNode *FPMD = nullptr) {
1475  if (IsFPConstrained)
1476  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_fmul,
1477  L, R, nullptr, Name, FPMD);
1478 
1479  if (Value *V = foldConstant(Instruction::FMul, L, R, Name)) return V;
1480  Instruction *I = setFPAttrs(BinaryOperator::CreateFMul(L, R), FPMD, FMF);
1481  return Insert(I, Name);
1482  }
1483 
1484  /// Copy fast-math-flags from an instruction rather than using the builder's
1485  /// default FMF.
1487  const Twine &Name = "") {
1488  if (IsFPConstrained)
1489  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_fmul,
1490  L, R, FMFSource, Name);
1491 
1492  if (Value *V = foldConstant(Instruction::FMul, L, R, Name)) return V;
1493  Instruction *I = setFPAttrs(BinaryOperator::CreateFMul(L, R), nullptr,
1494  FMFSource->getFastMathFlags());
1495  return Insert(I, Name);
1496  }
1497 
1498  Value *CreateFDiv(Value *L, Value *R, const Twine &Name = "",
1499  MDNode *FPMD = nullptr) {
1500  if (IsFPConstrained)
1501  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_fdiv,
1502  L, R, nullptr, Name, FPMD);
1503 
1504  if (Value *V = foldConstant(Instruction::FDiv, L, R, Name)) return V;
1505  Instruction *I = setFPAttrs(BinaryOperator::CreateFDiv(L, R), FPMD, FMF);
1506  return Insert(I, Name);
1507  }
1508 
1509  /// Copy fast-math-flags from an instruction rather than using the builder's
1510  /// default FMF.
1512  const Twine &Name = "") {
1513  if (IsFPConstrained)
1514  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_fdiv,
1515  L, R, FMFSource, Name);
1516 
1517  if (Value *V = foldConstant(Instruction::FDiv, L, R, Name)) return V;
1518  Instruction *I = setFPAttrs(BinaryOperator::CreateFDiv(L, R), nullptr,
1519  FMFSource->getFastMathFlags());
1520  return Insert(I, Name);
1521  }
1522 
1523  Value *CreateFRem(Value *L, Value *R, const Twine &Name = "",
1524  MDNode *FPMD = nullptr) {
1525  if (IsFPConstrained)
1526  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_frem,
1527  L, R, nullptr, Name, FPMD);
1528 
1529  if (Value *V = foldConstant(Instruction::FRem, L, R, Name)) return V;
1530  Instruction *I = setFPAttrs(BinaryOperator::CreateFRem(L, R), FPMD, FMF);
1531  return Insert(I, Name);
1532  }
1533 
1534  /// Copy fast-math-flags from an instruction rather than using the builder's
1535  /// default FMF.
1537  const Twine &Name = "") {
1538  if (IsFPConstrained)
1539  return CreateConstrainedFPBinOp(Intrinsic::experimental_constrained_frem,
1540  L, R, FMFSource, Name);
1541 
1542  if (Value *V = foldConstant(Instruction::FRem, L, R, Name)) return V;
1543  Instruction *I = setFPAttrs(BinaryOperator::CreateFRem(L, R), nullptr,
1544  FMFSource->getFastMathFlags());
1545  return Insert(I, Name);
1546  }
1547 
1549  Value *LHS, Value *RHS, const Twine &Name = "",
1550  MDNode *FPMathTag = nullptr) {
1551  if (Value *V = foldConstant(Opc, LHS, RHS, Name)) return V;
1552  Instruction *BinOp = BinaryOperator::Create(Opc, LHS, RHS);
1553  if (isa<FPMathOperator>(BinOp))
1554  setFPAttrs(BinOp, FPMathTag, FMF);
1555  return Insert(BinOp, Name);
1556  }
1557 
1558  Value *CreateLogicalAnd(Value *Cond1, Value *Cond2, const Twine &Name = "") {
1559  assert(Cond2->getType()->isIntOrIntVectorTy(1));
1560  return CreateSelect(Cond1, Cond2,
1562  }
1563 
1564  Value *CreateLogicalOr(Value *Cond1, Value *Cond2, const Twine &Name = "") {
1565  assert(Cond2->getType()->isIntOrIntVectorTy(1));
1566  return CreateSelect(Cond1, ConstantInt::getAllOnesValue(Cond2->getType()),
1567  Cond2, Name);
1568  }
1569 
1571  Intrinsic::ID ID, Value *L, Value *R, Instruction *FMFSource = nullptr,
1572  const Twine &Name = "", MDNode *FPMathTag = nullptr,
1575 
1576  Value *CreateNeg(Value *V, const Twine &Name = "",
1577  bool HasNUW = false, bool HasNSW = false) {
1578  if (auto *VC = dyn_cast<Constant>(V))
1579  return Insert(Folder.CreateNeg(VC, HasNUW, HasNSW), Name);
1581  if (HasNUW) BO->setHasNoUnsignedWrap();
1582  if (HasNSW) BO->setHasNoSignedWrap();
1583  return BO;
1584  }
1585 
1586  Value *CreateNSWNeg(Value *V, const Twine &Name = "") {
1587  return CreateNeg(V, Name, false, true);
1588  }
1589 
1590  Value *CreateNUWNeg(Value *V, const Twine &Name = "") {
1591  return CreateNeg(V, Name, true, false);
1592  }
1593 
1594  Value *CreateFNeg(Value *V, const Twine &Name = "",
1595  MDNode *FPMathTag = nullptr) {
1596  if (auto *VC = dyn_cast<Constant>(V))
1597  return Insert(Folder.CreateFNeg(VC), Name);
1598  return Insert(setFPAttrs(UnaryOperator::CreateFNeg(V), FPMathTag, FMF),
1599  Name);
1600  }
1601 
1602  /// Copy fast-math-flags from an instruction rather than using the builder's
1603  /// default FMF.
1605  const Twine &Name = "") {
1606  if (auto *VC = dyn_cast<Constant>(V))
1607  return Insert(Folder.CreateFNeg(VC), Name);
1608  return Insert(setFPAttrs(UnaryOperator::CreateFNeg(V), nullptr,
1609  FMFSource->getFastMathFlags()),
1610  Name);
1611  }
1612 
1613  Value *CreateNot(Value *V, const Twine &Name = "") {
1614  if (auto *VC = dyn_cast<Constant>(V))
1615  return Insert(Folder.CreateNot(VC), Name);
1617  }
1618 
1620  Value *V, const Twine &Name = "",
1621  MDNode *FPMathTag = nullptr) {
1622  if (auto *VC = dyn_cast<Constant>(V))
1623  return Insert(Folder.CreateUnOp(Opc, VC), Name);
1624  Instruction *UnOp = UnaryOperator::Create(Opc, V);
1625  if (isa<FPMathOperator>(UnOp))
1626  setFPAttrs(UnOp, FPMathTag, FMF);
1627  return Insert(UnOp, Name);
1628  }
1629 
1630  /// Create either a UnaryOperator or BinaryOperator depending on \p Opc.
1631  /// Correct number of operands must be passed accordingly.
1632  Value *CreateNAryOp(unsigned Opc, ArrayRef<Value *> Ops,
1633  const Twine &Name = "", MDNode *FPMathTag = nullptr);
1634 
1635  //===--------------------------------------------------------------------===//
1636  // Instruction creation methods: Memory Instructions
1637  //===--------------------------------------------------------------------===//
1638 
1639  AllocaInst *CreateAlloca(Type *Ty, unsigned AddrSpace,
1640  Value *ArraySize = nullptr, const Twine &Name = "") {
1641  const DataLayout &DL = BB->getModule()->getDataLayout();
1642  Align AllocaAlign = DL.getPrefTypeAlign(Ty);
1643  return Insert(new AllocaInst(Ty, AddrSpace, ArraySize, AllocaAlign), Name);
1644  }
1645 
1646  AllocaInst *CreateAlloca(Type *Ty, Value *ArraySize = nullptr,
1647  const Twine &Name = "") {
1648  const DataLayout &DL = BB->getModule()->getDataLayout();
1649  Align AllocaAlign = DL.getPrefTypeAlign(Ty);
1650  unsigned AddrSpace = DL.getAllocaAddrSpace();
1651  return Insert(new AllocaInst(Ty, AddrSpace, ArraySize, AllocaAlign), Name);
1652  }
1653 
1654  /// Provided to resolve 'CreateLoad(Ty, Ptr, "...")' correctly, instead of
1655  /// converting the string to 'bool' for the isVolatile parameter.
1656  LoadInst *CreateLoad(Type *Ty, Value *Ptr, const char *Name) {
1657  return CreateAlignedLoad(Ty, Ptr, MaybeAlign(), Name);
1658  }
1659 
1660  LoadInst *CreateLoad(Type *Ty, Value *Ptr, const Twine &Name = "") {
1661  return CreateAlignedLoad(Ty, Ptr, MaybeAlign(), Name);
1662  }
1663 
1664  LoadInst *CreateLoad(Type *Ty, Value *Ptr, bool isVolatile,
1665  const Twine &Name = "") {
1666  return CreateAlignedLoad(Ty, Ptr, MaybeAlign(), isVolatile, Name);
1667  }
1668 
1669  // Deprecated [opaque pointer types]
1671  const char *Name),
1672  "Use the version that explicitly specifies the "
1673  "loaded type instead") {
1674  return CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
1675  }
1676 
1677  // Deprecated [opaque pointer types]
1679  const Twine &Name = ""),
1680  "Use the version that explicitly specifies the "
1681  "loaded type instead") {
1682  return CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
1683  }
1684 
1685  // Deprecated [opaque pointer types]
1687  bool isVolatile,
1688  const Twine &Name = ""),
1689  "Use the version that explicitly specifies the "
1690  "loaded type instead") {
1691  return CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, isVolatile,
1692  Name);
1693  }
1694 
1695  StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) {
1696  return CreateAlignedStore(Val, Ptr, MaybeAlign(), isVolatile);
1697  }
1698 
1700  const char *Name) {
1701  return CreateAlignedLoad(Ty, Ptr, Align, /*isVolatile*/false, Name);
1702  }
1703 
1705  const Twine &Name = "") {
1706  return CreateAlignedLoad(Ty, Ptr, Align, /*isVolatile*/false, Name);
1707  }
1708 
1710  bool isVolatile, const Twine &Name = "") {
1711  if (!Align) {
1712  const DataLayout &DL = BB->getModule()->getDataLayout();
1713  Align = DL.getABITypeAlign(Ty);
1714  }
1715  return Insert(new LoadInst(Ty, Ptr, Twine(), isVolatile, *Align), Name);
1716  }
1717 
1718  // Deprecated [opaque pointer types]
1720  MaybeAlign Align,
1721  const char *Name),
1722  "Use the version that explicitly specifies the "
1723  "loaded type instead") {
1724  return CreateAlignedLoad(Ptr->getType()->getPointerElementType(), Ptr,
1725  Align, Name);
1726  }
1727  // Deprecated [opaque pointer types]
1729  MaybeAlign Align,
1730  const Twine &Name = ""),
1731  "Use the version that explicitly specifies the "
1732  "loaded type instead") {
1733  return CreateAlignedLoad(Ptr->getType()->getPointerElementType(), Ptr,
1734  Align, Name);
1735  }
1736  // Deprecated [opaque pointer types]
1738  MaybeAlign Align,
1739  bool isVolatile,
1740  const Twine &Name = ""),
1741  "Use the version that explicitly specifies the "
1742  "loaded type instead") {
1743  return CreateAlignedLoad(Ptr->getType()->getPointerElementType(), Ptr,
1744  Align, isVolatile, Name);
1745  }
1746 
1748  bool isVolatile = false) {
1749  if (!Align) {
1750  const DataLayout &DL = BB->getModule()->getDataLayout();
1751  Align = DL.getABITypeAlign(Val->getType());
1752  }
1753  return Insert(new StoreInst(Val, Ptr, isVolatile, *Align));
1754  }
1757  const Twine &Name = "") {
1758  return Insert(new FenceInst(Context, Ordering, SSID), Name);
1759  }
1760 
1763  AtomicOrdering SuccessOrdering,
1764  AtomicOrdering FailureOrdering,
1766  if (!Align) {
1767  const DataLayout &DL = BB->getModule()->getDataLayout();
1768  Align = llvm::Align(DL.getTypeStoreSize(New->getType()));
1769  }
1770 
1771  return Insert(new AtomicCmpXchgInst(Ptr, Cmp, New, *Align, SuccessOrdering,
1772  FailureOrdering, SSID));
1773  }
1774 
1776  Value *Val, MaybeAlign Align,
1777  AtomicOrdering Ordering,
1779  if (!Align) {
1780  const DataLayout &DL = BB->getModule()->getDataLayout();
1781  Align = llvm::Align(DL.getTypeStoreSize(Val->getType()));
1782  }
1783 
1784  return Insert(new AtomicRMWInst(Op, Ptr, Val, *Align, Ordering, SSID));
1785  }
1786 
1788  Value *CreateGEP(Value *Ptr, ArrayRef<Value *> IdxList,
1789  const Twine &Name = ""),
1790  "Use the version with explicit element type instead") {
1792  Ptr, IdxList, Name);
1793  }
1794 
1796  const Twine &Name = "") {
1797  if (auto *PC = dyn_cast<Constant>(Ptr)) {
1798  // Every index must be constant.
1799  size_t i, e;
1800  for (i = 0, e = IdxList.size(); i != e; ++i)
1801  if (!isa<Constant>(IdxList[i]))
1802  break;
1803  if (i == e)
1804  return Insert(Folder.CreateGetElementPtr(Ty, PC, IdxList), Name);
1805  }
1806  return Insert(GetElementPtrInst::Create(Ty, Ptr, IdxList), Name);
1807  }
1808 
1811  const Twine &Name = ""),
1812  "Use the version with explicit element type instead") {
1813  return CreateInBoundsGEP(
1814  Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, IdxList,
1815  Name);
1816  }
1817 
1819  const Twine &Name = "") {
1820  if (auto *PC = dyn_cast<Constant>(Ptr)) {
1821  // Every index must be constant.
1822  size_t i, e;
1823  for (i = 0, e = IdxList.size(); i != e; ++i)
1824  if (!isa<Constant>(IdxList[i]))
1825  break;
1826  if (i == e)
1827  return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, IdxList),
1828  Name);
1829  }
1830  return Insert(GetElementPtrInst::CreateInBounds(Ty, Ptr, IdxList), Name);
1831  }
1832 
1833  Value *CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name = "") {
1834  if (auto *PC = dyn_cast<Constant>(Ptr))
1835  if (auto *IC = dyn_cast<Constant>(Idx))
1836  return Insert(Folder.CreateGetElementPtr(Ty, PC, IC), Name);
1837  return Insert(GetElementPtrInst::Create(Ty, Ptr, Idx), Name);
1838  }
1839 
1841  const Twine &Name = "") {
1842  if (auto *PC = dyn_cast<Constant>(Ptr))
1843  if (auto *IC = dyn_cast<Constant>(Idx))
1844  return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, IC), Name);
1845  return Insert(GetElementPtrInst::CreateInBounds(Ty, Ptr, Idx), Name);
1846  }
1847 
1849  Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0,
1850  const Twine &Name = ""),
1851  "Use the version with explicit element type instead") {
1852  return CreateConstGEP1_32(
1853  Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
1854  Name);
1855  }
1856 
1857  Value *CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0,
1858  const Twine &Name = "") {
1860 
1861  if (auto *PC = dyn_cast<Constant>(Ptr))
1862  return Insert(Folder.CreateGetElementPtr(Ty, PC, Idx), Name);
1863 
1864  return Insert(GetElementPtrInst::Create(Ty, Ptr, Idx), Name);
1865  }
1866 
1867  Value *CreateConstInBoundsGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0,
1868  const Twine &Name = "") {
1870 
1871  if (auto *PC = dyn_cast<Constant>(Ptr))
1872  return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, Idx), Name);
1873 
1874  return Insert(GetElementPtrInst::CreateInBounds(Ty, Ptr, Idx), Name);
1875  }
1876 
1877  Value *CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1,
1878  const Twine &Name = "") {
1879  Value *Idxs[] = {
1882  };
1883 
1884  if (auto *PC = dyn_cast<Constant>(Ptr))
1885  return Insert(Folder.CreateGetElementPtr(Ty, PC, Idxs), Name);
1886 
1887  return Insert(GetElementPtrInst::Create(Ty, Ptr, Idxs), Name);
1888  }
1889 
1890  Value *CreateConstInBoundsGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0,
1891  unsigned Idx1, const Twine &Name = "") {
1892  Value *Idxs[] = {
1895  };
1896 
1897  if (auto *PC = dyn_cast<Constant>(Ptr))
1898  return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, Idxs), Name);
1899 
1900  return Insert(GetElementPtrInst::CreateInBounds(Ty, Ptr, Idxs), Name);
1901  }
1902 
1903  Value *CreateConstGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0,
1904  const Twine &Name = "") {
1906 
1907  if (auto *PC = dyn_cast<Constant>(Ptr))
1908  return Insert(Folder.CreateGetElementPtr(Ty, PC, Idx), Name);
1909 
1910  return Insert(GetElementPtrInst::Create(Ty, Ptr, Idx), Name);
1911  }
1912 
1914  Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0,
1915  const Twine &Name = ""),
1916  "Use the version with explicit element type instead") {
1917  return CreateConstGEP1_64(
1918  Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
1919  Name);
1920  }
1921 
1922  Value *CreateConstInBoundsGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0,
1923  const Twine &Name = "") {
1925 
1926  if (auto *PC = dyn_cast<Constant>(Ptr))
1927  return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, Idx), Name);
1928 
1929  return Insert(GetElementPtrInst::CreateInBounds(Ty, Ptr, Idx), Name);
1930  }
1931 
1933  Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0,
1934  const Twine &Name = ""),
1935  "Use the version with explicit element type instead") {
1937  Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
1938  Name);
1939  }
1940 
1941  Value *CreateConstGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1,
1942  const Twine &Name = "") {
1943  Value *Idxs[] = {
1946  };
1947 
1948  if (auto *PC = dyn_cast<Constant>(Ptr))
1949  return Insert(Folder.CreateGetElementPtr(Ty, PC, Idxs), Name);
1950 
1951  return Insert(GetElementPtrInst::Create(Ty, Ptr, Idxs), Name);
1952  }
1953 
1955  Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
1956  const Twine &Name = ""),
1957  "Use the version with explicit element type instead") {
1958  return CreateConstGEP2_64(
1959  Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
1960  Idx1, Name);
1961  }
1962 
1963  Value *CreateConstInBoundsGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0,
1964  uint64_t Idx1, const Twine &Name = "") {
1965  Value *Idxs[] = {
1968  };
1969 
1970  if (auto *PC = dyn_cast<Constant>(Ptr))
1971  return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, Idxs), Name);
1972 
1973  return Insert(GetElementPtrInst::CreateInBounds(Ty, Ptr, Idxs), Name);
1974  }
1975 
1977  Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0,
1978  uint64_t Idx1, const Twine &Name = ""),
1979  "Use the version with explicit element type instead") {
1981  Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, Idx0,
1982  Idx1, Name);
1983  }
1984 
1985  Value *CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx,
1986  const Twine &Name = "") {
1987  return CreateConstInBoundsGEP2_32(Ty, Ptr, 0, Idx, Name);
1988  }
1989 
1991  Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = ""),
1992  "Use the version with explicit element type instead") {
1994  Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, 0, Idx,
1995  Name);
1996  }
1997 
1998  /// Same as CreateGlobalString, but return a pointer with "i8*" type
1999  /// instead of a pointer to array of i8.
2000  ///
2001  /// If no module is given via \p M, it is take from the insertion point basic
2002  /// block.
2004  unsigned AddressSpace = 0,
2005  Module *M = nullptr) {
2008  Constant *Indices[] = {Zero, Zero};
2010  Indices);
2011  }
2012 
2013  //===--------------------------------------------------------------------===//
2014  // Instruction creation methods: Cast/Conversion Operators
2015  //===--------------------------------------------------------------------===//
2016 
2017  Value *CreateTrunc(Value *V, Type *DestTy, const Twine &Name = "") {
2018  return CreateCast(Instruction::Trunc, V, DestTy, Name);
2019  }
2020 
2021  Value *CreateZExt(Value *V, Type *DestTy, const Twine &Name = "") {
2022  return CreateCast(Instruction::ZExt, V, DestTy, Name);
2023  }
2024 
2025  Value *CreateSExt(Value *V, Type *DestTy, const Twine &Name = "") {
2026  return CreateCast(Instruction::SExt, V, DestTy, Name);
2027  }
2028 
2029  /// Create a ZExt or Trunc from the integer value V to DestTy. Return
2030  /// the value untouched if the type of V is already DestTy.
2032  const Twine &Name = "") {
2033  assert(V->getType()->isIntOrIntVectorTy() &&
2034  DestTy->isIntOrIntVectorTy() &&
2035  "Can only zero extend/truncate integers!");
2036  Type *VTy = V->getType();
2037  if (VTy->getScalarSizeInBits() < DestTy->getScalarSizeInBits())
2038  return CreateZExt(V, DestTy, Name);
2039  if (VTy->getScalarSizeInBits() > DestTy->getScalarSizeInBits())
2040  return CreateTrunc(V, DestTy, Name);
2041  return V;
2042  }
2043 
2044  /// Create a SExt or Trunc from the integer value V to DestTy. Return
2045  /// the value untouched if the type of V is already DestTy.
2047  const Twine &Name = "") {
2048  assert(V->getType()->isIntOrIntVectorTy() &&
2049  DestTy->isIntOrIntVectorTy() &&
2050  "Can only sign extend/truncate integers!");
2051  Type *VTy = V->getType();
2052  if (VTy->getScalarSizeInBits() < DestTy->getScalarSizeInBits())
2053  return CreateSExt(V, DestTy, Name);
2054  if (VTy->getScalarSizeInBits() > DestTy->getScalarSizeInBits())
2055  return CreateTrunc(V, DestTy, Name);
2056  return V;
2057  }
2058 
2059  Value *CreateFPToUI(Value *V, Type *DestTy, const Twine &Name = "") {
2060  if (IsFPConstrained)
2061  return CreateConstrainedFPCast(Intrinsic::experimental_constrained_fptoui,
2062  V, DestTy, nullptr, Name);
2063  return CreateCast(Instruction::FPToUI, V, DestTy, Name);
2064  }
2065 
2066  Value *CreateFPToSI(Value *V, Type *DestTy, const Twine &Name = "") {
2067  if (IsFPConstrained)
2068  return CreateConstrainedFPCast(Intrinsic::experimental_constrained_fptosi,
2069  V, DestTy, nullptr, Name);
2070  return CreateCast(Instruction::FPToSI, V, DestTy, Name);
2071  }
2072 
2073  Value *CreateUIToFP(Value *V, Type *DestTy, const Twine &Name = ""){
2074  if (IsFPConstrained)
2075  return CreateConstrainedFPCast(Intrinsic::experimental_constrained_uitofp,
2076  V, DestTy, nullptr, Name);
2077  return CreateCast(Instruction::UIToFP, V, DestTy, Name);
2078  }
2079 
2080  Value *CreateSIToFP(Value *V, Type *DestTy, const Twine &Name = ""){
2081  if (IsFPConstrained)
2082  return CreateConstrainedFPCast(Intrinsic::experimental_constrained_sitofp,
2083  V, DestTy, nullptr, Name);
2084  return CreateCast(Instruction::SIToFP, V, DestTy, Name);
2085  }
2086 
2088  const Twine &Name = "") {
2089  if (IsFPConstrained)
2090  return CreateConstrainedFPCast(
2091  Intrinsic::experimental_constrained_fptrunc, V, DestTy, nullptr,
2092  Name);
2093  return CreateCast(Instruction::FPTrunc, V, DestTy, Name);
2094  }
2095 
2096  Value *CreateFPExt(Value *V, Type *DestTy, const Twine &Name = "") {
2097  if (IsFPConstrained)
2098  return CreateConstrainedFPCast(Intrinsic::experimental_constrained_fpext,
2099  V, DestTy, nullptr, Name);
2100  return CreateCast(Instruction::FPExt, V, DestTy, Name);
2101  }
2102 
2104  const Twine &Name = "") {
2105  return CreateCast(Instruction::PtrToInt, V, DestTy, Name);
2106  }
2107 
2109  const Twine &Name = "") {
2110  return CreateCast(Instruction::IntToPtr, V, DestTy, Name);
2111  }
2112 
2114  const Twine &Name = "") {
2115  return CreateCast(Instruction::BitCast, V, DestTy, Name);
2116  }
2117 
2119  const Twine &Name = "") {
2120  return CreateCast(Instruction::AddrSpaceCast, V, DestTy, Name);
2121  }
2122 
2124  const Twine &Name = "") {
2125  if (V->getType() == DestTy)
2126  return V;
2127  if (auto *VC = dyn_cast<Constant>(V))
2128  return Insert(Folder.CreateZExtOrBitCast(VC, DestTy), Name);
2129  return Insert(CastInst::CreateZExtOrBitCast(V, DestTy), Name);
2130  }
2131 
2133  const Twine &Name = "") {
2134  if (V->getType() == DestTy)
2135  return V;
2136  if (auto *VC = dyn_cast<Constant>(V))
2137  return Insert(Folder.CreateSExtOrBitCast(VC, DestTy), Name);
2138  return Insert(CastInst::CreateSExtOrBitCast(V, DestTy), Name);
2139  }
2140 
2142  const Twine &Name = "") {
2143  if (V->getType() == DestTy)
2144  return V;
2145  if (auto *VC = dyn_cast<Constant>(V))
2146  return Insert(Folder.CreateTruncOrBitCast(VC, DestTy), Name);
2147  return Insert(CastInst::CreateTruncOrBitCast(V, DestTy), Name);
2148  }
2149 
2151  const Twine &Name = "") {
2152  if (V->getType() == DestTy)
2153  return V;
2154  if (auto *VC = dyn_cast<Constant>(V))
2155  return Insert(Folder.CreateCast(Op, VC, DestTy), Name);
2156  return Insert(CastInst::Create(Op, V, DestTy), Name);
2157  }
2158 
2160  const Twine &Name = "") {
2161  if (V->getType() == DestTy)
2162  return V;
2163  if (auto *VC = dyn_cast<Constant>(V))
2164  return Insert(Folder.CreatePointerCast(VC, DestTy), Name);
2165  return Insert(CastInst::CreatePointerCast(V, DestTy), Name);
2166  }
2167 
2169  const Twine &Name = "") {
2170  if (V->getType() == DestTy)
2171  return V;
2172 
2173  if (auto *VC = dyn_cast<Constant>(V)) {
2175  Name);
2176  }
2177 
2179  Name);
2180  }
2181 
2182  Value *CreateIntCast(Value *V, Type *DestTy, bool isSigned,
2183  const Twine &Name = "") {
2184  if (V->getType() == DestTy)
2185  return V;
2186  if (auto *VC = dyn_cast<Constant>(V))
2187  return Insert(Folder.CreateIntCast(VC, DestTy, isSigned), Name);
2188  return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned), Name);
2189  }
2190 
2192  const Twine &Name = "") {
2193  if (V->getType() == DestTy)
2194  return V;
2195  if (V->getType()->isPtrOrPtrVectorTy() && DestTy->isIntOrIntVectorTy())
2196  return CreatePtrToInt(V, DestTy, Name);
2197  if (V->getType()->isIntOrIntVectorTy() && DestTy->isPtrOrPtrVectorTy())
2198  return CreateIntToPtr(V, DestTy, Name);
2199 
2200  return CreateBitCast(V, DestTy, Name);
2201  }
2202 
2203  Value *CreateFPCast(Value *V, Type *DestTy, const Twine &Name = "") {
2204  if (V->getType() == DestTy)
2205  return V;
2206  if (auto *VC = dyn_cast<Constant>(V))
2207  return Insert(Folder.CreateFPCast(VC, DestTy), Name);
2208  return Insert(CastInst::CreateFPCast(V, DestTy), Name);
2209  }
2210 
2212  Intrinsic::ID ID, Value *V, Type *DestTy,
2213  Instruction *FMFSource = nullptr, const Twine &Name = "",
2214  MDNode *FPMathTag = nullptr,
2217 
2218  // Provided to resolve 'CreateIntCast(Ptr, Ptr, "...")', giving a
2219  // compile time error, instead of converting the string to bool for the
2220  // isSigned parameter.
2221  Value *CreateIntCast(Value *, Type *, const char *) = delete;
2222 
2223  //===--------------------------------------------------------------------===//
2224  // Instruction creation methods: Compare Instructions
2225  //===--------------------------------------------------------------------===//
2226 
2227  Value *CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name = "") {
2228  return CreateICmp(ICmpInst::ICMP_EQ, LHS, RHS, Name);
2229  }
2230 
2231  Value *CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name = "") {
2232  return CreateICmp(ICmpInst::ICMP_NE, LHS, RHS, Name);
2233  }
2234 
2235  Value *CreateICmpUGT(Value *LHS, Value *RHS, const Twine &Name = "") {
2236  return CreateICmp(ICmpInst::ICMP_UGT, LHS, RHS, Name);
2237  }
2238 
2239  Value *CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name = "") {
2240  return CreateICmp(ICmpInst::ICMP_UGE, LHS, RHS, Name);
2241  }
2242 
2243  Value *CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name = "") {
2244  return CreateICmp(ICmpInst::ICMP_ULT, LHS, RHS, Name);
2245  }
2246 
2247  Value *CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name = "") {
2248  return CreateICmp(ICmpInst::ICMP_ULE, LHS, RHS, Name);
2249  }
2250 
2251  Value *CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name = "") {
2252  return CreateICmp(ICmpInst::ICMP_SGT, LHS, RHS, Name);
2253  }
2254 
2255  Value *CreateICmpSGE(Value *LHS, Value *RHS, const Twine &Name = "") {
2256  return CreateICmp(ICmpInst::ICMP_SGE, LHS, RHS, Name);
2257  }
2258 
2259  Value *CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name = "") {
2260  return CreateICmp(ICmpInst::ICMP_SLT, LHS, RHS, Name);
2261  }
2262 
2263  Value *CreateICmpSLE(Value *LHS, Value *RHS, const Twine &Name = "") {
2264  return CreateICmp(ICmpInst::ICMP_SLE, LHS, RHS, Name);
2265  }
2266 
2267  Value *CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name = "",
2268  MDNode *FPMathTag = nullptr) {
2269  return CreateFCmp(FCmpInst::FCMP_OEQ, LHS, RHS, Name, FPMathTag);
2270  }
2271 
2272  Value *CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name = "",
2273  MDNode *FPMathTag = nullptr) {
2274  return CreateFCmp(FCmpInst::FCMP_OGT, LHS, RHS, Name, FPMathTag);
2275  }
2276 
2277  Value *CreateFCmpOGE(Value *LHS, Value *RHS, const Twine &Name = "",
2278  MDNode *FPMathTag = nullptr) {
2279  return CreateFCmp(FCmpInst::FCMP_OGE, LHS, RHS, Name, FPMathTag);
2280  }
2281 
2282  Value *CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name = "",
2283  MDNode *FPMathTag = nullptr) {
2284  return CreateFCmp(FCmpInst::FCMP_OLT, LHS, RHS, Name, FPMathTag);
2285  }
2286 
2287  Value *CreateFCmpOLE(Value *LHS, Value *RHS, const Twine &Name = "",
2288  MDNode *FPMathTag = nullptr) {
2289  return CreateFCmp(FCmpInst::FCMP_OLE, LHS, RHS, Name, FPMathTag);
2290  }
2291 
2292  Value *CreateFCmpONE(Value *LHS, Value *RHS, const Twine &Name = "",
2293  MDNode *FPMathTag = nullptr) {
2294  return CreateFCmp(FCmpInst::FCMP_ONE, LHS, RHS, Name, FPMathTag);
2295  }
2296 
2297  Value *CreateFCmpORD(Value *LHS, Value *RHS, const Twine &Name = "",
2298  MDNode *FPMathTag = nullptr) {
2299  return CreateFCmp(FCmpInst::FCMP_ORD, LHS, RHS, Name, FPMathTag);
2300  }
2301 
2302  Value *CreateFCmpUNO(Value *LHS, Value *RHS, const Twine &Name = "",
2303  MDNode *FPMathTag = nullptr) {
2304  return CreateFCmp(FCmpInst::FCMP_UNO, LHS, RHS, Name, FPMathTag);
2305  }
2306 
2307  Value *CreateFCmpUEQ(Value *LHS, Value *RHS, const Twine &Name = "",
2308  MDNode *FPMathTag = nullptr) {
2309  return CreateFCmp(FCmpInst::FCMP_UEQ, LHS, RHS, Name, FPMathTag);
2310  }
2311 
2312  Value *CreateFCmpUGT(Value *LHS, Value *RHS, const Twine &Name = "",
2313  MDNode *FPMathTag = nullptr) {
2314  return CreateFCmp(FCmpInst::FCMP_UGT, LHS, RHS, Name, FPMathTag);
2315  }
2316 
2317  Value *CreateFCmpUGE(Value *LHS, Value *RHS, const Twine &Name = "",
2318  MDNode *FPMathTag = nullptr) {
2319  return CreateFCmp(FCmpInst::FCMP_UGE, LHS, RHS, Name, FPMathTag);
2320  }
2321 
2322  Value *CreateFCmpULT(Value *LHS, Value *RHS, const Twine &Name = "",
2323  MDNode *FPMathTag = nullptr) {
2324  return CreateFCmp(FCmpInst::FCMP_ULT, LHS, RHS, Name, FPMathTag);
2325  }
2326 
2327  Value *CreateFCmpULE(Value *LHS, Value *RHS, const Twine &Name = "",
2328  MDNode *FPMathTag = nullptr) {
2329  return CreateFCmp(FCmpInst::FCMP_ULE, LHS, RHS, Name, FPMathTag);
2330  }
2331 
2332  Value *CreateFCmpUNE(Value *LHS, Value *RHS, const Twine &Name = "",
2333  MDNode *FPMathTag = nullptr) {
2334  return CreateFCmp(FCmpInst::FCMP_UNE, LHS, RHS, Name, FPMathTag);
2335  }
2336 
2338  const Twine &Name = "") {
2339  if (auto *LC = dyn_cast<Constant>(LHS))
2340  if (auto *RC = dyn_cast<Constant>(RHS))
2341  return Insert(Folder.CreateICmp(P, LC, RC), Name);
2342  return Insert(new ICmpInst(P, LHS, RHS), Name);
2343  }
2344 
2345  // Create a quiet floating-point comparison (i.e. one that raises an FP
2346  // exception only in the case where an input is a signaling NaN).
2347  // Note that this differs from CreateFCmpS only if IsFPConstrained is true.
2349  const Twine &Name = "", MDNode *FPMathTag = nullptr) {
2350  return CreateFCmpHelper(P, LHS, RHS, Name, FPMathTag, false);
2351  }
2352 
2354  const Twine &Name = "", MDNode *FPMathTag = nullptr) {
2355  return CmpInst::isFPPredicate(Pred)
2356  ? CreateFCmp(Pred, LHS, RHS, Name, FPMathTag)
2357  : CreateICmp(Pred, LHS, RHS, Name);
2358  }
2359 
2360  // Create a signaling floating-point comparison (i.e. one that raises an FP
2361  // exception whenever an input is any NaN, signaling or quiet).
2362  // Note that this differs from CreateFCmp only if IsFPConstrained is true.
2364  const Twine &Name = "", MDNode *FPMathTag = nullptr) {
2365  return CreateFCmpHelper(P, LHS, RHS, Name, FPMathTag, true);
2366  }
2367 
2368 private:
2369  // Helper routine to create either a signaling or a quiet FP comparison.
2370  Value *CreateFCmpHelper(CmpInst::Predicate P, Value *LHS, Value *RHS,
2371  const Twine &Name, MDNode *FPMathTag,
2372  bool IsSignaling);
2373 
2374 public:
2377  const Twine &Name = "", Optional<fp::ExceptionBehavior> Except = None);
2378 
2379  //===--------------------------------------------------------------------===//
2380  // Instruction creation methods: Other Instructions
2381  //===--------------------------------------------------------------------===//
2382 
2383  PHINode *CreatePHI(Type *Ty, unsigned NumReservedValues,
2384  const Twine &Name = "") {
2385  PHINode *Phi = PHINode::Create(Ty, NumReservedValues);
2386  if (isa<FPMathOperator>(Phi))
2387  setFPAttrs(Phi, nullptr /* MDNode* */, FMF);
2388  return Insert(Phi, Name);
2389  }
2390 
2392  ArrayRef<Value *> Args = None, const Twine &Name = "",
2393  MDNode *FPMathTag = nullptr) {
2395  if (IsFPConstrained)
2397  if (isa<FPMathOperator>(CI))
2398  setFPAttrs(CI, FPMathTag, FMF);
2399  return Insert(CI, Name);
2400  }
2401 
2403  ArrayRef<OperandBundleDef> OpBundles,
2404  const Twine &Name = "", MDNode *FPMathTag = nullptr) {
2405  CallInst *CI = CallInst::Create(FTy, Callee, Args, OpBundles);
2406  if (IsFPConstrained)
2408  if (isa<FPMathOperator>(CI))
2409  setFPAttrs(CI, FPMathTag, FMF);
2410  return Insert(CI, Name);
2411  }
2412 
2414  const Twine &Name = "", MDNode *FPMathTag = nullptr) {
2415  return CreateCall(Callee.getFunctionType(), Callee.getCallee(), Args, Name,
2416  FPMathTag);
2417  }
2418 
2420  ArrayRef<OperandBundleDef> OpBundles,
2421  const Twine &Name = "", MDNode *FPMathTag = nullptr) {
2422  return CreateCall(Callee.getFunctionType(), Callee.getCallee(), Args,
2423  OpBundles, Name, FPMathTag);
2424  }
2425 
2427  Function *Callee, ArrayRef<Value *> Args, const Twine &Name = "",
2430 
2431  Value *CreateSelect(Value *C, Value *True, Value *False,
2432  const Twine &Name = "", Instruction *MDFrom = nullptr);
2433 
2434  VAArgInst *CreateVAArg(Value *List, Type *Ty, const Twine &Name = "") {
2435  return Insert(new VAArgInst(List, Ty), Name);
2436  }
2437 
2439  const Twine &Name = "") {
2440  if (auto *VC = dyn_cast<Constant>(Vec))
2441  if (auto *IC = dyn_cast<Constant>(Idx))
2442  return Insert(Folder.CreateExtractElement(VC, IC), Name);
2443  return Insert(ExtractElementInst::Create(Vec, Idx), Name);
2444  }
2445 
2446  Value *CreateExtractElement(Value *Vec, uint64_t Idx,
2447  const Twine &Name = "") {
2448  return CreateExtractElement(Vec, getInt64(Idx), Name);
2449  }
2450 
2452  const Twine &Name = "") {
2453  if (auto *VC = dyn_cast<Constant>(Vec))
2454  if (auto *NC = dyn_cast<Constant>(NewElt))
2455  if (auto *IC = dyn_cast<Constant>(Idx))
2456  return Insert(Folder.CreateInsertElement(VC, NC, IC), Name);
2457  return Insert(InsertElementInst::Create(Vec, NewElt, Idx), Name);
2458  }
2459 
2460  Value *CreateInsertElement(Value *Vec, Value *NewElt, uint64_t Idx,
2461  const Twine &Name = "") {
2462  return CreateInsertElement(Vec, NewElt, getInt64(Idx), Name);
2463  }
2464 
2466  const Twine &Name = "") {
2467  SmallVector<int, 16> IntMask;
2468  ShuffleVectorInst::getShuffleMask(cast<Constant>(Mask), IntMask);
2469  return CreateShuffleVector(V1, V2, IntMask, Name);
2470  }
2471 
2474  const Twine &Name = ""),
2475  "Pass indices as 'int' instead") {
2476  SmallVector<int, 16> IntMask;
2477  IntMask.assign(Mask.begin(), Mask.end());
2478  return CreateShuffleVector(V1, V2, IntMask, Name);
2479  }
2480 
2481  /// See class ShuffleVectorInst for a description of the mask representation.
2483  const Twine &Name = "") {
2484  if (auto *V1C = dyn_cast<Constant>(V1))
2485  if (auto *V2C = dyn_cast<Constant>(V2))
2486  return Insert(Folder.CreateShuffleVector(V1C, V2C, Mask), Name);
2487  return Insert(new ShuffleVectorInst(V1, V2, Mask), Name);
2488  }
2489 
2490  /// Create a unary shuffle. The second vector operand of the IR instruction
2491  /// is poison.
2493  const Twine &Name = "") {
2495  }
2496 
2498  ArrayRef<unsigned> Idxs,
2499  const Twine &Name = "") {
2500  if (auto *AggC = dyn_cast<Constant>(Agg))
2501  return Insert(Folder.CreateExtractValue(AggC, Idxs), Name);
2502  return Insert(ExtractValueInst::Create(Agg, Idxs), Name);
2503  }
2504 
2506  ArrayRef<unsigned> Idxs,
2507  const Twine &Name = "") {
2508  if (auto *AggC = dyn_cast<Constant>(Agg))
2509  if (auto *ValC = dyn_cast<Constant>(Val))
2510  return Insert(Folder.CreateInsertValue(AggC, ValC, Idxs), Name);
2511  return Insert(InsertValueInst::Create(Agg, Val, Idxs), Name);
2512  }
2513 
2514  LandingPadInst *CreateLandingPad(Type *Ty, unsigned NumClauses,
2515  const Twine &Name = "") {
2516  return Insert(LandingPadInst::Create(Ty, NumClauses), Name);
2517  }
2518 
2519  Value *CreateFreeze(Value *V, const Twine &Name = "") {
2520  return Insert(new FreezeInst(V), Name);
2521  }
2522 
2523  //===--------------------------------------------------------------------===//
2524  // Utility creation methods
2525  //===--------------------------------------------------------------------===//
2526 
2527  /// Return an i1 value testing if \p Arg is null.
2528  Value *CreateIsNull(Value *Arg, const Twine &Name = "") {
2529  return CreateICmpEQ(Arg, Constant::getNullValue(Arg->getType()),
2530  Name);
2531  }
2532 
2533  /// Return an i1 value testing if \p Arg is not null.
2535  return CreateICmpNE(Arg, Constant::getNullValue(Arg->getType()),
2536  Name);
2537  }
2538 
2539  /// Return the i64 difference between two pointer values, dividing out
2540  /// the size of the pointed-to objects.
2541  ///
2542  /// This is intended to implement C-style pointer subtraction. As such, the
2543  /// pointers must be appropriately aligned for their element types and
2544  /// pointing into the same object.
2545  Value *CreatePtrDiff(Value *LHS, Value *RHS, const Twine &Name = "");
2546 
2547  /// Create a launder.invariant.group intrinsic call. If Ptr type is
2548  /// different from pointer to i8, it's casted to pointer to i8 in the same
2549  /// address space before call and casted back to Ptr type after call.
2551 
2552  /// \brief Create a strip.invariant.group intrinsic call. If Ptr type is
2553  /// different from pointer to i8, it's casted to pointer to i8 in the same
2554  /// address space before call and casted back to Ptr type after call.
2556 
2557  /// Return a vector value that contains the vector V reversed
2558  Value *CreateVectorReverse(Value *V, const Twine &Name = "");
2559 
2560  /// Return a vector splice intrinsic if using scalable vectors, otherwise
2561  /// return a shufflevector. If the immediate is positive, a vector is
2562  /// extracted from concat(V1, V2), starting at Imm. If the immediate
2563  /// is negative, we extract -Imm elements from V1 and the remaining
2564  /// elements from V2. Imm is a signed integer in the range
2565  /// -VL <= Imm < VL (where VL is the runtime vector length of the
2566  /// source/result vector)
2567  Value *CreateVectorSplice(Value *V1, Value *V2, int64_t Imm,
2568  const Twine &Name = "");
2569 
2570  /// Return a vector value that contains \arg V broadcasted to \p
2571  /// NumElts elements.
2572  Value *CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name = "");
2573 
2574  /// Return a vector value that contains \arg V broadcasted to \p
2575  /// EC elements.
2576  Value *CreateVectorSplat(ElementCount EC, Value *V, const Twine &Name = "");
2577 
2578  /// Return a value that has been extracted from a larger integer type.
2580  IntegerType *ExtractedTy, uint64_t Offset,
2581  const Twine &Name);
2582 
2584  unsigned Dimension, unsigned LastIndex,
2585  MDNode *DbgInfo);
2586 
2587  Value *CreatePreserveUnionAccessIndex(Value *Base, unsigned FieldIndex,
2588  MDNode *DbgInfo);
2589 
2591  unsigned Index, unsigned FieldIndex,
2592  MDNode *DbgInfo);
2593 
2594 private:
2595  /// Helper function that creates an assume intrinsic call that
2596  /// represents an alignment assumption on the provided pointer \p PtrValue
2597  /// with offset \p OffsetValue and alignment value \p AlignValue.
2598  CallInst *CreateAlignmentAssumptionHelper(const DataLayout &DL,
2599  Value *PtrValue, Value *AlignValue,
2600  Value *OffsetValue);
2601 
2602 public:
2603  /// Create an assume intrinsic call that represents an alignment
2604  /// assumption on the provided pointer.
2605  ///
2606  /// An optional offset can be provided, and if it is provided, the offset
2607  /// must be subtracted from the provided pointer to get the pointer with the
2608  /// specified alignment.
2610  unsigned Alignment,
2611  Value *OffsetValue = nullptr);
2612 
2613  /// Create an assume intrinsic call that represents an alignment
2614  /// assumption on the provided pointer.
2615  ///
2616  /// An optional offset can be provided, and if it is provided, the offset
2617  /// must be subtracted from the provided pointer to get the pointer with the
2618  /// specified alignment.
2619  ///
2620  /// This overload handles the condition where the Alignment is dependent
2621  /// on an existing value rather than a static value.
2623  Value *Alignment,
2624  Value *OffsetValue = nullptr);
2625 };
2626 
2627 /// This provides a uniform API for creating instructions and inserting
2628 /// them into a basic block: either at the end of a BasicBlock, or at a specific
2629 /// iterator location in a block.
2630 ///
2631 /// Note that the builder does not expose the full generality of LLVM
2632 /// instructions. For access to extra instruction properties, use the mutators
2633 /// (e.g. setVolatile) on the instructions after they have been
2634 /// created. Convenience state exists to specify fast-math flags and fp-math
2635 /// tags.
2636 ///
2637 /// The first template argument specifies a class to use for creating constants.
2638 /// This defaults to creating minimally folded constants. The second template
2639 /// argument allows clients to specify custom insertion hooks that are called on
2640 /// every newly created insertion.
2641 template <typename FolderTy = ConstantFolder,
2642  typename InserterTy = IRBuilderDefaultInserter>
2643 class IRBuilder : public IRBuilderBase {
2644 private:
2645  FolderTy Folder;
2646  InserterTy Inserter;
2647 
2648 public:
2649  IRBuilder(LLVMContext &C, FolderTy Folder, InserterTy Inserter = InserterTy(),
2650  MDNode *FPMathTag = nullptr,
2651  ArrayRef<OperandBundleDef> OpBundles = None)
2652  : IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles),
2653  Folder(Folder), Inserter(Inserter) {}
2654 
2655  explicit IRBuilder(LLVMContext &C, MDNode *FPMathTag = nullptr,
2656  ArrayRef<OperandBundleDef> OpBundles = None)
2657  : IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles) {}
2658 
2659  explicit IRBuilder(BasicBlock *TheBB, FolderTy Folder,
2660  MDNode *FPMathTag = nullptr,
2661  ArrayRef<OperandBundleDef> OpBundles = None)
2662  : IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
2663  FPMathTag, OpBundles), Folder(Folder) {
2664  SetInsertPoint(TheBB);
2665  }
2666 
2667  explicit IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag = nullptr,
2668  ArrayRef<OperandBundleDef> OpBundles = None)
2669  : IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
2670  FPMathTag, OpBundles) {
2671  SetInsertPoint(TheBB);
2672  }
2673 
2674  explicit IRBuilder(Instruction *IP, MDNode *FPMathTag = nullptr,
2675  ArrayRef<OperandBundleDef> OpBundles = None)
2676  : IRBuilderBase(IP->getContext(), this->Folder, this->Inserter,
2677  FPMathTag, OpBundles) {
2678  SetInsertPoint(IP);
2679  }
2680 
2681  IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, FolderTy Folder,
2682  MDNode *FPMathTag = nullptr,
2683  ArrayRef<OperandBundleDef> OpBundles = None)
2684  : IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
2685  FPMathTag, OpBundles), Folder(Folder) {
2686  SetInsertPoint(TheBB, IP);
2687  }
2688 
2690  MDNode *FPMathTag = nullptr,
2691  ArrayRef<OperandBundleDef> OpBundles = None)
2692  : IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
2693  FPMathTag, OpBundles) {
2694  SetInsertPoint(TheBB, IP);
2695  }
2696 
2697  /// Avoid copying the full IRBuilder. Prefer using InsertPointGuard
2698  /// or FastMathFlagGuard instead.
2699  IRBuilder(const IRBuilder &) = delete;
2700 
2701  InserterTy &getInserter() { return Inserter; }
2702 };
2703 
2704 // Create wrappers for C Binding types (see CBindingWrapping.h).
2706 
2707 } // end namespace llvm
2708 
2709 #endif // LLVM_IR_IRBUILDER_H
llvm::IRBuilderBase::CreateConstInBoundsGEP2_64
Value * CreateConstInBoundsGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
Definition: IRBuilder.h:1963
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::IRBuilderBase::CreateXor
Value * CreateXor(Value *LHS, uint64_t RHS, const Twine &Name="")
Definition: IRBuilder.h:1419
i
i
Definition: README.txt:29
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name=""), "Use the version with explicit element type instead")
Definition: IRBuilder.h:1932
llvm::IRBuilderBase::CreateInBoundsGEP
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Definition: IRBuilder.h:1818
llvm::CmpInst::FCMP_ULE
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
Definition: InstrTypes.h:735
llvm::IRBuilderBase::CreateIntMaxReduce
CallInst * CreateIntMaxReduce(Value *Src, bool IsSigned=false)
Create a vector integer max reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:404
llvm::IRBuilderBase::CreateFCmpUNE
Value * CreateFCmpUNE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2332
llvm::IRBuilderBase::CreateIntCast
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
Definition: IRBuilder.h:2182
llvm::IRBuilderBase::InsertPointGuard::~InsertPointGuard
~InsertPointGuard()
Definition: IRBuilder.h:381
llvm::IRBuilder::IRBuilder
IRBuilder(LLVMContext &C, FolderTy Folder, InserterTy Inserter=InserterTy(), MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Definition: IRBuilder.h:2649
llvm::BasicBlock::end
iterator end()
Definition: BasicBlock.h:298
llvm::IRBuilderBase::getInt32Ty
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
Definition: IRBuilder.h:518
llvm::IRBuilderBase::restoreIP
void restoreIP(InsertPoint IP)
Sets the current insert point to a previously-saved location.
Definition: IRBuilder.h:283
llvm::LandingPadInst::Create
static LandingPadInst * Create(Type *RetTy, unsigned NumReservedClauses, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedClauses is a hint for the number of incoming clauses that this landingpad w...
Definition: Instructions.cpp:214
llvm::IRBuilderBase::CreateStore
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
Definition: IRBuilder.h:1695
llvm::IRBuilderBase::CreateConstrainedFPCall
CallInst * CreateConstrainedFPCall(Function *Callee, ArrayRef< Value * > Args, const Twine &Name="", Optional< RoundingMode > Rounding=None, Optional< fp::ExceptionBehavior > Except=None)
Definition: IRBuilder.cpp:948
llvm::IRBuilder::getInserter
InserterTy & getInserter()
Definition: IRBuilder.h:2701
llvm::CatchSwitchInst::Create
static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:4263
llvm::IRBuilderBase::CreateICmpSGE
Value * CreateICmpSGE(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2255
llvm::IRBuilderBase::SetInsertPoint
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block.
Definition: IRBuilder.h:184
llvm::IRBuilderBase::CreateIndirectBr
IndirectBrInst * CreateIndirectBr(Value *Addr, unsigned NumDests=10)
Create an indirect branch instruction with the specified address operand, with an optional hint for t...
Definition: IRBuilder.h:1024
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::InvokeInst::Create
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:3757
llvm::IRBuilderBase::CreateMulReduce
CallInst * CreateMulReduce(Value *Src)
Create a vector int mul reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:388
llvm::Type::getInt1Ty
static IntegerType * getInt1Ty(LLVMContext &C)
Definition: Type.cpp:200
llvm::CastInst::CreatePointerBitCastOrAddrSpaceCast
static CastInst * CreatePointerBitCastOrAddrSpaceCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast or an AddrSpaceCast cast instruction.
Definition: Instructions.cpp:3095
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::IRBuilderBase::CreateLogicalAnd
Value * CreateLogicalAnd(Value *Cond1, Value *Cond2, const Twine &Name="")
Definition: IRBuilder.h:1558
llvm::IRBuilderBase::CreateConstInBoundsGEP2_32
Value * CreateConstInBoundsGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
Definition: IRBuilder.h:1890
llvm::CmpInst::ICMP_EQ
@ ICMP_EQ
equal
Definition: InstrTypes.h:741
llvm::IRBuilderBase::getInt64Ty
IntegerType * getInt64Ty()
Fetch the type representing a 64-bit integer.
Definition: IRBuilder.h:523
llvm::ReturnInst
Return a value (possibly void), from a function.
Definition: Instructions.h:2950
llvm::VAArgInst
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
Definition: Instructions.h:1835
llvm::IRBuilderBase::CreateAlignedStore
StoreInst * CreateAlignedStore(Value *Val, Value *Ptr, MaybeAlign Align, bool isVolatile=false)
Definition: IRBuilder.h:1747
llvm::IRBuilderBase::CreateConstGEP1_64
Value * CreateConstGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0, const Twine &Name="")
Definition: IRBuilder.h:1903
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:112
llvm::Instruction::UnaryOps
UnaryOps
Definition: Instruction.h:780
llvm::IRBuilderBase::CreateExtractValue
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
Definition: IRBuilder.h:2497
llvm::IRBuilderBase::CreateLifetimeEnd
CallInst * CreateLifetimeEnd(Value *Ptr, ConstantInt *Size=nullptr)
Create a lifetime.end intrinsic.
Definition: IRBuilder.cpp:440
llvm::Type::getInt8PtrTy
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:255
llvm::IRBuilderBase::setIsFPConstrained
void setIsFPConstrained(bool IsCon)
Enable/Disable use of constrained floating point math.
Definition: IRBuilder.h:311
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:720
llvm::IRBuilderBase::CreateZExtOrBitCast
Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2123
llvm::BasicBlock::iterator
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:90
llvm::IRBuilderBase::CreateGCStatepointInvoke
InvokeInst * CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes, Value *ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > InvokeArgs, Optional< ArrayRef< Value * >> DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
Create an invoke to the experimental.gc.statepoint intrinsic to start a new statepoint sequence.
Definition: IRBuilder.cpp:746
llvm::IRBuilderBase::CreateNUWNeg
Value * CreateNUWNeg(Value *V, const Twine &Name="")
Definition: IRBuilder.h:1590
llvm::BasicBlock::getParent
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:107
IntrinsicInst.h
AtomicOrdering.h
llvm::ElementCount
Definition: TypeSize.h:386
DebugInfoMetadata.h
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateInBoundsGEP(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name=""), "Use the version with explicit element type instead")
Definition: IRBuilder.h:1809
llvm::IRBuilderBase::Insert
Constant * Insert(Constant *C, const Twine &="") const
No-op overload to handle constants.
Definition: IRBuilder.h:156
llvm::IndirectBrInst::Create
static IndirectBrInst * Create(Value *Address, unsigned NumDests, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:3639
llvm::Function
Definition: Function.h:61
llvm::IRBuilderBase::CreatePtrToInt
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2103
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::BinaryOperator::CreateNot
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Definition: Instructions.cpp:2620
llvm::IRBuilderBase::CreateVectorReverse
Value * CreateVectorReverse(Value *V, const Twine &Name="")
Return a vector value that contains the vector V reversed.
Definition: IRBuilder.cpp:1054
llvm::IRBuilderBase::CreateFCmpOEQ
Value * CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2267
llvm::IRBuilderBase::CreateGlobalString
GlobalVariable * CreateGlobalString(StringRef Str, const Twine &Name="", unsigned AddressSpace=0, Module *M=nullptr)
Make a new global variable with initializer type i8*.
Definition: IRBuilder.cpp:43
llvm::IRBuilderBase::CreateXor
Value * CreateXor(Value *LHS, const APInt &RHS, const Twine &Name="")
Definition: IRBuilder.h:1415
minimum
Should compile r2 movcc movcs str strb mov lr r1 movcs movcc mov lr r1 str mov mov cmp r1 movlo r2 str bx lr r0 mov mov cmp r0 movhs r2 mov r1 bx lr Some of the NEON intrinsics may be appropriate for more general either as target independent intrinsics or perhaps elsewhere in the ARM backend Some of them may also be lowered to target independent and perhaps some new SDNodes could be added For minimum
Definition: README.txt:489
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateAlignedLoad(Value *Ptr, MaybeAlign Align, const char *Name), "Use the version that explicitly specifies the " "loaded type instead")
Definition: IRBuilder.h:1719
llvm::IRBuilderBase::CreateXor
Value * CreateXor(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1410
llvm::Type::getScalarType
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition: Type.h:319
llvm::AtomicRMWInst::BinOp
BinOp
This enumeration lists the possible modifications atomicrmw can make.
Definition: Instructions.h:738
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::IRBuilderBase::CreateConstrainedFPCast
CallInst * CreateConstrainedFPCast(Intrinsic::ID ID, Value *V, Type *DestTy, Instruction *FMFSource=nullptr, const Twine &Name="", MDNode *FPMathTag=nullptr, Optional< RoundingMode > Rounding=None, Optional< fp::ExceptionBehavior > Except=None)
Definition: IRBuilder.cpp:884
Types.h
llvm::LandingPadInst
The landingpad instruction holds all of the information necessary to generate correct exception handl...
Definition: Instructions.h:2849
llvm::SwitchInst::Create
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:3366
llvm::IRBuilderFolder
IRBuilderFolder - Interface for constant folding in IRBuilder.
Definition: IRBuilderFolder.h:24
llvm::CmpInst::FCMP_ONE
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
Definition: InstrTypes.h:728
llvm::IRBuilderBase::AddMetadataToInst
void AddMetadataToInst(Instruction *I) const
Add all entries in MetadataToCopy to I.
Definition: IRBuilder.h:241
llvm::IRBuilderBase::setFastMathFlags
void setFastMathFlags(FastMathFlags NewFMF)
Set the fast-math flags to be used with generated fp-math operators.
Definition: IRBuilder.h:305
llvm::IRBuilderBase::ClearInsertionPoint
void ClearInsertionPoint()
Clear the insertion point: created instructions will not be inserted into a block.
Definition: IRBuilder.h:173
llvm::IRBuilderBase::CreateInsertVector
CallInst * CreateInsertVector(Type *DstType, Value *SrcVec, Value *SubVec, Value *Idx, const Twine &Name="")
Create a call to the experimental.vector.insert intrinsic.
Definition: IRBuilder.h:927
llvm::IRBuilder
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:2643
llvm::SyncScope::System
@ System
Synchronized with respect to all concurrently executing threads.
Definition: LLVMContext.h:58
llvm::InsertValueInst::Create
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:2494
llvm::GlobalVariable
Definition: GlobalVariable.h:40
llvm::CastInst::Create
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
Definition: Instructions.cpp:2966
llvm::erase_if
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
Definition: STLExtras.h:1728
llvm::IRBuilder::IRBuilder
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, FolderTy Folder, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Definition: IRBuilder.h:2681
llvm::IRBuilderBase::getIsFPConstrained
bool getIsFPConstrained()
Query for the use of constrained floating point math.
Definition: IRBuilder.h:314
llvm::CmpInst::ICMP_NE
@ ICMP_NE
not equal
Definition: InstrTypes.h:742
llvm::IRBuilderBase::CreateStructGEP
Value * CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx, const Twine &Name="")
Definition: IRBuilder.h:1985
llvm::DebugLoc::getAsMDNode
MDNode * getAsMDNode() const
Return this as a bar MDNode.
Definition: DebugLoc.h:99
llvm::IRBuilderFolder::CreateInsertElement
virtual Value * CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const =0
llvm::IRBuilderBase::CreateBr
BranchInst * CreateBr(BasicBlock *Dest)
Create an unconditional 'br label X' instruction.
Definition: IRBuilder.h:985
llvm::IRBuilderBase::CreateOr
Value * CreateOr(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1384
llvm::IRBuilderBase::CreateFPExt
Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2096
llvm::IRBuilderBase::FastMathFlagGuard::~FastMathFlagGuard
~FastMathFlagGuard()
Definition: IRBuilder.h:407
llvm::IRBuilderBase::CreateUnaryIntrinsic
CallInst * CreateUnaryIntrinsic(Intrinsic::ID ID, Value *V, Instruction *FMFSource=nullptr, const Twine &Name="")
Create a call to intrinsic ID with 1 operand which is mangled on its type.
Definition: IRBuilder.cpp:823
llvm::IRBuilderBase::CreateAssumption
CallInst * CreateAssumption(Value *Cond, ArrayRef< OperandBundleDef > OpBundles=llvm::None)
Create an assume intrinsic call that allows the optimizer to assume that the provided condition will ...
Definition: IRBuilder.cpp:477
llvm::IRBuilderBase::setConstrainedFPCallAttr
void setConstrainedFPCallAttr(CallBase *I)
Definition: IRBuilder.h:353
llvm::IRBuilderBase::CreateStripInvariantGroup
Value * CreateStripInvariantGroup(Value *Ptr)
Create a strip.invariant.group intrinsic call.
Definition: IRBuilder.cpp:1029
llvm::IRBuilderBase::CreatePreserveUnionAccessIndex
Value * CreatePreserveUnionAccessIndex(Value *Base, unsigned FieldIndex, MDNode *DbgInfo)
Definition: IRBuilder.cpp:1175
llvm::InsertElementInst::Create
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:1953
llvm::CmpInst::ICMP_SGT
@ ICMP_SGT
signed greater than
Definition: InstrTypes.h:747
llvm::ExtractElementInst::Create
static ExtractElementInst * Create(Value *Vec, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:1888
llvm::IRBuilderBase::CreateCmp
Value * CreateCmp(CmpInst::Predicate Pred, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2353
llvm::IRBuilderBase::CreateMaxNum
CallInst * CreateMaxNum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the maxnum intrinsic.
Definition: IRBuilder.h:897
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::IRBuilderBase::CreateShuffleVector
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
Definition: IRBuilder.h:2465
Module.h
llvm::IRBuilderBase::CreateLogicalOr
Value * CreateLogicalOr(Value *Cond1, Value *Cond2, const Twine &Name="")
Definition: IRBuilder.h:1564
llvm::IRBuilderBase::FMF
FastMathFlags FMF
Definition: IRBuilder.h:127
llvm::IRBuilderBase::CreateCatchSwitch
CatchSwitchInst * CreateCatchSwitch(Value *ParentPad, BasicBlock *UnwindBB, unsigned NumHandlers, const Twine &Name="")
Definition: IRBuilder.h:1112
llvm::IRBuilderBase::CreateTruncOrBitCast
Value * CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2141
llvm::IRBuilderBase::Folder
const IRBuilderFolder & Folder
Definition: IRBuilder.h:123
llvm::IRBuilderBase::CreateFSub
Value * CreateFSub(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Definition: IRBuilder.h:1448
llvm::Instruction::setHasNoUnsignedWrap
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
Definition: Instruction.cpp:124
llvm::IRBuilderBase::CreateBinaryIntrinsic
CallInst * CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS, Instruction *FMFSource=nullptr, const Twine &Name="")
Create a call to intrinsic ID with 2 operands which is mangled on the first type.
Definition: IRBuilder.cpp:831
llvm::Optional
Definition: APInt.h:33
llvm::IRBuilderBase::CreateInsertElement
Value * CreateInsertElement(Value *Vec, Value *NewElt, uint64_t Idx, const Twine &Name="")
Definition: IRBuilder.h:2460
llvm::FenceInst
An instruction for ordering other memory operations.
Definition: Instructions.h:444
llvm::IRBuilderBase::CreateFPToSI
Value * CreateFPToSI(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2066
llvm::IRBuilderBase::getIntN
ConstantInt * getIntN(unsigned N, uint64_t C)
Get a constant N-bit value, zero extended or truncated from a 64-bit value.
Definition: IRBuilder.h:489
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
CBindingWrapping.h
llvm::IRBuilderBase::InsertPointGuard::operator=
InsertPointGuard & operator=(const InsertPointGuard &)=delete
llvm::IRBuilderBase::CreateFNeg
Value * CreateFNeg(Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:1594
Operator.h
llvm::CmpInst::ICMP_SLE
@ ICMP_SLE
signed less or equal
Definition: InstrTypes.h:750
llvm::IRBuilderBase::CreateNAryOp
Value * CreateNAryOp(unsigned Opc, ArrayRef< Value * > Ops, const Twine &Name="", MDNode *FPMathTag=nullptr)
Create either a UnaryOperator or BinaryOperator depending on Opc.
Definition: IRBuilder.cpp:869
llvm::Instruction::copyMetadata
void copyMetadata(const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())
Copy metadata from SrcInst to this instruction.
Definition: Instruction.cpp:829
llvm::ConstantExpr::getInBoundsGetElementPtr
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition: Constants.h:1237
llvm::IRBuilderBase::CreateInvoke
InvokeInst * CreateInvoke(FunctionType *Ty, Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
Create an invoke instruction.
Definition: IRBuilder.h:1029
llvm::IRBuilderBase::CreateCall
CallInst * CreateCall(FunctionCallee Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2419
llvm::CastInst::CreateIntegerCast
static CastInst * CreateIntegerCast(Value *S, Type *Ty, bool isSigned, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt, BitCast, or Trunc for int -> int casts.
Definition: Instructions.cpp:3132
STLExtras.h
llvm::IRBuilderDefaultInserter
This provides the default implementation of the IRBuilder 'InsertHelper' method that is called whenev...
Definition: IRBuilder.h:63
llvm::IRBuilderBase::CreateAlignedLoad
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, const char *Name)
Definition: IRBuilder.h:1699
llvm::IRBuilderFolder::CreateMul
virtual Value * CreateMul(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const =0
llvm::CmpInst::getPredicateName
static StringRef getPredicateName(Predicate P)
Definition: Instructions.cpp:3721
llvm::BinaryOperator::CreateNeg
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and...
Definition: Instructions.cpp:2580
llvm::FastMathFlags
Convenience struct for specifying and reasoning about fast-math flags.
Definition: Operator.h:161
llvm::IRBuilderBase::CreateGlobalStringPtr
Constant * CreateGlobalStringPtr(StringRef Str, const Twine &Name="", unsigned AddressSpace=0, Module *M=nullptr)
Same as CreateGlobalString, but return a pointer with "i8*" type instead of a pointer to array of i8.
Definition: IRBuilder.h:2003
llvm::IRBuilderBase::CreateInBoundsGEP
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name="")
Definition: IRBuilder.h:1840
llvm::IRBuilderBase::CreateCondBr
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, Instruction *MDSrc)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
Definition: IRBuilder.h:1000
llvm::IRBuilderBase::CreateAShr
Value * CreateAShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1338
llvm::IRBuilderBase::CreatePtrDiff
Value * CreatePtrDiff(Value *LHS, Value *RHS, const Twine &Name="")
Return the i64 difference between two pointer values, dividing out the size of the pointed-to objects...
Definition: IRBuilder.cpp:992
llvm::CallBrInst::Create
static CallBrInst * Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:3965
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name=""), "Use the version with explicit element type instead")
Definition: IRBuilder.h:1954
llvm::CmpInst::FCMP_OGT
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
Definition: InstrTypes.h:724
llvm::BitmaskEnumDetail::Mask
std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
llvm::Type::getInt8Ty
static IntegerType * getInt8Ty(LLVMContext &C)
Definition: Type.cpp:201
llvm::IRBuilderBase::CreateICmpSGT
Value * CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2251
llvm::IRBuilderBase::CreateAlloca
AllocaInst * CreateAlloca(Type *Ty, unsigned AddrSpace, Value *ArraySize=nullptr, const Twine &Name="")
Definition: IRBuilder.h:1639
llvm::IRBuilderBase::CreateArithmeticFence
CallInst * CreateArithmeticFence(Value *Val, Type *DstType, const Twine &Name="")
Create a call to the arithmetic_fence intrinsic.
Definition: IRBuilder.h:912
llvm::Type::getInt32Ty
static IntegerType * getInt32Ty(LLVMContext &C)
Definition: Type.cpp:203
llvm::IRBuilderBase::getInt1
ConstantInt * getInt1(bool V)
Get a constant value representing either true or false.
Definition: IRBuilder.h:453
llvm::IRBuilderFolder::CreateIntCast
virtual Value * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const =0
llvm::IRBuilderBase::CreateCall
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2402
llvm::IRBuilderBase::CreateIntToPtr
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2108
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:160
llvm::IRBuilderBase::CreateInvoke
InvokeInst * CreateInvoke(FunctionType *Ty, Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args=None, const Twine &Name="")
Definition: IRBuilder.h:1040
llvm::IRBuilderBase::CreateGCGetPointerBase
CallInst * CreateGCGetPointerBase(Value *DerivedPtr, const Twine &Name="")
Create a call to the experimental.gc.pointer.base intrinsic to get the base pointer for the specified...
Definition: IRBuilder.cpp:805
llvm::IRBuilderBase::CreateInvariantStart
CallInst * CreateInvariantStart(Value *Ptr, ConstantInt *Size=nullptr)
Create a call to invariant.start intrinsic.
Definition: IRBuilder.cpp:456
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::IRBuilderBase::CreateInvoke
InvokeInst * CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
Definition: IRBuilder.h:1051
llvm::IRBuilderBase::CreateGEP
Value * CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name="")
Definition: IRBuilder.h:1833
llvm::IRBuilderBase::CreateAlloca
AllocaInst * CreateAlloca(Type *Ty, Value *ArraySize=nullptr, const Twine &Name="")
Definition: IRBuilder.h:1646
llvm::IRBuilderBase::CreateAShr
Value * CreateAShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1348
llvm::IRBuilderBase::CreateAtomicCmpXchg
AtomicCmpXchgInst * CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, MaybeAlign Align, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID=SyncScope::System)
Definition: IRBuilder.h:1762
llvm::IRBuilderBase::getDefaultConstrainedExcept
fp::ExceptionBehavior getDefaultConstrainedExcept()
Get the exception handling used with constrained floating point.
Definition: IRBuilder.h:335
llvm::IRBuilderBase::CreateBinOp
Value * CreateBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:1548
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::IRBuilderBase::CreateLShr
Value * CreateLShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1333
DEFINE_SIMPLE_CONVERSION_FUNCTIONS
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Definition: CBindingWrapping.h:19
llvm::IRBuilderBase::setDefaultFPMathTag
void setDefaultFPMathTag(MDNode *FPMathTag)
Set the floating point math metadata to be used.
Definition: IRBuilder.h:302
llvm::IRBuilderFolder::CreateAShr
virtual Value * CreateAShr(Constant *LHS, Constant *RHS, bool isExact=false) const =0
llvm::Optional::hasValue
constexpr bool hasValue() const
Definition: Optional.h:288
llvm::CmpInst::FCMP_ULT
@ FCMP_ULT
1 1 0 0 True if unordered or less than
Definition: InstrTypes.h:734
llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove
CallInst * CreateElementUnorderedAtomicMemMove(Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memmove between the specified pointers.
Definition: IRBuilder.cpp:319
llvm::IRBuilderBase::CreateShl
Value * CreateShl(Value *LHS, uint64_t RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1312
llvm::IRBuilderBase::InsertPoint::isSet
bool isSet() const
Returns true if this insert point is set.
Definition: IRBuilder.h:264
llvm::IRBuilderBase::Insert
Value * Insert(Value *V, const Twine &Name="") const
Definition: IRBuilder.h:160
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:206
llvm::IRBuilderBase::CreateNUWSub
Value * CreateNUWSub(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1238
llvm::IRBuilderBase::CreateFCmpULE
Value * CreateFCmpULE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2327
Instruction.h
llvm::IRBuilderBase::CreateCast
Value * CreateCast(Instruction::CastOps Op, Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2150
llvm::IRBuilderBase::CreateInsertValue
Value * CreateInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &Name="")
Definition: IRBuilder.h:2505
llvm::IRBuilderBase::CreateConstrainedFPBinOp
CallInst * CreateConstrainedFPBinOp(Intrinsic::ID ID, Value *L, Value *R, Instruction *FMFSource=nullptr, const Twine &Name="", MDNode *FPMathTag=nullptr, Optional< RoundingMode > Rounding=None, Optional< fp::ExceptionBehavior > Except=None)
Definition: IRBuilder.cpp:850
llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet
CallInst * CreateElementUnorderedAtomicMemSet(Value *Ptr, Value *Val, uint64_t Size, Align Alignment, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memset of the region of memory starting at the given po...
Definition: IRBuilder.h:599
llvm::IRBuilderBase::CreateFMul
Value * CreateFMul(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Definition: IRBuilder.h:1473
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
llvm::IRBuilder::IRBuilder
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Definition: IRBuilder.h:2689
llvm::IRBuilderBase::getBFloatTy
Type * getBFloatTy()
Fetch the type representing a 16-bit brain floating point value.
Definition: IRBuilder.h:541
llvm::IRBuilderBase::CreateMul
Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1242
llvm::IRBuilderBase::CreateShuffleVector
Value * CreateShuffleVector(Value *V1, Value *V2, ArrayRef< int > Mask, const Twine &Name="")
See class ShuffleVectorInst for a description of the mask representation.
Definition: IRBuilder.h:2482
llvm::IRBuilderFolder::CreatePointerBitCastOrAddrSpaceCast
virtual Value * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const =0
llvm::IRBuilderBase::CreateExactUDiv
Value * CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1269
llvm::IRBuilderBase::CreateFMulFMF
Value * CreateFMulFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
Definition: IRBuilder.h:1486
llvm::IRBuilderBase::CreateUIToFP
Value * CreateUIToFP(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2073
llvm::AArch64CC::VC
@ VC
Definition: AArch64BaseInfo.h:262
llvm::IRBuilderBase::CreateNSWAdd
Value * CreateNSWAdd(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1217
llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy
CallInst * CreateElementUnorderedAtomicMemCpy(Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memcpy between the specified pointers.
Definition: IRBuilder.cpp:244
llvm::CmpInst::isFPPredicate
bool isFPPredicate() const
Definition: InstrTypes.h:813
Constants.h
llvm::IRBuilderBase::CreateFSubFMF
Value * CreateFSubFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
Definition: IRBuilder.h:1461
llvm::IRBuilder::IRBuilder
IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Definition: IRBuilder.h:2667
llvm::IRBuilderDefaultInserter::~IRBuilderDefaultInserter
virtual ~IRBuilderDefaultInserter()
Definition: IRBuilder.cpp:1256
llvm::IRBuilderBase::CreateVectorSplice
Value * CreateVectorSplice(Value *V1, Value *V2, int64_t Imm, const Twine &Name="")
Return a vector splice intrinsic if using scalable vectors, otherwise return a shufflevector.
Definition: IRBuilder.cpp:1070
llvm::IRBuilderBase::CreateMemTransferInst
CallInst * CreateMemTransferInst(Intrinsic::ID IntrID, Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Definition: IRBuilder.cpp:169
llvm::Instruction::setHasNoSignedWrap
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
Definition: Instruction.cpp:128
LLVMBuilderRef
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
Definition: Types.h:110
llvm::IRBuilderBase::CreateConstInBoundsGEP1_64
Value * CreateConstInBoundsGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0, const Twine &Name="")
Definition: IRBuilder.h:1922
llvm::IRBuilderBase::CreateMemSet
CallInst * CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, MaybeAlign Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memset to the specified pointer and the specified value.
Definition: IRBuilder.h:580
llvm::Type::getDoubleTy
static Type * getDoubleTy(LLVMContext &C)
Definition: Type.cpp:191
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::RoundingMode
RoundingMode
Rounding mode.
Definition: FloatingPointMode.h:34
llvm::CmpInst::ICMP_ULE
@ ICMP_ULE
unsigned less or equal
Definition: InstrTypes.h:746
llvm::IRBuilderBase::CreateLShr
Value * CreateLShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1328
llvm::IRBuilderBase::CreateCallBr
CallBrInst * CreateCallBr(FunctionCallee Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args=None, const Twine &Name="")
Definition: IRBuilder.h:1087
llvm::IRBuilderBase::getInt16Ty
IntegerType * getInt16Ty()
Fetch the type representing a 16-bit integer.
Definition: IRBuilder.h:513
llvm::CleanupReturnInst::Create
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:4590
Twine.h
InstrTypes.h
llvm::IRBuilderBase::CreateLoad
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ty, Ptr, "...")' correctly, instead of converting the string to 'bool...
Definition: IRBuilder.h:1656
llvm::IRBuilderBase::CreateExactSDiv
Value * CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1283
llvm::IRBuilderBase::getIntNTy
IntegerType * getIntNTy(unsigned N)
Fetch the type representing an N-bit integer.
Definition: IRBuilder.h:531
ConstantFolder.h
llvm::CallInst::Create
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:1518
llvm::IRBuilderBase::setConstrainedFPFunctionAttr
void setConstrainedFPFunctionAttr()
Definition: IRBuilder.h:344
llvm::IRBuilder::IRBuilder
IRBuilder(LLVMContext &C, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Definition: IRBuilder.h:2655
llvm::CmpInst::FCMP_UGE
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
Definition: InstrTypes.h:733
llvm::IRBuilderBase::OperandBundlesGuard::operator=
OperandBundlesGuard & operator=(const OperandBundlesGuard &)=delete
llvm::IRBuilderBase::CreateUnOp
Value * CreateUnOp(Instruction::UnaryOps Opc, Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:1619
llvm::CastInst::CreateFPCast
static CastInst * CreateFPCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create an FPExt, BitCast, or FPTrunc for fp -> fp casts.
Definition: Instructions.cpp:3160
llvm::IRBuilderBase::CreateAlignedLoad
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, bool isVolatile, const Twine &Name="")
Definition: IRBuilder.h:1709
IP
Definition: NVPTXLowerArgs.cpp:166
false
Definition: StackSlotColoring.cpp:142
llvm::IRBuilderBase::SetCurrentDebugLocation
void SetCurrentDebugLocation(DebugLoc L)
Set location information used by debugging information.
Definition: IRBuilder.h:208
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:109
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::IntegerType
Class to represent integer types.
Definition: DerivedTypes.h:40
llvm::Instruction::CastOps
CastOps
Definition: Instruction.h:801
llvm::Constant::getAllOnesValue
static Constant * getAllOnesValue(Type *Ty)
Definition: Constants.cpp:404
llvm::IRBuilderBase::CreatePreserveStructAccessIndex
Value * CreatePreserveStructAccessIndex(Type *ElTy, Value *Base, unsigned Index, unsigned FieldIndex, MDNode *DbgInfo)
Definition: IRBuilder.cpp:1194
llvm::IRBuilderBase::CreateFCmpUGE
Value * CreateFCmpUGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2317
llvm::IRBuilderBase::CreateShuffleVector
Value * CreateShuffleVector(Value *V, ArrayRef< int > Mask, const Twine &Name="")
Create a unary shuffle.
Definition: IRBuilder.h:2492
llvm::CmpInst::FCMP_UNO
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Definition: InstrTypes.h:730
llvm::Instruction
Definition: Instruction.h:45
llvm::Type::getScalarSizeInBits
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition: Type.cpp:153
llvm::IRBuilderBase::CreateXorReduce
CallInst * CreateXorReduce(Value *Src)
Create a vector int XOR reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:400
llvm::IRBuilderBase::getInt8Ty
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
Definition: IRBuilder.h:508
llvm::IRBuilderBase::getContext
LLVMContext & getContext() const
Definition: IRBuilder.h:180
llvm::CastInst::CreateSExtOrBitCast
static CastInst * CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a SExt or BitCast cast instruction.
Definition: Instructions.cpp:3026
llvm::IRBuilderBase::CreateMaskedGather
CallInst * CreateMaskedGather(Type *Ty, Value *Ptrs, Align Alignment, Value *Mask=nullptr, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Gather intrinsic.
Definition: IRBuilder.cpp:558
llvm::IRBuilderBase::CreateInsertElement
Value * CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx, const Twine &Name="")
Definition: IRBuilder.h:2451
llvm::IRBuilderBase::DefaultFPMathTag
MDNode * DefaultFPMathTag
Definition: IRBuilder.h:126
llvm::UndefValue::get
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1784
llvm::IRBuilder::IRBuilder
IRBuilder(BasicBlock *TheBB, FolderTy Folder, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Definition: IRBuilder.h:2659
llvm::IRBuilderBase::CreateFCmp
Value * CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2348
llvm::ConstantInt::get
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Definition: Constants.cpp:899
llvm::IRBuilderBase::FastMathFlagGuard::FastMathFlagGuard
FastMathFlagGuard(IRBuilderBase &B)
Definition: IRBuilder.h:398
llvm::CmpInst::FCMP_OEQ
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
Definition: InstrTypes.h:723
DebugLoc.h
llvm::IRBuilderBase::CreateConstInBoundsGEP1_32
Value * CreateConstInBoundsGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
Definition: IRBuilder.h:1867
llvm::CmpInst::FCMP_OLT
@ FCMP_OLT
0 1 0 0 True if ordered and less than
Definition: InstrTypes.h:726
llvm::BasicBlock::getModule
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
Definition: BasicBlock.cpp:144
llvm::IRBuilderBase::InsertPoint::getBlock
BasicBlock * getBlock() const
Definition: IRBuilder.h:266
llvm::IRBuilderBase::CreateVScale
Value * CreateVScale(Constant *Scaling, const Twine &Name="")
Create a call to llvm.vscale, multiplied by Scaling.
Definition: IRBuilder.cpp:83
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::IRBuilderBase::CreateFPMaxReduce
CallInst * CreateFPMaxReduce(Value *Src)
Create a vector float max reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:416
llvm::CastInst::CreateTruncOrBitCast
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a Trunc or BitCast cast instruction.
Definition: Instructions.cpp:3042
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::AddressSpace
AddressSpace
Definition: NVPTXBaseInfo.h:21
llvm::IRBuilderBase::CreateOr
Value * CreateOr(ArrayRef< Value * > Ops)
Definition: IRBuilder.h:1402
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name=""), "Use the version with explicit element type instead")
Definition: IRBuilder.h:1976
llvm::IRBuilderFolder::CreateGetElementPtr
virtual Value * CreateGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList) const =0
llvm::None
const NoneType None
Definition: None.h:23
llvm::IRBuilderBase::CreateAnd
Value * CreateAnd(Value *LHS, uint64_t RHS, const Twine &Name="")
Definition: IRBuilder.h:1372
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::CatchReturnInst::Create
static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:4504
llvm::IRBuilderBase::FastMathFlagGuard::operator=
FastMathFlagGuard & operator=(const FastMathFlagGuard &)=delete
llvm::IRBuilderBase::CreateInvoke
InvokeInst * CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args=None, const Twine &Name="")
Definition: IRBuilder.h:1059
llvm::IRBuilderBase::CreateRet
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
Definition: IRBuilder.h:966
Type.h
llvm::IRBuilderBase::CreateAddrSpaceCast
Value * CreateAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2118
llvm::IRBuilderFolder::CreateCast
virtual Value * CreateCast(Instruction::CastOps Op, Constant *C, Type *DestTy) const =0
llvm::IRBuilderBase::CreateAnd
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1358
llvm::IRBuilderBase::getDoubleTy
Type * getDoubleTy()
Fetch the type representing a 64-bit floating point value.
Definition: IRBuilder.h:551
llvm::IRBuilderBase::CreateURem
Value * CreateURem(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1287
llvm::IRBuilderBase::CreatePointerCast
Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2159
llvm::Instruction::getMetadata
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
Definition: Instruction.h:282
llvm::IRBuilderFolder::CreateZExtOrBitCast
virtual Value * CreateZExtOrBitCast(Constant *C, Type *DestTy) const =0
llvm::IRBuilderBase::CreateFPToUI
Value * CreateFPToUI(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2059
llvm::maxnum
LLVM_READONLY APFloat maxnum(const APFloat &A, const APFloat &B)
Implements IEEE maxNum semantics.
Definition: APFloat.h:1309
llvm::IRBuilderBase::CreateLifetimeStart
CallInst * CreateLifetimeStart(Value *Ptr, ConstantInt *Size=nullptr)
Create a lifetime.start intrinsic.
Definition: IRBuilder.cpp:424
llvm::IRBuilderFolder::CreateFPCast
virtual Value * CreateFPCast(Constant *C, Type *DestTy) const =0
llvm::CmpInst::FCMP_FALSE
@ FCMP_FALSE
0 0 0 0 Always false (always folded)
Definition: InstrTypes.h:722
llvm::IRBuilderBase::CreateLaunderInvariantGroup
Value * CreateLaunderInvariantGroup(Value *Ptr)
Create a launder.invariant.group intrinsic call.
Definition: IRBuilder.cpp:1005
llvm::InvokeInst
Invoke instruction.
Definition: Instructions.h:3713
llvm::IRBuilderBase::CreateAShr
Value * CreateAShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1353
llvm::IRBuilderBase::CreateAggregateRet
ReturnInst * CreateAggregateRet(Value *const *retVals, unsigned N)
Create a sequence of N insertvalue instructions, with one Value from the retVals array each,...
Definition: IRBuilder.h:977
llvm::IRBuilderFolder::CreateShl
virtual Value * CreateShl(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const =0
llvm::IRBuilderFolder::CreateAdd
virtual Value * CreateAdd(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const =0
llvm::IRBuilderBase::CreateZExt
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2021
llvm::IRBuilderBase::getDefaultConstrainedRounding
RoundingMode getDefaultConstrainedRounding()
Get the rounding mode handling used with constrained floating point.
Definition: IRBuilder.h:340
llvm::IRBuilderBase::CreateCatchPad
CatchPadInst * CreateCatchPad(Value *ParentPad, ArrayRef< Value * > Args, const Twine &Name="")
Definition: IRBuilder.h:1119
llvm::IRBuilderBase::FastMathFlagGuard
Definition: IRBuilder.h:389
llvm::AtomicOrdering
AtomicOrdering
Atomic ordering for LLVM's memory model.
Definition: AtomicOrdering.h:56
llvm::IRBuilderBase::CreateFAdd
Value * CreateFAdd(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Definition: IRBuilder.h:1423
llvm::IRBuilderBase::OperandBundlesGuard::OperandBundlesGuard
OperandBundlesGuard(IRBuilderBase &B)
Definition: IRBuilder.h:423
BasicBlock.h
llvm::IRBuilderBase::CreateFCmpOGE
Value * CreateFCmpOGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2277
llvm::IRBuilderBase::CreateFDiv
Value * CreateFDiv(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Definition: IRBuilder.h:1498
llvm::IRBuilderBase::getDefaultFPMathTag
MDNode * getDefaultFPMathTag() const
Get the floating point math metadata being used.
Definition: IRBuilder.h:291
llvm::IRBuilderBase::CreateNUWAdd
Value * CreateNUWAdd(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1221
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name=""), "Use the version with explicit element type instead")
Definition: IRBuilder.h:1848
llvm::CleanupPadInst
Definition: Instructions.h:4398
llvm::IRBuilderBase::CreateBitCast
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2113
llvm::PPC::Predicate
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
Definition: PPCPredicates.h:26
llvm::StoreInst
An instruction for storing to memory.
Definition: Instructions.h:304
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::IRBuilderBase::CreateFAddFMF
Value * CreateFAddFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
Definition: IRBuilder.h:1436
llvm::IRBuilderBase::GetInsertPoint
BasicBlock::iterator GetInsertPoint() const
Definition: IRBuilder.h:179
llvm::IRBuilderFolder::CreateTruncOrBitCast
virtual Value * CreateTruncOrBitCast(Constant *C, Type *DestTy) const =0
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name=""), "Use the version with explicit element type instead")
Definition: IRBuilder.h:1990
llvm::IRBuilderBase::CreateMaximum
CallInst * CreateMaximum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the maximum intrinsic.
Definition: IRBuilder.h:907
llvm::IRBuilderBase::CreateICmp
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2337
llvm::IRBuilderBase::getIntPtrTy
IntegerType * getIntPtrTy(const DataLayout &DL, unsigned AddrSpace=0)
Fetch the type representing a pointer to an integer value.
Definition: IRBuilder.h:566
llvm::ICmpInst
This instruction compares its operands according to the predicate given to the constructor.
Definition: Instructions.h:1203
llvm::ResumeInst::Create
static ResumeInst * Create(Value *Exn, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:4176
llvm::IRBuilderBase::CreatePreserveArrayAccessIndex
Value * CreatePreserveArrayAccessIndex(Type *ElTy, Value *Base, unsigned Dimension, unsigned LastIndex, MDNode *DbgInfo)
Definition: IRBuilder.cpp:1143
llvm::IRBuilderBase::CreateOr
Value * CreateOr(Value *LHS, uint64_t RHS, const Twine &Name="")
Definition: IRBuilder.h:1398
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::ExtractValueInst::Create
static ExtractValueInst * Create(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:2370
llvm::IRBuilderFolder::CreateICmp
virtual Value * CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const =0
llvm::CatchReturnInst
Definition: Instructions.h:4490
llvm::IRBuilderBase::CreateNeg
Value * CreateNeg(Value *V, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1576
llvm::IRBuilderBase::CreateCall
CallInst * CreateCall(FunctionCallee Callee, ArrayRef< Value * > Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2413
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
llvm::IRBuilderBase::CreateResume
ResumeInst * CreateResume(Value *Exn)
Definition: IRBuilder.h:1103
llvm::IRBuilderBase::CreateConstGEP2_32
Value * CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
Definition: IRBuilder.h:1877
llvm::IRBuilderBase::setDefaultOperandBundles
void setDefaultOperandBundles(ArrayRef< OperandBundleDef > OpBundles)
Definition: IRBuilder.h:357
llvm::IRBuilderBase::getInt32
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
Definition: IRBuilder.h:478
llvm::CallBrInst
CallBr instruction, tracking function calls that may not return control but instead transfer it to a ...
Definition: Instructions.h:3922
llvm::IRBuilderBase::CreateSDiv
Value * CreateSDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1273
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::IRBuilderBase::CreateNSWSub
Value * CreateNSWSub(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1234
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::BranchInst::Create
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:3088
llvm::SyncScope::ID
uint8_t ID
Definition: LLVMContext.h:47
llvm::IRBuilderBase::CreateCatchRet
CatchReturnInst * CreateCatchRet(CatchPadInst *CatchPad, BasicBlock *BB)
Definition: IRBuilder.h:1130
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateShuffleVector(Value *V1, Value *V2, ArrayRef< uint32_t > Mask, const Twine &Name=""), "Pass indices as 'int' instead")
Definition: IRBuilder.h:2472
llvm::IRBuilderBase::CreateMinimum
CallInst * CreateMinimum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the minimum intrinsic.
Definition: IRBuilder.h:902
llvm::IRBuilderBase::getInt8PtrTy
PointerType * getInt8PtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer to an 8-bit integer value.
Definition: IRBuilder.h:561
llvm::IRBuilderBase::setDefaultConstrainedExcept
void setDefaultConstrainedExcept(fp::ExceptionBehavior NewExcept)
Set the exception handling to be used with constrained floating point.
Definition: IRBuilder.h:317
llvm::IRBuilderBase::CreateIsNotNull
Value * CreateIsNotNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is not null.
Definition: IRBuilder.h:2534
llvm::IRBuilderBase::Context
LLVMContext & Context
Definition: IRBuilder.h:122
llvm::IRBuilderBase::CreateSelect
Value * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="", Instruction *MDFrom=nullptr)
Definition: IRBuilder.cpp:974
llvm::IRBuilderBase::CreateFPMinReduce
CallInst * CreateFPMinReduce(Value *Src)
Create a vector float min reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:420
llvm::IRBuilderBase::CreateFPCast
Value * CreateFPCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2203
llvm::IRBuilderBase::CreateIntMinReduce
CallInst * CreateIntMinReduce(Value *Src, bool IsSigned=false)
Create a vector integer min reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:410
llvm::IRBuilderCallbackInserter::InsertHelper
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const override
Definition: IRBuilder.h:86
llvm::PointerType
Class to represent pointers.
Definition: DerivedTypes.h:631
ArrayRef.h
llvm::IRBuilderBase::CreateConstrainedFPCmp
CallInst * CreateConstrainedFPCmp(Intrinsic::ID ID, CmpInst::Predicate P, Value *L, Value *R, const Twine &Name="", Optional< fp::ExceptionBehavior > Except=None)
Definition: IRBuilder.cpp:936
llvm::IRBuilderBase::CreateUnreachable
UnreachableInst * CreateUnreachable()
Definition: IRBuilder.h:1134
llvm::IRBuilderBase::CreateAdd
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1208
llvm::IRBuilderFolder::CreateLShr
virtual Value * CreateLShr(Constant *LHS, Constant *RHS, bool isExact=false) const =0
llvm::IRBuilderBase::saveAndClearIP
InsertPoint saveAndClearIP()
Returns the current insert point, clearing it in the process.
Definition: IRBuilder.h:276
llvm::MDString::get
static MDString * get(LLVMContext &Context, StringRef Str)
Definition: Metadata.cpp:473
llvm::GetElementPtrInst::CreateInBounds
static GetElementPtrInst * CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Create an "inbounds" getelementptr.
Definition: Instructions.h:990
llvm::IRBuilderFolder::CreateNeg
virtual Value * CreateNeg(Constant *C, bool HasNUW=false, bool HasNSW=false) const =0
llvm::IRBuilderBase::getInt
ConstantInt * getInt(const APInt &AI)
Get a constant integer value.
Definition: IRBuilder.h:494
maximum
Should compile r2 movcc movcs str strb mov lr r1 movcs movcc mov lr r1 str mov mov cmp r1 movlo r2 str bx lr r0 mov mov cmp r0 movhs r2 mov r1 bx lr Some of the NEON intrinsics may be appropriate for more general either as target independent intrinsics or perhaps elsewhere in the ARM backend Some of them may also be lowered to target independent and perhaps some new SDNodes could be added For maximum
Definition: README.txt:489
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::IRBuilderBase::SetInsertPoint
void SetInsertPoint(Instruction *I)
This specifies that created instructions should be inserted before the specified instruction.
Definition: IRBuilder.h:191
llvm::IRBuilderBase::CreateFMulReduce
CallInst * CreateFMulReduce(Value *Acc, Value *Src)
Create a vector fmul reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:376
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:1605
llvm::IRBuilderBase::CreateMemCpy
CallInst * CreateMemCpy(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Definition: IRBuilder.h:639
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateAlignedLoad(Value *Ptr, MaybeAlign Align, const Twine &Name=""), "Use the version that explicitly specifies the " "loaded type instead")
Definition: IRBuilder.h:1728
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateAlignedLoad(Value *Ptr, MaybeAlign Align, bool isVolatile, const Twine &Name=""), "Use the version that explicitly specifies the " "loaded type instead")
Definition: IRBuilder.h:1737
memcpy
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
llvm::CmpInst::FCMP_OGE
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
Definition: InstrTypes.h:725
llvm::IRBuilderBase::CreateSIToFP
Value * CreateSIToFP(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2080
llvm::IRBuilderBase::CreateFence
FenceInst * CreateFence(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System, const Twine &Name="")
Definition: IRBuilder.h:1755
llvm::CmpInst::ICMP_UGE
@ ICMP_UGE
unsigned greater or equal
Definition: InstrTypes.h:744
llvm::IRBuilderBase::CreateExtractElement
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
Definition: IRBuilder.h:2438
llvm::IRBuilderBase::CreateFNegFMF
Value * CreateFNegFMF(Value *V, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
Definition: IRBuilder.h:1604
llvm::IRBuilderBase::CreateGCResult
CallInst * CreateGCResult(Instruction *Statepoint, Type *ResultType, const Twine &Name="")
Create a call to the experimental.gc.result intrinsic to extract the result from a call wrapped in a ...
Definition: IRBuilder.cpp:777
llvm::IRBuilderBase::CreateLandingPad
LandingPadInst * CreateLandingPad(Type *Ty, unsigned NumClauses, const Twine &Name="")
Definition: IRBuilder.h:2514
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name=""), "Use the version with explicit element type instead")
Definition: IRBuilder.h:1913
llvm::IRBuilderBase::CreateLoad
LoadInst * CreateLoad(Type *Ty, Value *Ptr, bool isVolatile, const Twine &Name="")
Definition: IRBuilder.h:1664
llvm::IRBuilderBase::CreateIntrinsic
CallInst * CreateIntrinsic(Intrinsic::ID ID, ArrayRef< Type * > Types, ArrayRef< Value * > Args, Instruction *FMFSource=nullptr, const Twine &Name="")
Create a call to intrinsic ID with args, mangled using Types.
Definition: IRBuilder.cpp:840
llvm::IRBuilderBase::CreateAndReduce
CallInst * CreateAndReduce(Value *Src)
Create a vector int AND reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:392
llvm::IRBuilderBase::getTrue
ConstantInt * getTrue()
Get the constant value for i1 true.
Definition: IRBuilder.h:458
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::MDNode
Metadata node.
Definition: Metadata.h:897
llvm::IRBuilderCallbackInserter
Provides an 'InsertHelper' that calls a user-provided callback after performing the default insertion...
Definition: IRBuilder.h:77
llvm::IRBuilderBase::CreateICmpSLE
Value * CreateICmpSLE(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2263
llvm::IRBuilderBase::InsertPoint::InsertPoint
InsertPoint()=default
Creates a new insertion point which doesn't point to anything.
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(Value *CreateGEP(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name=""), "Use the version with explicit element type instead")
Definition: IRBuilder.h:1787
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:70
llvm::IRBuilderBase::CreateAnd
Value * CreateAnd(ArrayRef< Value * > Ops)
Definition: IRBuilder.h:1376
llvm::IRBuilderBase::CreateNoAliasScopeDeclaration
Instruction * CreateNoAliasScopeDeclaration(Value *Scope)
Create a llvm.experimental.noalias.scope.decl intrinsic call.
Definition: IRBuilder.cpp:488
llvm::CmpInst::ICMP_SLT
@ ICMP_SLT
signed less than
Definition: InstrTypes.h:749
llvm::GetElementPtrInst::Create
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:954
llvm::IRBuilderBase::CreatePHI
PHINode * CreatePHI(Type *Ty, unsigned NumReservedValues, const Twine &Name="")
Definition: IRBuilder.h:2383
llvm::IRBuilderBase::CreateICmpSLT
Value * CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2259
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::Instruction::getFastMathFlags
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags, which must be an operator which supports th...
Definition: Instruction.cpp:280
llvm::BinaryOperator
Definition: InstrTypes.h:189
llvm::IRBuilderBase::IsFPConstrained
bool IsFPConstrained
Definition: IRBuilder.h:129
None.h
DataLayout.h
Cond
SmallVector< MachineOperand, 4 > Cond
Definition: BasicBlockSections.cpp:179
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::IRBuilderBase::setDefaultConstrainedRounding
void setDefaultConstrainedRounding(RoundingMode NewRounding)
Set the rounding mode handling to be used with constrained floating point.
Definition: IRBuilder.h:326
llvm::CmpInst::ICMP_ULT
@ ICMP_ULT
unsigned less than
Definition: InstrTypes.h:745
llvm::IRBuilderBase::CreateSRem
Value * CreateSRem(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1292
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:256
llvm::IRBuilderBase::CreateICmpEQ
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2227
llvm::IRBuilderBase::CreateGCGetPointerOffset
CallInst * CreateGCGetPointerOffset(Value *DerivedPtr, const Twine &Name="")
Create a call to the experimental.gc.get.pointer.offset intrinsic to get the offset of the specified ...
Definition: IRBuilder.cpp:814
llvm::IRBuilderBase::getFastMathFlags
FastMathFlags getFastMathFlags() const
Get the flags to be applied to created floating point ops.
Definition: IRBuilder.h:294
llvm::RoundingMode::Dynamic
@ Dynamic
Denotes mode unknown at compile time.
uint32_t
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr, bool isVolatile, const Twine &Name=""), "Use the version that explicitly specifies the " "loaded type instead")
Definition: IRBuilder.h:1686
llvm::IRBuilderBase::InsertPointGuard
Definition: IRBuilder.h:367
llvm::IRBuilderBase
Common base class shared among various IRBuilders.
Definition: IRBuilder.h:95
llvm::IRBuilderFolder::CreatePointerCast
virtual Value * CreatePointerCast(Constant *C, Type *DestTy) const =0
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::CleanupPadInst::Create
static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value * > Args=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:4412
llvm::IRBuilderFolder::CreateSExtOrBitCast
virtual Value * CreateSExtOrBitCast(Constant *C, Type *DestTy) const =0
llvm::Type::isPtrOrPtrVectorTy
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Definition: Type.h:234
llvm::IRBuilderBase::getFloatTy
Type * getFloatTy()
Fetch the type representing a 32-bit floating point value.
Definition: IRBuilder.h:546
llvm::IRBuilderBase::CreateMaskedScatter
CallInst * CreateMaskedScatter(Value *Val, Value *Ptrs, Align Alignment, Value *Mask=nullptr)
Create a call to Masked Scatter intrinsic.
Definition: IRBuilder.cpp:594
llvm::IRBuilderBase::CreateICmpUGE
Value * CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2239
llvm::AMDGPU::HSAMD::Kernel::Arg::Key::IsVolatile
constexpr char IsVolatile[]
Key for Kernel::Arg::Metadata::mIsVolatile.
Definition: AMDGPUMetadata.h:194
llvm::IRBuilderBase::CreateCondBr
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
Definition: IRBuilder.h:991
llvm::IRBuilderBase::CreateFDivFMF
Value * CreateFDivFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
Definition: IRBuilder.h:1511
llvm::LoadInst
An instruction for reading from memory.
Definition: Instructions.h:175
ValueHandle.h
llvm::Type::getInt128Ty
static IntegerType * getInt128Ty(LLVMContext &C)
Definition: Type.cpp:205
llvm::IRBuilderBase::CreateConstGEP1_32
Value * CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
Definition: IRBuilder.h:1857
llvm::AtomicRMWInst
an instruction that atomically reads a memory location, combines it with another value,...
Definition: Instructions.h:726
llvm::IRBuilderBase::CreateGEP
Value * CreateGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Definition: IRBuilder.h:1795
llvm::ConstantInt::getFalse
static ConstantInt * getFalse(LLVMContext &Context)
Definition: Constants.cpp:854
llvm::IRBuilderBase::BB
BasicBlock * BB
Definition: IRBuilder.h:120
llvm::IRBuilderBase::CreateTrunc
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2017
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr, const char *Name), "Use the version that explicitly specifies the " "loaded type instead")
Definition: IRBuilder.h:1670
llvm::RoundingModeToStr
Optional< StringRef > RoundingModeToStr(RoundingMode)
For any RoundingMode enumerator, returns a string valid as input in constrained intrinsic rounding mo...
Definition: FPEnv.cpp:33
llvm::IRBuilderBase::CreateAddReduce
CallInst * CreateAddReduce(Value *Src)
Create a vector int add reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:384
llvm::IRBuilderBase::CreateCleanupRet
CleanupReturnInst * CreateCleanupRet(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB=nullptr)
Definition: IRBuilder.h:1107
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:206
llvm::IRBuilderBase::CreateFCmpONE
Value * CreateFCmpONE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2292
llvm::FastMathFlags::clear
void clear()
Definition: Operator.h:202
llvm::IRBuilderBase::CreateFCmpOLE
Value * CreateFCmpOLE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2287
llvm::IRBuilderBase::CreatePointerBitCastOrAddrSpaceCast
Value * CreatePointerBitCastOrAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2168
llvm::IRBuilderBase::DefaultOperandBundles
ArrayRef< OperandBundleDef > DefaultOperandBundles
Definition: IRBuilder.h:133
llvm::CmpInst::FCMP_UGT
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
Definition: InstrTypes.h:732
llvm::IRBuilderFolder::CreateUDiv
virtual Value * CreateUDiv(Constant *LHS, Constant *RHS, bool isExact=false) const =0
Constant.h
llvm::NVPTX::PTXLdStInstCode::V2
@ V2
Definition: NVPTX.h:123
llvm::IRBuilderFolder::CreateNot
virtual Value * CreateNot(Constant *C) const =0
llvm::ResumeInst
Resume the propagation of an exception.
Definition: Instructions.h:4163
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::minnum
LLVM_READONLY APFloat minnum(const APFloat &A, const APFloat &B)
Implements IEEE minNum semantics.
Definition: APFloat.h:1298
llvm::IRBuilderBase::getFalse
ConstantInt * getFalse()
Get the constant value for i1 false.
Definition: IRBuilder.h:463
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:204
llvm::IRBuilderFolder::CreateFNeg
virtual Value * CreateFNeg(Constant *C) const =0
llvm::IRBuilderBase::CreateBitOrPointerCast
Value * CreateBitOrPointerCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2191
llvm::ConstantInt::getTrue
static ConstantInt * getTrue(LLVMContext &Context)
Definition: Constants.cpp:847
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
std
Definition: BitVector.h:838
llvm::IRBuilderBase::OperandBundlesGuard::~OperandBundlesGuard
~OperandBundlesGuard()
Definition: IRBuilder.h:429
llvm::Constant::getNullValue
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
Definition: Constants.cpp:346
llvm::Type::getIntNTy
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
Definition: Type.cpp:207
llvm::IRBuilderBase::CreateIsNull
Value * CreateIsNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is null.
Definition: IRBuilder.h:2528
uint16_t
llvm::Type::getHalfTy
static Type * getHalfTy(LLVMContext &C)
Definition: Type.cpp:188
llvm::IRBuilderBase::CreateFreeze
Value * CreateFreeze(Value *V, const Twine &Name="")
Definition: IRBuilder.h:2519
NC
#define NC
Definition: regutils.h:42
llvm::MetadataAsValue::get
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition: Metadata.cpp:106
llvm::SmallVectorImpl::assign
void assign(size_type NumElts, ValueParamT Elt)
Definition: SmallVector.h:669
llvm::IRBuilderBase::CreateMemCpy
CallInst * CreateMemCpy(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, uint64_t Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memcpy between the specified pointers.
Definition: IRBuilder.h:622
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:314
llvm::IRBuilderBase::CreateFCmpOLT
Value * CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2282
llvm::PHINode::Create
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
Definition: Instructions.h:2639
llvm::IRBuilderBase::CreateICmpULT
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2243
llvm::IRBuilderBase::Insert
InstTy * Insert(InstTy *I, const Twine &Name="") const
Insert and return the specified instruction.
Definition: IRBuilder.h:149
llvm::Type::isIntOrIntVectorTy
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition: Type.h:207
llvm::IRBuilderFolder::CreateShuffleVector
virtual Value * CreateShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask) const =0
GlobalVariable.h
llvm::IRBuilderBase::getInt64
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
Definition: IRBuilder.h:483
llvm::IRBuilderBase::GetInsertBlock
BasicBlock * GetInsertBlock() const
Definition: IRBuilder.h:178
Casting.h
llvm::IRBuilderBase::CreateSExtOrTrunc
Value * CreateSExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a SExt or Trunc from the integer value V to DestTy.
Definition: IRBuilder.h:2046
Function.h
llvm::IRBuilderBase::CreateFPTrunc
Value * CreateFPTrunc(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2087
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::IRBuilderBase::getInt128Ty
IntegerType * getInt128Ty()
Fetch the type representing a 128-bit integer.
Definition: IRBuilder.h:528
llvm::IRBuilderBase::getFastMathFlags
FastMathFlags & getFastMathFlags()
Definition: IRBuilder.h:296
llvm::ReturnInst::Create
static ReturnInst * Create(LLVMContext &C, Value *retVal=nullptr, Instruction *InsertBefore=nullptr)
Definition: Instructions.h:2977
llvm::IRBuilderFolder::CreateBinOp
virtual Value * CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const =0
llvm::IRBuilderBase::CreateLoad
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const Twine &Name="")
Definition: IRBuilder.h:1660
llvm::IRBuilderFolder::CreateInBoundsGetElementPtr
virtual Value * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList) const =0
llvm::IRBuilderBase::DefaultConstrainedExcept
fp::ExceptionBehavior DefaultConstrainedExcept
Definition: IRBuilder.h:130
llvm::IRBuilderBase::CreateFAddReduce
CallInst * CreateFAddReduce(Value *Acc, Value *Src)
Create a vector fadd reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:368
llvm::CmpInst::ICMP_SGE
@ ICMP_SGE
signed greater or equal
Definition: InstrTypes.h:748
llvm::MCID::Add
@ Add
Definition: MCInstrDesc.h:183
llvm::IRBuilderBase::getHalfTy
Type * getHalfTy()
Fetch the type representing a 16-bit floating point value.
Definition: IRBuilder.h:536
llvm::Type::getBFloatTy
static Type * getBFloatTy(LLVMContext &C)
Definition: Type.cpp:189
llvm::CleanupReturnInst
Definition: Instructions.h:4571
llvm::IRBuilderBase::CreateNUWMul
Value * CreateNUWMul(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1255
llvm::IndirectBrInst
Indirect Branch Instruction.
Definition: Instructions.h:3578
llvm::IRBuilderBase::InsertPt
BasicBlock::iterator InsertPt
Definition: IRBuilder.h:121
llvm::IRBuilderFolder::CreateExtractElement
virtual Value * CreateExtractElement(Constant *Vec, Constant *Idx) const =0
llvm::makeArrayRef
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:476
llvm::IRBuilderBase::getCurrentDebugLocation
DebugLoc getCurrentDebugLocation() const
Get location information used by debugging information.
Definition: IRBuilder.h:222
llvm::IRBuilderBase::InsertPointGuard::InsertPointGuard
InsertPointGuard(IRBuilderBase &B)
Definition: IRBuilder.h:374
llvm::IRBuilderBase::CreateMinNum
CallInst * CreateMinNum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the minnum intrinsic.
Definition: IRBuilder.h:892
llvm::CatchPadInst
Definition: Instructions.h:4439
llvm::IRBuilderBase::saveIP
InsertPoint saveIP() const
Returns the current insert point.
Definition: IRBuilder.h:271
llvm::IRBuilderBase::CreateShl
Value * CreateShl(Value *LHS, const APInt &RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1306
llvm::IRBuilderBase::CreateExtractInteger
Value * CreateExtractInteger(const DataLayout &DL, Value *From, IntegerType *ExtractedTy, uint64_t Offset, const Twine &Name)
Return a value that has been extracted from a larger integer type.
Definition: IRBuilder.cpp:1120
llvm::AttributeList::FunctionIndex
@ FunctionIndex
Definition: Attributes.h:402
llvm::Instruction::BinaryOps
BinaryOps
Definition: Instruction.h:787
llvm::Type::getVoidTy
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:186
llvm::IRBuilderBase::getInt1Ty
IntegerType * getInt1Ty()
Fetch the type representing a single bit.
Definition: IRBuilder.h:503
llvm::IRBuilderBase::InsertPoint
InsertPoint - A saved insertion point.
Definition: IRBuilder.h:251
llvm::IRBuilderBase::CreateSExt
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2025
llvm::ShuffleVectorInst::getShuffleMask
ArrayRef< int > getShuffleMask() const
Definition: Instructions.h:2082
llvm::ShuffleVectorInst
This instruction constructs a fixed permutation of two input vectors.
Definition: Instructions.h:2011
llvm::UnaryOperator::Create
static UnaryOperator * Create(UnaryOps Op, Value *S, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a unary instruction, given the opcode and an operand.
Definition: Instructions.cpp:2435
Instructions.h
llvm::IRBuilderBase::CreateMemMove
CallInst * CreateMemMove(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, uint64_t Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Definition: IRBuilder.h:670
llvm::IRBuilderBase::getInt16
ConstantInt * getInt16(uint16_t C)
Get a constant 16-bit value.
Definition: IRBuilder.h:473
llvm::IRBuilderBase::CreateCallBr
CallBrInst * CreateCallBr(FunctionCallee Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
Definition: IRBuilder.h:1094
llvm::IRBuilderBase::InsertPoint::getPoint
BasicBlock::iterator getPoint() const
Definition: IRBuilder.h:267
llvm::IRBuilderBase::CreateExtractElement
Value * CreateExtractElement(Value *Vec, uint64_t Idx, const Twine &Name="")
Definition: IRBuilder.h:2446
llvm::IRBuilderBase::CollectMetadataToCopy
void CollectMetadataToCopy(Instruction *Src, ArrayRef< unsigned > MetadataKinds)
Collect metadata with IDs MetadataKinds from Src which should be added to all created instructions.
Definition: IRBuilder.h:215
llvm::IRBuilderBase::CreateOr
Value * CreateOr(Value *LHS, const APInt &RHS, const Twine &Name="")
Definition: IRBuilder.h:1394
llvm::IRBuilderBase::CreateLShr
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1318
llvm::CmpInst::ICMP_UGT
@ ICMP_UGT
unsigned greater than
Definition: InstrTypes.h:743
llvm::IRBuilderBase::CreateAtomicRMW
AtomicRMWInst * CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, MaybeAlign Align, AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Definition: IRBuilder.h:1775
List
const NodeList & List
Definition: RDFGraph.cpp:201
llvm::fp::ExceptionBehavior
ExceptionBehavior
Exception behavior used for floating point operations.
Definition: FPEnv.h:31
llvm::CmpInst::FCMP_UNE
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
Definition: InstrTypes.h:736
llvm::Type::getPointerElementType
Type * getPointerElementType() const
Definition: Type.h:380
llvm::IRBuilderBase::CreateFCmpUNO
Value * CreateFCmpUNO(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2302
llvm::IRBuilderBase::CreateMaskedStore
CallInst * CreateMaskedStore(Value *Val, Value *Ptr, Align Alignment, Value *Mask)
Create a call to Masked Store intrinsic.
Definition: IRBuilder.cpp:525
llvm::FreezeInst
This class represents a freeze function that returns random concrete value if an operand is either a ...
Definition: Instructions.h:5324
llvm::IRBuilderFolder::CreateSub
virtual Value * CreateSub(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const =0
N
#define N
llvm::AssertingVH
Value handle that asserts if the Value is deleted.
Definition: ValueHandle.h:260
llvm::IRBuilderFolder::CreateInsertValue
virtual Value * CreateInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > IdxList) const =0
llvm::IRBuilderCallbackInserter::IRBuilderCallbackInserter
IRBuilderCallbackInserter(std::function< void(Instruction *)> Callback)
Definition: IRBuilder.h:83
llvm::IRBuilderBase::CreateShl
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1297
llvm::IRBuilderBase::IRBuilderBase
IRBuilderBase(LLVMContext &context, const IRBuilderFolder &Folder, const IRBuilderDefaultInserter &Inserter, MDNode *FPMathTag, ArrayRef< OperandBundleDef > OpBundles)
Definition: IRBuilder.h:136
llvm::IRBuilderBase::LLVM_ATTRIBUTE_DEPRECATED
LLVM_ATTRIBUTE_DEPRECATED(LoadInst *CreateLoad(Value *Ptr, const Twine &Name=""), "Use the version that explicitly specifies the " "loaded type instead")
Definition: IRBuilder.h:1678
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:165
llvm::IRBuilderBase::CreateRetVoid
ReturnInst * CreateRetVoid()
Create a 'ret void' instruction.
Definition: IRBuilder.h:961
llvm::IRBuilderBase::CreateCallBr
CallBrInst * CreateCallBr(FunctionType *Ty, Value *Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
Definition: IRBuilder.h:1076
llvm::IRBuilderCallbackInserter::~IRBuilderCallbackInserter
virtual ~IRBuilderCallbackInserter()
Definition: IRBuilder.cpp:1257
llvm::IRBuilderDefaultInserter::InsertHelper
virtual void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const
Definition: IRBuilder.h:67
llvm::FunctionCallee
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Definition: DerivedTypes.h:164
llvm::IRBuilderBase::CreateFCmpUEQ
Value * CreateFCmpUEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2307
llvm::IRBuilderBase::CreateGCRelocate
CallInst * CreateGCRelocate(Instruction *Statepoint, int BaseOffset, int DerivedOffset, Type *ResultType, const Twine &Name="")
Create a call to the experimental.gc.relocate intrinsics to project the relocated value of one pointe...
Definition: IRBuilder.cpp:789
llvm::PHINode
Definition: Instructions.h:2597
llvm::IRBuilderBase::getInt8
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
Definition: IRBuilder.h:468
llvm::IRBuilderBase::CreateCallBr
CallBrInst * CreateCallBr(FunctionType *Ty, Value *Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args=None, const Twine &Name="")
Create a callbr instruction.
Definition: IRBuilder.h:1068
llvm::IRBuilderBase::CreateZExtOrTrunc
Value * CreateZExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a ZExt or Trunc from the integer value V to DestTy.
Definition: IRBuilder.h:2031
llvm::CmpInst::FCMP_OLE
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
Definition: InstrTypes.h:727
llvm::IRBuilderBase::CreateFCmpUGT
Value * CreateFCmpUGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2312
llvm::IRBuilderBase::CreateCleanupPad
CleanupPadInst * CreateCleanupPad(Value *ParentPad, ArrayRef< Value * > Args=None, const Twine &Name="")
Definition: IRBuilder.h:1124
llvm::IRBuilderBase::CreateFCmpS
Value * CreateFCmpS(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2363
llvm::IRBuilderBase::CreateNot
Value * CreateNot(Value *V, const Twine &Name="")
Definition: IRBuilder.h:1613
llvm::IRBuilderBase::CreateFRemFMF
Value * CreateFRemFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
Definition: IRBuilder.h:1536
llvm::Type::getInt16Ty
static IntegerType * getInt16Ty(LLVMContext &C)
Definition: Type.cpp:202
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1161
llvm::IRBuilderBase::CreateVectorSplat
Value * CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name="")
Return a vector value that contains.
Definition: IRBuilder.cpp:1098
llvm::IRBuilderBase::CreateStepVector
Value * CreateStepVector(Type *DstType, const Twine &Name="")
Creates a vector of type DstType with the linear sequence <0, 1, ...>
Definition: IRBuilder.cpp:96
llvm::Module::getDataLayout
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.cpp:401
DerivedTypes.h
llvm::IRBuilderBase::SetInsertPoint
void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP)
This specifies that created instructions should be inserted at the specified point.
Definition: IRBuilder.h:200
llvm::IRBuilderBase::CreateConstGEP2_64
Value * CreateConstGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
Definition: IRBuilder.h:1941
llvm::GlobalValue::getValueType
Type * getValueType() const
Definition: GlobalValue.h:273
llvm::IRBuilderBase::CreateNSWNeg
Value * CreateNSWNeg(Value *V, const Twine &Name="")
Definition: IRBuilder.h:1586
llvm::IRBuilderBase::CreateSwitch
SwitchInst * CreateSwitch(Value *V, BasicBlock *Dest, unsigned NumCases=10, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a switch instruction with the specified value, default dest, and with a hint for the number of...
Definition: IRBuilder.h:1014
llvm::IRBuilderBase::CreateFRem
Value * CreateFRem(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Definition: IRBuilder.h:1523
llvm::CallInst
This class represents a function call, abstracting a target machine's calling convention.
Definition: Instructions.h:1475
llvm::IRBuilderFolder::CreateUnOp
virtual Value * CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const =0
llvm::IRBuilderFolder::CreateExtractValue
virtual Value * CreateExtractValue(Constant *Agg, ArrayRef< unsigned > IdxList) const =0
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::IRBuilderBase::CreateICmpUGT
Value * CreateICmpUGT(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2235
llvm::IRBuilderBase::getVoidTy
Type * getVoidTy()
Fetch the type representing void.
Definition: IRBuilder.h:556
llvm::IRBuilderBase::CreateUDiv
Value * CreateUDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1259
llvm::UnreachableInst
This function has undefined behavior.
Definition: Instructions.h:4679
llvm::IRBuilderBase::CreateNoAliasScopeDeclaration
Instruction * CreateNoAliasScopeDeclaration(MDNode *ScopeTag)
Definition: IRBuilder.h:781
llvm::IRBuilderBase::CreateICmpNE
Value * CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2231
llvm::CastInst::CreatePointerCast
static CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
Definition: Instructions.cpp:3058
llvm::fp::ebStrict
@ ebStrict
This corresponds to "fpexcept.strict".
Definition: FPEnv.h:34
LLVMContext.h
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::IRBuilderBase::CreateSub
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1225
llvm::SwitchInst
Multiway switch.
Definition: Instructions.h:3176
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::IRBuilderBase::CreateSExtOrBitCast
Value * CreateSExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:2132
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::AllocaInst
an instruction to allocate memory on the stack
Definition: Instructions.h:62
llvm::IRBuilder::IRBuilder
IRBuilder(Instruction *IP, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Definition: IRBuilder.h:2674
llvm::CastInst::CreateZExtOrBitCast
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt or BitCast cast instruction.
Definition: Instructions.cpp:3010
llvm::IRBuilderBase::CreateFCmpORD
Value * CreateFCmpORD(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2297
llvm::BranchInst
Conditional or Unconditional Branch instruction.
Definition: Instructions.h:3032
llvm::IRBuilderBase::CreateVAArg
VAArgInst * CreateVAArg(Value *List, Type *Ty, const Twine &Name="")
Definition: IRBuilder.h:2434
llvm::AMDGPU::VGPRIndexMode::Id
Id
Definition: SIDefines.h:221
llvm::IRBuilderBase::getCurrentFunctionReturnType
Type * getCurrentFunctionReturnType() const
Get the return type of the current function that we're emitting into.
Definition: IRBuilder.cpp:58
llvm::BinaryOperator::Create
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
Definition: Instructions.cpp:2564
llvm::IRBuilderBase::CreateFCmpOGT
Value * CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2272
llvm::CmpInst::FCMP_TRUE
@ FCMP_TRUE
1 1 1 1 Always true (always folded)
Definition: InstrTypes.h:737
llvm::IRBuilderBase::CreateExtractVector
CallInst * CreateExtractVector(Type *DstType, Value *SrcVec, Value *Idx, const Twine &Name="")
Create a call to the experimental.vector.extract intrinsic.
Definition: IRBuilder.h:919
llvm::IRBuilderBase::CreateAlignmentAssumption
CallInst * CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue, unsigned Alignment, Value *OffsetValue=nullptr)
Create an assume intrinsic call that represents an alignment assumption on the provided pointer.
Definition: IRBuilder.cpp:1234
llvm::CatchPadInst::Create
static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:4453
llvm::IRBuilderBase::CreateICmpULE
Value * CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:2247
Value.h
llvm::CatchSwitchInst
Definition: Instructions.h:4220
llvm::IRBuilderBase::CreateFCmpULT
Value * CreateFCmpULT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2322
llvm::IRBuilderFolder::CreateAnd
virtual Value * CreateAnd(Constant *LHS, Constant *RHS) const =0
llvm::IRBuilderBase::CreateMemCpyInline
CallInst * CreateMemCpyInline(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool IsVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Definition: IRBuilder.cpp:206
llvm::IRBuilderFolder::CreateSDiv
virtual Value * CreateSDiv(Constant *LHS, Constant *RHS, bool isExact=false) const =0
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::AtomicCmpXchgInst
An instruction that atomically checks whether a specified value is in a memory location,...
Definition: Instructions.h:521
llvm::IRBuilderBase::CreateGCStatepointCall
CallInst * CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes, Value *ActualCallee, ArrayRef< Value * > CallArgs, Optional< ArrayRef< Value * >> DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
Create a call to the experimental.gc.statepoint intrinsic to start a new statepoint sequence.
Definition: IRBuilder.cpp:691
llvm::IRBuilderBase::clearFastMathFlags
void clearFastMathFlags()
Clear the fast-math flags.
Definition: IRBuilder.h:299
llvm::IRBuilderBase::CreateAlignedLoad
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, const Twine &Name="")
Definition: IRBuilder.h:1704
llvm::IRBuilderBase::CreateOrReduce
CallInst * CreateOrReduce(Value *Src)
Create a vector int OR reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:396
llvm::Type::getFloatTy
static Type * getFloatTy(LLVMContext &C)
Definition: Type.cpp:190
llvm::IRBuilderBase::CreateCall
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2391
llvm::CmpInst::FCMP_ORD
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
Definition: InstrTypes.h:729
llvm::IRBuilderBase::CreateAnd
Value * CreateAnd(Value *LHS, const APInt &RHS, const Twine &Name="")
Definition: IRBuilder.h:1368
llvm::IRBuilderBase::OperandBundlesGuard
Definition: IRBuilder.h:418
llvm::IRBuilderBase::CreateMaskedLoad
CallInst * CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment, Value *Mask, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Load intrinsic.
Definition: IRBuilder.cpp:504
llvm::IRBuilderFolder::CreateOr
virtual Value * CreateOr(Constant *LHS, Constant *RHS) const =0
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::CmpInst::FCMP_UEQ
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
Definition: InstrTypes.h:731
llvm::IRBuilderBase::CreateNSWMul
Value * CreateNSWMul(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1251
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:102
llvm::IRBuilderBase::DefaultConstrainedRounding
RoundingMode DefaultConstrainedRounding
Definition: IRBuilder.h:131
llvm::IRBuilderBase::Inserter
const IRBuilderDefaultInserter & Inserter
Definition: IRBuilder.h:124
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::IRBuilderBase::InsertPoint::InsertPoint
InsertPoint(BasicBlock *InsertBlock, BasicBlock::iterator InsertPoint)
Creates a new insertion point at the given location.
Definition: IRBuilder.h:260
llvm::AArch64::Rounding
Rounding
Possible values of current rounding mode, which is specified in bits 23:22 of FPCR.
Definition: AArch64ISelLowering.h:469
llvm::ExceptionBehaviorToStr
Optional< StringRef > ExceptionBehaviorToStr(fp::ExceptionBehavior)
For any ExceptionBehavior enumerator, returns a string valid as input in constrained intrinsic except...
Definition: FPEnv.cpp:68
llvm::PoisonValue::get
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Definition: Constants.cpp:1803
llvm::IRBuilderBase::SetInstDebugLocation
void SetInstDebugLocation(Instruction *I) const
If this builder has a current debug location, set it on the specified instruction.
Definition: IRBuilder.h:232