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