LLVM  16.0.0git
IRBuilder.cpp
Go to the documentation of this file.
1 //===- IRBuilder.cpp - Builder for LLVM Instrs ----------------------------===//
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 implements 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 #include "llvm/IR/IRBuilder.h"
15 #include "llvm/ADT/ArrayRef.h"
16 #include "llvm/ADT/None.h"
17 #include "llvm/IR/Constant.h"
18 #include "llvm/IR/Constants.h"
20 #include "llvm/IR/DerivedTypes.h"
21 #include "llvm/IR/Function.h"
22 #include "llvm/IR/GlobalValue.h"
23 #include "llvm/IR/GlobalVariable.h"
24 #include "llvm/IR/IntrinsicInst.h"
25 #include "llvm/IR/Intrinsics.h"
26 #include "llvm/IR/LLVMContext.h"
27 #include "llvm/IR/NoFolder.h"
28 #include "llvm/IR/Operator.h"
29 #include "llvm/IR/Statepoint.h"
30 #include "llvm/IR/Type.h"
31 #include "llvm/IR/Value.h"
32 #include "llvm/Support/Casting.h"
33 #include <cassert>
34 #include <cstdint>
35 #include <vector>
36 
37 using namespace llvm;
38 
39 /// CreateGlobalString - Make a new global variable with an initializer that
40 /// has array of i8 type filled in with the nul terminated string value
41 /// specified. If Name is specified, it is the name of the global variable
42 /// created.
44  const Twine &Name,
45  unsigned AddressSpace,
46  Module *M) {
47  Constant *StrConstant = ConstantDataArray::getString(Context, Str);
48  if (!M)
49  M = BB->getParent()->getParent();
50  auto *GV = new GlobalVariable(
51  *M, StrConstant->getType(), true, GlobalValue::PrivateLinkage,
52  StrConstant, Name, nullptr, GlobalVariable::NotThreadLocal, AddressSpace);
53  GV->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
54  GV->setAlignment(Align(1));
55  return GV;
56 }
57 
59  assert(BB && BB->getParent() && "No current function!");
60  return BB->getParent()->getReturnType();
61 }
62 
63 Value *IRBuilderBase::getCastedInt8PtrValue(Value *Ptr) {
64  auto *PT = cast<PointerType>(Ptr->getType());
65  if (PT->isOpaqueOrPointeeTypeMatches(getInt8Ty()))
66  return Ptr;
67 
68  // Otherwise, we need to insert a bitcast.
69  return CreateBitCast(Ptr, getInt8PtrTy(PT->getAddressSpace()));
70 }
71 
73  for (auto &KV : MetadataToCopy)
74  if (KV.first == LLVMContext::MD_dbg)
75  return {cast<DILocation>(KV.second)};
76 
77  return {};
78 }
80  for (const auto &KV : MetadataToCopy)
81  if (KV.first == LLVMContext::MD_dbg) {
82  I->setDebugLoc(DebugLoc(KV.second));
83  return;
84  }
85 }
86 
87 CallInst *
88 IRBuilderBase::createCallHelper(Function *Callee, ArrayRef<Value *> Ops,
89  const Twine &Name, Instruction *FMFSource,
90  ArrayRef<OperandBundleDef> OpBundles) {
91  CallInst *CI = CreateCall(Callee, Ops, OpBundles, Name);
92  if (FMFSource)
93  CI->copyFastMathFlags(FMFSource);
94  return CI;
95 }
96 
98  assert(isa<ConstantInt>(Scaling) && "Expected constant integer");
99  if (cast<ConstantInt>(Scaling)->isZero())
100  return Scaling;
102  Function *TheFn =
103  Intrinsic::getDeclaration(M, Intrinsic::vscale, {Scaling->getType()});
104  CallInst *CI = CreateCall(TheFn, {}, {}, Name);
105  return cast<ConstantInt>(Scaling)->getSExtValue() == 1
106  ? CI
107  : CreateMul(CI, Scaling);
108 }
109 
111  Type *STy = DstType->getScalarType();
112  if (isa<ScalableVectorType>(DstType)) {
113  Type *StepVecType = DstType;
114  // TODO: We expect this special case (element type < 8 bits) to be
115  // temporary - once the intrinsic properly supports < 8 bits this code
116  // can be removed.
117  if (STy->getScalarSizeInBits() < 8)
118  StepVecType =
119  VectorType::get(getInt8Ty(), cast<ScalableVectorType>(DstType));
120  Value *Res = CreateIntrinsic(Intrinsic::experimental_stepvector,
121  {StepVecType}, {}, nullptr, Name);
122  if (StepVecType != DstType)
123  Res = CreateTrunc(Res, DstType);
124  return Res;
125  }
126 
127  unsigned NumEls = cast<FixedVectorType>(DstType)->getNumElements();
128 
129  // Create a vector of consecutive numbers from zero to VF.
131  for (unsigned i = 0; i < NumEls; ++i)
132  Indices.push_back(ConstantInt::get(STy, i));
133 
134  // Add the consecutive indices to the vector value.
135  return ConstantVector::get(Indices);
136 }
137 
139  MaybeAlign Align, bool isVolatile,
140  MDNode *TBAATag, MDNode *ScopeTag,
141  MDNode *NoAliasTag) {
142  Ptr = getCastedInt8PtrValue(Ptr);
143  Value *Ops[] = {Ptr, Val, Size, getInt1(isVolatile)};
144  Type *Tys[] = { Ptr->getType(), Size->getType() };
145  Module *M = BB->getParent()->getParent();
146  Function *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memset, Tys);
147 
148  CallInst *CI = CreateCall(TheFn, Ops);
149 
150  if (Align)
151  cast<MemSetInst>(CI)->setDestAlignment(*Align);
152 
153  // Set the TBAA info if present.
154  if (TBAATag)
155  CI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
156 
157  if (ScopeTag)
158  CI->setMetadata(LLVMContext::MD_alias_scope, ScopeTag);
159 
160  if (NoAliasTag)
161  CI->setMetadata(LLVMContext::MD_noalias, NoAliasTag);
162 
163  return CI;
164 }
165 
167  Value *Val, Value *Size,
168  bool IsVolatile, MDNode *TBAATag,
169  MDNode *ScopeTag,
170  MDNode *NoAliasTag) {
171  Dst = getCastedInt8PtrValue(Dst);
172  Value *Ops[] = {Dst, Val, Size, getInt1(IsVolatile)};
173  Type *Tys[] = {Dst->getType(), Size->getType()};
174  Module *M = BB->getParent()->getParent();
175  Function *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memset_inline, Tys);
176 
177  CallInst *CI = CreateCall(TheFn, Ops);
178 
179  if (DstAlign)
180  cast<MemSetInlineInst>(CI)->setDestAlignment(*DstAlign);
181 
182  // Set the TBAA info if present.
183  if (TBAATag)
184  CI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
185 
186  if (ScopeTag)
187  CI->setMetadata(LLVMContext::MD_alias_scope, ScopeTag);
188 
189  if (NoAliasTag)
190  CI->setMetadata(LLVMContext::MD_noalias, NoAliasTag);
191 
192  return CI;
193 }
194 
196  Value *Ptr, Value *Val, Value *Size, Align Alignment, uint32_t ElementSize,
197  MDNode *TBAATag, MDNode *ScopeTag, MDNode *NoAliasTag) {
198 
199  Ptr = getCastedInt8PtrValue(Ptr);
200  Value *Ops[] = {Ptr, Val, Size, getInt32(ElementSize)};
201  Type *Tys[] = {Ptr->getType(), Size->getType()};
202  Module *M = BB->getParent()->getParent();
204  M, Intrinsic::memset_element_unordered_atomic, Tys);
205 
206  CallInst *CI = CreateCall(TheFn, Ops);
207 
208  cast<AtomicMemSetInst>(CI)->setDestAlignment(Alignment);
209 
210  // Set the TBAA info if present.
211  if (TBAATag)
212  CI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
213 
214  if (ScopeTag)
215  CI->setMetadata(LLVMContext::MD_alias_scope, ScopeTag);
216 
217  if (NoAliasTag)
218  CI->setMetadata(LLVMContext::MD_noalias, NoAliasTag);
219 
220  return CI;
221 }
222 
224  Intrinsic::ID IntrID, Value *Dst, MaybeAlign DstAlign, Value *Src,
225  MaybeAlign SrcAlign, Value *Size, bool isVolatile, MDNode *TBAATag,
226  MDNode *TBAAStructTag, MDNode *ScopeTag, MDNode *NoAliasTag) {
227  Dst = getCastedInt8PtrValue(Dst);
228  Src = getCastedInt8PtrValue(Src);
229 
230  Value *Ops[] = {Dst, Src, Size, getInt1(isVolatile)};
231  Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
232  Module *M = BB->getParent()->getParent();
233  Function *TheFn = Intrinsic::getDeclaration(M, IntrID, Tys);
234 
235  CallInst *CI = CreateCall(TheFn, Ops);
236 
237  auto* MCI = cast<MemTransferInst>(CI);
238  if (DstAlign)
239  MCI->setDestAlignment(*DstAlign);
240  if (SrcAlign)
241  MCI->setSourceAlignment(*SrcAlign);
242 
243  // Set the TBAA info if present.
244  if (TBAATag)
245  CI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
246 
247  // Set the TBAA Struct info if present.
248  if (TBAAStructTag)
249  CI->setMetadata(LLVMContext::MD_tbaa_struct, TBAAStructTag);
250 
251  if (ScopeTag)
252  CI->setMetadata(LLVMContext::MD_alias_scope, ScopeTag);
253 
254  if (NoAliasTag)
255  CI->setMetadata(LLVMContext::MD_noalias, NoAliasTag);
256 
257  return CI;
258 }
259 
261  Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign,
262  Value *Size, bool IsVolatile, MDNode *TBAATag, MDNode *TBAAStructTag,
263  MDNode *ScopeTag, MDNode *NoAliasTag) {
264  Dst = getCastedInt8PtrValue(Dst);
265  Src = getCastedInt8PtrValue(Src);
266 
267  Value *Ops[] = {Dst, Src, Size, getInt1(IsVolatile)};
268  Type *Tys[] = {Dst->getType(), Src->getType(), Size->getType()};
269  Function *F = BB->getParent();
270  Module *M = F->getParent();
271  Function *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memcpy_inline, Tys);
272 
273  CallInst *CI = CreateCall(TheFn, Ops);
274 
275  auto *MCI = cast<MemCpyInlineInst>(CI);
276  if (DstAlign)
277  MCI->setDestAlignment(*DstAlign);
278  if (SrcAlign)
279  MCI->setSourceAlignment(*SrcAlign);
280 
281  // Set the TBAA info if present.
282  if (TBAATag)
283  MCI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
284 
285  // Set the TBAA Struct info if present.
286  if (TBAAStructTag)
287  MCI->setMetadata(LLVMContext::MD_tbaa_struct, TBAAStructTag);
288 
289  if (ScopeTag)
290  MCI->setMetadata(LLVMContext::MD_alias_scope, ScopeTag);
291 
292  if (NoAliasTag)
293  MCI->setMetadata(LLVMContext::MD_noalias, NoAliasTag);
294 
295  return CI;
296 }
297 
299  Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size,
300  uint32_t ElementSize, MDNode *TBAATag, MDNode *TBAAStructTag,
301  MDNode *ScopeTag, MDNode *NoAliasTag) {
302  assert(DstAlign >= ElementSize &&
303  "Pointer alignment must be at least element size");
304  assert(SrcAlign >= ElementSize &&
305  "Pointer alignment must be at least element size");
306  Dst = getCastedInt8PtrValue(Dst);
307  Src = getCastedInt8PtrValue(Src);
308 
309  Value *Ops[] = {Dst, Src, Size, getInt32(ElementSize)};
310  Type *Tys[] = {Dst->getType(), Src->getType(), Size->getType()};
311  Module *M = BB->getParent()->getParent();
313  M, Intrinsic::memcpy_element_unordered_atomic, Tys);
314 
315  CallInst *CI = CreateCall(TheFn, Ops);
316 
317  // Set the alignment of the pointer args.
318  auto *AMCI = cast<AtomicMemCpyInst>(CI);
319  AMCI->setDestAlignment(DstAlign);
320  AMCI->setSourceAlignment(SrcAlign);
321 
322  // Set the TBAA info if present.
323  if (TBAATag)
324  CI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
325 
326  // Set the TBAA Struct info if present.
327  if (TBAAStructTag)
328  CI->setMetadata(LLVMContext::MD_tbaa_struct, TBAAStructTag);
329 
330  if (ScopeTag)
331  CI->setMetadata(LLVMContext::MD_alias_scope, ScopeTag);
332 
333  if (NoAliasTag)
334  CI->setMetadata(LLVMContext::MD_noalias, NoAliasTag);
335 
336  return CI;
337 }
338 
340  Value *Src, MaybeAlign SrcAlign,
341  Value *Size, bool isVolatile,
342  MDNode *TBAATag, MDNode *ScopeTag,
343  MDNode *NoAliasTag) {
344  Dst = getCastedInt8PtrValue(Dst);
345  Src = getCastedInt8PtrValue(Src);
346 
347  Value *Ops[] = {Dst, Src, Size, getInt1(isVolatile)};
348  Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
349  Module *M = BB->getParent()->getParent();
350  Function *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memmove, Tys);
351 
352  CallInst *CI = CreateCall(TheFn, Ops);
353 
354  auto *MMI = cast<MemMoveInst>(CI);
355  if (DstAlign)
356  MMI->setDestAlignment(*DstAlign);
357  if (SrcAlign)
358  MMI->setSourceAlignment(*SrcAlign);
359 
360  // Set the TBAA info if present.
361  if (TBAATag)
362  CI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
363 
364  if (ScopeTag)
365  CI->setMetadata(LLVMContext::MD_alias_scope, ScopeTag);
366 
367  if (NoAliasTag)
368  CI->setMetadata(LLVMContext::MD_noalias, NoAliasTag);
369 
370  return CI;
371 }
372 
374  Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size,
375  uint32_t ElementSize, MDNode *TBAATag, MDNode *TBAAStructTag,
376  MDNode *ScopeTag, MDNode *NoAliasTag) {
377  assert(DstAlign >= ElementSize &&
378  "Pointer alignment must be at least element size");
379  assert(SrcAlign >= ElementSize &&
380  "Pointer alignment must be at least element size");
381  Dst = getCastedInt8PtrValue(Dst);
382  Src = getCastedInt8PtrValue(Src);
383 
384  Value *Ops[] = {Dst, Src, Size, getInt32(ElementSize)};
385  Type *Tys[] = {Dst->getType(), Src->getType(), Size->getType()};
386  Module *M = BB->getParent()->getParent();
388  M, Intrinsic::memmove_element_unordered_atomic, Tys);
389 
390  CallInst *CI = CreateCall(TheFn, Ops);
391 
392  // Set the alignment of the pointer args.
393  CI->addParamAttr(0, Attribute::getWithAlignment(CI->getContext(), DstAlign));
394  CI->addParamAttr(1, Attribute::getWithAlignment(CI->getContext(), SrcAlign));
395 
396  // Set the TBAA info if present.
397  if (TBAATag)
398  CI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
399 
400  // Set the TBAA Struct info if present.
401  if (TBAAStructTag)
402  CI->setMetadata(LLVMContext::MD_tbaa_struct, TBAAStructTag);
403 
404  if (ScopeTag)
405  CI->setMetadata(LLVMContext::MD_alias_scope, ScopeTag);
406 
407  if (NoAliasTag)
408  CI->setMetadata(LLVMContext::MD_noalias, NoAliasTag);
409 
410  return CI;
411 }
412 
413 CallInst *IRBuilderBase::getReductionIntrinsic(Intrinsic::ID ID, Value *Src) {
415  Value *Ops[] = {Src};
416  Type *Tys[] = { Src->getType() };
417  auto Decl = Intrinsic::getDeclaration(M, ID, Tys);
418  return CreateCall(Decl, Ops);
419 }
420 
423  Value *Ops[] = {Acc, Src};
424  auto Decl = Intrinsic::getDeclaration(M, Intrinsic::vector_reduce_fadd,
425  {Src->getType()});
426  return CreateCall(Decl, Ops);
427 }
428 
431  Value *Ops[] = {Acc, Src};
432  auto Decl = Intrinsic::getDeclaration(M, Intrinsic::vector_reduce_fmul,
433  {Src->getType()});
434  return CreateCall(Decl, Ops);
435 }
436 
438  return getReductionIntrinsic(Intrinsic::vector_reduce_add, Src);
439 }
440 
442  return getReductionIntrinsic(Intrinsic::vector_reduce_mul, Src);
443 }
444 
446  return getReductionIntrinsic(Intrinsic::vector_reduce_and, Src);
447 }
448 
450  return getReductionIntrinsic(Intrinsic::vector_reduce_or, Src);
451 }
452 
454  return getReductionIntrinsic(Intrinsic::vector_reduce_xor, Src);
455 }
456 
458  auto ID =
459  IsSigned ? Intrinsic::vector_reduce_smax : Intrinsic::vector_reduce_umax;
460  return getReductionIntrinsic(ID, Src);
461 }
462 
464  auto ID =
465  IsSigned ? Intrinsic::vector_reduce_smin : Intrinsic::vector_reduce_umin;
466  return getReductionIntrinsic(ID, Src);
467 }
468 
470  return getReductionIntrinsic(Intrinsic::vector_reduce_fmax, Src);
471 }
472 
474  return getReductionIntrinsic(Intrinsic::vector_reduce_fmin, Src);
475 }
476 
478  assert(isa<PointerType>(Ptr->getType()) &&
479  "lifetime.start only applies to pointers.");
480  Ptr = getCastedInt8PtrValue(Ptr);
481  if (!Size)
482  Size = getInt64(-1);
483  else
484  assert(Size->getType() == getInt64Ty() &&
485  "lifetime.start requires the size to be an i64");
486  Value *Ops[] = { Size, Ptr };
487  Module *M = BB->getParent()->getParent();
488  Function *TheFn =
489  Intrinsic::getDeclaration(M, Intrinsic::lifetime_start, {Ptr->getType()});
490  return CreateCall(TheFn, Ops);
491 }
492 
494  assert(isa<PointerType>(Ptr->getType()) &&
495  "lifetime.end only applies to pointers.");
496  Ptr = getCastedInt8PtrValue(Ptr);
497  if (!Size)
498  Size = getInt64(-1);
499  else
500  assert(Size->getType() == getInt64Ty() &&
501  "lifetime.end requires the size to be an i64");
502  Value *Ops[] = { Size, Ptr };
503  Module *M = BB->getParent()->getParent();
504  Function *TheFn =
505  Intrinsic::getDeclaration(M, Intrinsic::lifetime_end, {Ptr->getType()});
506  return CreateCall(TheFn, Ops);
507 }
508 
510 
511  assert(isa<PointerType>(Ptr->getType()) &&
512  "invariant.start only applies to pointers.");
513  Ptr = getCastedInt8PtrValue(Ptr);
514  if (!Size)
515  Size = getInt64(-1);
516  else
517  assert(Size->getType() == getInt64Ty() &&
518  "invariant.start requires the size to be an i64");
519 
520  Value *Ops[] = {Size, Ptr};
521  // Fill in the single overloaded type: memory object type.
522  Type *ObjectPtr[1] = {Ptr->getType()};
523  Module *M = BB->getParent()->getParent();
524  Function *TheFn =
525  Intrinsic::getDeclaration(M, Intrinsic::invariant_start, ObjectPtr);
526  return CreateCall(TheFn, Ops);
527 }
528 
530  if (auto *O = dyn_cast<GlobalObject>(Ptr))
531  return O->getAlign();
532  if (auto *A = dyn_cast<GlobalAlias>(Ptr))
533  return A->getAliaseeObject()->getAlign();
534  return {};
535 }
536 
538 #ifndef NDEBUG
539  // Handle specially for constexpr cast. This is possible when
540  // opaque pointers not enabled since constant could be sinked
541  // directly by the design of llvm. This could be eliminated
542  // after we eliminate the abuse of constexpr.
543  auto *V = Ptr;
544  if (auto *CE = dyn_cast<ConstantExpr>(V))
545  if (CE->isCast())
546  V = CE->getOperand(0);
547 
548  assert(isa<GlobalValue>(V) && cast<GlobalValue>(V)->isThreadLocal() &&
549  "threadlocal_address only applies to thread local variables.");
550 #endif
551  CallInst *CI = CreateIntrinsic(llvm::Intrinsic::threadlocal_address,
552  {Ptr->getType()}, {Ptr});
553  if (MaybeAlign A = getAlign(Ptr)) {
556  }
557  return CI;
558 }
559 
560 CallInst *
562  ArrayRef<OperandBundleDef> OpBundles) {
563  assert(Cond->getType() == getInt1Ty() &&
564  "an assumption condition must be of type i1");
565 
566  Value *Ops[] = { Cond };
567  Module *M = BB->getParent()->getParent();
568  Function *FnAssume = Intrinsic::getDeclaration(M, Intrinsic::assume);
569  return CreateCall(FnAssume, Ops, OpBundles);
570 }
571 
573  Module *M = BB->getModule();
574  auto *FnIntrinsic = Intrinsic::getDeclaration(
575  M, Intrinsic::experimental_noalias_scope_decl, {});
576  return CreateCall(FnIntrinsic, {Scope});
577 }
578 
579 /// Create a call to a Masked Load intrinsic.
580 /// \p Ty - vector type to load
581 /// \p Ptr - base pointer for the load
582 /// \p Alignment - alignment of the source location
583 /// \p Mask - vector of booleans which indicates what vector lanes should
584 /// be accessed in memory
585 /// \p PassThru - pass-through value that is used to fill the masked-off lanes
586 /// of the result
587 /// \p Name - name of the result variable
589  Value *Mask, Value *PassThru,
590  const Twine &Name) {
591  auto *PtrTy = cast<PointerType>(Ptr->getType());
592  assert(Ty->isVectorTy() && "Type should be vector");
593  assert(PtrTy->isOpaqueOrPointeeTypeMatches(Ty) && "Wrong element type");
594  assert(Mask && "Mask should not be all-ones (null)");
595  if (!PassThru)
596  PassThru = PoisonValue::get(Ty);
597  Type *OverloadedTypes[] = { Ty, PtrTy };
598  Value *Ops[] = {Ptr, getInt32(Alignment.value()), Mask, PassThru};
599  return CreateMaskedIntrinsic(Intrinsic::masked_load, Ops,
600  OverloadedTypes, Name);
601 }
602 
603 /// Create a call to a Masked Store intrinsic.
604 /// \p Val - data to be stored,
605 /// \p Ptr - base pointer for the store
606 /// \p Alignment - alignment of the destination location
607 /// \p Mask - vector of booleans which indicates what vector lanes should
608 /// be accessed in memory
610  Align Alignment, Value *Mask) {
611  auto *PtrTy = cast<PointerType>(Ptr->getType());
612  Type *DataTy = Val->getType();
613  assert(DataTy->isVectorTy() && "Val should be a vector");
614  assert(PtrTy->isOpaqueOrPointeeTypeMatches(DataTy) && "Wrong element type");
615  assert(Mask && "Mask should not be all-ones (null)");
616  Type *OverloadedTypes[] = { DataTy, PtrTy };
617  Value *Ops[] = {Val, Ptr, getInt32(Alignment.value()), Mask};
618  return CreateMaskedIntrinsic(Intrinsic::masked_store, Ops, OverloadedTypes);
619 }
620 
621 /// Create a call to a Masked intrinsic, with given intrinsic Id,
622 /// an array of operands - Ops, and an array of overloaded types -
623 /// OverloadedTypes.
624 CallInst *IRBuilderBase::CreateMaskedIntrinsic(Intrinsic::ID Id,
625  ArrayRef<Value *> Ops,
626  ArrayRef<Type *> OverloadedTypes,
627  const Twine &Name) {
628  Module *M = BB->getParent()->getParent();
629  Function *TheFn = Intrinsic::getDeclaration(M, Id, OverloadedTypes);
630  return CreateCall(TheFn, Ops, {}, Name);
631 }
632 
633 /// Create a call to a Masked Gather intrinsic.
634 /// \p Ty - vector type to gather
635 /// \p Ptrs - vector of pointers for loading
636 /// \p Align - alignment for one element
637 /// \p Mask - vector of booleans which indicates what vector lanes should
638 /// be accessed in memory
639 /// \p PassThru - pass-through value that is used to fill the masked-off lanes
640 /// of the result
641 /// \p Name - name of the result variable
643  Align Alignment, Value *Mask,
644  Value *PassThru,
645  const Twine &Name) {
646  auto *VecTy = cast<VectorType>(Ty);
647  ElementCount NumElts = VecTy->getElementCount();
648  auto *PtrsTy = cast<VectorType>(Ptrs->getType());
649  assert(cast<PointerType>(PtrsTy->getElementType())
650  ->isOpaqueOrPointeeTypeMatches(
651  cast<VectorType>(Ty)->getElementType()) &&
652  "Element type mismatch");
653  assert(NumElts == PtrsTy->getElementCount() && "Element count mismatch");
654 
655  if (!Mask)
658 
659  if (!PassThru)
660  PassThru = PoisonValue::get(Ty);
661 
662  Type *OverloadedTypes[] = {Ty, PtrsTy};
663  Value *Ops[] = {Ptrs, getInt32(Alignment.value()), Mask, PassThru};
664 
665  // We specify only one type when we create this intrinsic. Types of other
666  // arguments are derived from this type.
667  return CreateMaskedIntrinsic(Intrinsic::masked_gather, Ops, OverloadedTypes,
668  Name);
669 }
670 
671 /// Create a call to a Masked Scatter intrinsic.
672 /// \p Data - data to be stored,
673 /// \p Ptrs - the vector of pointers, where the \p Data elements should be
674 /// stored
675 /// \p Align - alignment for one element
676 /// \p Mask - vector of booleans which indicates what vector lanes should
677 /// be accessed in memory
679  Align Alignment, Value *Mask) {
680  auto *PtrsTy = cast<VectorType>(Ptrs->getType());
681  auto *DataTy = cast<VectorType>(Data->getType());
682  ElementCount NumElts = PtrsTy->getElementCount();
683 
684 #ifndef NDEBUG
685  auto *PtrTy = cast<PointerType>(PtrsTy->getElementType());
686  assert(NumElts == DataTy->getElementCount() &&
687  PtrTy->isOpaqueOrPointeeTypeMatches(DataTy->getElementType()) &&
688  "Incompatible pointer and data types");
689 #endif
690 
691  if (!Mask)
694 
695  Type *OverloadedTypes[] = {DataTy, PtrsTy};
696  Value *Ops[] = {Data, Ptrs, getInt32(Alignment.value()), Mask};
697 
698  // We specify only one type when we create this intrinsic. Types of other
699  // arguments are derived from this type.
700  return CreateMaskedIntrinsic(Intrinsic::masked_scatter, Ops, OverloadedTypes);
701 }
702 
703 /// Create a call to Masked Expand Load intrinsic
704 /// \p Ty - vector type to load
705 /// \p Ptr - base pointer for the load
706 /// \p Mask - vector of booleans which indicates what vector lanes should
707 /// be accessed in memory
708 /// \p PassThru - pass-through value that is used to fill the masked-off lanes
709 /// of the result
710 /// \p Name - name of the result variable
712  Value *Mask, Value *PassThru,
713  const Twine &Name) {
714  auto *PtrTy = cast<PointerType>(Ptr->getType());
715  assert(Ty->isVectorTy() && "Type should be vector");
716  assert(PtrTy->isOpaqueOrPointeeTypeMatches(
717  cast<FixedVectorType>(Ty)->getElementType()) &&
718  "Wrong element type");
719  (void)PtrTy;
720  assert(Mask && "Mask should not be all-ones (null)");
721  if (!PassThru)
722  PassThru = PoisonValue::get(Ty);
723  Type *OverloadedTypes[] = {Ty};
724  Value *Ops[] = {Ptr, Mask, PassThru};
725  return CreateMaskedIntrinsic(Intrinsic::masked_expandload, Ops,
726  OverloadedTypes, Name);
727 }
728 
729 /// Create a call to Masked Compress Store intrinsic
730 /// \p Val - data to be stored,
731 /// \p Ptr - base pointer for the store
732 /// \p Mask - vector of booleans which indicates what vector lanes should
733 /// be accessed in memory
735  Value *Mask) {
736  auto *PtrTy = cast<PointerType>(Ptr->getType());
737  Type *DataTy = Val->getType();
738  assert(DataTy->isVectorTy() && "Val should be a vector");
739  assert(PtrTy->isOpaqueOrPointeeTypeMatches(
740  cast<FixedVectorType>(DataTy)->getElementType()) &&
741  "Wrong element type");
742  (void)PtrTy;
743  assert(Mask && "Mask should not be all-ones (null)");
744  Type *OverloadedTypes[] = {DataTy};
745  Value *Ops[] = {Val, Ptr, Mask};
746  return CreateMaskedIntrinsic(Intrinsic::masked_compressstore, Ops,
747  OverloadedTypes);
748 }
749 
750 template <typename T0>
751 static std::vector<Value *>
753  Value *ActualCallee, uint32_t Flags, ArrayRef<T0> CallArgs) {
754  std::vector<Value *> Args;
755  Args.push_back(B.getInt64(ID));
756  Args.push_back(B.getInt32(NumPatchBytes));
757  Args.push_back(ActualCallee);
758  Args.push_back(B.getInt32(CallArgs.size()));
759  Args.push_back(B.getInt32(Flags));
760  llvm::append_range(Args, CallArgs);
761  // GC Transition and Deopt args are now always handled via operand bundle.
762  // They will be removed from the signature of gc.statepoint shortly.
763  Args.push_back(B.getInt32(0));
764  Args.push_back(B.getInt32(0));
765  // GC args are now encoded in the gc-live operand bundle
766  return Args;
767 }
768 
769 template<typename T1, typename T2, typename T3>
770 static std::vector<OperandBundleDef>
772  Optional<ArrayRef<T2>> DeoptArgs,
773  ArrayRef<T3> GCArgs) {
774  std::vector<OperandBundleDef> Rval;
775  if (DeoptArgs) {
776  SmallVector<Value*, 16> DeoptValues;
777  llvm::append_range(DeoptValues, *DeoptArgs);
778  Rval.emplace_back("deopt", DeoptValues);
779  }
780  if (TransitionArgs) {
781  SmallVector<Value*, 16> TransitionValues;
782  llvm::append_range(TransitionValues, *TransitionArgs);
783  Rval.emplace_back("gc-transition", TransitionValues);
784  }
785  if (GCArgs.size()) {
786  SmallVector<Value*, 16> LiveValues;
787  llvm::append_range(LiveValues, GCArgs);
788  Rval.emplace_back("gc-live", LiveValues);
789  }
790  return Rval;
791 }
792 
793 template <typename T0, typename T1, typename T2, typename T3>
795  IRBuilderBase *Builder, uint64_t ID, uint32_t NumPatchBytes,
796  FunctionCallee ActualCallee, uint32_t Flags, ArrayRef<T0> CallArgs,
797  Optional<ArrayRef<T1>> TransitionArgs, Optional<ArrayRef<T2>> DeoptArgs,
798  ArrayRef<T3> GCArgs, const Twine &Name) {
799  Module *M = Builder->GetInsertBlock()->getParent()->getParent();
800  // Fill in the one generic type'd argument (the function is also vararg)
801  Function *FnStatepoint =
802  Intrinsic::getDeclaration(M, Intrinsic::experimental_gc_statepoint,
803  {ActualCallee.getCallee()->getType()});
804 
805  std::vector<Value *> Args = getStatepointArgs(
806  *Builder, ID, NumPatchBytes, ActualCallee.getCallee(), Flags, CallArgs);
807 
808  CallInst *CI = Builder->CreateCall(
809  FnStatepoint, Args,
810  getStatepointBundles(TransitionArgs, DeoptArgs, GCArgs), Name);
811  CI->addParamAttr(2,
812  Attribute::get(Builder->getContext(), Attribute::ElementType,
813  ActualCallee.getFunctionType()));
814  return CI;
815 }
816 
818  uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualCallee,
819  ArrayRef<Value *> CallArgs, Optional<ArrayRef<Value *>> DeoptArgs,
820  ArrayRef<Value *> GCArgs, const Twine &Name) {
821  return CreateGCStatepointCallCommon<Value *, Value *, Value *, Value *>(
822  this, ID, NumPatchBytes, ActualCallee, uint32_t(StatepointFlags::None),
823  CallArgs, None /* No Transition Args */, DeoptArgs, GCArgs, Name);
824 }
825 
827  uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualCallee,
828  uint32_t Flags, ArrayRef<Value *> CallArgs,
829  Optional<ArrayRef<Use>> TransitionArgs, Optional<ArrayRef<Use>> DeoptArgs,
830  ArrayRef<Value *> GCArgs, const Twine &Name) {
831  return CreateGCStatepointCallCommon<Value *, Use, Use, Value *>(
832  this, ID, NumPatchBytes, ActualCallee, Flags, CallArgs, TransitionArgs,
833  DeoptArgs, GCArgs, Name);
834 }
835 
837  uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualCallee,
838  ArrayRef<Use> CallArgs, Optional<ArrayRef<Value *>> DeoptArgs,
839  ArrayRef<Value *> GCArgs, const Twine &Name) {
840  return CreateGCStatepointCallCommon<Use, Value *, Value *, Value *>(
841  this, ID, NumPatchBytes, ActualCallee, uint32_t(StatepointFlags::None),
842  CallArgs, None, DeoptArgs, GCArgs, Name);
843 }
844 
845 template <typename T0, typename T1, typename T2, typename T3>
847  IRBuilderBase *Builder, uint64_t ID, uint32_t NumPatchBytes,
848  FunctionCallee ActualInvokee, BasicBlock *NormalDest,
849  BasicBlock *UnwindDest, uint32_t Flags, ArrayRef<T0> InvokeArgs,
850  Optional<ArrayRef<T1>> TransitionArgs, Optional<ArrayRef<T2>> DeoptArgs,
851  ArrayRef<T3> GCArgs, const Twine &Name) {
852  Module *M = Builder->GetInsertBlock()->getParent()->getParent();
853  // Fill in the one generic type'd argument (the function is also vararg)
854  Function *FnStatepoint =
855  Intrinsic::getDeclaration(M, Intrinsic::experimental_gc_statepoint,
856  {ActualInvokee.getCallee()->getType()});
857 
858  std::vector<Value *> Args =
859  getStatepointArgs(*Builder, ID, NumPatchBytes, ActualInvokee.getCallee(),
860  Flags, InvokeArgs);
861 
862  InvokeInst *II = Builder->CreateInvoke(
863  FnStatepoint, NormalDest, UnwindDest, Args,
864  getStatepointBundles(TransitionArgs, DeoptArgs, GCArgs), Name);
865  II->addParamAttr(2,
866  Attribute::get(Builder->getContext(), Attribute::ElementType,
867  ActualInvokee.getFunctionType()));
868  return II;
869 }
870 
872  uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualInvokee,
873  BasicBlock *NormalDest, BasicBlock *UnwindDest,
874  ArrayRef<Value *> InvokeArgs, Optional<ArrayRef<Value *>> DeoptArgs,
875  ArrayRef<Value *> GCArgs, const Twine &Name) {
876  return CreateGCStatepointInvokeCommon<Value *, Value *, Value *, Value *>(
877  this, ID, NumPatchBytes, ActualInvokee, NormalDest, UnwindDest,
878  uint32_t(StatepointFlags::None), InvokeArgs, None /* No Transition Args*/,
879  DeoptArgs, GCArgs, Name);
880 }
881 
883  uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualInvokee,
884  BasicBlock *NormalDest, BasicBlock *UnwindDest, uint32_t Flags,
885  ArrayRef<Value *> InvokeArgs, Optional<ArrayRef<Use>> TransitionArgs,
886  Optional<ArrayRef<Use>> DeoptArgs, ArrayRef<Value *> GCArgs,
887  const Twine &Name) {
888  return CreateGCStatepointInvokeCommon<Value *, Use, Use, Value *>(
889  this, ID, NumPatchBytes, ActualInvokee, NormalDest, UnwindDest, Flags,
890  InvokeArgs, TransitionArgs, DeoptArgs, GCArgs, Name);
891 }
892 
894  uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualInvokee,
895  BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef<Use> InvokeArgs,
896  Optional<ArrayRef<Value *>> DeoptArgs, ArrayRef<Value *> GCArgs,
897  const Twine &Name) {
898  return CreateGCStatepointInvokeCommon<Use, Value *, Value *, Value *>(
899  this, ID, NumPatchBytes, ActualInvokee, NormalDest, UnwindDest,
900  uint32_t(StatepointFlags::None), InvokeArgs, None, DeoptArgs, GCArgs,
901  Name);
902 }
903 
905  Type *ResultType, const Twine &Name) {
906  Intrinsic::ID ID = Intrinsic::experimental_gc_result;
907  Module *M = BB->getParent()->getParent();
908  Type *Types[] = {ResultType};
909  Function *FnGCResult = Intrinsic::getDeclaration(M, ID, Types);
910 
911  Value *Args[] = {Statepoint};
912  return CreateCall(FnGCResult, Args, {}, Name);
913 }
914 
916  int BaseOffset, int DerivedOffset,
917  Type *ResultType, const Twine &Name) {
918  Module *M = BB->getParent()->getParent();
919  Type *Types[] = {ResultType};
920  Function *FnGCRelocate =
921  Intrinsic::getDeclaration(M, Intrinsic::experimental_gc_relocate, Types);
922 
923  Value *Args[] = {Statepoint, getInt32(BaseOffset), getInt32(DerivedOffset)};
924  return CreateCall(FnGCRelocate, Args, {}, Name);
925 }
926 
928  const Twine &Name) {
929  Module *M = BB->getParent()->getParent();
930  Type *PtrTy = DerivedPtr->getType();
931  Function *FnGCFindBase = Intrinsic::getDeclaration(
932  M, Intrinsic::experimental_gc_get_pointer_base, {PtrTy, PtrTy});
933  return CreateCall(FnGCFindBase, {DerivedPtr}, {}, Name);
934 }
935 
937  const Twine &Name) {
938  Module *M = BB->getParent()->getParent();
939  Type *PtrTy = DerivedPtr->getType();
940  Function *FnGCGetOffset = Intrinsic::getDeclaration(
941  M, Intrinsic::experimental_gc_get_pointer_offset, {PtrTy});
942  return CreateCall(FnGCGetOffset, {DerivedPtr}, {}, Name);
943 }
944 
946  Instruction *FMFSource,
947  const Twine &Name) {
948  Module *M = BB->getModule();
950  return createCallHelper(Fn, {V}, Name, FMFSource);
951 }
952 
954  Value *RHS,
955  Instruction *FMFSource,
956  const Twine &Name) {
957  Module *M = BB->getModule();
959  return createCallHelper(Fn, {LHS, RHS}, Name, FMFSource);
960 }
961 
963  ArrayRef<Type *> Types,
965  Instruction *FMFSource,
966  const Twine &Name) {
967  Module *M = BB->getModule();
968  Function *Fn = Intrinsic::getDeclaration(M, ID, Types);
969  return createCallHelper(Fn, Args, Name, FMFSource);
970 }
971 
974  Instruction *FMFSource,
975  const Twine &Name) {
976  Module *M = BB->getModule();
977 
981 
982  SmallVector<Type *> ArgTys;
983  ArgTys.reserve(Args.size());
984  for (auto &I : Args)
985  ArgTys.push_back(I->getType());
986  FunctionType *FTy = FunctionType::get(RetTy, ArgTys, false);
987  SmallVector<Type *> OverloadTys;
989  matchIntrinsicSignature(FTy, TableRef, OverloadTys);
990  (void)Res;
992  "Wrong types for intrinsic!");
993  // TODO: Handle varargs intrinsics.
994 
995  Function *Fn = Intrinsic::getDeclaration(M, ID, OverloadTys);
996  return createCallHelper(Fn, Args, Name, FMFSource);
997 }
998 
1000  Intrinsic::ID ID, Value *L, Value *R, Instruction *FMFSource,
1001  const Twine &Name, MDNode *FPMathTag,
1004  Value *RoundingV = getConstrainedFPRounding(Rounding);
1005  Value *ExceptV = getConstrainedFPExcept(Except);
1006 
1007  FastMathFlags UseFMF = FMF;
1008  if (FMFSource)
1009  UseFMF = FMFSource->getFastMathFlags();
1010 
1011  CallInst *C = CreateIntrinsic(ID, {L->getType()},
1012  {L, R, RoundingV, ExceptV}, nullptr, Name);
1014  setFPAttrs(C, FPMathTag, UseFMF);
1015  return C;
1016 }
1017 
1019  const Twine &Name, MDNode *FPMathTag) {
1020  if (Instruction::isBinaryOp(Opc)) {
1021  assert(Ops.size() == 2 && "Invalid number of operands!");
1022  return CreateBinOp(static_cast<Instruction::BinaryOps>(Opc),
1023  Ops[0], Ops[1], Name, FPMathTag);
1024  }
1025  if (Instruction::isUnaryOp(Opc)) {
1026  assert(Ops.size() == 1 && "Invalid number of operands!");
1027  return CreateUnOp(static_cast<Instruction::UnaryOps>(Opc),
1028  Ops[0], Name, FPMathTag);
1029  }
1030  llvm_unreachable("Unexpected opcode!");
1031 }
1032 
1034  Intrinsic::ID ID, Value *V, Type *DestTy,
1035  Instruction *FMFSource, const Twine &Name, MDNode *FPMathTag,
1038  Value *ExceptV = getConstrainedFPExcept(Except);
1039 
1040  FastMathFlags UseFMF = FMF;
1041  if (FMFSource)
1042  UseFMF = FMFSource->getFastMathFlags();
1043 
1044  CallInst *C;
1045  bool HasRoundingMD = false;
1046  switch (ID) {
1047  default:
1048  break;
1049 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
1050  case Intrinsic::INTRINSIC: \
1051  HasRoundingMD = ROUND_MODE; \
1052  break;
1053 #include "llvm/IR/ConstrainedOps.def"
1054  }
1055  if (HasRoundingMD) {
1056  Value *RoundingV = getConstrainedFPRounding(Rounding);
1057  C = CreateIntrinsic(ID, {DestTy, V->getType()}, {V, RoundingV, ExceptV},
1058  nullptr, Name);
1059  } else
1060  C = CreateIntrinsic(ID, {DestTy, V->getType()}, {V, ExceptV}, nullptr,
1061  Name);
1062 
1064 
1065  if (isa<FPMathOperator>(C))
1066  setFPAttrs(C, FPMathTag, UseFMF);
1067  return C;
1068 }
1069 
1070 Value *IRBuilderBase::CreateFCmpHelper(
1071  CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name,
1072  MDNode *FPMathTag, bool IsSignaling) {
1073  if (IsFPConstrained) {
1074  auto ID = IsSignaling ? Intrinsic::experimental_constrained_fcmps
1075  : Intrinsic::experimental_constrained_fcmp;
1076  return CreateConstrainedFPCmp(ID, P, LHS, RHS, Name);
1077  }
1078 
1079  if (auto *LC = dyn_cast<Constant>(LHS))
1080  if (auto *RC = dyn_cast<Constant>(RHS))
1081  return Insert(Folder.CreateFCmp(P, LC, RC), Name);
1082  return Insert(setFPAttrs(new FCmpInst(P, LHS, RHS), FPMathTag, FMF), Name);
1083 }
1084 
1087  const Twine &Name, Optional<fp::ExceptionBehavior> Except) {
1088  Value *PredicateV = getConstrainedFPPredicate(P);
1089  Value *ExceptV = getConstrainedFPExcept(Except);
1090 
1091  CallInst *C = CreateIntrinsic(ID, {L->getType()},
1092  {L, R, PredicateV, ExceptV}, nullptr, Name);
1094  return C;
1095 }
1096 
1098  Function *Callee, ArrayRef<Value *> Args, const Twine &Name,
1102 
1103  append_range(UseArgs, Args);
1104  bool HasRoundingMD = false;
1105  switch (Callee->getIntrinsicID()) {
1106  default:
1107  break;
1108 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
1109  case Intrinsic::INTRINSIC: \
1110  HasRoundingMD = ROUND_MODE; \
1111  break;
1112 #include "llvm/IR/ConstrainedOps.def"
1113  }
1114  if (HasRoundingMD)
1115  UseArgs.push_back(getConstrainedFPRounding(Rounding));
1116  UseArgs.push_back(getConstrainedFPExcept(Except));
1117 
1118  CallInst *C = CreateCall(Callee, UseArgs, Name);
1120  return C;
1121 }
1122 
1124  const Twine &Name, Instruction *MDFrom) {
1125  if (auto *V = Folder.FoldSelect(C, True, False))
1126  return V;
1127 
1128  SelectInst *Sel = SelectInst::Create(C, True, False);
1129  if (MDFrom) {
1130  MDNode *Prof = MDFrom->getMetadata(LLVMContext::MD_prof);
1131  MDNode *Unpred = MDFrom->getMetadata(LLVMContext::MD_unpredictable);
1132  Sel = addBranchMetadata(Sel, Prof, Unpred);
1133  }
1134  if (isa<FPMathOperator>(Sel))
1135  setFPAttrs(Sel, nullptr /* MDNode* */, FMF);
1136  return Insert(Sel, Name);
1137 }
1138 
1140  const Twine &Name) {
1141  assert(LHS->getType() == RHS->getType() &&
1142  "Pointer subtraction operand types must match!");
1143  assert(cast<PointerType>(LHS->getType())
1144  ->isOpaqueOrPointeeTypeMatches(ElemTy) &&
1145  "Pointer type must match element type");
1148  Value *Difference = CreateSub(LHS_int, RHS_int);
1149  return CreateExactSDiv(Difference, ConstantExpr::getSizeOf(ElemTy),
1150  Name);
1151 }
1152 
1154  assert(isa<PointerType>(Ptr->getType()) &&
1155  "launder.invariant.group only applies to pointers.");
1156  // FIXME: we could potentially avoid casts to/from i8*.
1157  auto *PtrType = Ptr->getType();
1158  auto *Int8PtrTy = getInt8PtrTy(PtrType->getPointerAddressSpace());
1159  if (PtrType != Int8PtrTy)
1160  Ptr = CreateBitCast(Ptr, Int8PtrTy);
1161  Module *M = BB->getParent()->getParent();
1162  Function *FnLaunderInvariantGroup = Intrinsic::getDeclaration(
1163  M, Intrinsic::launder_invariant_group, {Int8PtrTy});
1164 
1165  assert(FnLaunderInvariantGroup->getReturnType() == Int8PtrTy &&
1166  FnLaunderInvariantGroup->getFunctionType()->getParamType(0) ==
1167  Int8PtrTy &&
1168  "LaunderInvariantGroup should take and return the same type");
1169 
1170  CallInst *Fn = CreateCall(FnLaunderInvariantGroup, {Ptr});
1171 
1172  if (PtrType != Int8PtrTy)
1173  return CreateBitCast(Fn, PtrType);
1174  return Fn;
1175 }
1176 
1178  assert(isa<PointerType>(Ptr->getType()) &&
1179  "strip.invariant.group only applies to pointers.");
1180 
1181  // FIXME: we could potentially avoid casts to/from i8*.
1182  auto *PtrType = Ptr->getType();
1183  auto *Int8PtrTy = getInt8PtrTy(PtrType->getPointerAddressSpace());
1184  if (PtrType != Int8PtrTy)
1185  Ptr = CreateBitCast(Ptr, Int8PtrTy);
1186  Module *M = BB->getParent()->getParent();
1187  Function *FnStripInvariantGroup = Intrinsic::getDeclaration(
1188  M, Intrinsic::strip_invariant_group, {Int8PtrTy});
1189 
1190  assert(FnStripInvariantGroup->getReturnType() == Int8PtrTy &&
1191  FnStripInvariantGroup->getFunctionType()->getParamType(0) ==
1192  Int8PtrTy &&
1193  "StripInvariantGroup should take and return the same type");
1194 
1195  CallInst *Fn = CreateCall(FnStripInvariantGroup, {Ptr});
1196 
1197  if (PtrType != Int8PtrTy)
1198  return CreateBitCast(Fn, PtrType);
1199  return Fn;
1200 }
1201 
1203  auto *Ty = cast<VectorType>(V->getType());
1204  if (isa<ScalableVectorType>(Ty)) {
1205  Module *M = BB->getParent()->getParent();
1207  M, Intrinsic::experimental_vector_reverse, Ty);
1208  return Insert(CallInst::Create(F, V), Name);
1209  }
1210  // Keep the original behaviour for fixed vector
1211  SmallVector<int, 8> ShuffleMask;
1212  int NumElts = Ty->getElementCount().getKnownMinValue();
1213  for (int i = 0; i < NumElts; ++i)
1214  ShuffleMask.push_back(NumElts - i - 1);
1215  return CreateShuffleVector(V, ShuffleMask, Name);
1216 }
1217 
1219  const Twine &Name) {
1220  assert(isa<VectorType>(V1->getType()) && "Unexpected type");
1221  assert(V1->getType() == V2->getType() &&
1222  "Splice expects matching operand types!");
1223 
1224  if (auto *VTy = dyn_cast<ScalableVectorType>(V1->getType())) {
1225  Module *M = BB->getParent()->getParent();
1227  M, Intrinsic::experimental_vector_splice, VTy);
1228 
1229  Value *Ops[] = {V1, V2, getInt32(Imm)};
1230  return Insert(CallInst::Create(F, Ops), Name);
1231  }
1232 
1233  unsigned NumElts = cast<FixedVectorType>(V1->getType())->getNumElements();
1234  assert(((-Imm <= NumElts) || (Imm < NumElts)) &&
1235  "Invalid immediate for vector splice!");
1236 
1237  // Keep the original behaviour for fixed vector
1238  unsigned Idx = (NumElts + Imm) % NumElts;
1240  for (unsigned I = 0; I < NumElts; ++I)
1241  Mask.push_back(Idx + I);
1242 
1243  return CreateShuffleVector(V1, V2, Mask);
1244 }
1245 
1247  const Twine &Name) {
1248  auto EC = ElementCount::getFixed(NumElts);
1249  return CreateVectorSplat(EC, V, Name);
1250 }
1251 
1253  const Twine &Name) {
1254  assert(EC.isNonZero() && "Cannot splat to an empty vector!");
1255 
1256  // First insert it into a poison vector so we can shuffle it.
1257  Type *I32Ty = getInt32Ty();
1258  Value *Poison = PoisonValue::get(VectorType::get(V->getType(), EC));
1259  V = CreateInsertElement(Poison, V, ConstantInt::get(I32Ty, 0),
1260  Name + ".splatinsert");
1261 
1262  // Shuffle the value across the desired number of elements.
1263  SmallVector<int, 16> Zeros;
1264  Zeros.resize(EC.getKnownMinValue());
1265  return CreateShuffleVector(V, Zeros, Name + ".splat");
1266 }
1267 
1269  const DataLayout &DL, Value *From, IntegerType *ExtractedTy,
1270  uint64_t Offset, const Twine &Name) {
1271  auto *IntTy = cast<IntegerType>(From->getType());
1272  assert(DL.getTypeStoreSize(ExtractedTy) + Offset <=
1273  DL.getTypeStoreSize(IntTy) &&
1274  "Element extends past full value");
1275  uint64_t ShAmt = 8 * Offset;
1276  Value *V = From;
1277  if (DL.isBigEndian())
1278  ShAmt = 8 * (DL.getTypeStoreSize(IntTy) -
1279  DL.getTypeStoreSize(ExtractedTy) - Offset);
1280  if (ShAmt) {
1281  V = CreateLShr(V, ShAmt, Name + ".shift");
1282  }
1283  assert(ExtractedTy->getBitWidth() <= IntTy->getBitWidth() &&
1284  "Cannot extract to a larger integer!");
1285  if (ExtractedTy != IntTy) {
1286  V = CreateTrunc(V, ExtractedTy, Name + ".trunc");
1287  }
1288  return V;
1289 }
1290 
1292  Type *ElTy, Value *Base, unsigned Dimension, unsigned LastIndex,
1293  MDNode *DbgInfo) {
1294  auto *BaseType = Base->getType();
1295  assert(isa<PointerType>(BaseType) &&
1296  "Invalid Base ptr type for preserve.array.access.index.");
1297  assert(cast<PointerType>(BaseType)->isOpaqueOrPointeeTypeMatches(ElTy) &&
1298  "Pointer element type mismatch");
1299 
1300  Value *LastIndexV = getInt32(LastIndex);
1302  SmallVector<Value *, 4> IdxList(Dimension, Zero);
1303  IdxList.push_back(LastIndexV);
1304 
1305  Type *ResultType =
1306  GetElementPtrInst::getGEPReturnType(ElTy, Base, IdxList);
1307 
1308  Module *M = BB->getParent()->getParent();
1309  Function *FnPreserveArrayAccessIndex = Intrinsic::getDeclaration(
1310  M, Intrinsic::preserve_array_access_index, {ResultType, BaseType});
1311 
1312  Value *DimV = getInt32(Dimension);
1313  CallInst *Fn =
1314  CreateCall(FnPreserveArrayAccessIndex, {Base, DimV, LastIndexV});
1315  Fn->addParamAttr(
1316  0, Attribute::get(Fn->getContext(), Attribute::ElementType, ElTy));
1317  if (DbgInfo)
1318  Fn->setMetadata(LLVMContext::MD_preserve_access_index, DbgInfo);
1319 
1320  return Fn;
1321 }
1322 
1324  Value *Base, unsigned FieldIndex, MDNode *DbgInfo) {
1325  assert(isa<PointerType>(Base->getType()) &&
1326  "Invalid Base ptr type for preserve.union.access.index.");
1327  auto *BaseType = Base->getType();
1328 
1329  Module *M = BB->getParent()->getParent();
1330  Function *FnPreserveUnionAccessIndex = Intrinsic::getDeclaration(
1331  M, Intrinsic::preserve_union_access_index, {BaseType, BaseType});
1332 
1333  Value *DIIndex = getInt32(FieldIndex);
1334  CallInst *Fn =
1335  CreateCall(FnPreserveUnionAccessIndex, {Base, DIIndex});
1336  if (DbgInfo)
1337  Fn->setMetadata(LLVMContext::MD_preserve_access_index, DbgInfo);
1338 
1339  return Fn;
1340 }
1341 
1343  Type *ElTy, Value *Base, unsigned Index, unsigned FieldIndex,
1344  MDNode *DbgInfo) {
1345  auto *BaseType = Base->getType();
1346  assert(isa<PointerType>(BaseType) &&
1347  "Invalid Base ptr type for preserve.struct.access.index.");
1348  assert(cast<PointerType>(BaseType)->isOpaqueOrPointeeTypeMatches(ElTy) &&
1349  "Pointer element type mismatch");
1350 
1351  Value *GEPIndex = getInt32(Index);
1353  Type *ResultType =
1354  GetElementPtrInst::getGEPReturnType(ElTy, Base, {Zero, GEPIndex});
1355 
1356  Module *M = BB->getParent()->getParent();
1357  Function *FnPreserveStructAccessIndex = Intrinsic::getDeclaration(
1358  M, Intrinsic::preserve_struct_access_index, {ResultType, BaseType});
1359 
1360  Value *DIIndex = getInt32(FieldIndex);
1361  CallInst *Fn = CreateCall(FnPreserveStructAccessIndex,
1362  {Base, GEPIndex, DIIndex});
1363  Fn->addParamAttr(
1364  0, Attribute::get(Fn->getContext(), Attribute::ElementType, ElTy));
1365  if (DbgInfo)
1366  Fn->setMetadata(LLVMContext::MD_preserve_access_index, DbgInfo);
1367 
1368  return Fn;
1369 }
1370 
1371 CallInst *IRBuilderBase::CreateAlignmentAssumptionHelper(const DataLayout &DL,
1372  Value *PtrValue,
1373  Value *AlignValue,
1374  Value *OffsetValue) {
1375  SmallVector<Value *, 4> Vals({PtrValue, AlignValue});
1376  if (OffsetValue)
1377  Vals.push_back(OffsetValue);
1378  OperandBundleDefT<Value *> AlignOpB("align", Vals);
1379  return CreateAssumption(ConstantInt::getTrue(getContext()), {AlignOpB});
1380 }
1381 
1383  Value *PtrValue,
1384  unsigned Alignment,
1385  Value *OffsetValue) {
1386  assert(isa<PointerType>(PtrValue->getType()) &&
1387  "trying to create an alignment assumption on a non-pointer?");
1388  assert(Alignment != 0 && "Invalid Alignment");
1389  auto *PtrTy = cast<PointerType>(PtrValue->getType());
1390  Type *IntPtrTy = getIntPtrTy(DL, PtrTy->getAddressSpace());
1391  Value *AlignValue = ConstantInt::get(IntPtrTy, Alignment);
1392  return CreateAlignmentAssumptionHelper(DL, PtrValue, AlignValue, OffsetValue);
1393 }
1394 
1396  Value *PtrValue,
1397  Value *Alignment,
1398  Value *OffsetValue) {
1399  assert(isa<PointerType>(PtrValue->getType()) &&
1400  "trying to create an alignment assumption on a non-pointer?");
1401  return CreateAlignmentAssumptionHelper(DL, PtrValue, Alignment, OffsetValue);
1402 }
1403 
1407 void ConstantFolder::anchor() {}
1408 void NoFolder::anchor() {}
i
i
Definition: README.txt:29
llvm::IRBuilderBase::CreateIntMaxReduce
CallInst * CreateIntMaxReduce(Value *Src, bool IsSigned=false)
Create a vector integer max reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:457
llvm::IRBuilderBase::getInt32Ty
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
Definition: IRBuilder.h:509
llvm::IRBuilderBase::CreateConstrainedFPCall
CallInst * CreateConstrainedFPCall(Function *Callee, ArrayRef< Value * > Args, const Twine &Name="", Optional< RoundingMode > Rounding=None, Optional< fp::ExceptionBehavior > Except=None)
Definition: IRBuilder.cpp:1097
llvm::IRBuilderBase::CreateMemSetInline
CallInst * CreateMemSetInline(Value *Dst, MaybeAlign DstAlign, Value *Val, Value *Size, bool IsVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Definition: IRBuilder.cpp:166
getStatepointArgs
static std::vector< Value * > getStatepointArgs(IRBuilderBase &B, uint64_t ID, uint32_t NumPatchBytes, Value *ActualCallee, uint32_t Flags, ArrayRef< T0 > CallArgs)
Definition: IRBuilder.cpp:752
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::IRBuilderBase::CreateMulReduce
CallInst * CreateMulReduce(Value *Src)
Create a vector int mul reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:441
llvm::Type::getInt1Ty
static IntegerType * getInt1Ty(LLVMContext &C)
Definition: Type.cpp:236
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::getInt64Ty
IntegerType * getInt64Ty()
Fetch the type representing a 64-bit integer.
Definition: IRBuilder.h:514
llvm::IRBuilderFolder::CreateFCmp
virtual Value * CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const =0
NoFolder.h
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:781
llvm::IRBuilderBase::CreateLifetimeEnd
CallInst * CreateLifetimeEnd(Value *Ptr, ConstantInt *Size=nullptr)
Create a lifetime.end intrinsic.
Definition: IRBuilder.cpp:493
llvm::Intrinsic::getDeclaration
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1481
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:719
llvm::BasicBlock::getParent
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:104
IntrinsicInst.h
llvm::ElementCount
Definition: TypeSize.h:404
DebugInfoMetadata.h
llvm::Function
Definition: Function.h:60
llvm::IRBuilderBase::CreatePtrToInt
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:1975
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::IRBuilderBase::CreateVectorReverse
Value * CreateVectorReverse(Value *V, const Twine &Name="")
Return a vector value that contains the vector V reversed.
Definition: IRBuilder.cpp:1202
llvm::IRBuilderBase::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::Attribute::get
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Definition: Attributes.cpp:91
llvm::Type::getScalarType
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition: Type.h:328
llvm::GlobalValue::NotThreadLocal
@ NotThreadLocal
Definition: GlobalValue.h:192
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1199
llvm::IRBuilderBase::CreateConstrainedFPCast
CallInst * CreateConstrainedFPCast(Intrinsic::ID ID, Value *V, Type *DestTy, Instruction *FMFSource=nullptr, const Twine &Name="", MDNode *FPMathTag=nullptr, Optional< RoundingMode > Rounding=None, Optional< fp::ExceptionBehavior > Except=None)
Definition: IRBuilder.cpp:1033
llvm::GlobalVariable
Definition: GlobalVariable.h:39
llvm::FunctionType::get
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
Definition: Type.cpp:361
llvm::IRBuilderBase::CreateUnaryIntrinsic
CallInst * CreateUnaryIntrinsic(Intrinsic::ID ID, Value *V, Instruction *FMFSource=nullptr, const Twine &Name="")
Create a call to intrinsic ID with 1 operand which is mangled on its type.
Definition: IRBuilder.cpp:945
llvm::IRBuilderBase::CreateAssumption
CallInst * CreateAssumption(Value *Cond, ArrayRef< OperandBundleDef > OpBundles=llvm::None)
Create an assume intrinsic call that allows the optimizer to assume that the provided condition will ...
Definition: IRBuilder.cpp:561
llvm::IRBuilderBase::setConstrainedFPCallAttr
void setConstrainedFPCallAttr(CallBase *I)
Definition: IRBuilder.h:344
llvm::IRBuilderBase::CreateStripInvariantGroup
Value * CreateStripInvariantGroup(Value *Ptr)
Create a strip.invariant.group intrinsic call.
Definition: IRBuilder.cpp:1177
llvm::IRBuilderBase::CreatePreserveUnionAccessIndex
Value * CreatePreserveUnionAccessIndex(Value *Base, unsigned FieldIndex, MDNode *DbgInfo)
Definition: IRBuilder.cpp:1323
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::IRBuilderBase::CreateShuffleVector
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
Definition: IRBuilder.h:2350
llvm::OperandBundleDefT
A container for an operand bundle being viewed as a set of values rather than a set of uses.
Definition: AutoUpgrade.h:32
llvm::IRBuilderBase::FMF
FastMathFlags FMF
Definition: IRBuilder.h:125
llvm::GlobalValue::UnnamedAddr::Global
@ Global
llvm::IRBuilderBase::Folder
const IRBuilderFolder & Folder
Definition: IRBuilder.h:121
llvm::IRBuilderBase::CreateBinaryIntrinsic
CallInst * CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS, Instruction *FMFSource=nullptr, const Twine &Name="")
Create a call to intrinsic ID with 2 operands which is mangled on the first type.
Definition: IRBuilder.cpp:953
llvm::Optional
Definition: APInt.h:33
llvm::IRBuilderBase::CreateInsertElement
Value * CreateInsertElement(Type *VecTy, Value *NewElt, Value *Idx, const Twine &Name="")
Definition: IRBuilder.h:2328
Operator.h
llvm::IRBuilderBase::CreateNAryOp
Value * CreateNAryOp(unsigned Opc, ArrayRef< Value * > Ops, const Twine &Name="", MDNode *FPMathTag=nullptr)
Create either a UnaryOperator or BinaryOperator depending on Opc.
Definition: IRBuilder.cpp:1018
llvm::GetElementPtrInst::getGEPReturnType
static Type * getGEPReturnType(Type *ElTy, Value *Ptr, ArrayRef< Value * > IdxList)
Returns the pointer type returned by the GEP instruction, which may be a vector of pointers.
Definition: Instructions.h:1074
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::FastMathFlags
Convenience struct for specifying and reasoning about fast-math flags.
Definition: FMF.h:21
BaseType
llvm::CallBase::addParamAttr
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
Definition: InstrTypes.h:1526
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::Type::getInt32Ty
static IntegerType * getInt32Ty(LLVMContext &C)
Definition: Type.cpp:239
llvm::IRBuilderBase::getInt1
ConstantInt * getInt1(bool V)
Get a constant value representing either true or false.
Definition: IRBuilder.h:444
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:159
llvm::IRBuilderBase::CreateGCGetPointerBase
CallInst * CreateGCGetPointerBase(Value *DerivedPtr, const Twine &Name="")
Create a call to the experimental.gc.pointer.base intrinsic to get the base pointer for the specified...
Definition: IRBuilder.cpp:927
llvm::IRBuilderBase::CreateInvariantStart
CallInst * CreateInvariantStart(Value *Ptr, ConstantInt *Size=nullptr)
Create a call to invariant.start intrinsic.
Definition: IRBuilder.cpp:509
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::Instruction::setMetadata
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
Definition: Metadata.cpp:1456
llvm::IRBuilderBase::CreateBinOp
Value * CreateBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:1571
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove
CallInst * CreateElementUnorderedAtomicMemMove(Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memmove between the specified pointers.
Definition: IRBuilder.cpp:373
llvm::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
llvm::IRBuilderBase::CreateConstrainedFPBinOp
CallInst * CreateConstrainedFPBinOp(Intrinsic::ID ID, Value *L, Value *R, Instruction *FMFSource=nullptr, const Twine &Name="", MDNode *FPMathTag=nullptr, Optional< RoundingMode > Rounding=None, Optional< fp::ExceptionBehavior > Except=None)
Definition: IRBuilder.cpp:999
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet
CallInst * CreateElementUnorderedAtomicMemSet(Value *Ptr, Value *Val, uint64_t Size, Align Alignment, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memset of the region of memory starting at the given po...
Definition: IRBuilder.h:602
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
llvm::IRBuilderBase::CreateMul
Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1267
llvm::SelectInst::Create
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr, Instruction *MDFrom=nullptr)
Definition: Instructions.h:1767
llvm::IRBuilderBase::CreateThreadLocalAddress
CallInst * CreateThreadLocalAddress(Value *Ptr)
Create a call to llvm.threadlocal.address intrinsic.
Definition: IRBuilder.cpp:537
GlobalValue.h
llvm::IRBuilderBase::CreateGCStatepointCall
CallInst * CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualCallee, ArrayRef< Value * > CallArgs, Optional< ArrayRef< Value * >> DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
Create a call to the experimental.gc.statepoint intrinsic to start a new statepoint sequence.
Definition: IRBuilder.cpp:817
llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy
CallInst * CreateElementUnorderedAtomicMemCpy(Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memcpy between the specified pointers.
Definition: IRBuilder.cpp:298
Constants.h
isZero
static bool isZero(Value *V, const DataLayout &DL, DominatorTree *DT, AssumptionCache *AC)
Definition: Lint.cpp:524
llvm::IRBuilderFolder::FoldSelect
virtual Value * FoldSelect(Value *C, Value *True, Value *False) const =0
llvm::IRBuilderDefaultInserter::~IRBuilderDefaultInserter
virtual ~IRBuilderDefaultInserter()
llvm::IRBuilderBase::CreateVectorSplice
Value * CreateVectorSplice(Value *V1, Value *V2, int64_t Imm, const Twine &Name="")
Return a vector splice intrinsic if using scalable vectors, otherwise return a shufflevector.
Definition: IRBuilder.cpp:1218
llvm::IRBuilderBase::CreateMemTransferInst
CallInst * CreateMemTransferInst(Intrinsic::ID IntrID, Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Definition: IRBuilder.cpp:223
llvm::IRBuilderBase::CreateMemSet
CallInst * CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, MaybeAlign Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memset to the specified pointer and the specified value.
Definition: IRBuilder.h:577
Intrinsics.h
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::IRBuilderBase::CreateExactSDiv
Value * CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name="")
Definition: IRBuilder.h:1306
llvm::FCmpInst
This instruction compares its operands according to the predicate given to the constructor.
Definition: Instructions.h:1359
llvm::CallInst::Create
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:1516
llvm::IRBuilderBase::CreateUnOp
Value * CreateUnOp(Instruction::UnaryOps Opc, Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:1645
llvm::Type::isVectorTy
bool isVectorTy() const
True if this is an instance of VectorType.
Definition: Type.h:246
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::Constant::getAllOnesValue
static Constant * getAllOnesValue(Type *Ty)
Definition: Constants.cpp:395
llvm::IRBuilderBase::CreatePreserveStructAccessIndex
Value * CreatePreserveStructAccessIndex(Type *ElTy, Value *Base, unsigned Index, unsigned FieldIndex, MDNode *DbgInfo)
Definition: IRBuilder.cpp:1342
llvm::Instruction
Definition: Instruction.h:42
llvm::Type::getScalarSizeInBits
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition: Type.cpp:189
llvm::IRBuilderBase::CreateXorReduce
CallInst * CreateXorReduce(Value *Src)
Create a vector int XOR reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:453
llvm::IRBuilderBase::getInt8Ty
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
Definition: IRBuilder.h:499
llvm::IRBuilderBase::getContext
LLVMContext & getContext() const
Definition: IRBuilder.h:175
llvm::IRBuilderBase::CreateMaskedGather
CallInst * CreateMaskedGather(Type *Ty, Value *Ptrs, Align Alignment, Value *Mask=nullptr, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Gather intrinsic.
Definition: IRBuilder.cpp:642
llvm::SmallVectorImpl::resize
void resize(size_type N)
Definition: SmallVector.h:642
llvm::ConstantInt::get
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Definition: Constants.cpp:879
llvm::FunctionCallee::getFunctionType
FunctionType * getFunctionType()
Definition: DerivedTypes.h:182
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::CreateVScale
Value * CreateVScale(Constant *Scaling, const Twine &Name="")
Create a call to llvm.vscale, multiplied by Scaling.
Definition: IRBuilder.cpp:97
Align
uint64_t Align
Definition: ELFObjHandler.cpp:82
llvm::IRBuilderBase::CreateFPMaxReduce
CallInst * CreateFPMaxReduce(Value *Src)
Create a vector float max reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:469
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::IRBuilderBase::getCurrentDebugLocation
DebugLoc getCurrentDebugLocation() const
Get location information used by debugging information.
Definition: IRBuilder.cpp:72
llvm::AddressSpace
AddressSpace
Definition: NVPTXBaseInfo.h:21
llvm::LinearPolySize< ElementCount >::getFixed
static ElementCount getFixed(ScalarTy MinVal)
Definition: TypeSize.h:283
Statepoint.h
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
Type.h
llvm::Instruction::getMetadata
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
Definition: Instruction.h:271
llvm::IRBuilderBase::CreateLifetimeStart
CallInst * CreateLifetimeStart(Value *Ptr, ConstantInt *Size=nullptr)
Create a lifetime.start intrinsic.
Definition: IRBuilder.cpp:477
llvm::IRBuilderBase::CreateLaunderInvariantGroup
Value * CreateLaunderInvariantGroup(Value *Ptr)
Create a launder.invariant.group intrinsic call.
Definition: IRBuilder.cpp:1153
llvm::InvokeInst
Invoke instruction.
Definition: Instructions.h:3810
llvm::Intrinsic::MatchIntrinsicTypes_Match
@ MatchIntrinsicTypes_Match
Definition: Intrinsics.h:220
llvm::IRBuilderBase::CreateMaskedCompressStore
CallInst * CreateMaskedCompressStore(Value *Val, Value *Ptr, Value *Mask=nullptr)
Create a call to Masked Compress Store intrinsic.
Definition: IRBuilder.cpp:734
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:264
llvm::IRBuilderBase::CreateBitCast
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:1985
BaseType
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
Definition: SafepointIRVerifier.cpp:314
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::Function::getReturnType
Type * getReturnType() const
Returns the type of the ret val.
Definition: Function.h:180
llvm::IRBuilderBase::getIntPtrTy
IntegerType * getIntPtrTy(const DataLayout &DL, unsigned AddrSpace=0)
Fetch the type of an integer with size at least as big as that of a pointer in the given address spac...
Definition: IRBuilder.h:563
llvm::StatepointFlags::None
@ None
llvm::IRBuilderBase::CreatePreserveArrayAccessIndex
Value * CreatePreserveArrayAccessIndex(Type *ElTy, Value *Base, unsigned Dimension, unsigned LastIndex, MDNode *DbgInfo)
Definition: IRBuilder.cpp:1291
uint64_t
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:650
llvm::IRBuilderBase::getInt32
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
Definition: IRBuilder.h:469
llvm::Intrinsic::getIntrinsicInfoTableEntries
void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl< IITDescriptor > &T)
Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors.
Definition: Function.cpp:1299
TableRef
ArrayRef< TableEntry > TableRef
Definition: AMDGPULibCalls.cpp:380
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::FunctionType::getParamType
Type * getParamType(unsigned i) const
Parameter type accessors.
Definition: DerivedTypes.h:135
llvm::IRBuilderBase::getInt8PtrTy
PointerType * getInt8PtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer to an 8-bit integer value.
Definition: IRBuilder.h:557
llvm::IRBuilderBase::Context
LLVMContext & Context
Definition: IRBuilder.h:120
llvm::IRBuilderBase::CreateSelect
Value * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="", Instruction *MDFrom=nullptr)
Definition: IRBuilder.cpp:1123
llvm::IRBuilderBase::CreateFPMinReduce
CallInst * CreateFPMinReduce(Value *Src)
Create a vector float min reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:473
llvm::IRBuilderBase::CreateIntMinReduce
CallInst * CreateIntMinReduce(Value *Src, bool IsSigned=false)
Create a vector integer min reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:463
ArrayRef.h
llvm::CallBase::addRetAttr
void addRetAttr(Attribute::AttrKind Kind)
Adds the attribute to the return value.
Definition: InstrTypes.h:1516
llvm::IRBuilderBase::CreateConstrainedFPCmp
CallInst * CreateConstrainedFPCmp(Intrinsic::ID ID, CmpInst::Predicate P, Value *L, Value *R, const Twine &Name="", Optional< fp::ExceptionBehavior > Except=None)
Definition: IRBuilder.cpp:1085
IRBuilder.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::IRBuilderBase::CreateFMulReduce
CallInst * CreateFMulReduce(Value *Acc, Value *Src)
Create a sequential vector fmul reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:429
llvm::Instruction::getFastMathFlags
FastMathFlags getFastMathFlags() const LLVM_READONLY
Convenience function for getting all the fast-math flags, which must be an operator which supports th...
Definition: Instruction.cpp:319
llvm::IRBuilderBase::CreateGCResult
CallInst * CreateGCResult(Instruction *Statepoint, Type *ResultType, const Twine &Name="")
Create a call to the experimental.gc.result intrinsic to extract the result from a call wrapped in a ...
Definition: IRBuilder.cpp:904
Ptr
@ Ptr
Definition: TargetLibraryInfo.cpp:60
llvm::SelectInst
This class represents the LLVM 'select' instruction.
Definition: Instructions.h:1736
llvm::Instruction::isBinaryOp
bool isBinaryOp() const
Definition: Instruction.h:169
llvm::IRBuilderBase::CreateIntrinsic
CallInst * CreateIntrinsic(Intrinsic::ID ID, ArrayRef< Type * > Types, ArrayRef< Value * > Args, Instruction *FMFSource=nullptr, const Twine &Name="")
Create a call to intrinsic ID with Args, mangled using Types.
Definition: IRBuilder.cpp:962
CreateGCStatepointInvokeCommon
static InvokeInst * CreateGCStatepointInvokeCommon(IRBuilderBase *Builder, uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest, uint32_t Flags, ArrayRef< T0 > InvokeArgs, Optional< ArrayRef< T1 >> TransitionArgs, Optional< ArrayRef< T2 >> DeoptArgs, ArrayRef< T3 > GCArgs, const Twine &Name)
Definition: IRBuilder.cpp:846
llvm::IRBuilderBase::CreateAndReduce
CallInst * CreateAndReduce(Value *Src)
Create a vector int AND reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:445
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
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::ConstantExpr::getSizeOf
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
Definition: Constants.cpp:2351
llvm::IRBuilderCallbackInserter::~IRBuilderCallbackInserter
~IRBuilderCallbackInserter() override
getType
static M68kRelType getType(unsigned Kind, MCSymbolRefExpr::VariantKind &Modifier, bool &IsPCRel)
Definition: M68kELFObjectWriter.cpp:48
llvm::IRBuilderBase::CreateNoAliasScopeDeclaration
Instruction * CreateNoAliasScopeDeclaration(Value *Scope)
Create a llvm.experimental.noalias.scope.decl intrinsic call.
Definition: IRBuilder.cpp:572
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::IRBuilderBase::IsFPConstrained
bool IsFPConstrained
Definition: IRBuilder.h:127
None.h
Cond
SmallVector< MachineOperand, 4 > Cond
Definition: BasicBlockSections.cpp:138
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:255
llvm::IRBuilderBase::CreateGCGetPointerOffset
CallInst * CreateGCGetPointerOffset(Value *DerivedPtr, const Twine &Name="")
Create a call to the experimental.gc.get.pointer.offset intrinsic to get the offset of the specified ...
Definition: IRBuilder.cpp:936
uint32_t
llvm::append_range
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
Definition: STLExtras.h:1988
llvm::Value::getContext
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:994
llvm::IRBuilderBase
Common base class shared among various IRBuilders.
Definition: IRBuilder.h:93
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::ConstantDataArray::getString
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
Definition: Constants.cpp:2967
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::Instruction::copyFastMathFlags
void copyFastMathFlags(FastMathFlags FMF)
Convenience function for transferring all fast-math flag values to this instruction,...
Definition: Instruction.cpp:274
llvm::ConstantVector::get
static Constant * get(ArrayRef< Constant * > V)
Definition: Constants.cpp:1348
llvm::IRBuilderBase::CreateMaskedScatter
CallInst * CreateMaskedScatter(Value *Val, Value *Ptrs, Align Alignment, Value *Mask=nullptr)
Create a call to Masked Scatter intrinsic.
Definition: IRBuilder.cpp:678
llvm::IRBuilderBase::BB
BasicBlock * BB
Definition: IRBuilder.h:118
llvm::IRBuilderBase::CreateTrunc
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
Definition: IRBuilder.h:1889
llvm::FunctionCallee::getCallee
Value * getCallee()
Definition: DerivedTypes.h:184
llvm::IRBuilderBase::CreateAddReduce
CallInst * CreateAddReduce(Value *Src)
Create a vector int add reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:437
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:187
llvm::Attribute::getWithAlignment
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
Definition: Attributes.cpp:167
Constant.h
llvm::NVPTX::PTXLdStInstCode::V2
@ V2
Definition: NVPTX.h:123
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
CreateGCStatepointCallCommon
static CallInst * CreateGCStatepointCallCommon(IRBuilderBase *Builder, uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualCallee, uint32_t Flags, ArrayRef< T0 > CallArgs, Optional< ArrayRef< T1 >> TransitionArgs, Optional< ArrayRef< T2 >> DeoptArgs, ArrayRef< T3 > GCArgs, const Twine &Name)
Definition: IRBuilder.cpp:794
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:240
llvm::ConstantInt::getTrue
static ConstantInt * getTrue(LLVMContext &Context)
Definition: Constants.cpp:827
llvm::None
constexpr std::nullopt_t None
Definition: None.h:27
llvm::IRBuilderBase::CreateGCStatepointInvoke
InvokeInst * CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > InvokeArgs, Optional< ArrayRef< Value * >> DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
Create an invoke to the experimental.gc.statepoint intrinsic to start a new statepoint sequence.
Definition: IRBuilder.cpp:871
llvm::Align::value
uint64_t value() const
This is a hole in the type system and should not be abused.
Definition: Alignment.h:85
llvm::IRBuilderBase::Insert
InstTy * Insert(InstTy *I, const Twine &Name="") const
Insert and return the specified instruction.
Definition: IRBuilder.h:144
GlobalVariable.h
llvm::IRBuilderBase::CreateMaskedExpandLoad
CallInst * CreateMaskedExpandLoad(Type *Ty, Value *Ptr, Value *Mask=nullptr, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Expand Load intrinsic.
Definition: IRBuilder.cpp:711
llvm::IRBuilderBase::getInt64
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
Definition: IRBuilder.h:474
llvm::IRBuilderBase::GetInsertBlock
BasicBlock * GetInsertBlock() const
Definition: IRBuilder.h:173
Casting.h
Function.h
llvm::IRBuilderFolder::~IRBuilderFolder
virtual ~IRBuilderFolder()
llvm::IRBuilderBase::CreatePtrDiff
Value * CreatePtrDiff(Type *ElemTy, Value *LHS, Value *RHS, const Twine &Name="")
Return the i64 difference between two pointer values, dividing out the size of the pointed-to objects...
Definition: IRBuilder.cpp:1139
llvm::Function::getFunctionType
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Definition: Function.h:175
llvm::IRBuilderBase::CreateFAddReduce
CallInst * CreateFAddReduce(Value *Acc, Value *Src)
Create a sequential vector fadd reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:421
llvm::getAlign
bool getAlign(const Function &F, unsigned index, unsigned &align)
Definition: NVPTXUtilities.cpp:294
llvm::RISCVMatInt::Imm
@ Imm
Definition: RISCVMatInt.h:23
llvm::IRBuilderBase::CreateExtractInteger
Value * CreateExtractInteger(const DataLayout &DL, Value *From, IntegerType *ExtractedTy, uint64_t Offset, const Twine &Name)
Return a value that has been extracted from a larger integer type.
Definition: IRBuilder.cpp:1268
llvm::Instruction::BinaryOps
BinaryOps
Definition: Instruction.h:788
llvm::IRBuilderBase::getInt1Ty
IntegerType * getInt1Ty()
Fetch the type representing a single bit.
Definition: IRBuilder.h:494
llvm::GlobalValue::PrivateLinkage
@ PrivateLinkage
Like Internal, but omit from symbol table.
Definition: GlobalValue.h:56
llvm::IRBuilderBase::CreateMemMove
CallInst * CreateMemMove(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, uint64_t Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Definition: IRBuilder.h:673
llvm::IRBuilderBase::CreateLShr
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Definition: IRBuilder.h:1343
llvm::IRBuilderBase::CreateMaskedStore
CallInst * CreateMaskedStore(Value *Val, Value *Ptr, Align Alignment, Value *Mask)
Create a call to Masked Store intrinsic.
Definition: IRBuilder.cpp:609
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:164
llvm::IntegerType::getBitWidth
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition: DerivedTypes.h:72
llvm::Intrinsic::matchIntrinsicSignature
MatchIntrinsicTypesResult matchIntrinsicSignature(FunctionType *FTy, ArrayRef< IITDescriptor > &Infos, SmallVectorImpl< Type * > &ArgTys)
Match the specified function type with the type constraints specified by the .td file.
Definition: Function.cpp:1780
llvm::Instruction::isUnaryOp
bool isUnaryOp() const
Definition: Instruction.h:168
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::CreateGCRelocate
CallInst * CreateGCRelocate(Instruction *Statepoint, int BaseOffset, int DerivedOffset, Type *ResultType, const Twine &Name="")
Create a call to the experimental.gc.relocate intrinsics to project the relocated value of one pointe...
Definition: IRBuilder.cpp:915
getStatepointBundles
static std::vector< OperandBundleDef > getStatepointBundles(Optional< ArrayRef< T1 >> TransitionArgs, Optional< ArrayRef< T2 >> DeoptArgs, ArrayRef< T3 > GCArgs)
Definition: IRBuilder.cpp:771
llvm::IRBuilderBase::CreateVectorSplat
Value * CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name="")
Return a vector value that contains.
Definition: IRBuilder.cpp:1246
llvm::IRBuilderBase::CreateStepVector
Value * CreateStepVector(Type *DstType, const Twine &Name="")
Creates a vector of type DstType with the linear sequence <0, 1, ...>
Definition: IRBuilder.cpp:110
DerivedTypes.h
llvm::CallInst
This class represents a function call, abstracting a target machine's calling convention.
Definition: Instructions.h:1473
LLVMContext.h
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::IRBuilderBase::CreateSub
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Definition: IRBuilder.h:1250
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
llvm::AMDGPU::VGPRIndexMode::Id
Id
Definition: SIDefines.h:241
llvm::IRBuilderBase::getCurrentFunctionReturnType
Type * getCurrentFunctionReturnType() const
Get the return type of the current function that we're emitting into.
Definition: IRBuilder.cpp:58
llvm::Intrinsic::MatchIntrinsicTypesResult
MatchIntrinsicTypesResult
Definition: Intrinsics.h:219
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:667
llvm::IRBuilderBase::CreateAlignmentAssumption
CallInst * CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue, unsigned Alignment, Value *OffsetValue=nullptr)
Create an assume intrinsic call that represents an alignment assumption on the provided pointer.
Definition: IRBuilder.cpp:1382
Value.h
llvm::IRBuilderBase::CreateMemCpyInline
CallInst * CreateMemCpyInline(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool IsVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Definition: IRBuilder.cpp:260
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::VectorType::get
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Definition: Type.cpp:668
llvm::IRBuilderBase::CreateOrReduce
CallInst * CreateOrReduce(Value *Src)
Create a vector int OR reduction intrinsic of the source vector.
Definition: IRBuilder.cpp:449
llvm::IRBuilderBase::CreateCall
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
Definition: IRBuilder.h:2269
llvm::IRBuilderBase::CreateMaskedLoad
CallInst * CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment, Value *Mask, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Load intrinsic.
Definition: IRBuilder.cpp:588
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:39
llvm::AArch64::Rounding
Rounding
Possible values of current rounding mode, which is specified in bits 23:22 of FPCR.
Definition: AArch64ISelLowering.h:484
llvm::PoisonValue::get
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Definition: Constants.cpp:1732