LLVM  7.0.0svn
Operator.h
Go to the documentation of this file.
1 //===-- llvm/Operator.h - Operator utility subclass -------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines various classes for working with Instructions and
11 // ConstantExprs.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_OPERATOR_H
16 #define LLVM_IR_OPERATOR_H
17 
18 #include "llvm/ADT/None.h"
19 #include "llvm/ADT/Optional.h"
20 #include "llvm/IR/Constants.h"
21 #include "llvm/IR/Instruction.h"
22 #include "llvm/IR/Type.h"
23 #include "llvm/IR/Value.h"
24 #include "llvm/Support/Casting.h"
25 #include <cstddef>
26 
27 namespace llvm {
28 
29 /// This is a utility class that provides an abstraction for the common
30 /// functionality between Instructions and ConstantExprs.
31 class Operator : public User {
32 public:
33  // The Operator class is intended to be used as a utility, and is never itself
34  // instantiated.
35  Operator() = delete;
36  ~Operator() = delete;
37 
38  void *operator new(size_t s) = delete;
39 
40  /// Return the opcode for this Instruction or ConstantExpr.
41  unsigned getOpcode() const {
42  if (const Instruction *I = dyn_cast<Instruction>(this))
43  return I->getOpcode();
44  return cast<ConstantExpr>(this)->getOpcode();
45  }
46 
47  /// If V is an Instruction or ConstantExpr, return its opcode.
48  /// Otherwise return UserOp1.
49  static unsigned getOpcode(const Value *V) {
50  if (const Instruction *I = dyn_cast<Instruction>(V))
51  return I->getOpcode();
52  if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
53  return CE->getOpcode();
54  return Instruction::UserOp1;
55  }
56 
57  static bool classof(const Instruction *) { return true; }
58  static bool classof(const ConstantExpr *) { return true; }
59  static bool classof(const Value *V) {
60  return isa<Instruction>(V) || isa<ConstantExpr>(V);
61  }
62 };
63 
64 /// Utility class for integer operators which may exhibit overflow - Add, Sub,
65 /// Mul, and Shl. It does not include SDiv, despite that operator having the
66 /// potential for overflow.
68 public:
69  enum {
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) {
80  (SubclassOptionalData & ~NoUnsignedWrap) | (B * NoUnsignedWrap);
81  }
82  void setHasNoSignedWrap(bool B) {
84  (SubclassOptionalData & ~NoSignedWrap) | (B * NoSignedWrap);
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 {
91  return SubclassOptionalData & NoUnsignedWrap;
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) {
131  SubclassOptionalData = (SubclassOptionalData & ~IsExact) | (B * IsExact);
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 
191  bool any() const { return Flags != 0; }
192  bool none() const { return Flags == 0; }
193  bool all() const { return Flags == ~0U; }
194 
195  void clear() { Flags = 0; }
196  void set() { Flags = ~0U; }
197 
198  /// Flag queries
199  bool allowReassoc() const { return 0 != (Flags & AllowReassoc); }
200  bool noNaNs() const { return 0 != (Flags & NoNaNs); }
201  bool noInfs() const { return 0 != (Flags & NoInfs); }
202  bool noSignedZeros() const { return 0 != (Flags & NoSignedZeros); }
203  bool allowReciprocal() const { return 0 != (Flags & AllowReciprocal); }
204  bool allowContract() const { return 0 != (Flags & AllowContract); }
205  bool approxFunc() const { return 0 != (Flags & ApproxFunc); }
206  /// 'Fast' means all bits are set.
207  bool isFast() const { return all(); }
208 
209  /// Flag setters
210  void setAllowReassoc(bool B = true) {
211  Flags = (Flags & ~AllowReassoc) | B * AllowReassoc;
212  }
213  void setNoNaNs(bool B = true) {
214  Flags = (Flags & ~NoNaNs) | B * NoNaNs;
215  }
216  void setNoInfs(bool B = true) {
217  Flags = (Flags & ~NoInfs) | B * NoInfs;
218  }
219  void setNoSignedZeros(bool B = true) {
220  Flags = (Flags & ~NoSignedZeros) | B * NoSignedZeros;
221  }
222  void setAllowReciprocal(bool B = true) {
223  Flags = (Flags & ~AllowReciprocal) | B * AllowReciprocal;
224  }
225  void setAllowContract(bool B = true) {
226  Flags = (Flags & ~AllowContract) | B * AllowContract;
227  }
228  void setApproxFunc(bool B = true) {
229  Flags = (Flags & ~ApproxFunc) | B * ApproxFunc;
230  }
231  void setFast(bool B = true) { B ? set() : clear(); }
232 
233  void operator&=(const FastMathFlags &OtherFlags) {
234  Flags &= OtherFlags.Flags;
235  }
236 };
237 
238 /// Utility class for floating point operations which can have
239 /// information about relaxed accuracy requirements attached to them.
240 class FPMathOperator : public Operator {
241 private:
242  friend class Instruction;
243 
244  /// 'Fast' means all bits are set.
245  void setFast(bool B) {
246  setHasAllowReassoc(B);
247  setHasNoNaNs(B);
248  setHasNoInfs(B);
249  setHasNoSignedZeros(B);
250  setHasAllowReciprocal(B);
251  setHasAllowContract(B);
252  setHasApproxFunc(B);
253  }
254 
255  void setHasAllowReassoc(bool B) {
259  }
260 
261  void setHasNoNaNs(bool B) {
264  (B * FastMathFlags::NoNaNs);
265  }
266 
267  void setHasNoInfs(bool B) {
270  (B * FastMathFlags::NoInfs);
271  }
272 
273  void setHasNoSignedZeros(bool B) {
277  }
278 
279  void setHasAllowReciprocal(bool B) {
283  }
284 
285  void setHasAllowContract(bool B) {
289  }
290 
291  void setHasApproxFunc(bool B) {
295  }
296 
297  /// Convenience function for setting multiple fast-math flags.
298  /// FMF is a mask of the bits to set.
299  void setFastMathFlags(FastMathFlags FMF) {
300  SubclassOptionalData |= FMF.Flags;
301  }
302 
303  /// Convenience function for copying all fast-math flags.
304  /// All values in FMF are transferred to this operator.
305  void copyFastMathFlags(FastMathFlags FMF) {
306  SubclassOptionalData = FMF.Flags;
307  }
308 
309 public:
310  /// Test if this operation allows all non-strict floating-point transforms.
311  bool isFast() const {
319  }
320 
321  /// Test if this operation may be simplified with reassociative transforms.
322  bool hasAllowReassoc() const {
324  }
325 
326  /// Test if this operation's arguments and results are assumed not-NaN.
327  bool hasNoNaNs() const {
329  }
330 
331  /// Test if this operation's arguments and results are assumed not-infinite.
332  bool hasNoInfs() const {
334  }
335 
336  /// Test if this operation can ignore the sign of zero.
337  bool hasNoSignedZeros() const {
339  }
340 
341  /// Test if this operation can use reciprocal multiply instead of division.
342  bool hasAllowReciprocal() const {
344  }
345 
346  /// Test if this operation can be floating-point contracted (FMA).
347  bool hasAllowContract() const {
349  }
350 
351  /// Test if this operation allows approximations of math library functions or
352  /// intrinsics.
353  bool hasApproxFunc() const {
355  }
356 
357  /// Convenience function for getting all the fast-math flags
360  }
361 
362  /// Get the maximum error permitted by this operation in ULPs. An accuracy of
363  /// 0.0 means that the operation should be performed with the default
364  /// precision.
365  float getFPAccuracy() const;
366 
367  static bool classof(const Instruction *I) {
368  return I->getType()->isFPOrFPVectorTy() ||
369  I->getOpcode() == Instruction::FCmp;
370  }
371 
372  static bool classof(const ConstantExpr *CE) {
373  return CE->getType()->isFPOrFPVectorTy() ||
374  CE->getOpcode() == Instruction::FCmp;
375  }
376 
377  static bool classof(const Value *V) {
378  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
379  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
380  }
381 };
382 
383 /// A helper template for defining operators for individual opcodes.
384 template<typename SuperClass, unsigned Opc>
385 class ConcreteOperator : public SuperClass {
386 public:
387  static bool classof(const Instruction *I) {
388  return I->getOpcode() == Opc;
389  }
390  static bool classof(const ConstantExpr *CE) {
391  return CE->getOpcode() == Opc;
392  }
393  static bool classof(const Value *V) {
394  return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
395  (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
396  }
397 };
398 
400  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {
401 };
403  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {
404 };
406  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {
407 };
409  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {
410 };
411 
413  : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {
414 };
416  : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {
417 };
419  : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {
420 };
422  : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {
423 };
424 
425 class ZExtOperator : public ConcreteOperator<Operator, Instruction::ZExt> {};
426 
428  : public ConcreteOperator<Operator, Instruction::GetElementPtr> {
429  friend class GetElementPtrInst;
430  friend class ConstantExpr;
431 
432  enum {
433  IsInBounds = (1 << 0),
434  // InRangeIndex: bits 1-6
435  };
436 
437  void setIsInBounds(bool B) {
439  (SubclassOptionalData & ~IsInBounds) | (B * IsInBounds);
440  }
441 
442 public:
443  /// Test whether this is an inbounds GEP, as defined by LangRef.html.
444  bool isInBounds() const {
445  return SubclassOptionalData & IsInBounds;
446  }
447 
448  /// Returns the offset of the index with an inrange attachment, or None if
449  /// none.
451  if (SubclassOptionalData >> 1 == 0) return None;
452  return (SubclassOptionalData >> 1) - 1;
453  }
454 
455  inline op_iterator idx_begin() { return op_begin()+1; }
456  inline const_op_iterator idx_begin() const { return op_begin()+1; }
457  inline op_iterator idx_end() { return op_end(); }
458  inline const_op_iterator idx_end() const { return op_end(); }
459 
461  return getOperand(0);
462  }
463  const Value *getPointerOperand() const {
464  return getOperand(0);
465  }
466  static unsigned getPointerOperandIndex() {
467  return 0U; // get index for modifying correct operand
468  }
469 
470  /// Method to return the pointer operand as a PointerType.
472  return getPointerOperand()->getType();
473  }
474 
475  Type *getSourceElementType() const;
476  Type *getResultElementType() const;
477 
478  /// Method to return the address space of the pointer operand.
479  unsigned getPointerAddressSpace() const {
480  return getPointerOperandType()->getPointerAddressSpace();
481  }
482 
483  unsigned getNumIndices() const { // Note: always non-negative
484  return getNumOperands() - 1;
485  }
486 
487  bool hasIndices() const {
488  return getNumOperands() > 1;
489  }
490 
491  /// Return true if all of the indices of this GEP are zeros.
492  /// If so, the result pointer and the first operand have the same
493  /// value, just potentially different types.
494  bool hasAllZeroIndices() const {
495  for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
496  if (ConstantInt *C = dyn_cast<ConstantInt>(I))
497  if (C->isZero())
498  continue;
499  return false;
500  }
501  return true;
502  }
503 
504  /// Return true if all of the indices of this GEP are constant integers.
505  /// If so, the result pointer and the first operand have
506  /// a constant offset between them.
507  bool hasAllConstantIndices() const {
508  for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
509  if (!isa<ConstantInt>(I))
510  return false;
511  }
512  return true;
513  }
514 
515  unsigned countNonConstantIndices() const {
516  return count_if(make_range(idx_begin(), idx_end()), [](const Use& use) {
517  return !isa<ConstantInt>(*use);
518  });
519  }
520 
521  /// Accumulate the constant address offset of this GEP if possible.
522  ///
523  /// This routine accepts an APInt into which it will accumulate the constant
524  /// offset of this GEP if the GEP is in fact constant. If the GEP is not
525  /// all-constant, it returns false and the value of the offset APInt is
526  /// undefined (it is *not* preserved!). The APInt passed into this routine
527  /// must be at exactly as wide as the IntPtr type for the address space of the
528  /// base GEP pointer.
529  bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const;
530 };
531 
533  : public ConcreteOperator<Operator, Instruction::PtrToInt> {
534  friend class PtrToInt;
535  friend class ConstantExpr;
536 
537 public:
539  return getOperand(0);
540  }
541  const Value *getPointerOperand() const {
542  return getOperand(0);
543  }
544 
545  static unsigned getPointerOperandIndex() {
546  return 0U; // get index for modifying correct operand
547  }
548 
549  /// Method to return the pointer operand as a PointerType.
551  return getPointerOperand()->getType();
552  }
553 
554  /// Method to return the address space of the pointer operand.
555  unsigned getPointerAddressSpace() const {
556  return cast<PointerType>(getPointerOperandType())->getAddressSpace();
557  }
558 };
559 
561  : public ConcreteOperator<Operator, Instruction::BitCast> {
562  friend class BitCastInst;
563  friend class ConstantExpr;
564 
565 public:
566  Type *getSrcTy() const {
567  return getOperand(0)->getType();
568  }
569 
570  Type *getDestTy() const {
571  return getType();
572  }
573 };
574 
575 } // end namespace llvm
576 
577 #endif // LLVM_IR_OPERATOR_H
bool hasIndices() const
Definition: Operator.h:487
uint64_t CallInst * C
bool none() const
Definition: Operator.h:192
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:111
static bool classof(const Instruction *I)
Definition: Operator.h:387
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:372
unsigned getOpcode() const
Return the opcode at the root of this constant expression.
Definition: Constants.h:1184
bool hasNoNaNs() const
Test if this operation&#39;s arguments and results are assumed not-NaN.
Definition: Operator.h:327
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:332
bool noNaNs() const
Definition: Operator.h:200
static bool classof(const Value *V)
Definition: Operator.h:59
void setFast(bool B=true)
Definition: Operator.h:231
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
static bool classof(const ConstantExpr *)
Definition: Operator.h:58
static unsigned getOpcode(const Value *V)
If V is an Instruction or ConstantExpr, return its opcode.
Definition: Operator.h:49
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
Definition: Operator.h:555
static bool classof(const Instruction *)
Definition: Operator.h:57
Optional< unsigned > getInRangeIndex() const
Returns the offset of the index with an inrange attachment, or None if none.
Definition: Operator.h:450
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
Definition: Operator.h:479
bool noInfs() const
Definition: Operator.h:201
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:982
void setNoInfs(bool B=true)
Definition: Operator.h:216
F(f)
bool hasAllowContract() const
Test if this operation can be floating-point contracted (FMA).
Definition: Operator.h:347
op_iterator idx_end()
Definition: Operator.h:457
op_iterator op_begin()
Definition: User.h:230
bool all() const
Definition: Operator.h:193
static bool classof(const Value *V)
Definition: Operator.h:112
A Use represents the edge between a Value definition and its users.
Definition: Use.h:56
static bool classof(const Instruction *I)
Definition: Operator.h:100
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
Definition: Operator.h:471
static bool classof(const Value *V)
Definition: Operator.h:377
bool hasAllowReciprocal() const
Test if this operation can use reciprocal multiply instead of division.
Definition: Operator.h:342
Value * getPointerOperand()
Definition: Operator.h:538
static unsigned getPointerOperandIndex()
Definition: Operator.h:466
bool isExact() const
Test whether this division is known to be exact, with zero remainder.
Definition: Operator.h:136
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:106
A constant value that is initialized with an expression using other constant values.
Definition: Constants.h:875
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:245
static bool classof(const Value *V)
Definition: Operator.h:153
unsigned getNumIndices() const
Definition: Operator.h:483
bool isInBounds() const
Test whether this is an inbounds GEP, as defined by LangRef.html.
Definition: Operator.h:444
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:126
bool allowContract() const
Definition: Operator.h:204
static bool classof(const Instruction *I)
Definition: Operator.h:367
Value * getOperand(unsigned i) const
Definition: User.h:170
const Value * getPointerOperand() const
Definition: Operator.h:541
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
Definition: Instructions.h:837
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags.
Definition: Operator.h:358
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
Definition: Operator.h:494
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void setNoSignedZeros(bool B=true)
Definition: Operator.h:219
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
bool any() const
Definition: Operator.h:191
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:120
bool isFast() const
&#39;Fast&#39; means all bits are set.
Definition: Operator.h:207
op_iterator op_end()
Definition: User.h:232
Utility class for integer operators which may exhibit overflow - Add, Sub, Mul, and Shl...
Definition: Operator.h:67
Value * getPointerOperand()
Definition: Operator.h:460
bool allowReciprocal() const
Definition: Operator.h:203
static bool classof(const Value *V)
Definition: Operator.h:393
~Operator()=delete
static bool isPossiblyExactOpcode(unsigned OpC)
Definition: Operator.h:140
bool hasApproxFunc() const
Test if this operation allows approximations of math library functions or intrinsics.
Definition: Operator.h:353
op_iterator idx_begin()
Definition: Operator.h:455
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
Definition: Value.h:91
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
Definition: Operator.h:550
bool hasAllowReassoc() const
Test if this operation may be simplified with reassociative transforms.
Definition: Operator.h:322
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
unsigned getNumOperands() const
Definition: User.h:192
bool hasNoSignedZeros() const
Test if this operation can ignore the sign of zero.
Definition: Operator.h:337
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:147
This is the shared class of boolean and integer constants.
Definition: Constants.h:84
Type * getDestTy() const
Definition: Operator.h:570
A helper template for defining operators for individual opcodes.
Definition: Operator.h:385
Utility class for floating point operations which can have information about relaxed accuracy require...
Definition: Operator.h:240
This is a utility class that provides an abstraction for the common functionality between Instruction...
Definition: Operator.h:31
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
Definition: Operator.h:507
void setApproxFunc(bool B=true)
Definition: Operator.h:228
Type * getSrcTy() const
Definition: Operator.h:566
void setNoNaNs(bool B=true)
Definition: Operator.h:213
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:96
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:211
static bool classof(const Instruction *I)
Definition: Operator.h:150
const_op_iterator idx_end() const
Definition: Operator.h:458
void setAllowContract(bool B=true)
Definition: Operator.h:225
#define I(x, y, z)
Definition: MD5.cpp:58
const_op_iterator idx_begin() const
Definition: Operator.h:456
LegalityPredicate all(LegalityPredicate P0, LegalityPredicate P1)
True iff P0 and P1 are true.
void setAllowReciprocal(bool B=true)
Definition: Operator.h:222
static unsigned getPointerOperandIndex()
Definition: Operator.h:545
const Value * getPointerOperand() const
Definition: Operator.h:463
static bool classof(const ConstantExpr *CE)
Definition: Operator.h:390
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition: Type.h:185
LLVM Value Representation.
Definition: Value.h:73
E & operator &=(E &LHS, E RHS)
Definition: BitmaskEnum.h:134
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
Definition: Operator.h:41
bool allowReassoc() const
Flag queries.
Definition: Operator.h:199
bool isFast() const
Test if this operation allows all non-strict floating-point transforms.
Definition: Operator.h:311
Convenience struct for specifying and reasoning about fast-math flags.
Definition: Operator.h:160
bool approxFunc() const
Definition: Operator.h:205
pgo instr use
void setAllowReassoc(bool B=true)
Flag setters.
Definition: Operator.h:210
unsigned countNonConstantIndices() const
Definition: Operator.h:515
bool noSignedZeros() const
Definition: Operator.h:202
bool hasNoUnsignedWrap() const
Test whether this operation is known to never undergo unsigned overflow, aka the nuw property...
Definition: Operator.h:90