LLVM  16.0.0git
Operator.h
Go to the documentation of this file.
1 //===-- llvm/Operator.h - Operator utility subclass -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines various classes for working with Instructions and
10 // ConstantExprs.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_IR_OPERATOR_H
15 #define LLVM_IR_OPERATOR_H
16 
17 #include "llvm/ADT/MapVector.h"
18 #include "llvm/ADT/None.h"
19 #include "llvm/ADT/Optional.h"
20 #include "llvm/IR/Constants.h"
21 #include "llvm/IR/FMF.h"
22 #include "llvm/IR/Instruction.h"
23 #include "llvm/IR/Type.h"
24 #include "llvm/IR/Value.h"
25 #include "llvm/Support/Casting.h"
26 #include <cstddef>
27 
28 namespace llvm {
29 
30 /// This is a utility class that provides an abstraction for the common
31 /// functionality between Instructions and ConstantExprs.
32 class Operator : public User {
33 public:
34  // The Operator class is intended to be used as a utility, and is never itself
35  // instantiated.
36  Operator() = delete;
37  ~Operator() = delete;
38 
39  void *operator new(size_t s) = delete;
40 
41  /// Return the opcode for this Instruction or ConstantExpr.
42  unsigned getOpcode() const {
43  if (const Instruction *I = dyn_cast<Instruction>(this))
44  return I->getOpcode();
45  return cast<ConstantExpr>(this)->getOpcode();
46  }
47 
48  /// If V is an Instruction or ConstantExpr, return its opcode.
49  /// Otherwise return UserOp1.
50  static unsigned getOpcode(const Value *V) {
51  if (const Instruction *I = dyn_cast<Instruction>(V))
52  return I->getOpcode();
53  if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
54  return CE->getOpcode();
55  return Instruction::UserOp1;
56  }
57 
58  static bool classof(const Instruction *) { return true; }
59  static bool classof(const ConstantExpr *) { return true; }
60  static bool classof(const Value *V) {
61  return isa<Instruction>(V) || isa<ConstantExpr>(V);
62  }
63 
64  /// Return true if this operator has flags which may cause this operator
65  /// to evaluate to poison despite having non-poison inputs.
66  bool hasPoisonGeneratingFlags() const;
67 };
68 
69 /// Utility class for integer operators which may exhibit overflow - Add, Sub,
70 /// Mul, and Shl. It does not include SDiv, despite that operator having the
71 /// potential for overflow.
73 public:
74  enum {
75  AnyWrap = 0,
76  NoUnsignedWrap = (1 << 0),
77  NoSignedWrap = (1 << 1)
78  };
79 
80 private:
81  friend class Instruction;
82  friend class ConstantExpr;
83 
84  void setHasNoUnsignedWrap(bool B) {
87  }
88  void setHasNoSignedWrap(bool B) {
91  }
92 
93 public:
94  /// Test whether this operation is known to never
95  /// undergo unsigned overflow, aka the nuw property.
96  bool hasNoUnsignedWrap() const {
98  }
99 
100  /// Test whether this operation is known to never
101  /// undergo signed overflow, aka the nsw property.
102  bool hasNoSignedWrap() const {
103  return (SubclassOptionalData & NoSignedWrap) != 0;
104  }
105 
106  static bool classof(const Instruction *I) {
107  return I->getOpcode() == Instruction::Add ||
108  I->getOpcode() == Instruction::Sub ||
109  I->getOpcode() == Instruction::Mul ||
110  I->getOpcode() == Instruction::Shl;
111  }
112  static bool classof(const ConstantExpr *CE) {
113  return CE->getOpcode() == Instruction::Add ||
114  CE->getOpcode() == Instruction::Sub ||
115  CE->getOpcode() == Instruction::Mul ||
116  CE->getOpcode() == Instruction::Shl;
117  }
118  static bool classof(const Value *V) {
119  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
120  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
121  }
122 };
123 
124 /// A udiv or sdiv instruction, which can be marked as "exact",
125 /// indicating that no bits are destroyed.
127 public:
128  enum {
129  IsExact = (1 << 0)
130  };
131 
132 private:
133  friend class Instruction;
134  friend class ConstantExpr;
135 
136  void setIsExact(bool B) {
138  }
139 
140 public:
141  /// Test whether this division is known to be exact, with zero remainder.
142  bool isExact() const {
143  return SubclassOptionalData & IsExact;
144  }
145 
146  static bool isPossiblyExactOpcode(unsigned OpC) {
147  return OpC == Instruction::SDiv ||
148  OpC == Instruction::UDiv ||
149  OpC == Instruction::AShr ||
150  OpC == Instruction::LShr;
151  }
152 
153  static bool classof(const ConstantExpr *CE) {
154  return isPossiblyExactOpcode(CE->getOpcode());
155  }
156  static bool classof(const Instruction *I) {
157  return isPossiblyExactOpcode(I->getOpcode());
158  }
159  static bool classof(const Value *V) {
160  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
161  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
162  }
163 };
164 
165 /// Utility class for floating point operations which can have
166 /// information about relaxed accuracy requirements attached to them.
167 class FPMathOperator : public Operator {
168 private:
169  friend class Instruction;
170 
171  /// 'Fast' means all bits are set.
172  void setFast(bool B) {
173  setHasAllowReassoc(B);
174  setHasNoNaNs(B);
175  setHasNoInfs(B);
176  setHasNoSignedZeros(B);
177  setHasAllowReciprocal(B);
178  setHasAllowContract(B);
179  setHasApproxFunc(B);
180  }
181 
182  void setHasAllowReassoc(bool B) {
186  }
187 
188  void setHasNoNaNs(bool B) {
190  (SubclassOptionalData & ~FastMathFlags::NoNaNs) |
192  }
193 
194  void setHasNoInfs(bool B) {
196  (SubclassOptionalData & ~FastMathFlags::NoInfs) |
198  }
199 
200  void setHasNoSignedZeros(bool B) {
202  (SubclassOptionalData & ~FastMathFlags::NoSignedZeros) |
204  }
205 
206  void setHasAllowReciprocal(bool B) {
208  (SubclassOptionalData & ~FastMathFlags::AllowReciprocal) |
210  }
211 
212  void setHasAllowContract(bool B) {
214  (SubclassOptionalData & ~FastMathFlags::AllowContract) |
216  }
217 
218  void setHasApproxFunc(bool B) {
220  (SubclassOptionalData & ~FastMathFlags::ApproxFunc) |
222  }
223 
224  /// Convenience function for setting multiple fast-math flags.
225  /// FMF is a mask of the bits to set.
226  void setFastMathFlags(FastMathFlags FMF) {
227  SubclassOptionalData |= FMF.Flags;
228  }
229 
230  /// Convenience function for copying all fast-math flags.
231  /// All values in FMF are transferred to this operator.
232  void copyFastMathFlags(FastMathFlags FMF) {
233  SubclassOptionalData = FMF.Flags;
234  }
235 
236 public:
237  /// Test if this operation allows all non-strict floating-point transforms.
238  bool isFast() const {
246  }
247 
248  /// Test if this operation may be simplified with reassociative transforms.
249  bool hasAllowReassoc() const {
251  }
252 
253  /// Test if this operation's arguments and results are assumed not-NaN.
254  bool hasNoNaNs() const {
256  }
257 
258  /// Test if this operation's arguments and results are assumed not-infinite.
259  bool hasNoInfs() const {
261  }
262 
263  /// Test if this operation can ignore the sign of zero.
264  bool hasNoSignedZeros() const {
266  }
267 
268  /// Test if this operation can use reciprocal multiply instead of division.
269  bool hasAllowReciprocal() const {
271  }
272 
273  /// Test if this operation can be floating-point contracted (FMA).
274  bool hasAllowContract() const {
276  }
277 
278  /// Test if this operation allows approximations of math library functions or
279  /// intrinsics.
280  bool hasApproxFunc() const {
282  }
283 
284  /// Convenience function for getting all the fast-math flags
287  }
288 
289  /// Get the maximum error permitted by this operation in ULPs. An accuracy of
290  /// 0.0 means that the operation should be performed with the default
291  /// precision.
292  float getFPAccuracy() const;
293 
294  static bool classof(const Value *V) {
295  unsigned Opcode;
296  if (auto *I = dyn_cast<Instruction>(V))
297  Opcode = I->getOpcode();
298  else if (auto *CE = dyn_cast<ConstantExpr>(V))
299  Opcode = CE->getOpcode();
300  else
301  return false;
302 
303  switch (Opcode) {
304  case Instruction::FNeg:
305  case Instruction::FAdd:
306  case Instruction::FSub:
307  case Instruction::FMul:
308  case Instruction::FDiv:
309  case Instruction::FRem:
310  // FIXME: To clean up and correct the semantics of fast-math-flags, FCmp
311  // should not be treated as a math op, but the other opcodes should.
312  // This would make things consistent with Select/PHI (FP value type
313  // determines whether they are math ops and, therefore, capable of
314  // having fast-math-flags).
315  case Instruction::FCmp:
316  return true;
317  case Instruction::PHI:
318  case Instruction::Select:
319  case Instruction::Call: {
320  Type *Ty = V->getType();
321  while (ArrayType *ArrTy = dyn_cast<ArrayType>(Ty))
322  Ty = ArrTy->getElementType();
323  return Ty->isFPOrFPVectorTy();
324  }
325  default:
326  return false;
327  }
328  }
329 };
330 
331 /// A helper template for defining operators for individual opcodes.
332 template<typename SuperClass, unsigned Opc>
333 class ConcreteOperator : public SuperClass {
334 public:
335  static bool classof(const Instruction *I) {
336  return I->getOpcode() == Opc;
337  }
338  static bool classof(const ConstantExpr *CE) {
339  return CE->getOpcode() == Opc;
340  }
341  static bool classof(const Value *V) {
342  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
343  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
344  }
345 };
346 
348  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {
349 };
351  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {
352 };
354  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {
355 };
357  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {
358 };
359 
361  : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {
362 };
364  : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {
365 };
367  : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {
368 };
370  : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {
371 };
372 
373 class ZExtOperator : public ConcreteOperator<Operator, Instruction::ZExt> {};
374 
376  : public ConcreteOperator<Operator, Instruction::GetElementPtr> {
377  friend class GetElementPtrInst;
378  friend class ConstantExpr;
379 
380  enum {
381  IsInBounds = (1 << 0),
382  // InRangeIndex: bits 1-6
383  };
384 
385  void setIsInBounds(bool B) {
387  (SubclassOptionalData & ~IsInBounds) | (B * IsInBounds);
388  }
389 
390 public:
391  /// Test whether this is an inbounds GEP, as defined by LangRef.html.
392  bool isInBounds() const {
393  return SubclassOptionalData & IsInBounds;
394  }
395 
396  /// Returns the offset of the index with an inrange attachment, or None if
397  /// none.
399  if (SubclassOptionalData >> 1 == 0) return None;
400  return (SubclassOptionalData >> 1) - 1;
401  }
402 
403  inline op_iterator idx_begin() { return op_begin()+1; }
404  inline const_op_iterator idx_begin() const { return op_begin()+1; }
405  inline op_iterator idx_end() { return op_end(); }
406  inline const_op_iterator idx_end() const { return op_end(); }
407 
409  return make_range(idx_begin(), idx_end());
410  }
411 
413  return make_range(idx_begin(), idx_end());
414  }
415 
417  return getOperand(0);
418  }
419  const Value *getPointerOperand() const {
420  return getOperand(0);
421  }
422  static unsigned getPointerOperandIndex() {
423  return 0U; // get index for modifying correct operand
424  }
425 
426  /// Method to return the pointer operand as a PointerType.
428  return getPointerOperand()->getType();
429  }
430 
431  Type *getSourceElementType() const;
432  Type *getResultElementType() const;
433 
434  /// Method to return the address space of the pointer operand.
435  unsigned getPointerAddressSpace() const {
437  }
438 
439  unsigned getNumIndices() const { // Note: always non-negative
440  return getNumOperands() - 1;
441  }
442 
443  bool hasIndices() const {
444  return getNumOperands() > 1;
445  }
446 
447  /// Return true if all of the indices of this GEP are zeros.
448  /// If so, the result pointer and the first operand have the same
449  /// value, just potentially different types.
450  bool hasAllZeroIndices() const {
451  for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
452  if (ConstantInt *C = dyn_cast<ConstantInt>(I))
453  if (C->isZero())
454  continue;
455  return false;
456  }
457  return true;
458  }
459 
460  /// Return true if all of the indices of this GEP are constant integers.
461  /// If so, the result pointer and the first operand have
462  /// a constant offset between them.
463  bool hasAllConstantIndices() const {
464  for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
465  if (!isa<ConstantInt>(I))
466  return false;
467  }
468  return true;
469  }
470 
471  unsigned countNonConstantIndices() const {
472  return count_if(indices(), [](const Use& use) {
473  return !isa<ConstantInt>(*use);
474  });
475  }
476 
477  /// Compute the maximum alignment that this GEP is garranteed to preserve.
479 
480  /// Accumulate the constant address offset of this GEP if possible.
481  ///
482  /// This routine accepts an APInt into which it will try to accumulate the
483  /// constant offset of this GEP.
484  ///
485  /// If \p ExternalAnalysis is provided it will be used to calculate a offset
486  /// when a operand of GEP is not constant.
487  /// For example, for a value \p ExternalAnalysis might try to calculate a
488  /// lower bound. If \p ExternalAnalysis is successful, it should return true.
489  ///
490  /// If the \p ExternalAnalysis returns false or the value returned by \p
491  /// ExternalAnalysis results in a overflow/underflow, this routine returns
492  /// false and the value of the offset APInt is undefined (it is *not*
493  /// preserved!).
494  ///
495  /// The APInt passed into this routine must be at exactly as wide as the
496  /// IntPtr type for the address space of the base GEP pointer.
498  const DataLayout &DL, APInt &Offset,
499  function_ref<bool(Value &, APInt &)> ExternalAnalysis = nullptr) const;
500 
501  static bool accumulateConstantOffset(
502  Type *SourceType, ArrayRef<const Value *> Index, const DataLayout &DL,
503  APInt &Offset,
504  function_ref<bool(Value &, APInt &)> ExternalAnalysis = nullptr);
505 
506  /// Collect the offset of this GEP as a map of Values to their associated
507  /// APInt multipliers, as well as a total Constant Offset.
508  bool collectOffset(const DataLayout &DL, unsigned BitWidth,
509  MapVector<Value *, APInt> &VariableOffsets,
510  APInt &ConstantOffset) const;
511 };
512 
514  : public ConcreteOperator<Operator, Instruction::PtrToInt> {
515  friend class PtrToInt;
516  friend class ConstantExpr;
517 
518 public:
520  return getOperand(0);
521  }
522  const Value *getPointerOperand() const {
523  return getOperand(0);
524  }
525 
526  static unsigned getPointerOperandIndex() {
527  return 0U; // get index for modifying correct operand
528  }
529 
530  /// Method to return the pointer operand as a PointerType.
532  return getPointerOperand()->getType();
533  }
534 
535  /// Method to return the address space of the pointer operand.
536  unsigned getPointerAddressSpace() const {
537  return cast<PointerType>(getPointerOperandType())->getAddressSpace();
538  }
539 };
540 
542  : public ConcreteOperator<Operator, Instruction::BitCast> {
543  friend class BitCastInst;
544  friend class ConstantExpr;
545 
546 public:
547  Type *getSrcTy() const {
548  return getOperand(0)->getType();
549  }
550 
551  Type *getDestTy() const {
552  return getType();
553  }
554 };
555 
557  : public ConcreteOperator<Operator, Instruction::AddrSpaceCast> {
558  friend class AddrSpaceCastInst;
559  friend class ConstantExpr;
560 
561 public:
563 
564  const Value *getPointerOperand() const { return getOperand(0); }
565 
566  unsigned getSrcAddressSpace() const {
568  }
569 
570  unsigned getDestAddressSpace() const {
571  return getType()->getPointerAddressSpace();
572  }
573 };
574 
575 } // end namespace llvm
576 
577 #endif // LLVM_IR_OPERATOR_H
use
Move duplicate certain instructions close to their use
Definition: Localizer.cpp:32
llvm::FastMathFlags::ApproxFunc
@ ApproxFunc
Definition: FMF.h:47
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::FPMathOperator::isFast
bool isFast() const
Test if this operation allows all non-strict floating-point transforms.
Definition: Operator.h:238
llvm::bitc::NoInfs
@ NoInfs
Definition: LLVMBitCodes.h:479
FMF.h
llvm::Operator
This is a utility class that provides an abstraction for the common functionality between Instruction...
Definition: Operator.h:32
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::PtrToIntOperator::getPointerOperand
const Value * getPointerOperand() const
Definition: Operator.h:522
Optional.h
llvm::Operator::Operator
Operator()=delete
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:113
llvm::GEPOperator::getNumIndices
unsigned getNumIndices() const
Definition: Operator.h:439
llvm::Value::SubclassOptionalData
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
Definition: Value.h:90
llvm::GEPOperator::hasIndices
bool hasIndices() const
Definition: Operator.h:443
llvm::GEPOperator::indices
iterator_range< const_op_iterator > indices() const
Definition: Operator.h:412
llvm::Operator::~Operator
~Operator()=delete
llvm::ConcreteOperator::classof
static bool classof(const Instruction *I)
Definition: Operator.h:335
llvm::BitCastInst
This class represents a no-op cast from one type to another.
Definition: Instructions.h:5256
llvm::FastMathFlags::NoSignedZeros
@ NoSignedZeros
Definition: FMF.h:44
llvm::PossiblyExactOperator::classof
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:153
llvm::Type::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition: DerivedTypes.h:729
MapVector.h
llvm::Type::isFPOrFPVectorTy
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition: Type.h:184
llvm::GEPOperator::getInRangeIndex
Optional< unsigned > getInRangeIndex() const
Returns the offset of the index with an inrange attachment, or None if none.
Definition: Operator.h:398
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::BitCastOperator::getSrcTy
Type * getSrcTy() const
Definition: Operator.h:547
llvm::Optional< unsigned >
llvm::AddrSpaceCastOperator::getPointerOperand
const Value * getPointerOperand() const
Definition: Operator.h:564
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:37
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:79
llvm::OverflowingBinaryOperator::hasNoUnsignedWrap
bool hasNoUnsignedWrap() const
Test whether this operation is known to never undergo unsigned overflow, aka the nuw property.
Definition: Operator.h:96
llvm::FPMathOperator::hasNoNaNs
bool hasNoNaNs() const
Test if this operation's arguments and results are assumed not-NaN.
Definition: Operator.h:254
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:357
llvm::PossiblyExactOperator::classof
static bool classof(const Value *V)
Definition: Operator.h:159
llvm::FastMathFlags
Convenience struct for specifying and reasoning about fast-math flags.
Definition: FMF.h:21
llvm::FastMathFlags::AllowReciprocal
@ AllowReciprocal
Definition: FMF.h:45
llvm::count_if
auto count_if(R &&Range, UnaryPredicate P)
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
Definition: STLExtras.h:1707
llvm::PossiblyExactOperator
A udiv or sdiv instruction, which can be marked as "exact", indicating that no bits are destroyed.
Definition: Operator.h:126
llvm::FastMathFlags::NoInfs
@ NoInfs
Definition: FMF.h:43
llvm::FPMathOperator::hasNoInfs
bool hasNoInfs() const
Test if this operation's arguments and results are assumed not-infinite.
Definition: Operator.h:259
llvm::PossiblyExactOperator::isPossiblyExactOpcode
static bool isPossiblyExactOpcode(unsigned OpC)
Definition: Operator.h:146
Instruction.h
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
llvm::GEPOperator::idx_begin
const_op_iterator idx_begin() const
Definition: Operator.h:404
llvm::GEPOperator::getResultElementType
Type * getResultElementType() const
Definition: Operator.cpp:53
llvm::OverflowingBinaryOperator::classof
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:112
llvm::AddrSpaceCastInst
This class represents a conversion between pointers from one address space to another.
Definition: Instructions.h:5296
llvm::BitCastOperator
Definition: Operator.h:541
llvm::AddrSpaceCastOperator::getDestAddressSpace
unsigned getDestAddressSpace() const
Definition: Operator.h:570
Constants.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::FastMathFlags::AllowContract
@ AllowContract
Definition: FMF.h:46
llvm::User
Definition: User.h:44
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::GEPOperator::getPointerOperand
Value * getPointerOperand()
Definition: Operator.h:416
llvm::FastMathFlags::AllowReassoc
@ AllowReassoc
Definition: FMF.h:41
llvm::ConcreteOperator
A helper template for defining operators for individual opcodes.
Definition: Operator.h:333
llvm::AShrOperator
Definition: Operator.h:366
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::ShlOperator
Definition: Operator.h:356
llvm::Instruction
Definition: Instruction.h:42
llvm::Operator::getOpcode
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
Definition: Operator.h:42
llvm::BitCastOperator::getDestTy
Type * getDestTy() const
Definition: Operator.h:551
llvm::bitc::NoNaNs
@ NoNaNs
Definition: LLVMBitCodes.h:478
llvm::PtrToIntOperator::getPointerOperandIndex
static unsigned getPointerOperandIndex()
Definition: Operator.h:526
llvm::GEPOperator::getMaxPreservedAlignment
Align getMaxPreservedAlignment(const DataLayout &DL) const
Compute the maximum alignment that this GEP is garranteed to preserve.
Definition: Operator.cpp:59
llvm::LShrOperator
Definition: Operator.h:369
llvm::FPMathOperator::hasNoSignedZeros
bool hasNoSignedZeros() const
Test if this operation can ignore the sign of zero.
Definition: Operator.h:264
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::MCID::Call
@ Call
Definition: MCInstrDesc.h:155
llvm::AddrSpaceCastOperator::getPointerOperand
Value * getPointerOperand()
Definition: Operator.h:562
llvm::FPMathOperator::classof
static bool classof(const Value *V)
Definition: Operator.h:294
llvm::None
const NoneType None
Definition: None.h:24
Type.h
llvm::PossiblyExactOperator::IsExact
@ IsExact
Definition: Operator.h:129
llvm::PtrToIntOperator::getPointerOperand
Value * getPointerOperand()
Definition: Operator.h:519
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
llvm::ConcreteOperator::classof
static bool classof(const Value *V)
Definition: Operator.h:341
llvm::OverflowingBinaryOperator::classof
static bool classof(const Value *V)
Definition: Operator.h:118
llvm::GEPOperator::hasAllZeroIndices
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
Definition: Operator.h:450
llvm::OverflowingBinaryOperator::classof
static bool classof(const Instruction *I)
Definition: Operator.h:106
llvm::OverflowingBinaryOperator::NoUnsignedWrap
@ NoUnsignedWrap
Definition: Operator.h:76
llvm::AddrSpaceCastOperator
Definition: Operator.h:556
llvm::ZExtOperator
Definition: Operator.h:373
llvm::Operator::classof
static bool classof(const ConstantExpr *)
Definition: Operator.h:59
llvm::GEPOperator::countNonConstantIndices
unsigned countNonConstantIndices() const
Definition: Operator.h:471
s
multiplies can be turned into SHL s
Definition: README.txt:370
llvm::FPMathOperator::hasAllowReciprocal
bool hasAllowReciprocal() const
Test if this operation can use reciprocal multiply instead of division.
Definition: Operator.h:269
llvm::AddOperator
Definition: Operator.h:347
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::UDivOperator
Definition: Operator.h:363
llvm::GetElementPtrInst
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
Definition: Instructions.h:929
llvm::FPMathOperator::hasAllowReassoc
bool hasAllowReassoc() const
Test if this operation may be simplified with reassociative transforms.
Definition: Operator.h:249
llvm::FPMathOperator
Utility class for floating point operations which can have information about relaxed accuracy require...
Definition: Operator.h:167
llvm::Operator::hasPoisonGeneratingFlags
bool hasPoisonGeneratingFlags() const
Return true if this operator has flags which may cause this operator to evaluate to poison despite ha...
Definition: Operator.cpp:21
llvm::Operator::getOpcode
static unsigned getOpcode(const Value *V)
If V is an Instruction or ConstantExpr, return its opcode.
Definition: Operator.h:50
llvm::Operator::classof
static bool classof(const Value *V)
Definition: Operator.h:60
llvm::bitc::NoSignedZeros
@ NoSignedZeros
Definition: LLVMBitCodes.h:480
llvm::PtrToIntOperator::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
Definition: Operator.h:536
llvm::GEPOperator
Definition: Operator.h:375
llvm::FPMathOperator::hasApproxFunc
bool hasApproxFunc() const
Test if this operation allows approximations of math library functions or intrinsics.
Definition: Operator.h:280
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::GEPOperator::hasAllConstantIndices
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
Definition: Operator.h:463
llvm::bitc::AllowReassoc
@ AllowReassoc
Definition: LLVMBitCodes.h:484
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::GEPOperator::indices
iterator_range< op_iterator > indices()
Definition: Operator.h:408
None.h
Mul
BinaryOperator * Mul
Definition: X86PartialReduction.cpp:70
llvm::OverflowingBinaryOperator::AnyWrap
@ AnyWrap
Definition: Operator.h:75
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:255
llvm::Operator::classof
static bool classof(const Instruction *)
Definition: Operator.h:58
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::GEPOperator::getPointerOperandIndex
static unsigned getPointerOperandIndex()
Definition: Operator.h:422
llvm::OverflowingBinaryOperator
Utility class for integer operators which may exhibit overflow - Add, Sub, Mul, and Shl.
Definition: Operator.h:72
llvm::FPMathOperator::hasAllowContract
bool hasAllowContract() const
Test if this operation can be floating-point contracted (FMA).
Definition: Operator.h:274
llvm::GEPOperator::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
Definition: Operator.h:435
llvm::MCID::Select
@ Select
Definition: MCInstrDesc.h:164
llvm::ConstantExpr
A constant value that is initialized with an expression using other constant values.
Definition: Constants.h:972
llvm::OverflowingBinaryOperator::hasNoSignedWrap
bool hasNoSignedWrap() const
Test whether this operation is known to never undergo signed overflow, aka the nsw property.
Definition: Operator.h:102
llvm::AddrSpaceCastOperator::getSrcAddressSpace
unsigned getSrcAddressSpace() const
Definition: Operator.h:566
llvm::MulOperator
Definition: Operator.h:353
llvm::FPMathOperator::getFastMathFlags
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags.
Definition: Operator.h:285
llvm::GEPOperator::isInBounds
bool isInBounds() const
Test whether this is an inbounds GEP, as defined by LangRef.html.
Definition: Operator.h:392
llvm::SubOperator
Definition: Operator.h:350
llvm::PtrToIntOperator::getPointerOperandType
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
Definition: Operator.h:531
llvm::GEPOperator::accumulateConstantOffset
bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset, function_ref< bool(Value &, APInt &)> ExternalAnalysis=nullptr) const
Accumulate the constant address offset of this GEP if possible.
Definition: Operator.cpp:86
Casting.h
llvm::PtrToIntOperator
Definition: Operator.h:513
llvm::BitWidth
constexpr unsigned BitWidth
Definition: BitmaskEnum.h:147
llvm::GEPOperator::collectOffset
bool collectOffset(const DataLayout &DL, unsigned BitWidth, MapVector< Value *, APInt > &VariableOffsets, APInt &ConstantOffset) const
Collect the offset of this GEP as a map of Values to their associated APInt multipliers,...
Definition: Operator.cpp:171
llvm::MCID::Add
@ Add
Definition: MCInstrDesc.h:185
llvm::PtrToIntOperator::PtrToInt
friend class PtrToInt
Definition: Operator.h:515
llvm::OverflowingBinaryOperator::NoSignedWrap
@ NoSignedWrap
Definition: Operator.h:77
llvm::ConcreteOperator::classof
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:338
llvm::GEPOperator::getSourceElementType
Type * getSourceElementType() const
Definition: Operator.cpp:47
llvm::User::getNumOperands
unsigned getNumOperands() const
Definition: User.h:191
SuperClass
llvm::FPMathOperator::getFPAccuracy
float getFPAccuracy() const
Get the maximum error permitted by this operation in ULPs.
Definition: Instructions.cpp:2924
llvm::GEPOperator::idx_end
const_op_iterator idx_end() const
Definition: Operator.h:406
llvm::User::op_begin
op_iterator op_begin()
Definition: User.h:234
llvm::PossiblyExactOperator::classof
static bool classof(const Instruction *I)
Definition: Operator.h:156
llvm::SDivOperator
Definition: Operator.h:360
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::GEPOperator::getPointerOperand
const Value * getPointerOperand() const
Definition: Operator.h:419
llvm::GEPOperator::idx_begin
op_iterator idx_begin()
Definition: Operator.h:403
llvm::User::getOperand
Value * getOperand(unsigned i) const
Definition: User.h:169
llvm::bitc::AllowContract
@ AllowContract
Definition: LLVMBitCodes.h:482
llvm::FastMathFlags::NoNaNs
@ NoNaNs
Definition: FMF.h:42
llvm::PossiblyExactOperator::isExact
bool isExact() const
Test whether this division is known to be exact, with zero remainder.
Definition: Operator.h:142
Value.h
llvm::GEPOperator::getPointerOperandType
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
Definition: Operator.h:427
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::bitc::ApproxFunc
@ ApproxFunc
Definition: LLVMBitCodes.h:483
llvm::GEPOperator::idx_end
op_iterator idx_end()
Definition: Operator.h:405
llvm::bitc::AllowReciprocal
@ AllowReciprocal
Definition: LLVMBitCodes.h:481
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:43
llvm::User::op_end
op_iterator op_end()
Definition: User.h:236