LLVM  14.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/GlobalVariable.h"
28 #include "llvm/IR/Metadata.h"
29 #include "llvm/IR/Module.h"
30 #include "llvm/IR/Operator.h"
31 #include "llvm/IR/PatternMatch.h"
32 #include "llvm/IR/Statepoint.h"
33 
35 using namespace llvm;
36 
37 //===----------------------------------------------------------------------===//
38 /// DbgVariableIntrinsic - This is the common base class for debug info
39 /// intrinsics for variables.
40 ///
41 
44  auto *MD = getRawLocation();
45  assert(MD && "First operand of DbgVariableIntrinsic should be non-null.");
46 
47  // If operand is ValueAsMetadata, return a range over just that operand.
48  if (auto *VAM = dyn_cast<ValueAsMetadata>(MD)) {
49  return {location_op_iterator(VAM), location_op_iterator(VAM + 1)};
50  }
51  // If operand is DIArgList, return a range over its args.
52  if (auto *AL = dyn_cast<DIArgList>(MD))
53  return {location_op_iterator(AL->args_begin()),
54  location_op_iterator(AL->args_end())};
55  // Operand must be an empty metadata tuple, so return empty iterator.
56  return {location_op_iterator(static_cast<ValueAsMetadata *>(nullptr)),
57  location_op_iterator(static_cast<ValueAsMetadata *>(nullptr))};
58 }
59 
61  auto *MD = getRawLocation();
62  assert(MD && "First operand of DbgVariableIntrinsic should be non-null.");
63  if (auto *AL = dyn_cast<DIArgList>(MD))
64  return AL->getArgs()[OpIdx]->getValue();
65  if (isa<MDNode>(MD))
66  return nullptr;
67  assert(
68  isa<ValueAsMetadata>(MD) &&
69  "Attempted to get location operand from DbgVariableIntrinsic with none.");
70  auto *V = cast<ValueAsMetadata>(MD);
71  assert(OpIdx == 0 && "Operand Index must be 0 for a debug intrinsic with a "
72  "single location operand.");
73  return V->getValue();
74 }
75 
77  return isa<MetadataAsValue>(V) ? dyn_cast<ValueAsMetadata>(
78  cast<MetadataAsValue>(V)->getMetadata())
80 }
81 
83  Value *NewValue) {
84  assert(NewValue && "Values must be non-null");
85  auto Locations = location_ops();
86  auto OldIt = find(Locations, OldValue);
87  assert(OldIt != Locations.end() && "OldValue must be a current location");
88  if (!hasArgList()) {
89  Value *NewOperand = isa<MetadataAsValue>(NewValue)
90  ? NewValue
92  getContext(), ValueAsMetadata::get(NewValue));
93  return setArgOperand(0, NewOperand);
94  }
96  ValueAsMetadata *NewOperand = getAsMetadata(NewValue);
97  for (auto *VMD : Locations)
98  MDs.push_back(VMD == *OldIt ? NewOperand : getAsMetadata(VMD));
99  setArgOperand(
101 }
103  Value *NewValue) {
104  assert(OpIdx < getNumVariableLocationOps() && "Invalid Operand Index");
105  if (!hasArgList()) {
106  Value *NewOperand = isa<MetadataAsValue>(NewValue)
107  ? NewValue
109  getContext(), ValueAsMetadata::get(NewValue));
110  return setArgOperand(0, NewOperand);
111  }
113  ValueAsMetadata *NewOperand = getAsMetadata(NewValue);
114  for (unsigned Idx = 0; Idx < getNumVariableLocationOps(); ++Idx)
115  MDs.push_back(Idx == OpIdx ? NewOperand
117  setArgOperand(
119 }
120 
123  assert(NewExpr->hasAllLocationOps(getNumVariableLocationOps() +
124  NewValues.size()) &&
125  "NewExpr for debug variable intrinsic does not reference every "
126  "location operand.");
127  assert(!is_contained(NewValues, nullptr) && "New values must be non-null");
128  setArgOperand(2, MetadataAsValue::get(getContext(), NewExpr));
130  for (auto *VMD : location_ops())
131  MDs.push_back(getAsMetadata(VMD));
132  for (auto *VMD : NewValues)
133  MDs.push_back(getAsMetadata(VMD));
134  setArgOperand(
136 }
137 
139  if (auto Fragment = getExpression()->getFragmentInfo())
140  return Fragment->SizeInBits;
141  return getVariable()->getSizeInBits();
142 }
143 
145  StringRef Name) {
146  assert(Name.startswith("llvm."));
147 
148  // Do successive binary searches of the dotted name components. For
149  // "llvm.gc.experimental.statepoint.p1i8.p1i32", we will find the range of
150  // intrinsics starting with "llvm.gc", then "llvm.gc.experimental", then
151  // "llvm.gc.experimental.statepoint", and then we will stop as the range is
152  // size 1. During the search, we can skip the prefix that we already know is
153  // identical. By using strncmp we consider names with differing suffixes to
154  // be part of the equal range.
155  size_t CmpEnd = 4; // Skip the "llvm" component.
156  const char *const *Low = NameTable.begin();
157  const char *const *High = NameTable.end();
158  const char *const *LastLow = Low;
159  while (CmpEnd < Name.size() && High - Low > 0) {
160  size_t CmpStart = CmpEnd;
161  CmpEnd = Name.find('.', CmpStart + 1);
162  CmpEnd = CmpEnd == StringRef::npos ? Name.size() : CmpEnd;
163  auto Cmp = [CmpStart, CmpEnd](const char *LHS, const char *RHS) {
164  return strncmp(LHS + CmpStart, RHS + CmpStart, CmpEnd - CmpStart) < 0;
165  };
166  LastLow = Low;
167  std::tie(Low, High) = std::equal_range(Low, High, Name.data(), Cmp);
168  }
169  if (High - Low > 0)
170  LastLow = Low;
171 
172  if (LastLow == NameTable.end())
173  return -1;
174  StringRef NameFound = *LastLow;
175  if (Name == NameFound ||
176  (Name.startswith(NameFound) && Name[NameFound.size()] == '.'))
177  return LastLow - NameTable.begin();
178  return -1;
179 }
180 
183  llvm_unreachable("InstrProfValueProfileInst does not have counters!");
184  return cast<ConstantInt>(const_cast<Value *>(getArgOperand(2)));
185 }
186 
189  llvm_unreachable("Please use InstrProfValueProfileInst::getIndex()");
190  return cast<ConstantInt>(const_cast<Value *>(getArgOperand(3)));
191 }
192 
195  return const_cast<Value *>(getArgOperand(4));
196  }
197  const Module *M = getModule();
198  LLVMContext &Context = M->getContext();
200 }
201 
203  unsigned NumOperands = arg_size();
204  Metadata *MD = nullptr;
205  auto *MAV = dyn_cast<MetadataAsValue>(getArgOperand(NumOperands - 2));
206  if (MAV)
207  MD = MAV->getMetadata();
208  if (!MD || !isa<MDString>(MD))
209  return None;
210  return convertStrToRoundingMode(cast<MDString>(MD)->getString());
211 }
212 
215  unsigned NumOperands = arg_size();
216  Metadata *MD = nullptr;
217  auto *MAV = dyn_cast<MetadataAsValue>(getArgOperand(NumOperands - 1));
218  if (MAV)
219  MD = MAV->getMetadata();
220  if (!MD || !isa<MDString>(MD))
221  return None;
222  return convertStrToExceptionBehavior(cast<MDString>(MD)->getString());
223 }
224 
227  if (Except) {
228  if (Except.getValue() != fp::ebIgnore)
229  return false;
230  }
231 
233  if (Rounding) {
234  if (Rounding.getValue() != RoundingMode::NearestTiesToEven)
235  return false;
236  }
237 
238  return true;
239 }
240 
242  Metadata *MD = cast<MetadataAsValue>(getArgOperand(2))->getMetadata();
243  if (!MD || !isa<MDString>(MD))
245  return StringSwitch<FCmpInst::Predicate>(cast<MDString>(MD)->getString())
246  .Case("oeq", FCmpInst::FCMP_OEQ)
247  .Case("ogt", FCmpInst::FCMP_OGT)
248  .Case("oge", FCmpInst::FCMP_OGE)
249  .Case("olt", FCmpInst::FCMP_OLT)
250  .Case("ole", FCmpInst::FCMP_OLE)
251  .Case("one", FCmpInst::FCMP_ONE)
252  .Case("ord", FCmpInst::FCMP_ORD)
253  .Case("uno", FCmpInst::FCMP_UNO)
254  .Case("ueq", FCmpInst::FCMP_UEQ)
255  .Case("ugt", FCmpInst::FCMP_UGT)
256  .Case("uge", FCmpInst::FCMP_UGE)
257  .Case("ult", FCmpInst::FCMP_ULT)
258  .Case("ule", FCmpInst::FCMP_ULE)
259  .Case("une", FCmpInst::FCMP_UNE)
261 }
262 
264  switch (getIntrinsicID()) {
265  default:
266  return false;
267 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
268  case Intrinsic::INTRINSIC: \
269  return NARG == 1;
270 #include "llvm/IR/ConstrainedOps.def"
271  }
272 }
273 
275  switch (getIntrinsicID()) {
276  default:
277  return false;
278 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
279  case Intrinsic::INTRINSIC: \
280  return NARG == 3;
281 #include "llvm/IR/ConstrainedOps.def"
282  }
283 }
284 
286  switch (I->getIntrinsicID()) {
287 #define INSTRUCTION(NAME, NARGS, ROUND_MODE, INTRINSIC) \
288  case Intrinsic::INTRINSIC:
289 #include "llvm/IR/ConstrainedOps.def"
290  return true;
291  default:
292  return false;
293  }
294 }
295 
297  auto GetVectorLengthOfType = [](const Type *T) -> ElementCount {
298  const auto *VT = cast<VectorType>(T);
299  auto ElemCount = VT->getElementCount();
300  return ElemCount;
301  };
302 
303  Value *VPMask = getMaskParam();
304  assert(VPMask && "No mask param?");
305  return GetVectorLengthOfType(VPMask->getType());
306 }
307 
309  if (auto MaskPos = getMaskParamPos(getIntrinsicID()))
310  return getArgOperand(MaskPos.getValue());
311  return nullptr;
312 }
313 
315  auto MaskPos = getMaskParamPos(getIntrinsicID());
316  setArgOperand(*MaskPos, NewMask);
317 }
318 
320  if (auto EVLPos = getVectorLengthParamPos(getIntrinsicID()))
321  return getArgOperand(EVLPos.getValue());
322  return nullptr;
323 }
324 
326  auto EVLPos = getVectorLengthParamPos(getIntrinsicID());
327  setArgOperand(*EVLPos, NewEVL);
328 }
329 
331  switch (IntrinsicID) {
332  default:
333  return None;
334 
335 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
336  case Intrinsic::VPID: \
337  return MASKPOS;
338 #include "llvm/IR/VPIntrinsics.def"
339  }
340 }
341 
344  switch (IntrinsicID) {
345  default:
346  return None;
347 
348 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
349  case Intrinsic::VPID: \
350  return VLENPOS;
351 #include "llvm/IR/VPIntrinsics.def"
352  }
353 }
354 
355 /// \return the alignment of the pointer used by this load/store/gather or
356 /// scatter.
359  assert(PtrParamOpt.hasValue() && "no pointer argument!");
360  return getParamAlign(PtrParamOpt.getValue());
361 }
362 
363 /// \return The pointer operand of this load,store, gather or scatter.
365  if (auto PtrParamOpt = getMemoryPointerParamPos(getIntrinsicID()))
366  return getArgOperand(PtrParamOpt.getValue());
367  return nullptr;
368 }
369 
371  switch (VPID) {
372  default:
373  break;
374 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
375 #define VP_PROPERTY_MEMOP(POINTERPOS, ...) return POINTERPOS;
376 #define END_REGISTER_VP_INTRINSIC(VPID) break;
377 #include "llvm/IR/VPIntrinsics.def"
378  }
379  return None;
380 }
381 
382 /// \return The data (payload) operand of this store or scatter.
384  auto DataParamOpt = getMemoryDataParamPos(getIntrinsicID());
385  if (!DataParamOpt.hasValue())
386  return nullptr;
387  return getArgOperand(DataParamOpt.getValue());
388 }
389 
391  switch (VPID) {
392  default:
393  break;
394 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
395 #define VP_PROPERTY_MEMOP(POINTERPOS, DATAPOS) return DATAPOS;
396 #define END_REGISTER_VP_INTRINSIC(VPID) break;
397 #include "llvm/IR/VPIntrinsics.def"
398  }
399  return None;
400 }
401 
403  switch (ID) {
404  default:
405  break;
406 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
407  case Intrinsic::VPID: \
408  return true;
409 #include "llvm/IR/VPIntrinsics.def"
410  }
411  return false;
412 }
413 
414 // Equivalent non-predicated opcode
416  switch (ID) {
417  default:
418  break;
419 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
420 #define VP_PROPERTY_FUNCTIONAL_OPC(OPC) return Instruction::OPC;
421 #define END_REGISTER_VP_INTRINSIC(VPID) break;
422 #include "llvm/IR/VPIntrinsics.def"
423  }
424  return None;
425 }
426 
428  switch (IROPC) {
429  default:
430  break;
431 
432 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) break;
433 #define VP_PROPERTY_FUNCTIONAL_OPC(OPC) case Instruction::OPC:
434 #define END_REGISTER_VP_INTRINSIC(VPID) return Intrinsic::VPID;
435 #include "llvm/IR/VPIntrinsics.def"
436  }
438 }
439 
441  using namespace PatternMatch;
442 
444 
445  // No vlen param - no lanes masked-off by it.
446  auto *VLParam = getVectorLengthParam();
447  if (!VLParam)
448  return true;
449 
450  // Note that the VP intrinsic causes undefined behavior if the Explicit Vector
451  // Length parameter is strictly greater-than the number of vector elements of
452  // the operation. This function returns true when this is detected statically
453  // in the IR.
454 
455  // Check whether "W == vscale * EC.getKnownMinValue()"
456  if (EC.isScalable()) {
457  // Undig the DL
458  const auto *ParMod = this->getModule();
459  if (!ParMod)
460  return false;
461  const auto &DL = ParMod->getDataLayout();
462 
463  // Compare vscale patterns
464  uint64_t VScaleFactor;
465  if (match(VLParam, m_c_Mul(m_ConstantInt(VScaleFactor), m_VScale(DL))))
466  return VScaleFactor >= EC.getKnownMinValue();
467  return (EC.getKnownMinValue() == 1) && match(VLParam, m_VScale(DL));
468  }
469 
470  // standard SIMD operation
471  const auto *VLConst = dyn_cast<ConstantInt>(VLParam);
472  if (!VLConst)
473  return false;
474 
475  uint64_t VLNum = VLConst->getZExtValue();
476  if (VLNum >= EC.getKnownMinValue())
477  return true;
478 
479  return false;
480 }
481 
483  Type *ReturnType,
484  ArrayRef<Value *> Params) {
485  assert(isVPIntrinsic(VPID) && "not a VP intrinsic");
486  Function *VPFunc;
487  switch (VPID) {
488  default: {
489  Type *OverloadTy = Params[0]->getType();
491  OverloadTy =
492  Params[*VPReductionIntrinsic::getVectorParamPos(VPID)]->getType();
493 
494  VPFunc = Intrinsic::getDeclaration(M, VPID, OverloadTy);
495  break;
496  }
497  case Intrinsic::vp_merge:
498  case Intrinsic::vp_select:
499  VPFunc = Intrinsic::getDeclaration(M, VPID, {Params[1]->getType()});
500  break;
501  case Intrinsic::vp_load:
502  VPFunc = Intrinsic::getDeclaration(
503  M, VPID, {ReturnType, Params[0]->getType()});
504  break;
505  case Intrinsic::vp_gather:
506  VPFunc = Intrinsic::getDeclaration(
507  M, VPID, {ReturnType, Params[0]->getType()});
508  break;
509  case Intrinsic::vp_store:
510  VPFunc = Intrinsic::getDeclaration(
511  M, VPID, {Params[0]->getType(), Params[1]->getType()});
512  break;
513  case Intrinsic::vp_scatter:
514  VPFunc = Intrinsic::getDeclaration(
515  M, VPID, {Params[0]->getType(), Params[1]->getType()});
516  break;
517  }
518  assert(VPFunc && "Could not declare VP intrinsic");
519  return VPFunc;
520 }
521 
523  switch (ID) {
524  default:
525  break;
526 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
527 #define VP_PROPERTY_REDUCTION(STARTPOS, ...) return true;
528 #define END_REGISTER_VP_INTRINSIC(VPID) break;
529 #include "llvm/IR/VPIntrinsics.def"
530  }
531  return false;
532 }
533 
536 }
537 
540 }
541 
543  switch (ID) {
544 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
545 #define VP_PROPERTY_REDUCTION(STARTPOS, VECTORPOS) return VECTORPOS;
546 #define END_REGISTER_VP_INTRINSIC(VPID) break;
547 #include "llvm/IR/VPIntrinsics.def"
548  default:
549  break;
550  }
551  return None;
552 }
553 
555  switch (ID) {
556 #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
557 #define VP_PROPERTY_REDUCTION(STARTPOS, VECTORPOS) return STARTPOS;
558 #define END_REGISTER_VP_INTRINSIC(VPID) break;
559 #include "llvm/IR/VPIntrinsics.def"
560  default:
561  break;
562  }
563  return None;
564 }
565 
567  switch (getIntrinsicID()) {
568  case Intrinsic::uadd_with_overflow:
569  case Intrinsic::sadd_with_overflow:
570  case Intrinsic::uadd_sat:
571  case Intrinsic::sadd_sat:
572  return Instruction::Add;
573  case Intrinsic::usub_with_overflow:
574  case Intrinsic::ssub_with_overflow:
575  case Intrinsic::usub_sat:
576  case Intrinsic::ssub_sat:
577  return Instruction::Sub;
578  case Intrinsic::umul_with_overflow:
579  case Intrinsic::smul_with_overflow:
580  return Instruction::Mul;
581  default:
582  llvm_unreachable("Invalid intrinsic");
583  }
584 }
585 
587  switch (getIntrinsicID()) {
588  case Intrinsic::sadd_with_overflow:
589  case Intrinsic::ssub_with_overflow:
590  case Intrinsic::smul_with_overflow:
591  case Intrinsic::sadd_sat:
592  case Intrinsic::ssub_sat:
593  return true;
594  default:
595  return false;
596  }
597 }
598 
600  if (isSigned())
602  else
604 }
605 
607  const Value *Token = getArgOperand(0);
608 
609  // This takes care both of relocates for call statepoints and relocates
610  // on normal path of invoke statepoint.
611  if (!isa<LandingPadInst>(Token))
612  return cast<GCStatepointInst>(Token);
613 
614  // This relocate is on exceptional path of an invoke statepoint
615  const BasicBlock *InvokeBB =
616  cast<Instruction>(Token)->getParent()->getUniquePredecessor();
617 
618  assert(InvokeBB && "safepoints should have unique landingpads");
619  assert(InvokeBB->getTerminator() &&
620  "safepoint block should be well formed");
621 
622  return cast<GCStatepointInst>(InvokeBB->getTerminator());
623 }
624 
626  if (auto Opt = getStatepoint()->getOperandBundle(LLVMContext::OB_gc_live))
627  return *(Opt->Inputs.begin() + getBasePtrIndex());
628  return *(getStatepoint()->arg_begin() + getBasePtrIndex());
629 }
630 
632  if (auto Opt = getStatepoint()->getOperandBundle(LLVMContext::OB_gc_live))
633  return *(Opt->Inputs.begin() + getDerivedPtrIndex());
634  return *(getStatepoint()->arg_begin() + getDerivedPtrIndex());
635 }
llvm::StringSwitch::Case
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:67
llvm::CmpInst::FCMP_ULE
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
Definition: InstrTypes.h:736
llvm::DbgVariableIntrinsic::getExpression
DIExpression * getExpression() const
Definition: IntrinsicInst.h:257
llvm::BinaryOpIntrinsic::getBinaryOp
Instruction::BinaryOps getBinaryOp() const
Returns the binary operation underlying the intrinsic.
Definition: IntrinsicInst.cpp:566
llvm::VPIntrinsic::getVectorLengthParamPos
static Optional< unsigned > getVectorLengthParamPos(Intrinsic::ID IntrinsicID)
Definition: IntrinsicInst.cpp:343
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::InstrProfIncrementInst::getStep
Value * getStep() const
Definition: IntrinsicInst.cpp:193
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:66
llvm::AArch64CC::AL
@ AL
Definition: AArch64BaseInfo.h:269
llvm::CallBase::getOperandBundle
Optional< OperandBundleUse > getOperandBundle(StringRef Name) const
Return an operand bundle by name, if present.
Definition: InstrTypes.h:1992
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:1399
Metadata.h
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:721
llvm::BasicBlock::getParent
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:107
IntrinsicInst.h
llvm::ElementCount
Definition: TypeSize.h:385
DebugInfoMetadata.h
T
llvm::Function
Definition: Function.h:62
llvm::StringSwitch::Default
LLVM_NODISCARD R Default(T Value)
Definition: StringSwitch.h:181
llvm::IntrinsicInst::getIntrinsicID
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
Definition: IntrinsicInst.h:52
High
uint64_t High
Definition: NVVMIntrRange.cpp:61
llvm::StringRef::npos
static constexpr size_t npos
Definition: StringRef.h:59
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1177
llvm::DIVariable::getSizeInBits
Optional< uint64_t > getSizeInBits() const
Determines the size of the variable's type.
Definition: DebugInfoMetadata.cpp:1039
llvm::InstrProfIncrementInstStep::classof
static bool classof(const IntrinsicInst *I)
Definition: IntrinsicInst.h:1212
llvm::CmpInst::FCMP_ONE
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
Definition: InstrTypes.h:729
llvm::VPIntrinsic::setVectorLengthParam
void setVectorLengthParam(Value *)
Definition: IntrinsicInst.cpp:325
llvm::DbgVariableIntrinsic::replaceVariableLocationOp
void replaceVariableLocationOp(Value *OldValue, Value *NewValue)
Definition: IntrinsicInst.cpp:82
llvm::VPIntrinsic::canIgnoreVectorLengthParam
bool canIgnoreVectorLengthParam() const
Definition: IntrinsicInst.cpp:440
llvm::ConstrainedFPIntrinsic::isDefaultFPEnvironment
bool isDefaultFPEnvironment() const
Definition: IntrinsicInst.cpp:225
NewExpr
Definition: ItaniumDemangle.h:1916
llvm::VPIntrinsic::getDeclarationForParams
static Function * getDeclarationForParams(Module *M, Intrinsic::ID, Type *ReturnType, ArrayRef< Value * > Params)
Declares a llvm.vp.
Definition: IntrinsicInst.cpp:482
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:144
Module.h
llvm::VPIntrinsic::getMemoryDataParam
Value * getMemoryDataParam() const
Definition: IntrinsicInst.cpp:383
llvm::InstrProfInstBase::getIndex
ConstantInt * getIndex() const
Definition: IntrinsicInst.cpp:187
llvm::DbgVariableIntrinsic::getVariable
DILocalVariable * getVariable() const
Definition: IntrinsicInst.h:253
llvm::InstrProfInstBase::getNumCounters
ConstantInt * getNumCounters() const
Definition: IntrinsicInst.cpp:181
llvm::VPIntrinsic::getFunctionalOpcodeForVP
static Optional< unsigned > getFunctionalOpcodeForVP(Intrinsic::ID ID)
Definition: IntrinsicInst.cpp:415
llvm::Optional< uint64_t >
Operator.h
llvm::ConstrainedFPIntrinsic::classof
static bool classof(const IntrinsicInst *I)
Definition: IntrinsicInst.cpp:285
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:368
llvm::Intrinsic::not_intrinsic
@ not_intrinsic
Definition: Intrinsics.h:45
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2596
RHS
Value * RHS
Definition: X86PartialReduction.cpp:74
llvm::PatternMatch::m_VScale
VScaleVal_match m_VScale(const DataLayout &DL)
Definition: PatternMatch.h:2487
llvm::CmpInst::FCMP_OGT
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
Definition: InstrTypes.h:725
llvm::DbgVariableIntrinsic::getVariableLocationOp
Value * getVariableLocationOp(unsigned OpIdx) const
Definition: IntrinsicInst.cpp:60
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1233
llvm::VPIntrinsic::setMaskParam
void setMaskParam(Value *)
Definition: IntrinsicInst.cpp:314
Context
ManagedStatic< detail::RecordContext > Context
Definition: Record.cpp:96
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::Optional::hasValue
constexpr bool hasValue() const
Definition: Optional.h:289
llvm::LLVMContext::OB_gc_live
@ OB_gc_live
Definition: LLVMContext.h:94
llvm::CmpInst::FCMP_ULT
@ FCMP_ULT
1 1 0 0 True if unordered or less than
Definition: InstrTypes.h:735
llvm::GCStatepointInst
Represents a gc.statepoint intrinsic call.
Definition: Statepoint.h:63
llvm::VPReductionIntrinsic::isVPReduction
static bool isVPReduction(Intrinsic::ID ID)
Definition: IntrinsicInst.cpp:522
LHS
Value * LHS
Definition: X86PartialReduction.cpp:73
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
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:121
Constants.h
llvm::PatternMatch::match
bool match(Val *V, const Pattern &P)
Definition: PatternMatch.h:49
llvm::CmpInst::FCMP_UGE
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
Definition: InstrTypes.h:734
llvm::BinaryOpIntrinsic::getNoWrapKind
unsigned getNoWrapKind() const
Returns one of OBO::NoSignedWrap or OBO::NoUnsignedWrap.
Definition: IntrinsicInst.cpp:599
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:109
llvm::PatternMatch::m_ConstantInt
class_match< ConstantInt > m_ConstantInt()
Match an arbitrary ConstantInt and ignore it.
Definition: PatternMatch.h:145
llvm::CmpInst::FCMP_UNO
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Definition: InstrTypes.h:731
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:932
llvm::VPIntrinsic::getForOpcode
static Intrinsic::ID getForOpcode(unsigned OC)
The llvm.vp.* intrinsics for this instruction Opcode.
Definition: IntrinsicInst.cpp:427
llvm::CmpInst::FCMP_OEQ
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
Definition: InstrTypes.h:724
llvm::DbgVariableIntrinsic::hasArgList
bool hasArgList() const
Definition: IntrinsicInst.h:227
llvm::CmpInst::FCMP_OLT
@ FCMP_OLT
0 1 0 0 True if ordered and less than
Definition: InstrTypes.h:727
PatternMatch.h
llvm::Metadata
Root of the metadata hierarchy.
Definition: Metadata.h:62
llvm::DbgVariableIntrinsic::getNumVariableLocationOps
unsigned getNumVariableLocationOps() const
Definition: IntrinsicInst.h:221
llvm::None
const NoneType None
Definition: None.h:23
Statepoint.h
llvm::VPIntrinsic::getMemoryPointerParamPos
static Optional< unsigned > getMemoryPointerParamPos(Intrinsic::ID)
Definition: IntrinsicInst.cpp:370
llvm::VPIntrinsic::getVectorLengthParam
Value * getVectorLengthParam() const
Definition: IntrinsicInst.cpp:319
llvm::VPIntrinsic::getStaticVectorLength
ElementCount getStaticVectorLength() const
Definition: IntrinsicInst.cpp:296
llvm::BinaryOpIntrinsic::isSigned
bool isSigned() const
Whether the intrinsic is signed or unsigned.
Definition: IntrinsicInst.cpp:586
uint64_t
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:1669
llvm::VPIntrinsic::getPointerAlignment
MaybeAlign getPointerAlignment() const
Definition: IntrinsicInst.cpp:357
llvm::GCRelocateInst::getDerivedPtr
Value * getDerivedPtr() const
Definition: IntrinsicInst.cpp:631
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::OverflowingBinaryOperator::NoUnsignedWrap
@ NoUnsignedWrap
Definition: Operator.h:75
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:1714
llvm::VPIntrinsic::isVPIntrinsic
static bool isVPIntrinsic(Intrinsic::ID)
Definition: IntrinsicInst.cpp:402
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:726
llvm::convertStrToExceptionBehavior
Optional< fp::ExceptionBehavior > convertStrToExceptionBehavior(StringRef)
Returns a valid ExceptionBehavior enumerator when given a string valid as input in constrained intrin...
Definition: FPEnv.cpp:61
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::VPIntrinsic::getMemoryDataParamPos
static Optional< unsigned > getMemoryDataParamPos(Intrinsic::ID)
Definition: IntrinsicInst.cpp:390
llvm::ARM::WinEH::ReturnType
ReturnType
Definition: ARMWinEH.h:25
llvm::ConstrainedFPCmpIntrinsic::getPredicate
FCmpInst::Predicate getPredicate() const
Definition: IntrinsicInst.cpp:241
llvm::OverflowingBinaryOperator::NoSignedWrap
@ NoSignedWrap
Definition: Operator.h:76
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::ConstrainedFPIntrinsic::getExceptionBehavior
Optional< fp::ExceptionBehavior > getExceptionBehavior() const
Definition: IntrinsicInst.cpp:214
Mul
BinaryOperator * Mul
Definition: X86PartialReduction.cpp:68
llvm::CallBase::getParamAlign
MaybeAlign getParamAlign(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Definition: InstrTypes.h:1729
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:255
llvm::convertStrToRoundingMode
Optional< RoundingMode > convertStrToRoundingMode(StringRef)
Returns a valid RoundingMode enumerator when given a string that is valid as input in constrained int...
Definition: FPEnv.cpp:20
llvm::DbgVariableIntrinsic::getRawLocation
Metadata * getRawLocation() const
Definition: IntrinsicInst.h:261
llvm::Value::getContext
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:991
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::DbgVariableIntrinsic::getFragmentSizeInBits
Optional< uint64_t > getFragmentSizeInBits() const
Get the size (in bits) of the variable, or fragment of the variable that is described.
Definition: IntrinsicInst.cpp:138
llvm::VPReductionIntrinsic::getStartParamPos
unsigned getStartParamPos() const
Definition: IntrinsicInst.cpp:538
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.cpp:152
llvm::CallBase::setArgOperand
void setArgOperand(unsigned i, Value *v)
Definition: InstrTypes.h:1348
getAsMetadata
static ValueAsMetadata * getAsMetadata(Value *V)
Definition: IntrinsicInst.cpp:76
llvm::StringRef::size
constexpr LLVM_NODISCARD size_t size() const
size - Get the string size.
Definition: StringRef.h:156
llvm::CmpInst::FCMP_UGT
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
Definition: InstrTypes.h:733
llvm::GCRelocateInst::getBasePtr
Value * getBasePtr() const
Definition: IntrinsicInst.cpp:625
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:242
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::InstrProfValueProfileInst::classof
static bool classof(const IntrinsicInst *I)
Definition: IntrinsicInst.h:1223
llvm::ConstrainedFPIntrinsic::isUnaryOp
bool isUnaryOp() const
Definition: IntrinsicInst.cpp:263
llvm::VPIntrinsic::getMemoryPointerParam
Value * getMemoryPointerParam() const
Definition: IntrinsicInst.cpp:364
llvm::MetadataAsValue::get
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition: Metadata.cpp:106
llvm::ArrayRef::begin
iterator begin() const
Definition: ArrayRef.h:151
llvm::CallBase::arg_size
unsigned arg_size() const
Definition: InstrTypes.h:1341
GlobalVariable.h
llvm::VPReductionIntrinsic::getVectorParamPos
unsigned getVectorParamPos() const
Definition: IntrinsicInst.cpp:534
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:2242
StringSwitch.h
llvm::fp::ebIgnore
@ ebIgnore
This corresponds to "fpexcept.ignore".
Definition: FPEnv.h:32
llvm::ConstrainedFPIntrinsic::isTernaryOp
bool isTernaryOp() const
Definition: IntrinsicInst.cpp:274
llvm::VPIntrinsic::getMaskParamPos
static Optional< unsigned > getMaskParamPos(Intrinsic::ID IntrinsicID)
Definition: IntrinsicInst.cpp:330
llvm::MCID::Add
@ Add
Definition: MCInstrDesc.h:183
llvm::IntrinsicInst
A wrapper class for inspecting calls to intrinsic functions.
Definition: IntrinsicInst.h:45
llvm::Instruction::BinaryOps
BinaryOps
Definition: Instruction.h:789
llvm::DbgVariableIntrinsic::location_op_iterator
Definition: IntrinsicInst.h:153
llvm::CmpInst::FCMP_UNE
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
Definition: InstrTypes.h:737
llvm::CallBase::getArgOperand
Value * getArgOperand(unsigned i) const
Definition: InstrTypes.h:1343
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:43
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
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:9116
llvm::CmpInst::FCMP_OLE
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
Definition: InstrTypes.h:728
llvm::ValueAsMetadata
Value wrapper in the Metadata hierarchy.
Definition: Metadata.h:344
llvm::ConstrainedFPIntrinsic::getRoundingMode
Optional< RoundingMode > getRoundingMode() const
Definition: IntrinsicInst.cpp:202
llvm::StringSwitch
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:42
llvm::VPIntrinsic::getMaskParam
Value * getMaskParam() const
Definition: IntrinsicInst.cpp:308
raw_ostream.h
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:741
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:152
llvm::Optional::getValue
constexpr const T & getValue() const LLVM_LVALUE_FUNCTION
Definition: Optional.h:283
llvm::CmpInst::FCMP_ORD
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
Definition: InstrTypes.h:730
llvm::GCProjectionInst::getStatepoint
const GCStatepointInst * getStatepoint() const
The statepoint with which this gc.relocate is associated.
Definition: IntrinsicInst.cpp:606
llvm::CmpInst::FCMP_UEQ
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
Definition: InstrTypes.h:732
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::AArch64::Rounding
Rounding
Possible values of current rounding mode, which is specified in bits 23:22 of FPCR.
Definition: AArch64ISelLowering.h:477