LLVM  9.0.0svn
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  NoUnsignedWrap = (1 << 0),
70  NoSignedWrap = (1 << 1)
71  };
72 
73 private:
74  friend class Instruction;
75  friend class ConstantExpr;
76 
77  void setHasNoUnsignedWrap(bool B) {
79  (SubclassOptionalData & ~NoUnsignedWrap) | (B * NoUnsignedWrap);
80  }
81  void setHasNoSignedWrap(bool B) {
83  (SubclassOptionalData & ~NoSignedWrap) | (B * NoSignedWrap);
84  }
85 
86 public:
87  /// Test whether this operation is known to never
88  /// undergo unsigned overflow, aka the nuw property.
89  bool hasNoUnsignedWrap() const {
90  return SubclassOptionalData & NoUnsignedWrap;
91  }
92 
93  /// Test whether this operation is known to never
94  /// undergo signed overflow, aka the nsw property.
95  bool hasNoSignedWrap() const {
96  return (SubclassOptionalData & NoSignedWrap) != 0;
97  }
98 
99  static bool classof(const Instruction *I) {
100  return I->getOpcode() == Instruction::Add ||
101  I->getOpcode() == Instruction::Sub ||
102  I->getOpcode() == Instruction::Mul ||
103  I->getOpcode() == Instruction::Shl;
104  }
105  static bool classof(const ConstantExpr *CE) {
106  return CE->getOpcode() == Instruction::Add ||
107  CE->getOpcode() == Instruction::Sub ||
108  CE->getOpcode() == Instruction::Mul ||
109  CE->getOpcode() == Instruction::Shl;
110  }
111  static bool classof(const Value *V) {
112  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
113  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
114  }
115 };
116 
117 /// A udiv or sdiv instruction, which can be marked as "exact",
118 /// indicating that no bits are destroyed.
120 public:
121  enum {
122  IsExact = (1 << 0)
123  };
124 
125 private:
126  friend class Instruction;
127  friend class ConstantExpr;
128 
129  void setIsExact(bool B) {
130  SubclassOptionalData = (SubclassOptionalData & ~IsExact) | (B * IsExact);
131  }
132 
133 public:
134  /// Test whether this division is known to be exact, with zero remainder.
135  bool isExact() const {
136  return SubclassOptionalData & IsExact;
137  }
138 
139  static bool isPossiblyExactOpcode(unsigned OpC) {
140  return OpC == Instruction::SDiv ||
141  OpC == Instruction::UDiv ||
142  OpC == Instruction::AShr ||
143  OpC == Instruction::LShr;
144  }
145 
146  static bool classof(const ConstantExpr *CE) {
147  return isPossiblyExactOpcode(CE->getOpcode());
148  }
149  static bool classof(const Instruction *I) {
150  return isPossiblyExactOpcode(I->getOpcode());
151  }
152  static bool classof(const Value *V) {
153  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
154  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
155  }
156 };
157 
158 /// Convenience struct for specifying and reasoning about fast-math flags.
160 private:
161  friend class FPMathOperator;
162 
163  unsigned Flags = 0;
164 
165  FastMathFlags(unsigned F) {
166  // If all 7 bits are set, turn this into -1. If the number of bits grows,
167  // this must be updated. This is intended to provide some forward binary
168  // compatibility insurance for the meaning of 'fast' in case bits are added.
169  if (F == 0x7F) Flags = ~0U;
170  else Flags = F;
171  }
172 
173 public:
174  // This is how the bits are used in Value::SubclassOptionalData so they
175  // should fit there too.
176  // WARNING: We're out of space. SubclassOptionalData only has 7 bits. New
177  // functionality will require a change in how this information is stored.
178  enum {
179  AllowReassoc = (1 << 0),
180  NoNaNs = (1 << 1),
181  NoInfs = (1 << 2),
182  NoSignedZeros = (1 << 3),
183  AllowReciprocal = (1 << 4),
184  AllowContract = (1 << 5),
185  ApproxFunc = (1 << 6)
186  };
187 
188  FastMathFlags() = default;
189 
191  FastMathFlags FMF;
192  FMF.setFast();
193  return FMF;
194  }
195 
196  bool any() const { return Flags != 0; }
197  bool none() const { return Flags == 0; }
198  bool all() const { return Flags == ~0U; }
199 
200  void clear() { Flags = 0; }
201  void set() { Flags = ~0U; }
202 
203  /// Flag queries
204  bool allowReassoc() const { return 0 != (Flags & AllowReassoc); }
205  bool noNaNs() const { return 0 != (Flags & NoNaNs); }
206  bool noInfs() const { return 0 != (Flags & NoInfs); }
207  bool noSignedZeros() const { return 0 != (Flags & NoSignedZeros); }
208  bool allowReciprocal() const { return 0 != (Flags & AllowReciprocal); }
209  bool allowContract() const { return 0 != (Flags & AllowContract); }
210  bool approxFunc() const { return 0 != (Flags & ApproxFunc); }
211  /// 'Fast' means all bits are set.
212  bool isFast() const { return all(); }
213 
214  /// Flag setters
215  void setAllowReassoc(bool B = true) {
216  Flags = (Flags & ~AllowReassoc) | B * AllowReassoc;
217  }
218  void setNoNaNs(bool B = true) {
219  Flags = (Flags & ~NoNaNs) | B * NoNaNs;
220  }
221  void setNoInfs(bool B = true) {
222  Flags = (Flags & ~NoInfs) | B * NoInfs;
223  }
224  void setNoSignedZeros(bool B = true) {
225  Flags = (Flags & ~NoSignedZeros) | B * NoSignedZeros;
226  }
227  void setAllowReciprocal(bool B = true) {
228  Flags = (Flags & ~AllowReciprocal) | B * AllowReciprocal;
229  }
230  void setAllowContract(bool B = true) {
231  Flags = (Flags & ~AllowContract) | B * AllowContract;
232  }
233  void setApproxFunc(bool B = true) {
234  Flags = (Flags & ~ApproxFunc) | B * ApproxFunc;
235  }
236  void setFast(bool B = true) { B ? set() : clear(); }
237 
238  void operator&=(const FastMathFlags &OtherFlags) {
239  Flags &= OtherFlags.Flags;
240  }
241 };
242 
243 /// Utility class for floating point operations which can have
244 /// information about relaxed accuracy requirements attached to them.
245 class FPMathOperator : public Operator {
246 private:
247  friend class Instruction;
248 
249  /// 'Fast' means all bits are set.
250  void setFast(bool B) {
251  setHasAllowReassoc(B);
252  setHasNoNaNs(B);
253  setHasNoInfs(B);
254  setHasNoSignedZeros(B);
255  setHasAllowReciprocal(B);
256  setHasAllowContract(B);
257  setHasApproxFunc(B);
258  }
259 
260  void setHasAllowReassoc(bool B) {
264  }
265 
266  void setHasNoNaNs(bool B) {
269  (B * FastMathFlags::NoNaNs);
270  }
271 
272  void setHasNoInfs(bool B) {
275  (B * FastMathFlags::NoInfs);
276  }
277 
278  void setHasNoSignedZeros(bool B) {
282  }
283 
284  void setHasAllowReciprocal(bool B) {
288  }
289 
290  void setHasAllowContract(bool B) {
294  }
295 
296  void setHasApproxFunc(bool B) {
300  }
301 
302  /// Convenience function for setting multiple fast-math flags.
303  /// FMF is a mask of the bits to set.
304  void setFastMathFlags(FastMathFlags FMF) {
305  SubclassOptionalData |= FMF.Flags;
306  }
307 
308  /// Convenience function for copying all fast-math flags.
309  /// All values in FMF are transferred to this operator.
310  void copyFastMathFlags(FastMathFlags FMF) {
311  SubclassOptionalData = FMF.Flags;
312  }
313 
314 public:
315  /// Test if this operation allows all non-strict floating-point transforms.
316  bool isFast() const {
324  }
325 
326  /// Test if this operation may be simplified with reassociative transforms.
327  bool hasAllowReassoc() const {
329  }
330 
331  /// Test if this operation's arguments and results are assumed not-NaN.
332  bool hasNoNaNs() const {
334  }
335 
336  /// Test if this operation's arguments and results are assumed not-infinite.
337  bool hasNoInfs() const {
339  }
340 
341  /// Test if this operation can ignore the sign of zero.
342  bool hasNoSignedZeros() const {
344  }
345 
346  /// Test if this operation can use reciprocal multiply instead of division.
347  bool hasAllowReciprocal() const {
349  }
350 
351  /// Test if this operation can be floating-point contracted (FMA).
352  bool hasAllowContract() const {
354  }
355 
356  /// Test if this operation allows approximations of math library functions or
357  /// intrinsics.
358  bool hasApproxFunc() const {
360  }
361 
362  /// Convenience function for getting all the fast-math flags
365  }
366 
367  /// Get the maximum error permitted by this operation in ULPs. An accuracy of
368  /// 0.0 means that the operation should be performed with the default
369  /// precision.
370  float getFPAccuracy() const;
371 
372  static bool classof(const Value *V) {
373  unsigned Opcode;
374  if (auto *I = dyn_cast<Instruction>(V))
375  Opcode = I->getOpcode();
376  else if (auto *CE = dyn_cast<ConstantExpr>(V))
377  Opcode = CE->getOpcode();
378  else
379  return false;
380 
381  switch (Opcode) {
382  case Instruction::FCmp:
383  return true;
384  // non math FP Operators (no FMF)
385  case Instruction::ExtractElement:
386  case Instruction::ShuffleVector:
387  case Instruction::InsertElement:
388  case Instruction::PHI:
389  return false;
390  default:
391  return V->getType()->isFPOrFPVectorTy();
392  }
393  }
394 };
395 
396 /// A helper template for defining operators for individual opcodes.
397 template<typename SuperClass, unsigned Opc>
398 class ConcreteOperator : public SuperClass {
399 public:
400  static bool classof(const Instruction *I) {
401  return I->getOpcode() == Opc;
402  }
403  static bool classof(const ConstantExpr *CE) {
404  return CE->getOpcode() == Opc;
405  }
406  static bool classof(const Value *V) {
407  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
408  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
409  }
410 };
411 
413  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {
414 };
416  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {
417 };
419  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {
420 };
422  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {
423 };
424 
426  : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {
427 };
429  : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {
430 };
432  : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {
433 };
435  : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {
436 };
437 
438 class ZExtOperator : public ConcreteOperator<Operator, Instruction::ZExt> {};
439 
441  : public ConcreteOperator<Operator, Instruction::GetElementPtr> {
442  friend class GetElementPtrInst;
443  friend class ConstantExpr;
444 
445  enum {
446  IsInBounds = (1 << 0),
447  // InRangeIndex: bits 1-6
448  };
449 
450  void setIsInBounds(bool B) {
452  (SubclassOptionalData & ~IsInBounds) | (B * IsInBounds);
453  }
454 
455 public:
456  /// Test whether this is an inbounds GEP, as defined by LangRef.html.
457  bool isInBounds() const {
458  return SubclassOptionalData & IsInBounds;
459  }
460 
461  /// Returns the offset of the index with an inrange attachment, or None if
462  /// none.
464  if (SubclassOptionalData >> 1 == 0) return None;
465  return (SubclassOptionalData >> 1) - 1;
466  }
467 
468  inline op_iterator idx_begin() { return op_begin()+1; }
469  inline const_op_iterator idx_begin() const { return op_begin()+1; }
470  inline op_iterator idx_end() { return op_end(); }
471  inline const_op_iterator idx_end() const { return op_end(); }
472 
474  return getOperand(0);
475  }
476  const Value *getPointerOperand() const {
477  return getOperand(0);
478  }
479  static unsigned getPointerOperandIndex() {
480  return 0U; // get index for modifying correct operand
481  }
482 
483  /// Method to return the pointer operand as a PointerType.
485  return getPointerOperand()->getType();
486  }
487 
488  Type *getSourceElementType() const;
489  Type *getResultElementType() const;
490 
491  /// Method to return the address space of the pointer operand.
492  unsigned getPointerAddressSpace() const {
493  return getPointerOperandType()->getPointerAddressSpace();
494  }
495 
496  unsigned getNumIndices() const { // Note: always non-negative
497  return getNumOperands() - 1;
498  }
499 
500  bool hasIndices() const {
501  return getNumOperands() > 1;
502  }
503 
504  /// Return true if all of the indices of this GEP are zeros.
505  /// If so, the result pointer and the first operand have the same
506  /// value, just potentially different types.
507  bool hasAllZeroIndices() const {
508  for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
509  if (ConstantInt *C = dyn_cast<ConstantInt>(I))
510  if (C->isZero())
511  continue;
512  return false;
513  }
514  return true;
515  }
516 
517  /// Return true if all of the indices of this GEP are constant integers.
518  /// If so, the result pointer and the first operand have
519  /// a constant offset between them.
520  bool hasAllConstantIndices() const {
521  for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
522  if (!isa<ConstantInt>(I))
523  return false;
524  }
525  return true;
526  }
527 
528  unsigned countNonConstantIndices() const {
529  return count_if(make_range(idx_begin(), idx_end()), [](const Use& use) {
530  return !isa<ConstantInt>(*use);
531  });
532  }
533 
534  /// Accumulate the constant address offset of this GEP if possible.
535  ///
536  /// This routine accepts an APInt into which it will accumulate the constant
537  /// offset of this GEP if the GEP is in fact constant. If the GEP is not
538  /// all-constant, it returns false and the value of the offset APInt is
539  /// undefined (it is *not* preserved!). The APInt passed into this routine
540  /// must be at exactly as wide as the IntPtr type for the address space of the
541  /// base GEP pointer.
542  bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const;
543 };
544 
546  : public ConcreteOperator<Operator, Instruction::PtrToInt> {
547  friend class PtrToInt;
548  friend class ConstantExpr;
549 
550 public:
552  return getOperand(0);
553  }
554  const Value *getPointerOperand() const {
555  return getOperand(0);
556  }
557 
558  static unsigned getPointerOperandIndex() {
559  return 0U; // get index for modifying correct operand
560  }
561 
562  /// Method to return the pointer operand as a PointerType.
564  return getPointerOperand()->getType();
565  }
566 
567  /// Method to return the address space of the pointer operand.
568  unsigned getPointerAddressSpace() const {
569  return cast<PointerType>(getPointerOperandType())->getAddressSpace();
570  }
571 };
572 
574  : public ConcreteOperator<Operator, Instruction::BitCast> {
575  friend class BitCastInst;
576  friend class ConstantExpr;
577 
578 public:
579  Type *getSrcTy() const {
580  return getOperand(0)->getType();
581  }
582 
583  Type *getDestTy() const {
584  return getType();
585  }
586 };
587 
588 } // end namespace llvm
589 
590 #endif // LLVM_IR_OPERATOR_H
bool hasIndices() const
Definition: Operator.h:500
uint64_t CallInst * C
bool none() const
Definition: Operator.h:197
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:110
static bool classof(const Instruction *I)
Definition: Operator.h:400
unsigned getOpcode() const
Return the opcode at the root of this constant expression.
Definition: Constants.h:1209
bool hasNoNaNs() const
Test if this operation&#39;s arguments and results are assumed not-NaN.
Definition: Operator.h:332
Value * getPointerOperand(Value *V)
A helper function that returns the pointer operand of a load, store or GEP instruction.
bool hasNoInfs() const
Test if this operation&#39;s arguments and results are assumed not-infinite.
Definition: Operator.h:337
bool noNaNs() const
Definition: Operator.h:205
static bool classof(const Value *V)
Definition: Operator.h:58
void setFast(bool B=true)
Definition: Operator.h:236
This class represents lattice values for constants.
Definition: AllocatorList.h:23
static bool classof(const ConstantExpr *)
Definition: Operator.h:57
static unsigned getOpcode(const Value *V)
If V is an Instruction or ConstantExpr, return its opcode.
Definition: Operator.h:48
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
Definition: Operator.h:568
static bool classof(const Instruction *)
Definition: Operator.h:56
Optional< unsigned > getInRangeIndex() const
Returns the offset of the index with an inrange attachment, or None if none.
Definition: Operator.h:463
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
Definition: Operator.h:492
bool noInfs() const
Definition: Operator.h:206
auto count_if(R &&Range, UnaryPredicate P) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
Definition: STLExtras.h:1259
void setNoInfs(bool B=true)
Definition: Operator.h:221
F(f)
bool hasAllowContract() const
Test if this operation can be floating-point contracted (FMA).
Definition: Operator.h:352
op_iterator idx_end()
Definition: Operator.h:470
op_iterator op_begin()
Definition: User.h:229
bool all() const
Definition: Operator.h:198
static FastMathFlags getFast()
Definition: Operator.h:190
static bool classof(const Value *V)
Definition: Operator.h:111
A Use represents the edge between a Value definition and its users.
Definition: Use.h:55
static bool classof(const Instruction *I)
Definition: Operator.h:99
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
Definition: Operator.h:484
static bool classof(const Value *V)
Definition: Operator.h:372
bool hasAllowReciprocal() const
Test if this operation can use reciprocal multiply instead of division.
Definition: Operator.h:347
Value * getPointerOperand()
Definition: Operator.h:551
static unsigned getPointerOperandIndex()
Definition: Operator.h:479
bool isExact() const
Test whether this division is known to be exact, with zero remainder.
Definition: Operator.h:135
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:105
A constant value that is initialized with an expression using other constant values.
Definition: Constants.h:888
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:244
static bool classof(const Value *V)
Definition: Operator.h:152
unsigned getNumIndices() const
Definition: Operator.h:496
bool isInBounds() const
Test whether this is an inbounds GEP, as defined by LangRef.html.
Definition: Operator.h:457
Predicate all(Predicate P0, Predicate P1)
True iff P0 and P1 are true.
This class represents a no-op cast from one type to another.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
Definition: Instruction.h:125
bool allowContract() const
Definition: Operator.h:209
Value * getOperand(unsigned i) const
Definition: User.h:169
const Value * getPointerOperand() const
Definition: Operator.h:554
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
Definition: Instructions.h:873
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags.
Definition: Operator.h:363
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
Definition: Operator.h:507
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void setNoSignedZeros(bool B=true)
Definition: Operator.h:224
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
bool any() const
Definition: Operator.h:196
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Operator()=delete
A udiv or sdiv instruction, which can be marked as "exact", indicating that no bits are destroyed...
Definition: Operator.h:119
bool isFast() const
&#39;Fast&#39; means all bits are set.
Definition: Operator.h:212
op_iterator op_end()
Definition: User.h:231
Utility class for integer operators which may exhibit overflow - Add, Sub, Mul, and Shl...
Definition: Operator.h:66
Value * getPointerOperand()
Definition: Operator.h:473
bool allowReciprocal() const
Definition: Operator.h:208
static bool classof(const Value *V)
Definition: Operator.h:406
~Operator()=delete
static bool isPossiblyExactOpcode(unsigned OpC)
Definition: Operator.h:139
bool hasApproxFunc() const
Test if this operation allows approximations of math library functions or intrinsics.
Definition: Operator.h:358
op_iterator idx_begin()
Definition: Operator.h:468
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
Definition: Value.h:90
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
Definition: Operator.h:563
bool hasAllowReassoc() const
Test if this operation may be simplified with reassociative transforms.
Definition: Operator.h:327
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
unsigned getNumOperands() const
Definition: User.h:191
bool hasNoSignedZeros() const
Test if this operation can ignore the sign of zero.
Definition: Operator.h:342
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:146
This is the shared class of boolean and integer constants.
Definition: Constants.h:83
Type * getDestTy() const
Definition: Operator.h:583
A helper template for defining operators for individual opcodes.
Definition: Operator.h:398
Utility class for floating point operations which can have information about relaxed accuracy require...
Definition: Operator.h:245
This is a utility class that provides an abstraction for the common functionality between Instruction...
Definition: Operator.h:30
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
Definition: Operator.h:520
void setApproxFunc(bool B=true)
Definition: Operator.h:233
Type * getSrcTy() const
Definition: Operator.h:579
void setNoNaNs(bool B=true)
Definition: Operator.h:218
Class for arbitrary precision integers.
Definition: APInt.h:69
bool hasNoSignedWrap() const
Test whether this operation is known to never undergo signed overflow, aka the nsw property...
Definition: Operator.h:95
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:211
static bool classof(const Instruction *I)
Definition: Operator.h:149
const_op_iterator idx_end() const
Definition: Operator.h:471
void setAllowContract(bool B=true)
Definition: Operator.h:230
#define I(x, y, z)
Definition: MD5.cpp:58
const_op_iterator idx_begin() const
Definition: Operator.h:469
void setAllowReciprocal(bool B=true)
Definition: Operator.h:227
static unsigned getPointerOperandIndex()
Definition: Operator.h:558
pgo instr use
const Value * getPointerOperand() const
Definition: Operator.h:476
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:403
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition: Type.h:184
LLVM Value Representation.
Definition: Value.h:72
E & operator &=(E &LHS, E RHS)
Definition: BitmaskEnum.h:133
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
Definition: Operator.h:40
bool allowReassoc() const
Flag queries.
Definition: Operator.h:204
bool isFast() const
Test if this operation allows all non-strict floating-point transforms.
Definition: Operator.h:316
Convenience struct for specifying and reasoning about fast-math flags.
Definition: Operator.h:159
bool approxFunc() const
Definition: Operator.h:210
void setAllowReassoc(bool B=true)
Flag setters.
Definition: Operator.h:215
unsigned countNonConstantIndices() const
Definition: Operator.h:528
bool noSignedZeros() const
Definition: Operator.h:207
bool hasNoUnsignedWrap() const
Test whether this operation is known to never undergo unsigned overflow, aka the nuw property...
Definition: Operator.h:89