LLVM  13.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/None.h"
18 #include "llvm/ADT/Optional.h"
19 #include "llvm/IR/Constants.h"
20 #include "llvm/IR/Instruction.h"
21 #include "llvm/IR/Type.h"
22 #include "llvm/IR/Value.h"
23 #include "llvm/Support/Casting.h"
24 #include <cstddef>
25 
26 namespace llvm {
27 
28 /// This is a utility class that provides an abstraction for the common
29 /// functionality between Instructions and ConstantExprs.
30 class Operator : public User {
31 public:
32  // The Operator class is intended to be used as a utility, and is never itself
33  // instantiated.
34  Operator() = delete;
35  ~Operator() = delete;
36 
37  void *operator new(size_t s) = delete;
38 
39  /// Return the opcode for this Instruction or ConstantExpr.
40  unsigned getOpcode() const {
41  if (const Instruction *I = dyn_cast<Instruction>(this))
42  return I->getOpcode();
43  return cast<ConstantExpr>(this)->getOpcode();
44  }
45 
46  /// If V is an Instruction or ConstantExpr, return its opcode.
47  /// Otherwise return UserOp1.
48  static unsigned getOpcode(const Value *V) {
49  if (const Instruction *I = dyn_cast<Instruction>(V))
50  return I->getOpcode();
51  if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
52  return CE->getOpcode();
53  return Instruction::UserOp1;
54  }
55 
56  static bool classof(const Instruction *) { return true; }
57  static bool classof(const ConstantExpr *) { return true; }
58  static bool classof(const Value *V) {
59  return isa<Instruction>(V) || isa<ConstantExpr>(V);
60  }
61 };
62 
63 /// Utility class for integer operators which may exhibit overflow - Add, Sub,
64 /// Mul, and Shl. It does not include SDiv, despite that operator having the
65 /// potential for overflow.
67 public:
68  enum {
69  AnyWrap = 0,
70  NoUnsignedWrap = (1 << 0),
71  NoSignedWrap = (1 << 1)
72  };
73 
74 private:
75  friend class Instruction;
76  friend class ConstantExpr;
77 
78  void setHasNoUnsignedWrap(bool B) {
81  }
82  void setHasNoSignedWrap(bool B) {
85  }
86 
87 public:
88  /// Test whether this operation is known to never
89  /// undergo unsigned overflow, aka the nuw property.
90  bool hasNoUnsignedWrap() const {
92  }
93 
94  /// Test whether this operation is known to never
95  /// undergo signed overflow, aka the nsw property.
96  bool hasNoSignedWrap() const {
97  return (SubclassOptionalData & NoSignedWrap) != 0;
98  }
99 
100  static bool classof(const Instruction *I) {
101  return I->getOpcode() == Instruction::Add ||
102  I->getOpcode() == Instruction::Sub ||
103  I->getOpcode() == Instruction::Mul ||
104  I->getOpcode() == Instruction::Shl;
105  }
106  static bool classof(const ConstantExpr *CE) {
107  return CE->getOpcode() == Instruction::Add ||
108  CE->getOpcode() == Instruction::Sub ||
109  CE->getOpcode() == Instruction::Mul ||
110  CE->getOpcode() == Instruction::Shl;
111  }
112  static bool classof(const Value *V) {
113  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
114  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
115  }
116 };
117 
118 /// A udiv or sdiv instruction, which can be marked as "exact",
119 /// indicating that no bits are destroyed.
121 public:
122  enum {
123  IsExact = (1 << 0)
124  };
125 
126 private:
127  friend class Instruction;
128  friend class ConstantExpr;
129 
130  void setIsExact(bool B) {
132  }
133 
134 public:
135  /// Test whether this division is known to be exact, with zero remainder.
136  bool isExact() const {
137  return SubclassOptionalData & IsExact;
138  }
139 
140  static bool isPossiblyExactOpcode(unsigned OpC) {
141  return OpC == Instruction::SDiv ||
142  OpC == Instruction::UDiv ||
143  OpC == Instruction::AShr ||
144  OpC == Instruction::LShr;
145  }
146 
147  static bool classof(const ConstantExpr *CE) {
148  return isPossiblyExactOpcode(CE->getOpcode());
149  }
150  static bool classof(const Instruction *I) {
151  return isPossiblyExactOpcode(I->getOpcode());
152  }
153  static bool classof(const Value *V) {
154  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
155  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
156  }
157 };
158 
159 /// Convenience struct for specifying and reasoning about fast-math flags.
161 private:
162  friend class FPMathOperator;
163 
164  unsigned Flags = 0;
165 
166  FastMathFlags(unsigned F) {
167  // If all 7 bits are set, turn this into -1. If the number of bits grows,
168  // this must be updated. This is intended to provide some forward binary
169  // compatibility insurance for the meaning of 'fast' in case bits are added.
170  if (F == 0x7F) Flags = ~0U;
171  else Flags = F;
172  }
173 
174 public:
175  // This is how the bits are used in Value::SubclassOptionalData so they
176  // should fit there too.
177  // WARNING: We're out of space. SubclassOptionalData only has 7 bits. New
178  // functionality will require a change in how this information is stored.
179  enum {
180  AllowReassoc = (1 << 0),
181  NoNaNs = (1 << 1),
182  NoInfs = (1 << 2),
183  NoSignedZeros = (1 << 3),
184  AllowReciprocal = (1 << 4),
185  AllowContract = (1 << 5),
186  ApproxFunc = (1 << 6)
187  };
188 
189  FastMathFlags() = default;
190 
192  FastMathFlags FMF;
193  FMF.setFast();
194  return FMF;
195  }
196 
197  bool any() const { return Flags != 0; }
198  bool none() const { return Flags == 0; }
199  bool all() const { return Flags == ~0U; }
200 
201  void clear() { Flags = 0; }
202  void set() { Flags = ~0U; }
203 
204  /// Flag queries
205  bool allowReassoc() const { return 0 != (Flags & AllowReassoc); }
206  bool noNaNs() const { return 0 != (Flags & NoNaNs); }
207  bool noInfs() const { return 0 != (Flags & NoInfs); }
208  bool noSignedZeros() const { return 0 != (Flags & NoSignedZeros); }
209  bool allowReciprocal() const { return 0 != (Flags & AllowReciprocal); }
210  bool allowContract() const { return 0 != (Flags & AllowContract); }
211  bool approxFunc() const { return 0 != (Flags & ApproxFunc); }
212  /// 'Fast' means all bits are set.
213  bool isFast() const { return all(); }
214 
215  /// Flag setters
216  void setAllowReassoc(bool B = true) {
217  Flags = (Flags & ~AllowReassoc) | B * AllowReassoc;
218  }
219  void setNoNaNs(bool B = true) {
220  Flags = (Flags & ~NoNaNs) | B * NoNaNs;
221  }
222  void setNoInfs(bool B = true) {
223  Flags = (Flags & ~NoInfs) | B * NoInfs;
224  }
225  void setNoSignedZeros(bool B = true) {
226  Flags = (Flags & ~NoSignedZeros) | B * NoSignedZeros;
227  }
228  void setAllowReciprocal(bool B = true) {
229  Flags = (Flags & ~AllowReciprocal) | B * AllowReciprocal;
230  }
231  void setAllowContract(bool B = true) {
232  Flags = (Flags & ~AllowContract) | B * AllowContract;
233  }
234  void setApproxFunc(bool B = true) {
235  Flags = (Flags & ~ApproxFunc) | B * ApproxFunc;
236  }
237  void setFast(bool B = true) { B ? set() : clear(); }
238 
239  void operator&=(const FastMathFlags &OtherFlags) {
240  Flags &= OtherFlags.Flags;
241  }
242  void operator|=(const FastMathFlags &OtherFlags) {
243  Flags |= OtherFlags.Flags;
244  }
245 };
246 
247 /// Utility class for floating point operations which can have
248 /// information about relaxed accuracy requirements attached to them.
249 class FPMathOperator : public Operator {
250 private:
251  friend class Instruction;
252 
253  /// 'Fast' means all bits are set.
254  void setFast(bool B) {
255  setHasAllowReassoc(B);
256  setHasNoNaNs(B);
257  setHasNoInfs(B);
258  setHasNoSignedZeros(B);
259  setHasAllowReciprocal(B);
260  setHasAllowContract(B);
261  setHasApproxFunc(B);
262  }
263 
264  void setHasAllowReassoc(bool B) {
268  }
269 
270  void setHasNoNaNs(bool B) {
272  (SubclassOptionalData & ~FastMathFlags::NoNaNs) |
274  }
275 
276  void setHasNoInfs(bool B) {
278  (SubclassOptionalData & ~FastMathFlags::NoInfs) |
280  }
281 
282  void setHasNoSignedZeros(bool B) {
284  (SubclassOptionalData & ~FastMathFlags::NoSignedZeros) |
286  }
287 
288  void setHasAllowReciprocal(bool B) {
290  (SubclassOptionalData & ~FastMathFlags::AllowReciprocal) |
292  }
293 
294  void setHasAllowContract(bool B) {
296  (SubclassOptionalData & ~FastMathFlags::AllowContract) |
298  }
299 
300  void setHasApproxFunc(bool B) {
302  (SubclassOptionalData & ~FastMathFlags::ApproxFunc) |
304  }
305 
306  /// Convenience function for setting multiple fast-math flags.
307  /// FMF is a mask of the bits to set.
308  void setFastMathFlags(FastMathFlags FMF) {
309  SubclassOptionalData |= FMF.Flags;
310  }
311 
312  /// Convenience function for copying all fast-math flags.
313  /// All values in FMF are transferred to this operator.
314  void copyFastMathFlags(FastMathFlags FMF) {
315  SubclassOptionalData = FMF.Flags;
316  }
317 
318 public:
319  /// Test if this operation allows all non-strict floating-point transforms.
320  bool isFast() const {
328  }
329 
330  /// Test if this operation may be simplified with reassociative transforms.
331  bool hasAllowReassoc() const {
333  }
334 
335  /// Test if this operation's arguments and results are assumed not-NaN.
336  bool hasNoNaNs() const {
338  }
339 
340  /// Test if this operation's arguments and results are assumed not-infinite.
341  bool hasNoInfs() const {
343  }
344 
345  /// Test if this operation can ignore the sign of zero.
346  bool hasNoSignedZeros() const {
348  }
349 
350  /// Test if this operation can use reciprocal multiply instead of division.
351  bool hasAllowReciprocal() const {
353  }
354 
355  /// Test if this operation can be floating-point contracted (FMA).
356  bool hasAllowContract() const {
358  }
359 
360  /// Test if this operation allows approximations of math library functions or
361  /// intrinsics.
362  bool hasApproxFunc() const {
364  }
365 
366  /// Convenience function for getting all the fast-math flags
369  }
370 
371  /// Get the maximum error permitted by this operation in ULPs. An accuracy of
372  /// 0.0 means that the operation should be performed with the default
373  /// precision.
374  float getFPAccuracy() const;
375 
376  static bool classof(const Value *V) {
377  unsigned Opcode;
378  if (auto *I = dyn_cast<Instruction>(V))
379  Opcode = I->getOpcode();
380  else if (auto *CE = dyn_cast<ConstantExpr>(V))
381  Opcode = CE->getOpcode();
382  else
383  return false;
384 
385  switch (Opcode) {
386  case Instruction::FNeg:
387  case Instruction::FAdd:
388  case Instruction::FSub:
389  case Instruction::FMul:
390  case Instruction::FDiv:
391  case Instruction::FRem:
392  // FIXME: To clean up and correct the semantics of fast-math-flags, FCmp
393  // should not be treated as a math op, but the other opcodes should.
394  // This would make things consistent with Select/PHI (FP value type
395  // determines whether they are math ops and, therefore, capable of
396  // having fast-math-flags).
397  case Instruction::FCmp:
398  return true;
399  case Instruction::PHI:
400  case Instruction::Select:
401  case Instruction::Call: {
402  Type *Ty = V->getType();
403  while (ArrayType *ArrTy = dyn_cast<ArrayType>(Ty))
404  Ty = ArrTy->getElementType();
405  return Ty->isFPOrFPVectorTy();
406  }
407  default:
408  return false;
409  }
410  }
411 };
412 
413 /// A helper template for defining operators for individual opcodes.
414 template<typename SuperClass, unsigned Opc>
415 class ConcreteOperator : public SuperClass {
416 public:
417  static bool classof(const Instruction *I) {
418  return I->getOpcode() == Opc;
419  }
420  static bool classof(const ConstantExpr *CE) {
421  return CE->getOpcode() == Opc;
422  }
423  static bool classof(const Value *V) {
424  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
425  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
426  }
427 };
428 
430  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {
431 };
433  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {
434 };
436  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {
437 };
439  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {
440 };
441 
443  : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {
444 };
446  : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {
447 };
449  : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {
450 };
452  : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {
453 };
454 
455 class ZExtOperator : public ConcreteOperator<Operator, Instruction::ZExt> {};
456 
458  : public ConcreteOperator<Operator, Instruction::GetElementPtr> {
459  friend class GetElementPtrInst;
460  friend class ConstantExpr;
461 
462  enum {
463  IsInBounds = (1 << 0),
464  // InRangeIndex: bits 1-6
465  };
466 
467  void setIsInBounds(bool B) {
469  (SubclassOptionalData & ~IsInBounds) | (B * IsInBounds);
470  }
471 
472 public:
473  /// Test whether this is an inbounds GEP, as defined by LangRef.html.
474  bool isInBounds() const {
475  return SubclassOptionalData & IsInBounds;
476  }
477 
478  /// Returns the offset of the index with an inrange attachment, or None if
479  /// none.
481  if (SubclassOptionalData >> 1 == 0) return None;
482  return (SubclassOptionalData >> 1) - 1;
483  }
484 
485  inline op_iterator idx_begin() { return op_begin()+1; }
486  inline const_op_iterator idx_begin() const { return op_begin()+1; }
487  inline op_iterator idx_end() { return op_end(); }
488  inline const_op_iterator idx_end() const { return op_end(); }
489 
491  return getOperand(0);
492  }
493  const Value *getPointerOperand() const {
494  return getOperand(0);
495  }
496  static unsigned getPointerOperandIndex() {
497  return 0U; // get index for modifying correct operand
498  }
499 
500  /// Method to return the pointer operand as a PointerType.
502  return getPointerOperand()->getType();
503  }
504 
505  Type *getSourceElementType() const;
506  Type *getResultElementType() const;
507 
508  /// Method to return the address space of the pointer operand.
509  unsigned getPointerAddressSpace() const {
511  }
512 
513  unsigned getNumIndices() const { // Note: always non-negative
514  return getNumOperands() - 1;
515  }
516 
517  bool hasIndices() const {
518  return getNumOperands() > 1;
519  }
520 
521  /// Return true if all of the indices of this GEP are zeros.
522  /// If so, the result pointer and the first operand have the same
523  /// value, just potentially different types.
524  bool hasAllZeroIndices() const {
525  for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
526  if (ConstantInt *C = dyn_cast<ConstantInt>(I))
527  if (C->isZero())
528  continue;
529  return false;
530  }
531  return true;
532  }
533 
534  /// Return true if all of the indices of this GEP are constant integers.
535  /// If so, the result pointer and the first operand have
536  /// a constant offset between them.
537  bool hasAllConstantIndices() const {
538  for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
539  if (!isa<ConstantInt>(I))
540  return false;
541  }
542  return true;
543  }
544 
545  unsigned countNonConstantIndices() const {
546  return count_if(make_range(idx_begin(), idx_end()), [](const Use& use) {
547  return !isa<ConstantInt>(*use);
548  });
549  }
550 
551  /// Compute the maximum alignment that this GEP is garranteed to preserve.
553 
554  /// Accumulate the constant address offset of this GEP if possible.
555  ///
556  /// This routine accepts an APInt into which it will try to accumulate the
557  /// constant offset of this GEP.
558  ///
559  /// If \p ExternalAnalysis is provided it will be used to calculate a offset
560  /// when a operand of GEP is not constant.
561  /// For example, for a value \p ExternalAnalysis might try to calculate a
562  /// lower bound. If \p ExternalAnalysis is successful, it should return true.
563  ///
564  /// If the \p ExternalAnalysis returns false or the value returned by \p
565  /// ExternalAnalysis results in a overflow/underflow, this routine returns
566  /// false and the value of the offset APInt is undefined (it is *not*
567  /// preserved!).
568  ///
569  /// The APInt passed into this routine must be at exactly as wide as the
570  /// IntPtr type for the address space of the base GEP pointer.
572  const DataLayout &DL, APInt &Offset,
573  function_ref<bool(Value &, APInt &)> ExternalAnalysis = nullptr) const;
574 
575  static bool accumulateConstantOffset(
576  Type *SourceType, ArrayRef<const Value *> Index, const DataLayout &DL,
577  APInt &Offset,
578  function_ref<bool(Value &, APInt &)> ExternalAnalysis = nullptr);
579 };
580 
582  : public ConcreteOperator<Operator, Instruction::PtrToInt> {
583  friend class PtrToInt;
584  friend class ConstantExpr;
585 
586 public:
588  return getOperand(0);
589  }
590  const Value *getPointerOperand() const {
591  return getOperand(0);
592  }
593 
594  static unsigned getPointerOperandIndex() {
595  return 0U; // get index for modifying correct operand
596  }
597 
598  /// Method to return the pointer operand as a PointerType.
600  return getPointerOperand()->getType();
601  }
602 
603  /// Method to return the address space of the pointer operand.
604  unsigned getPointerAddressSpace() const {
605  return cast<PointerType>(getPointerOperandType())->getAddressSpace();
606  }
607 };
608 
610  : public ConcreteOperator<Operator, Instruction::BitCast> {
611  friend class BitCastInst;
612  friend class ConstantExpr;
613 
614 public:
615  Type *getSrcTy() const {
616  return getOperand(0)->getType();
617  }
618 
619  Type *getDestTy() const {
620  return getType();
621  }
622 };
623 
625  : public ConcreteOperator<Operator, Instruction::AddrSpaceCast> {
626  friend class AddrSpaceCastInst;
627  friend class ConstantExpr;
628 
629 public:
631 
632  const Value *getPointerOperand() const { return getOperand(0); }
633 
634  unsigned getSrcAddressSpace() const {
636  }
637 
638  unsigned getDestAddressSpace() const {
639  return getType()->getPointerAddressSpace();
640  }
641 };
642 
643 } // end namespace llvm
644 
645 #endif // LLVM_IR_OPERATOR_H
use
Move duplicate certain instructions close to their use
Definition: Localizer.cpp:31
llvm::FastMathFlags::NoSignedZeros
@ NoSignedZeros
Definition: Operator.h:183
llvm
Definition: AllocatorList.h:23
llvm::FPMathOperator::isFast
bool isFast() const
Test if this operation allows all non-strict floating-point transforms.
Definition: Operator.h:320
llvm::bitc::NoInfs
@ NoInfs
Definition: LLVMBitCodes.h:464
llvm::FastMathFlags::getFast
static FastMathFlags getFast()
Definition: Operator.h:191
llvm::Operator
This is a utility class that provides an abstraction for the common functionality between Instruction...
Definition: Operator.h:30
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:590
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:112
llvm::GEPOperator::getNumIndices
unsigned getNumIndices() const
Definition: Operator.h:513
llvm::Value::SubclassOptionalData
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
Definition: Value.h:91
llvm::GEPOperator::hasIndices
bool hasIndices() const
Definition: Operator.h:517
llvm::FastMathFlags::setNoSignedZeros
void setNoSignedZeros(bool B=true)
Definition: Operator.h:225
llvm::Operator::~Operator
~Operator()=delete
llvm::ConcreteOperator::classof
static bool classof(const Instruction *I)
Definition: Operator.h:417
llvm::BitCastInst
This class represents a no-op cast from one type to another.
Definition: Instructions.h:5136
llvm::PossiblyExactOperator::classof
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:147
llvm::Type::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition: DerivedTypes.h:693
llvm::Type::isFPOrFPVectorTy
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition: Type.h:190
llvm::GEPOperator::getInRangeIndex
Optional< unsigned > getInRangeIndex() const
Returns the offset of the index with an inrange attachment, or None if none.
Definition: Operator.h:480
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
llvm::FastMathFlags::setAllowReciprocal
void setAllowReciprocal(bool B=true)
Definition: Operator.h:228
llvm::FastMathFlags::noSignedZeros
bool noSignedZeros() const
Definition: Operator.h:208
llvm::BitCastOperator::getSrcTy
Type * getSrcTy() const
Definition: Operator.h:615
llvm::Optional< unsigned >
llvm::FastMathFlags::operator&=
void operator&=(const FastMathFlags &OtherFlags)
Definition: Operator.h:239
llvm::AddrSpaceCastOperator::getPointerOperand
const Value * getPointerOperand() const
Definition: Operator.h:632
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::OverflowingBinaryOperator::hasNoUnsignedWrap
bool hasNoUnsignedWrap() const
Test whether this operation is known to never undergo unsigned overflow, aka the nuw property.
Definition: Operator.h:90
llvm::FPMathOperator::hasNoNaNs
bool hasNoNaNs() const
Test if this operation's arguments and results are assumed not-NaN.
Definition: Operator.h:336
llvm::FastMathFlags::none
bool none() const
Definition: Operator.h:198
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:359
llvm::PossiblyExactOperator::classof
static bool classof(const Value *V)
Definition: Operator.h:153
llvm::FastMathFlags
Convenience struct for specifying and reasoning about fast-math flags.
Definition: Operator.h:160
llvm::FastMathFlags::noNaNs
bool noNaNs() const
Definition: Operator.h:206
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:1595
llvm::PossiblyExactOperator
A udiv or sdiv instruction, which can be marked as "exact", indicating that no bits are destroyed.
Definition: Operator.h:120
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::FPMathOperator::hasNoInfs
bool hasNoInfs() const
Test if this operation's arguments and results are assumed not-infinite.
Definition: Operator.h:341
llvm::FastMathFlags::FastMathFlags
FastMathFlags()=default
llvm::PossiblyExactOperator::isPossiblyExactOpcode
static bool isPossiblyExactOpcode(unsigned OpC)
Definition: Operator.h:140
Instruction.h
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:77
llvm::GEPOperator::idx_begin
const_op_iterator idx_begin() const
Definition: Operator.h:486
llvm::FastMathFlags::setApproxFunc
void setApproxFunc(bool B=true)
Definition: Operator.h:234
llvm::GEPOperator::getResultElementType
Type * getResultElementType() const
Definition: Operator.cpp:28
llvm::FastMathFlags::any
bool any() const
Definition: Operator.h:197
llvm::OverflowingBinaryOperator::classof
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:106
llvm::FastMathFlags::approxFunc
bool approxFunc() const
Definition: Operator.h:211
llvm::AddrSpaceCastInst
This class represents a conversion between pointers from one address space to another.
Definition: Instructions.h:5176
llvm::BitCastOperator
Definition: Operator.h:609
llvm::AddrSpaceCastOperator::getDestAddressSpace
unsigned getDestAddressSpace() const
Definition: Operator.h:638
Constants.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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:490
llvm::FastMathFlags::allowReassoc
bool allowReassoc() const
Flag queries.
Definition: Operator.h:205
llvm::ConcreteOperator
A helper template for defining operators for individual opcodes.
Definition: Operator.h:415
llvm::AShrOperator
Definition: Operator.h:448
llvm::FastMathFlags::allowReciprocal
bool allowReciprocal() const
Definition: Operator.h:209
llvm::FastMathFlags::AllowReassoc
@ AllowReassoc
Definition: Operator.h:180
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::ShlOperator
Definition: Operator.h:438
llvm::Instruction
Definition: Instruction.h:45
llvm::Operator::getOpcode
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
Definition: Operator.h:40
llvm::BitCastOperator::getDestTy
Type * getDestTy() const
Definition: Operator.h:619
llvm::bitc::NoNaNs
@ NoNaNs
Definition: LLVMBitCodes.h:463
llvm::PtrToIntOperator::getPointerOperandIndex
static unsigned getPointerOperandIndex()
Definition: Operator.h:594
llvm::FastMathFlags::operator|=
void operator|=(const FastMathFlags &OtherFlags)
Definition: Operator.h:242
llvm::GEPOperator::getMaxPreservedAlignment
Align getMaxPreservedAlignment(const DataLayout &DL) const
Compute the maximum alignment that this GEP is garranteed to preserve.
Definition: Operator.cpp:34
llvm::FastMathFlags::NoNaNs
@ NoNaNs
Definition: Operator.h:181
llvm::LShrOperator
Definition: Operator.h:451
llvm::FPMathOperator::hasNoSignedZeros
bool hasNoSignedZeros() const
Test if this operation can ignore the sign of zero.
Definition: Operator.h:346
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:154
llvm::AddrSpaceCastOperator::getPointerOperand
Value * getPointerOperand()
Definition: Operator.h:630
llvm::FastMathFlags::setAllowContract
void setAllowContract(bool B=true)
Definition: Operator.h:231
llvm::FPMathOperator::classof
static bool classof(const Value *V)
Definition: Operator.h:376
llvm::None
const NoneType None
Definition: None.h:23
Type.h
llvm::FastMathFlags::set
void set()
Definition: Operator.h:202
llvm::PtrToIntOperator::getPointerOperand
Value * getPointerOperand()
Definition: Operator.h:587
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:176
llvm::ConcreteOperator::classof
static bool classof(const Value *V)
Definition: Operator.h:423
llvm::OverflowingBinaryOperator::classof
static bool classof(const Value *V)
Definition: Operator.h:112
llvm::GEPOperator::hasAllZeroIndices
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
Definition: Operator.h:524
llvm::OverflowingBinaryOperator::classof
static bool classof(const Instruction *I)
Definition: Operator.h:100
llvm::AddrSpaceCastOperator
Definition: Operator.h:624
llvm::FastMathFlags::noInfs
bool noInfs() const
Definition: Operator.h:207
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::ZExtOperator
Definition: Operator.h:455
llvm::Operator::classof
static bool classof(const ConstantExpr *)
Definition: Operator.h:57
llvm::GEPOperator::countNonConstantIndices
unsigned countNonConstantIndices() const
Definition: Operator.h:545
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:351
llvm::AddOperator
Definition: Operator.h:429
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::UDivOperator
Definition: Operator.h:445
llvm::FastMathFlags::NoInfs
@ NoInfs
Definition: Operator.h:182
llvm::GetElementPtrInst
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
Definition: Instructions.h:905
llvm::FPMathOperator::hasAllowReassoc
bool hasAllowReassoc() const
Test if this operation may be simplified with reassociative transforms.
Definition: Operator.h:331
llvm::FPMathOperator
Utility class for floating point operations which can have information about relaxed accuracy require...
Definition: Operator.h:249
llvm::FastMathFlags::setAllowReassoc
void setAllowReassoc(bool B=true)
Flag setters.
Definition: Operator.h:216
llvm::Operator::getOpcode
static unsigned getOpcode(const Value *V)
If V is an Instruction or ConstantExpr, return its opcode.
Definition: Operator.h:48
llvm::Operator::classof
static bool classof(const Value *V)
Definition: Operator.h:58
llvm::bitc::NoSignedZeros
@ NoSignedZeros
Definition: LLVMBitCodes.h:465
llvm::PtrToIntOperator::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
Definition: Operator.h:604
llvm::GEPOperator
Definition: Operator.h:457
llvm::FPMathOperator::hasApproxFunc
bool hasApproxFunc() const
Test if this operation allows approximations of math library functions or intrinsics.
Definition: Operator.h:362
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:70
llvm::GEPOperator::hasAllConstantIndices
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
Definition: Operator.h:537
llvm::bitc::AllowReassoc
@ AllowReassoc
Definition: LLVMBitCodes.h:469
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
None.h
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:256
llvm::Operator::classof
static bool classof(const Instruction *)
Definition: Operator.h:56
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::PossiblyExactOperator::IsExact
@ IsExact
Definition: Operator.h:123
llvm::OverflowingBinaryOperator::NoUnsignedWrap
@ NoUnsignedWrap
Definition: Operator.h:70
llvm::FastMathFlags::setFast
void setFast(bool B=true)
Definition: Operator.h:237
llvm::GEPOperator::getPointerOperandIndex
static unsigned getPointerOperandIndex()
Definition: Operator.h:496
llvm::OverflowingBinaryOperator
Utility class for integer operators which may exhibit overflow - Add, Sub, Mul, and Shl.
Definition: Operator.h:66
llvm::FPMathOperator::hasAllowContract
bool hasAllowContract() const
Test if this operation can be floating-point contracted (FMA).
Definition: Operator.h:356
llvm::FastMathFlags::setNoInfs
void setNoInfs(bool B=true)
Definition: Operator.h:222
llvm::GEPOperator::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
Definition: Operator.h:509
llvm::MCID::Select
@ Select
Definition: MCInstrDesc.h:163
llvm::FastMathFlags::clear
void clear()
Definition: Operator.h:201
llvm::OverflowingBinaryOperator::AnyWrap
@ AnyWrap
Definition: Operator.h:69
llvm::ConstantExpr
A constant value that is initialized with an expression using other constant values.
Definition: Constants.h:931
llvm::OverflowingBinaryOperator::hasNoSignedWrap
bool hasNoSignedWrap() const
Test whether this operation is known to never undergo signed overflow, aka the nsw property.
Definition: Operator.h:96
llvm::AddrSpaceCastOperator::getSrcAddressSpace
unsigned getSrcAddressSpace() const
Definition: Operator.h:634
llvm::MulOperator
Definition: Operator.h:435
llvm::FPMathOperator::getFastMathFlags
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags.
Definition: Operator.h:367
llvm::GEPOperator::isInBounds
bool isInBounds() const
Test whether this is an inbounds GEP, as defined by LangRef.html.
Definition: Operator.h:474
llvm::SubOperator
Definition: Operator.h:432
llvm::PtrToIntOperator::getPointerOperandType
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
Definition: Operator.h:599
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:61
Casting.h
llvm::FastMathFlags::isFast
bool isFast() const
'Fast' means all bits are set.
Definition: Operator.h:213
llvm::PtrToIntOperator
Definition: Operator.h:581
llvm::FastMathFlags::AllowReciprocal
@ AllowReciprocal
Definition: Operator.h:184
llvm::MCID::Add
@ Add
Definition: MCInstrDesc.h:184
llvm::PtrToIntOperator::PtrToInt
friend class PtrToInt
Definition: Operator.h:583
llvm::ConcreteOperator::classof
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:420
llvm::GEPOperator::getSourceElementType
Type * getSourceElementType() const
Definition: Operator.cpp:22
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:2634
llvm::GEPOperator::idx_end
const_op_iterator idx_end() const
Definition: Operator.h:488
llvm::OverflowingBinaryOperator::NoSignedWrap
@ NoSignedWrap
Definition: Operator.h:71
llvm::User::op_begin
op_iterator op_begin()
Definition: User.h:234
llvm::PossiblyExactOperator::classof
static bool classof(const Instruction *I)
Definition: Operator.h:150
llvm::SDivOperator
Definition: Operator.h:442
llvm::FastMathFlags::all
bool all() const
Definition: Operator.h:199
llvm::GEPOperator::getPointerOperand
const Value * getPointerOperand() const
Definition: Operator.h:493
llvm::GEPOperator::idx_begin
op_iterator idx_begin()
Definition: Operator.h:485
llvm::FastMathFlags::allowContract
bool allowContract() const
Definition: Operator.h:210
llvm::User::getOperand
Value * getOperand(unsigned i) const
Definition: User.h:169
llvm::bitc::AllowContract
@ AllowContract
Definition: LLVMBitCodes.h:467
llvm::FastMathFlags::AllowContract
@ AllowContract
Definition: Operator.h:185
llvm::FastMathFlags::ApproxFunc
@ ApproxFunc
Definition: Operator.h:186
llvm::PossiblyExactOperator::isExact
bool isExact() const
Test whether this division is known to be exact, with zero remainder.
Definition: Operator.h:136
Value.h
llvm::GEPOperator::getPointerOperandType
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
Definition: Operator.h:501
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::FastMathFlags::setNoNaNs
void setNoNaNs(bool B=true)
Definition: Operator.h:219
llvm::bitc::ApproxFunc
@ ApproxFunc
Definition: LLVMBitCodes.h:468
llvm::GEPOperator::idx_end
op_iterator idx_end()
Definition: Operator.h:487
llvm::bitc::AllowReciprocal
@ AllowReciprocal
Definition: LLVMBitCodes.h:466
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:44
llvm::User::op_end
op_iterator op_end()
Definition: User.h:236