LLVM  16.0.0git
IntrinsicInst.cpp
Go to the documentation of this file.
1 //===-- IntrinsicInst.cpp - Intrinsic Instruction Wrappers ---------------===//
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 methods that make it really easy to deal with intrinsic
10 // functions.
11 //
12 // All intrinsic function calls are instances of the call instruction, so these
13 // are all subclasses of the CallInst class. Note that none of these classes
14 // has state or virtual methods, which is an important part of this gross/neat
15 // hack working.
16 //
17 // In some cases, arguments to intrinsics need to be generic and are defined as
18 // type pointer to empty struct { }*. To access the real item of interest the
19 // cast instruction needs to be stripped away.
20 //
21 //===----------------------------------------------------------------------===//
22 
23 #include "llvm/IR/IntrinsicInst.h"
24 #include "llvm/ADT/StringSwitch.h"
25 #include "llvm/IR/Constants.h"
27 #include "llvm/IR/Metadata.h"
28 #include "llvm/IR/Module.h"
29 #include "llvm/IR/Operator.h"
30 #include "llvm/IR/PatternMatch.h"
31 #include "llvm/IR/Statepoint.h"
32 #include <optional>
33 
34 using namespace llvm;
35 
37  switch (IID) {
38  case Intrinsic::objc_autorelease:
39  case Intrinsic::objc_autoreleasePoolPop:
40  case Intrinsic::objc_autoreleasePoolPush:
41  case Intrinsic::objc_autoreleaseReturnValue:
42  case Intrinsic::objc_copyWeak:
43  case Intrinsic::objc_destroyWeak:
44  case Intrinsic::objc_initWeak:
45  case Intrinsic::objc_loadWeak:
46  case Intrinsic::objc_loadWeakRetained:
47  case Intrinsic::objc_moveWeak:
48  case Intrinsic::objc_release:
49  case Intrinsic::objc_retain:
50  case Intrinsic::objc_retainAutorelease:
51  case Intrinsic::objc_retainAutoreleaseReturnValue:
52  case Intrinsic::objc_retainAutoreleasedReturnValue:
53  case Intrinsic::objc_retainBlock:
54  case Intrinsic::objc_storeStrong:
55  case Intrinsic::objc_storeWeak:
56  case Intrinsic::objc_unsafeClaimAutoreleasedReturnValue:
57  case Intrinsic::objc_retainedObject:
58  case Intrinsic::objc_unretainedObject:
59  case Intrinsic::objc_unretainedPointer:
60  case Intrinsic::objc_retain_autorelease:
61  case Intrinsic::objc_sync_enter:
62  case Intrinsic::objc_sync_exit:
63  return true;
64  default:
65  return false;
66  }
67 }
68 
69 //===----------------------------------------------------------------------===//
70 /// DbgVariableIntrinsic - This is the common base class for debug info
71 /// intrinsics for variables.
72 ///
73 
76  auto *MD = getRawLocation();
77  assert(MD && "First operand of DbgVariableIntrinsic should be non-null.");
78 
79  // If operand is ValueAsMetadata, return a range over just that operand.
80  if (auto *VAM = dyn_cast<ValueAsMetadata>(MD)) {
81  return {location_op_iterator(VAM), location_op_iterator(VAM + 1)};
82  }
83  // If operand is DIArgList, return a range over its args.
84  if (auto *AL = dyn_cast<DIArgList>(MD))
85  return {location_op_iterator(AL->args_begin()),
86  location_op_iterator(AL->args_end())};
87  // Operand must be an empty metadata tuple, so return empty iterator.
88  return {location_op_iterator(static_cast<ValueAsMetadata *>(nullptr)),
89  location_op_iterator(static_cast<ValueAsMetadata *>(nullptr))};
90 }
91 
93  auto *MD = getRawLocation();
94  assert(MD && "First operand of DbgVariableIntrinsic should be non-null.");
95  if (auto *AL = dyn_cast<DIArgList>(MD))
96  return AL->getArgs()[OpIdx]->getValue();
97  if (isa<MDNode>(MD))
98  return nullptr;
99  assert(
100  isa<ValueAsMetadata>(MD) &&
101  "Attempted to get location operand from DbgVariableIntrinsic with none.");
102  auto *V = cast<ValueAsMetadata>(MD);
103  assert(OpIdx == 0 && "Operand Index must be 0 for a debug intrinsic with a "
104  "single location operand.");
105  return V->getValue();
106 }
107 
109  return isa<MetadataAsValue>(V) ? dyn_cast<ValueAsMetadata>(
110  cast<MetadataAsValue>(V)->getMetadata())
112 }
113 
115  Value *NewValue) {
116  // If OldValue is used as the address part of a dbg.assign intrinsic replace
117  // it with NewValue and return true.
118  auto ReplaceDbgAssignAddress = [this, OldValue, NewValue]() -> bool {
119  auto *DAI = dyn_cast<DbgAssignIntrinsic>(this);
120  if (!DAI || OldValue != DAI->getAddress())
121  return false;
122  DAI->setAddress(NewValue);
123  return true;
124  };
125  bool DbgAssignAddrReplaced = ReplaceDbgAssignAddress();
126  (void)DbgAssignAddrReplaced;
127 
128  assert(NewValue && "Values must be non-null");
129  auto Locations = location_ops();
130  auto OldIt = find(Locations, OldValue);
131  assert((OldIt != Locations.end() || DbgAssignAddrReplaced) &&
132  "OldValue must be a current location");
133  if (!hasArgList()) {
134  // Additional check necessary to avoid unconditionally replacing this
135  // operand when a dbg.assign address is replaced (DbgAssignAddrReplaced is
136  // true).
137  if (OldValue != getVariableLocationOp(0))
138  return;
139  Value *NewOperand = isa<MetadataAsValue>(NewValue)
140  ? NewValue
142  getContext(), ValueAsMetadata::get(NewValue));
143  return setArgOperand(0, NewOperand);
144  }
146  ValueAsMetadata *NewOperand = getAsMetadata(NewValue);
147  for (auto *VMD : Locations)
148  MDs.push_back(VMD == *OldIt ? NewOperand : getAsMetadata(VMD));
151 }
153  Value *NewValue) {
154  assert(OpIdx < getNumVariableLocationOps() && "Invalid Operand Index");
155  if (!hasArgList()) {
156  Value *NewOperand = isa<MetadataAsValue>(NewValue)
157  ? NewValue
159  getContext(), ValueAsMetadata::get(NewValue));
160  return setArgOperand(0, NewOperand);
161  }
163  ValueAsMetadata *NewOperand = getAsMetadata(NewValue);
164  for (unsigned Idx = 0; Idx < getNumVariableLocationOps(); ++Idx)
165  MDs.push_back(Idx == OpIdx ? NewOperand
169 }
170 
173  assert(NewExpr->hasAllLocationOps(getNumVariableLocationOps() +
174  NewValues.size()) &&
175  "NewExpr for debug variable intrinsic does not reference every "
176  "location operand.");
177  assert(!is_contained(NewValues, nullptr) && "New values must be non-null");
180  for (auto *VMD : location_ops())
181  MDs.push_back(getAsMetadata(VMD));
182  for (auto *VMD : NewValues)
183  MDs.push_back(getAsMetadata(VMD));
186 }
187 
188 std::optional<uint64_t> DbgVariableIntrinsic::getFragmentSizeInBits() const {
189  if (auto Fragment = getExpression()->getFragmentInfo())
190  return Fragment->SizeInBits;
191  return getVariable()->getSizeInBits();
192 }
193 
195  auto *MD = getRawAddress();
196  if (auto *V = dyn_cast<ValueAsMetadata>(MD))
197  return V->getValue();
198 
199  // When the value goes to null, it gets replaced by an empty MDNode.
200  assert(!cast<MDNode>(MD)->getNumOperands() && "Expected an empty MDNode");
201  return nullptr;
202 }
203 
205  setOperand(OpAssignID, MetadataAsValue::get(getContext(), New));
206 }
207 
209  assert(V->getType()->isPointerTy() &&
210  "Destination Component must be a pointer type");
211  setOperand(OpAddress,
213 }
214 
216  setOperand(OpValue,
218 }
219 
221  StringRef Name) {
222  assert(Name.startswith("llvm."));
223 
224  // Do successive binary searches of the dotted name components. For
225  // "llvm.gc.experimental.statepoint.p1i8.p1i32", we will find the range of
226  // intrinsics starting with "llvm.gc", then "llvm.gc.experimental", then
227  // "llvm.gc.experimental.statepoint", and then we will stop as the range is
228  // size 1. During the search, we can skip the prefix that we already know is
229  // identical. By using strncmp we consider names with differing suffixes to
230  // be part of the equal range.
231  size_t CmpEnd = 4; // Skip the "llvm" component.
232  const char *const *Low = NameTable.begin();
233  const char *const *High = NameTable.end();
234  const char *const *LastLow = Low;
235  while (CmpEnd < Name.size() && High - Low > 0) {
236  size_t CmpStart = CmpEnd;
237  CmpEnd = Name.find('.', CmpStart + 1);
238  CmpEnd = CmpEnd == StringRef::npos ? Name.size() : CmpEnd;
239  auto Cmp = [CmpStart, CmpEnd](const char *LHS, const char *RHS) {
240  return strncmp(LHS + CmpStart, RHS + CmpStart, CmpEnd - CmpStart) < 0;
241  };
242  LastLow = Low;
243  std::tie(Low, High) = std::equal_range(Low, High, Name.data(), Cmp);
244  }
245  if (High - Low > 0)
246  LastLow = Low;
247 
248  if (LastLow == NameTable.end())
249  return -1;
250  StringRef NameFound = *LastLow;
251  if (Name == NameFound ||
252  (Name.startswith(NameFound) && Name[NameFound.size()] == '.'))
253  return LastLow - NameTable.begin();
254  return -1;
255 }
256 
259  llvm_unreachable("InstrProfValueProfileInst does not have counters!");
260  return cast<ConstantInt>(const_cast<Value *>(getArgOperand(2)));
261 }
262 
265  llvm_unreachable("Please use InstrProfValueProfileInst::getIndex()");
266  return cast<ConstantInt>(const_cast<Value *>(getArgOperand(3)));
267 }
268 
271  return const_cast<Value *>(getArgOperand(4));
272  }
273  const Module *M = getModule();
274  LLVMContext &Context = M->getContext();
276 }
277 
278 std::optional<RoundingMode> ConstrainedFPIntrinsic::getRoundingMode() const {
279  unsigned NumOperands = arg_size();
280  Metadata *MD = nullptr;
281  auto *MAV = dyn_cast<MetadataAsValue>(getArgOperand(NumOperands - 2));
282  if (MAV)
283  MD = MAV->getMetadata();
284  if (!MD || !isa<MDString>(MD))
285  return std::nullopt;
286  return convertStrToRoundingMode(cast<MDString>(MD)->getString());
287 }
288 
289 std::optional<fp::ExceptionBehavior>
291  unsigned NumOperands = arg_size();
292  Metadata *MD = nullptr;
293  auto *MAV = dyn_cast<MetadataAsValue>(getArgOperand(NumOperands - 1));
294  if (MAV)
295  MD = MAV->getMetadata();
296  if (!MD || !isa<MDString>(MD))
297  return std::nullopt;
298  return convertStrToExceptionBehavior(cast<MDString>(MD)->getString());
299 }
300 
302  std::optional<fp::ExceptionBehavior> Except = getExceptionBehavior();
303  if (Except) {
304  if (Except.value() != fp::ebIgnore)
305  return false;
306  }
307 
308  std::optional<RoundingMode> Rounding = getRoundingMode();
309  if (Rounding) {
311  return false;
312  }
313 
314  return true;
315 }
316 
318  Metadata *MD = cast<MetadataAsValue>(Op)->getMetadata();
319  if (!MD || !isa<MDString>(MD))
321  return StringSwitch<FCmpInst::Predicate>(cast<MDString>(MD)->getString())
322  .Case("oeq", FCmpInst::FCMP_OEQ)
323  .Case("ogt", FCmpInst::FCMP_OGT)
324  .Case("oge", FCmpInst::FCMP_OGE)
325  .Case("olt", FCmpInst::FCMP_OLT)
326  .Case("ole", FCmpInst::FCMP_OLE)
327  .Case("one", FCmpInst::FCMP_ONE)
328  .Case("ord", FCmpInst::FCMP_ORD)
329  .Case("uno", FCmpInst::FCMP_UNO)
330  .Case("ueq", FCmpInst::FCMP_UEQ)
331  .Case("ugt", FCmpInst::FCMP_UGT)
332  .Case("uge", FCmpInst::FCMP_UGE)
333  .Case("ult", FCmpInst::FCMP_ULT)
334  .Case("ule", FCmpInst::FCMP_ULE)
335  .Case("une", FCmpInst::FCMP_UNE)
337 }
338 
341 }
342 
344  switch (getIntrinsicID()) {
345  default:
346  return false;
347 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
348  case Intrinsic::INTRINSIC: \
349  return NARG == 1;
350 #include "llvm/IR/ConstrainedOps.def"
351  }
352 }
353 
355  switch (getIntrinsicID()) {
356  default:
357  return false;
358 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
359  case Intrinsic::INTRINSIC: \
360  return NARG == 3;
361 #include "llvm/IR/ConstrainedOps.def"
362  }
363 }
364 
366  switch (I->getIntrinsicID()) {
367 #define INSTRUCTION(NAME, NARGS, ROUND_MODE, INTRINSIC) \
368  case Intrinsic::INTRINSIC:
369 #include "llvm/IR/ConstrainedOps.def"
370  return true;
371  default:
372  return false;
373  }
374 }
375 
377  auto GetVectorLengthOfType = [](const Type *T) -> ElementCount {
378  const auto *VT = cast<VectorType>(T);
379  auto ElemCount = VT->getElementCount();
380  return ElemCount;
381  };
382 
383  Value *VPMask = getMaskParam();
384  if (!VPMask) {
385  assert((getIntrinsicID() == Intrinsic::vp_merge ||
386  getIntrinsicID() == Intrinsic::vp_select) &&
387  "Unexpected VP intrinsic without mask operand");
388  return GetVectorLengthOfType(getType());
389  }
390  return GetVectorLengthOfType(VPMask->getType());
391 }
392 
394  if (auto MaskPos = getMaskParamPos(getIntrinsicID()))
395  return getArgOperand(*MaskPos);
396  return nullptr;
397 }
398 
400  auto MaskPos = getMaskParamPos(getIntrinsicID());
401  setArgOperand(*MaskPos, NewMask);
402 }
403 
405  if (auto EVLPos = getVectorLengthParamPos(getIntrinsicID()))
406  return getArgOperand(*EVLPos);
407  return nullptr;
408 }
409 
411  auto EVLPos = getVectorLengthParamPos(getIntrinsicID());
412  setArgOperand(*EVLPos, NewEVL);
413 }
414 
415 std::optional<unsigned>
417  switch (IntrinsicID) {
418  default:
419  return std::nullopt;
420 
421 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
422  case Intrinsic::VPID: \
423  return MASKPOS;
424 #include "llvm/IR/VPIntrinsics.def"
425  }
426 }
427 
428 std::optional<unsigned>
430  switch (IntrinsicID) {
431  default:
432  return std::nullopt;
433 
434 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
435  case Intrinsic::VPID: \
436  return VLENPOS;
437 #include "llvm/IR/VPIntrinsics.def"
438  }
439 }
440 
441 /// \return the alignment of the pointer used by this load/store/gather or
442 /// scatter.
444  std::optional<unsigned> PtrParamOpt =
446  assert(PtrParamOpt && "no pointer argument!");
447  return getParamAlign(PtrParamOpt.value());
448 }
449 
450 /// \return The pointer operand of this load,store, gather or scatter.
452  if (auto PtrParamOpt = getMemoryPointerParamPos(getIntrinsicID()))
453  return getArgOperand(PtrParamOpt.value());
454  return nullptr;
455 }
456 
457 std::optional<unsigned>
459  switch (VPID) {
460  default:
461  break;
462 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
463 #define VP_PROPERTY_MEMOP(POINTERPOS, ...) return POINTERPOS;
464 #define END_REGISTER_VP_INTRINSIC(VPID) break;
465 #include "llvm/IR/VPIntrinsics.def"
466  }
467  return std::nullopt;
468 }
469 
470 /// \return The data (payload) operand of this store or scatter.
472  auto DataParamOpt = getMemoryDataParamPos(getIntrinsicID());
473  if (!DataParamOpt)
474  return nullptr;
475  return getArgOperand(DataParamOpt.value());
476 }
477 
478 std::optional<unsigned> VPIntrinsic::getMemoryDataParamPos(Intrinsic::ID VPID) {
479  switch (VPID) {
480  default:
481  break;
482 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
483 #define VP_PROPERTY_MEMOP(POINTERPOS, DATAPOS) return DATAPOS;
484 #define END_REGISTER_VP_INTRINSIC(VPID) break;
485 #include "llvm/IR/VPIntrinsics.def"
486  }
487  return std::nullopt;
488 }
489 
491  switch (ID) {
492  default:
493  break;
494 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
495  case Intrinsic::VPID: \
496  return true;
497 #include "llvm/IR/VPIntrinsics.def"
498  }
499  return false;
500 }
501 
502 // Equivalent non-predicated opcode
503 std::optional<unsigned>
505  switch (ID) {
506  default:
507  break;
508 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
509 #define VP_PROPERTY_FUNCTIONAL_OPC(OPC) return Instruction::OPC;
510 #define END_REGISTER_VP_INTRINSIC(VPID) break;
511 #include "llvm/IR/VPIntrinsics.def"
512  }
513  return std::nullopt;
514 }
515 
517  switch (IROPC) {
518  default:
519  break;
520 
521 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) break;
522 #define VP_PROPERTY_FUNCTIONAL_OPC(OPC) case Instruction::OPC:
523 #define END_REGISTER_VP_INTRINSIC(VPID) return Intrinsic::VPID;
524 #include "llvm/IR/VPIntrinsics.def"
525  }
527 }
528 
530  using namespace PatternMatch;
531 
533 
534  // No vlen param - no lanes masked-off by it.
535  auto *VLParam = getVectorLengthParam();
536  if (!VLParam)
537  return true;
538 
539  // Note that the VP intrinsic causes undefined behavior if the Explicit Vector
540  // Length parameter is strictly greater-than the number of vector elements of
541  // the operation. This function returns true when this is detected statically
542  // in the IR.
543 
544  // Check whether "W == vscale * EC.getKnownMinValue()"
545  if (EC.isScalable()) {
546  // Undig the DL
547  const auto *ParMod = this->getModule();
548  if (!ParMod)
549  return false;
550  const auto &DL = ParMod->getDataLayout();
551 
552  // Compare vscale patterns
553  uint64_t VScaleFactor;
554  if (match(VLParam, m_c_Mul(m_ConstantInt(VScaleFactor), m_VScale(DL))))
555  return VScaleFactor >= EC.getKnownMinValue();
556  return (EC.getKnownMinValue() == 1) && match(VLParam, m_VScale(DL));
557  }
558 
559  // standard SIMD operation
560  const auto *VLConst = dyn_cast<ConstantInt>(VLParam);
561  if (!VLConst)
562  return false;
563 
564  uint64_t VLNum = VLConst->getZExtValue();
565  if (VLNum >= EC.getKnownMinValue())
566  return true;
567 
568  return false;
569 }
570 
572  Type *ReturnType,
573  ArrayRef<Value *> Params) {
574  assert(isVPIntrinsic(VPID) && "not a VP intrinsic");
575  Function *VPFunc;
576  switch (VPID) {
577  default: {
578  Type *OverloadTy = Params[0]->getType();
580  OverloadTy =
581  Params[*VPReductionIntrinsic::getVectorParamPos(VPID)]->getType();
582 
583  VPFunc = Intrinsic::getDeclaration(M, VPID, OverloadTy);
584  break;
585  }
586  case Intrinsic::vp_trunc:
587  case Intrinsic::vp_sext:
588  case Intrinsic::vp_zext:
589  case Intrinsic::vp_fptoui:
590  case Intrinsic::vp_fptosi:
591  case Intrinsic::vp_uitofp:
592  case Intrinsic::vp_sitofp:
593  case Intrinsic::vp_fptrunc:
594  case Intrinsic::vp_fpext:
595  case Intrinsic::vp_ptrtoint:
596  case Intrinsic::vp_inttoptr:
597  VPFunc =
598  Intrinsic::getDeclaration(M, VPID, {ReturnType, Params[0]->getType()});
599  break;
600  case Intrinsic::vp_merge:
601  case Intrinsic::vp_select:
602  VPFunc = Intrinsic::getDeclaration(M, VPID, {Params[1]->getType()});
603  break;
604  case Intrinsic::vp_load:
605  VPFunc = Intrinsic::getDeclaration(
606  M, VPID, {ReturnType, Params[0]->getType()});
607  break;
608  case Intrinsic::experimental_vp_strided_load:
609  VPFunc = Intrinsic::getDeclaration(
610  M, VPID, {ReturnType, Params[0]->getType(), Params[1]->getType()});
611  break;
612  case Intrinsic::vp_gather:
613  VPFunc = Intrinsic::getDeclaration(
614  M, VPID, {ReturnType, Params[0]->getType()});
615  break;
616  case Intrinsic::vp_store:
617  VPFunc = Intrinsic::getDeclaration(
618  M, VPID, {Params[0]->getType(), Params[1]->getType()});
619  break;
620  case Intrinsic::experimental_vp_strided_store:
621  VPFunc = Intrinsic::getDeclaration(
622  M, VPID,
623  {Params[0]->getType(), Params[1]->getType(), Params[2]->getType()});
624  break;
625  case Intrinsic::vp_scatter:
626  VPFunc = Intrinsic::getDeclaration(
627  M, VPID, {Params[0]->getType(), Params[1]->getType()});
628  break;
629  }
630  assert(VPFunc && "Could not declare VP intrinsic");
631  return VPFunc;
632 }
633 
635  switch (ID) {
636  default:
637  break;
638 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
639 #define VP_PROPERTY_REDUCTION(STARTPOS, ...) return true;
640 #define END_REGISTER_VP_INTRINSIC(VPID) break;
641 #include "llvm/IR/VPIntrinsics.def"
642  }
643  return false;
644 }
645 
647  switch (ID) {
648  default:
649  break;
650 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
651 #define VP_PROPERTY_CASTOP return true;
652 #define END_REGISTER_VP_INTRINSIC(VPID) break;
653 #include "llvm/IR/VPIntrinsics.def"
654  }
655  return false;
656 }
657 
659  switch (ID) {
660  default:
661  break;
662 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
663 #define VP_PROPERTY_CMP(CCPOS, ...) return true;
664 #define END_REGISTER_VP_INTRINSIC(VPID) break;
665 #include "llvm/IR/VPIntrinsics.def"
666  }
667  return false;
668 }
669 
671  Metadata *MD = cast<MetadataAsValue>(Op)->getMetadata();
672  if (!MD || !isa<MDString>(MD))
674  return StringSwitch<ICmpInst::Predicate>(cast<MDString>(MD)->getString())
675  .Case("eq", ICmpInst::ICMP_EQ)
676  .Case("ne", ICmpInst::ICMP_NE)
677  .Case("ugt", ICmpInst::ICMP_UGT)
678  .Case("uge", ICmpInst::ICMP_UGE)
679  .Case("ult", ICmpInst::ICMP_ULT)
680  .Case("ule", ICmpInst::ICMP_ULE)
681  .Case("sgt", ICmpInst::ICMP_SGT)
682  .Case("sge", ICmpInst::ICMP_SGE)
683  .Case("slt", ICmpInst::ICMP_SLT)
684  .Case("sle", ICmpInst::ICMP_SLE)
686 }
687 
689  bool IsFP = true;
690  std::optional<unsigned> CCArgIdx;
691  switch (getIntrinsicID()) {
692  default:
693  break;
694 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
695 #define VP_PROPERTY_CMP(CCPOS, ISFP) \
696  CCArgIdx = CCPOS; \
697  IsFP = ISFP; \
698  break;
699 #define END_REGISTER_VP_INTRINSIC(VPID) break;
700 #include "llvm/IR/VPIntrinsics.def"
701  }
702  assert(CCArgIdx && "Unexpected vector-predicated comparison");
703  return IsFP ? getFPPredicateFromMD(getArgOperand(*CCArgIdx))
704  : getIntPredicateFromMD(getArgOperand(*CCArgIdx));
705 }
706 
709 }
710 
713 }
714 
715 std::optional<unsigned>
717  switch (ID) {
718 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
719 #define VP_PROPERTY_REDUCTION(STARTPOS, VECTORPOS) return VECTORPOS;
720 #define END_REGISTER_VP_INTRINSIC(VPID) break;
721 #include "llvm/IR/VPIntrinsics.def"
722  default:
723  break;
724  }
725  return std::nullopt;
726 }
727 
728 std::optional<unsigned>
730  switch (ID) {
731 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
732 #define VP_PROPERTY_REDUCTION(STARTPOS, VECTORPOS) return STARTPOS;
733 #define END_REGISTER_VP_INTRINSIC(VPID) break;
734 #include "llvm/IR/VPIntrinsics.def"
735  default:
736  break;
737  }
738  return std::nullopt;
739 }
740 
742  switch (getIntrinsicID()) {
743  case Intrinsic::uadd_with_overflow:
744  case Intrinsic::sadd_with_overflow:
745  case Intrinsic::uadd_sat:
746  case Intrinsic::sadd_sat:
747  return Instruction::Add;
748  case Intrinsic::usub_with_overflow:
749  case Intrinsic::ssub_with_overflow:
750  case Intrinsic::usub_sat:
751  case Intrinsic::ssub_sat:
752  return Instruction::Sub;
753  case Intrinsic::umul_with_overflow:
754  case Intrinsic::smul_with_overflow:
755  return Instruction::Mul;
756  default:
757  llvm_unreachable("Invalid intrinsic");
758  }
759 }
760 
762  switch (getIntrinsicID()) {
763  case Intrinsic::sadd_with_overflow:
764  case Intrinsic::ssub_with_overflow:
765  case Intrinsic::smul_with_overflow:
766  case Intrinsic::sadd_sat:
767  case Intrinsic::ssub_sat:
768  return true;
769  default:
770  return false;
771  }
772 }
773 
775  if (isSigned())
777  else
779 }
780 
782  const Value *Token = getArgOperand(0);
783  if (isa<UndefValue>(Token))
784  return Token;
785 
786  // This takes care both of relocates for call statepoints and relocates
787  // on normal path of invoke statepoint.
788  if (!isa<LandingPadInst>(Token))
789  return cast<GCStatepointInst>(Token);
790 
791  // This relocate is on exceptional path of an invoke statepoint
792  const BasicBlock *InvokeBB =
793  cast<Instruction>(Token)->getParent()->getUniquePredecessor();
794 
795  assert(InvokeBB && "safepoints should have unique landingpads");
796  assert(InvokeBB->getTerminator() &&
797  "safepoint block should be well formed");
798 
799  return cast<GCStatepointInst>(InvokeBB->getTerminator());
800 }
801 
803  auto Statepoint = getStatepoint();
804  if (isa<UndefValue>(Statepoint))
805  return UndefValue::get(Statepoint->getType());
806 
807  auto *GCInst = cast<GCStatepointInst>(Statepoint);
808  if (auto Opt = GCInst->getOperandBundle(LLVMContext::OB_gc_live))
809  return *(Opt->Inputs.begin() + getBasePtrIndex());
810  return *(GCInst->arg_begin() + getBasePtrIndex());
811 }
812 
814  auto *Statepoint = getStatepoint();
815  if (isa<UndefValue>(Statepoint))
816  return UndefValue::get(Statepoint->getType());
817 
818  auto *GCInst = cast<GCStatepointInst>(Statepoint);
819  if (auto Opt = GCInst->getOperandBundle(LLVMContext::OB_gc_live))
820  return *(Opt->Inputs.begin() + getDerivedPtrIndex());
821  return *(GCInst->arg_begin() + getDerivedPtrIndex());
822 }
llvm::StringSwitch::Case
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:69
llvm::CmpInst::FCMP_ULE
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
Definition: InstrTypes.h:734
llvm::DbgVariableIntrinsic::getExpression
DIExpression * getExpression() const
Definition: IntrinsicInst.h:292
llvm::BinaryOpIntrinsic::getBinaryOp
Instruction::BinaryOps getBinaryOp() const
Returns the binary operation underlying the intrinsic.
Definition: IntrinsicInst.cpp:741
llvm::convertStrToRoundingMode
std::optional< RoundingMode > convertStrToRoundingMode(StringRef)
Returns a valid RoundingMode enumerator when given a string that is valid as input in constrained int...
Definition: FPEnv.cpp:24
llvm::VPIntrinsic::getMemoryDataParamPos
static std::optional< unsigned > getMemoryDataParamPos(Intrinsic::ID)
Definition: IntrinsicInst.cpp:478
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::InstrProfIncrementInst::getStep
Value * getStep() const
Definition: IntrinsicInst.cpp:269
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::Instruction::getModule
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
Definition: Instruction.cpp:69
llvm::AArch64CC::AL
@ AL
Definition: AArch64BaseInfo.h:269
llvm::CmpInst::ICMP_EQ
@ ICMP_EQ
equal
Definition: InstrTypes.h:740
Metadata.h
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::Type::isPointerTy
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:237
llvm::ElementCount
Definition: TypeSize.h:404
DebugInfoMetadata.h
T
llvm::Function
Definition: Function.h:60
llvm::IntrinsicInst::getIntrinsicID
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
Definition: IntrinsicInst.h:54
High
uint64_t High
Definition: NVVMIntrRange.cpp:61
llvm::StringRef::npos
static constexpr size_t npos
Definition: StringRef.h:52
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::InstrProfIncrementInstStep::classof
static bool classof(const IntrinsicInst *I)
Definition: IntrinsicInst.h:1364
llvm::CmpInst::FCMP_ONE
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
Definition: InstrTypes.h:727
llvm::VPIntrinsic::setVectorLengthParam
void setVectorLengthParam(Value *)
Definition: IntrinsicInst.cpp:410
llvm::VPCmpIntrinsic::getPredicate
CmpInst::Predicate getPredicate() const
Definition: IntrinsicInst.cpp:688
llvm::CmpInst::ICMP_NE
@ ICMP_NE
not equal
Definition: InstrTypes.h:741
llvm::DbgVariableIntrinsic::replaceVariableLocationOp
void replaceVariableLocationOp(Value *OldValue, Value *NewValue)
Definition: IntrinsicInst.cpp:114
llvm::VPIntrinsic::canIgnoreVectorLengthParam
bool canIgnoreVectorLengthParam() const
Definition: IntrinsicInst.cpp:529
llvm::ConstrainedFPIntrinsic::isDefaultFPEnvironment
bool isDefaultFPEnvironment() const
Definition: IntrinsicInst.cpp:301
NewExpr
Definition: ItaniumDemangle.h:1935
llvm::CmpInst::ICMP_SGT
@ ICMP_SGT
signed greater than
Definition: InstrTypes.h:746
llvm::DbgAssignIntrinsic::getAddress
Value * getAddress() const
Definition: IntrinsicInst.cpp:194
llvm::VPIntrinsic::getDeclarationForParams
static Function * getDeclarationForParams(Module *M, Intrinsic::ID, Type *ReturnType, ArrayRef< Value * > Params)
Declares a llvm.vp.
Definition: IntrinsicInst.cpp:571
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::Intrinsic::lookupLLVMIntrinsicByName
int lookupLLVMIntrinsicByName(ArrayRef< const char * > NameTable, StringRef Name)
Looks up Name in NameTable via binary search.
Definition: IntrinsicInst.cpp:220
Module.h
llvm::VPIntrinsic::getMemoryDataParam
Value * getMemoryDataParam() const
Definition: IntrinsicInst.cpp:471
llvm::InstrProfInstBase::getIndex
ConstantInt * getIndex() const
Definition: IntrinsicInst.cpp:263
llvm::DbgVariableIntrinsic::getVariable
DILocalVariable * getVariable() const
Definition: IntrinsicInst.h:288
llvm::InstrProfInstBase::getNumCounters
ConstantInt * getNumCounters() const
Definition: IntrinsicInst.cpp:257
Operator.h
llvm::ConstrainedFPIntrinsic::classof
static bool classof(const IntrinsicInst *I)
Definition: IntrinsicInst.cpp:365
llvm::CmpInst::ICMP_SLE
@ ICMP_SLE
signed less or equal
Definition: InstrTypes.h:749
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:393
llvm::Intrinsic::not_intrinsic
@ not_intrinsic
Definition: Intrinsics.h:45
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2601
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::PatternMatch::m_VScale
VScaleVal_match m_VScale(const DataLayout &DL)
Definition: PatternMatch.h:2494
llvm::CmpInst::FCMP_OGT
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
Definition: InstrTypes.h:723
llvm::convertStrToExceptionBehavior
std::optional< fp::ExceptionBehavior > convertStrToExceptionBehavior(StringRef)
Returns a valid ExceptionBehavior enumerator when given a string valid as input in constrained intrin...
Definition: FPEnv.cpp:65
llvm::DbgVariableIntrinsic::getVariableLocationOp
Value * getVariableLocationOp(unsigned OpIdx) const
Definition: IntrinsicInst.cpp:92
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1400
llvm::VPIntrinsic::setMaskParam
void setMaskParam(Value *)
Definition: IntrinsicInst.cpp:399
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::CmpInst::FCMP_ULT
@ FCMP_ULT
1 1 0 0 True if unordered or less than
Definition: InstrTypes.h:733
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::VPReductionIntrinsic::isVPReduction
static bool isVPReduction(Intrinsic::ID ID)
Definition: IntrinsicInst.cpp:634
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
llvm::DbgAssignIntrinsic::getRawAddress
Metadata * getRawAddress() const
Definition: IntrinsicInst.h:424
llvm::DbgAssignIntrinsic::setAssignId
void setAssignId(DIAssignID *New)
Definition: IntrinsicInst.cpp:204
llvm::DbgVariableIntrinsic::addVariableLocationOps
void addVariableLocationOps(ArrayRef< Value * > NewValues, DIExpression *NewExpr)
Adding a new location operand will always result in this intrinsic using an ArgList,...
Definition: IntrinsicInst.cpp:171
Constants.h
llvm::PatternMatch::match
bool match(Val *V, const Pattern &P)
Definition: PatternMatch.h:49
llvm::CmpInst::ICMP_ULE
@ ICMP_ULE
unsigned less or equal
Definition: InstrTypes.h:745
llvm::VPIntrinsic::getFunctionalOpcodeForVP
static std::optional< unsigned > getFunctionalOpcodeForVP(Intrinsic::ID ID)
Definition: IntrinsicInst.cpp:504
llvm::CmpInst::FCMP_UGE
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
Definition: InstrTypes.h:732
llvm::BinaryOpIntrinsic::getNoWrapKind
unsigned getNoWrapKind() const
Returns one of OBO::NoSignedWrap or OBO::NoUnsignedWrap.
Definition: IntrinsicInst.cpp:774
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117
llvm::PatternMatch::m_ConstantInt
class_match< ConstantInt > m_ConstantInt()
Match an arbitrary ConstantInt and ignore it.
Definition: PatternMatch.h:147
llvm::CmpInst::FCMP_UNO
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Definition: InstrTypes.h:729
llvm::UndefValue::get
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1713
llvm::ThreadPriority::Low
@ Low
Lower the current thread's priority such that it does not affect foreground tasks significantly.
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::VPIntrinsic::getForOpcode
static Intrinsic::ID getForOpcode(unsigned OC)
The llvm.vp.* intrinsics for this instruction Opcode.
Definition: IntrinsicInst.cpp:516
llvm::CmpInst::FCMP_OEQ
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
Definition: InstrTypes.h:722
llvm::DbgVariableIntrinsic::hasArgList
bool hasArgList() const
Definition: IntrinsicInst.h:260
llvm::CmpInst::FCMP_OLT
@ FCMP_OLT
0 1 0 0 True if ordered and less than
Definition: InstrTypes.h:725
PatternMatch.h
llvm::VPIntrinsic::getMaskParamPos
static std::optional< unsigned > getMaskParamPos(Intrinsic::ID IntrinsicID)
Definition: IntrinsicInst.cpp:416
llvm::Metadata
Root of the metadata hierarchy.
Definition: Metadata.h:62
llvm::GCProjectionInst::getStatepoint
const Value * getStatepoint() const
The statepoint with which this gc.relocate is associated.
Definition: IntrinsicInst.cpp:781
llvm::DbgVariableIntrinsic::getNumVariableLocationOps
unsigned getNumVariableLocationOps() const
Definition: IntrinsicInst.h:254
Statepoint.h
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::VPCmpIntrinsic::isVPCmp
static bool isVPCmp(Intrinsic::ID ID)
Definition: IntrinsicInst.cpp:658
getFPPredicateFromMD
static FCmpInst::Predicate getFPPredicateFromMD(const Value *Op)
Definition: IntrinsicInst.cpp:317
llvm::LLVMContext::OB_gc_live
@ OB_gc_live
Definition: LLVMContext.h:94
llvm::VPIntrinsic::getVectorLengthParam
Value * getVectorLengthParam() const
Definition: IntrinsicInst.cpp:404
llvm::VPIntrinsic::getStaticVectorLength
ElementCount getStaticVectorLength() const
Definition: IntrinsicInst.cpp:376
llvm::BinaryOpIntrinsic::isSigned
bool isSigned() const
Whether the intrinsic is signed or unsigned.
Definition: IntrinsicInst.cpp:761
uint64_t
llvm::ConstrainedFPIntrinsic::getRoundingMode
std::optional< RoundingMode > getRoundingMode() const
Definition: IntrinsicInst.cpp:278
llvm::find
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1754
llvm::VPIntrinsic::getPointerAlignment
MaybeAlign getPointerAlignment() const
Definition: IntrinsicInst.cpp:443
llvm::GCRelocateInst::getDerivedPtr
Value * getDerivedPtr() const
Definition: IntrinsicInst.cpp:813
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:1868
llvm::VPIntrinsic::isVPIntrinsic
static bool isVPIntrinsic(Intrinsic::ID)
Definition: IntrinsicInst.cpp:490
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::CmpInst::FCMP_OGE
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
Definition: InstrTypes.h:724
llvm::CmpInst::ICMP_UGE
@ ICMP_UGE
unsigned greater or equal
Definition: InstrTypes.h:743
llvm::CmpInst::BAD_ICMP_PREDICATE
@ BAD_ICMP_PREDICATE
Definition: InstrTypes.h:752
llvm::DbgAssignIntrinsic::setAddress
void setAddress(Value *V)
Definition: IntrinsicInst.cpp:208
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
getIntPredicateFromMD
static ICmpInst::Predicate getIntPredicateFromMD(const Value *Op)
Definition: IntrinsicInst.cpp:670
llvm::ARM::WinEH::ReturnType
ReturnType
Definition: ARMWinEH.h:25
llvm::VPIntrinsic::getVectorLengthParamPos
static std::optional< unsigned > getVectorLengthParamPos(Intrinsic::ID IntrinsicID)
Definition: IntrinsicInst.cpp:429
llvm::CmpInst::ICMP_SLT
@ ICMP_SLT
signed less than
Definition: InstrTypes.h:748
llvm::ConstrainedFPCmpIntrinsic::getPredicate
FCmpInst::Predicate getPredicate() const
Definition: IntrinsicInst.cpp:339
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
Mul
BinaryOperator * Mul
Definition: X86PartialReduction.cpp:70
llvm::CallBase::getParamAlign
MaybeAlign getParamAlign(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Definition: InstrTypes.h:1742
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::DbgVariableIntrinsic::getFragmentSizeInBits
std::optional< uint64_t > getFragmentSizeInBits() const
Get the size (in bits) of the variable, or fragment of the variable that is described.
Definition: IntrinsicInst.cpp:188
llvm::CmpInst::ICMP_ULT
@ ICMP_ULT
unsigned less than
Definition: InstrTypes.h:744
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::DbgVariableIntrinsic::getRawLocation
Metadata * getRawLocation() const
Definition: IntrinsicInst.h:296
llvm::Value::getContext
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:994
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::IntrinsicInst::mayLowerToFunctionCall
static bool mayLowerToFunctionCall(Intrinsic::ID IID)
Check if the intrinsic might lower into a regular function call in the course of IR transformations.
Definition: IntrinsicInst.cpp:36
llvm::VPReductionIntrinsic::getStartParamPos
unsigned getStartParamPos() const
Definition: IntrinsicInst.cpp:711
llvm::DbgVariableIntrinsic::setArgOperand
void setArgOperand(unsigned i, Value *v)
Definition: IntrinsicInst.h:342
llvm::CallBase::setArgOperand
void setArgOperand(unsigned i, Value *v)
Definition: InstrTypes.h:1346
llvm::Intrinsic::getDeclaration
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1481
getAsMetadata
static ValueAsMetadata * getAsMetadata(Value *V)
Definition: IntrinsicInst.cpp:108
llvm::StringRef::size
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:137
llvm::CmpInst::FCMP_UGT
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
Definition: InstrTypes.h:731
llvm::GCRelocateInst::getBasePtr
Value * getBasePtr() const
Definition: IntrinsicInst.cpp:802
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:240
llvm::DbgAssignIntrinsic::setValue
void setValue(Value *V)
Definition: IntrinsicInst.cpp:215
llvm::InstrProfValueProfileInst::classof
static bool classof(const IntrinsicInst *I)
Definition: IntrinsicInst.h:1375
llvm::ConstrainedFPIntrinsic::isUnaryOp
bool isUnaryOp() const
Definition: IntrinsicInst.cpp:343
llvm::VPIntrinsic::getMemoryPointerParam
Value * getMemoryPointerParam() const
Definition: IntrinsicInst.cpp:451
llvm::MetadataAsValue::get
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition: Metadata.cpp:103
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:351
llvm::ArrayRef::begin
iterator begin() const
Definition: ArrayRef.h:152
llvm::CallBase::arg_size
unsigned arg_size() const
Definition: InstrTypes.h:1339
llvm::VPReductionIntrinsic::getVectorParamPos
unsigned getVectorParamPos() const
Definition: IntrinsicInst.cpp:707
llvm::PatternMatch::m_c_Mul
BinaryOp_match< LHS, RHS, Instruction::Mul, true > m_c_Mul(const LHS &L, const RHS &R)
Matches a Mul with LHS and RHS in either order.
Definition: PatternMatch.h:2249
StringSwitch.h
llvm::VPIntrinsic::getMemoryPointerParamPos
static std::optional< unsigned > getMemoryPointerParamPos(Intrinsic::ID)
Definition: IntrinsicInst.cpp:458
llvm::fp::ebIgnore
@ ebIgnore
This corresponds to "fpexcept.ignore".
Definition: FPEnv.h:39
llvm::ConstrainedFPIntrinsic::isTernaryOp
bool isTernaryOp() const
Definition: IntrinsicInst.cpp:354
llvm::CmpInst::ICMP_SGE
@ ICMP_SGE
signed greater or equal
Definition: InstrTypes.h:747
llvm::MCID::Add
@ Add
Definition: MCInstrDesc.h:185
llvm::OverflowingBinaryOperator::NoSignedWrap
@ NoSignedWrap
Definition: Operator.h:77
llvm::IntrinsicInst
A wrapper class for inspecting calls to intrinsic functions.
Definition: IntrinsicInst.h:47
llvm::DbgVariableIntrinsic::setOperand
void setOperand(unsigned i, Value *v)
Definition: IntrinsicInst.h:345
llvm::OverflowingBinaryOperator::NoUnsignedWrap
@ NoUnsignedWrap
Definition: Operator.h:76
llvm::DIVariable::getSizeInBits
std::optional< uint64_t > getSizeInBits() const
Determines the size of the variable's type.
Definition: DebugInfoMetadata.cpp:1211
llvm::Instruction::BinaryOps
BinaryOps
Definition: Instruction.h:793
isSigned
static bool isSigned(unsigned int Opcode)
Definition: ExpandLargeDivRem.cpp:52
llvm::User::getNumOperands
unsigned getNumOperands() const
Definition: User.h:191
llvm::DbgVariableIntrinsic::location_op_iterator
Definition: IntrinsicInst.h:186
llvm::CmpInst::ICMP_UGT
@ ICMP_UGT
unsigned greater than
Definition: InstrTypes.h:742
llvm::DIAssignID
Assignment ID.
Definition: DebugInfoMetadata.h:303
llvm::CmpInst::FCMP_UNE
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
Definition: InstrTypes.h:735
llvm::CallBase::getArgOperand
Value * getArgOperand(unsigned i) const
Definition: InstrTypes.h:1341
llvm::VPCastIntrinsic::isVPCast
static bool isVPCast(Intrinsic::ID ID)
Definition: IntrinsicInst.cpp:646
llvm::DbgVariableIntrinsic::location_ops
iterator_range< location_op_iterator > location_ops() const
Get the locations corresponding to the variable referenced by the debug info intrinsic.
Definition: IntrinsicInst.cpp:75
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:164
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::BasicBlock::getTerminator
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Definition: BasicBlock.h:119
getBasePtrIndex
static unsigned getBasePtrIndex(const MemSDNode *N)
MemSDNode::getBasePtr() does not work for intrinsics, which needs to offset by the chain and intrinsi...
Definition: SIISelLowering.cpp:9490
llvm::CmpInst::FCMP_OLE
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
Definition: InstrTypes.h:726
llvm::ValueAsMetadata
Value wrapper in the Metadata hierarchy.
Definition: Metadata.h:345
llvm::StringSwitch::Default
R Default(T Value)
Definition: StringSwitch.h:182
llvm::StringSwitch
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:44
llvm::ConstrainedFPIntrinsic::getExceptionBehavior
std::optional< fp::ExceptionBehavior > getExceptionBehavior() const
Definition: IntrinsicInst.cpp:290
llvm::User::Op
Use & Op()
Definition: User.h:133
llvm::VPIntrinsic::getMaskParam
Value * getMaskParam() const
Definition: IntrinsicInst.cpp:393
llvm::RoundingMode::NearestTiesToEven
@ NearestTiesToEven
roundTiesToEven.
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::CmpInst::BAD_FCMP_PREDICATE
@ BAD_FCMP_PREDICATE
Definition: InstrTypes.h:739
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:153
llvm::CmpInst::FCMP_ORD
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
Definition: InstrTypes.h:728
llvm::CmpInst::FCMP_UEQ
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
Definition: InstrTypes.h:730
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