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