MLIR  14.0.0git
Value.h
Go to the documentation of this file.
1 //===- Value.h - Base of the SSA Value hierarchy ----------------*- 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 generic Value type and manipulation utilities.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_IR_VALUE_H
14 #define MLIR_IR_VALUE_H
15 
16 #include "mlir/IR/Types.h"
17 #include "mlir/IR/UseDefLists.h"
18 #include "mlir/Support/LLVM.h"
19 #include "llvm/Support/PointerLikeTypeTraits.h"
20 
21 namespace mlir {
22 class AsmState;
23 class Block;
24 class BlockArgument;
25 class Operation;
26 class OpOperand;
27 class OpResult;
28 class Region;
29 class Value;
30 
31 //===----------------------------------------------------------------------===//
32 // Value
33 //===----------------------------------------------------------------------===//
34 
35 namespace detail {
36 
37 /// The base class for all derived Value classes. It contains all of the
38 /// components that are shared across Value classes.
39 class alignas(8) ValueImpl : public IRObjectWithUseList<OpOperand> {
40 public:
41  /// The enumeration represents the various different kinds of values the
42  /// internal representation may take. We use all of the bits from Type that we
43  /// can to store indices inline.
44  enum class Kind {
45  /// The first N kinds are all inline operation results. An inline operation
46  /// result means that the kind represents the result number. This removes
47  /// the need to store an additional index value. The derived class here is
48  /// an `OpResultImpl`.
49  InlineOpResult = 0,
50 
51  /// The next kind represents a 'out-of-line' operation result. This is for
52  /// results with numbers larger than we can represent inline. The derived
53  /// class here is an `OpResultImpl`.
55 
56  /// The last kind represents a block argument. The derived class here is an
57  /// `BlockArgumentImpl`.
58  BlockArgument = 7
59  };
60 
61  /// Return the type of this value.
62  Type getType() const { return typeAndKind.getPointer(); }
63 
64  /// Set the type of this value.
65  void setType(Type type) { return typeAndKind.setPointer(type); }
66 
67  /// Return the kind of this value.
68  Kind getKind() const { return typeAndKind.getInt(); }
69 
70 protected:
71  ValueImpl(Type type, Kind kind) : typeAndKind(type, kind) {}
72 
73  /// The type of this result and the kind.
74  llvm::PointerIntPair<Type, 3, Kind> typeAndKind;
75 };
76 } // namespace detail
77 
78 /// This class represents an instance of an SSA value in the MLIR system,
79 /// representing a computable value that has a type and a set of users. An SSA
80 /// value is either a BlockArgument or the result of an operation. Note: This
81 /// class has value-type semantics and is just a simple wrapper around a
82 /// ValueImpl that is either owner by a block(in the case of a BlockArgument) or
83 /// an Operation(in the case of an OpResult).
84 class Value {
85 public:
86  constexpr Value(detail::ValueImpl *impl = nullptr) : impl(impl) {}
87 
88  template <typename U>
89  bool isa() const {
90  assert(*this && "isa<> used on a null type.");
91  return U::classof(*this);
92  }
93 
94  template <typename First, typename Second, typename... Rest>
95  bool isa() const {
96  return isa<First>() || isa<Second, Rest...>();
97  }
98  template <typename U>
99  U dyn_cast() const {
100  return isa<U>() ? U(impl) : U(nullptr);
101  }
102  template <typename U>
103  U dyn_cast_or_null() const {
104  return (*this && isa<U>()) ? U(impl) : U(nullptr);
105  }
106  template <typename U>
107  U cast() const {
108  assert(isa<U>());
109  return U(impl);
110  }
111 
112  explicit operator bool() const { return impl; }
113  bool operator==(const Value &other) const { return impl == other.impl; }
114  bool operator!=(const Value &other) const { return !(*this == other); }
115 
116  /// Return the type of this value.
117  Type getType() const { return impl->getType(); }
118 
119  /// Utility to get the associated MLIRContext that this value is defined in.
120  MLIRContext *getContext() const { return getType().getContext(); }
121 
122  /// Mutate the type of this Value to be of the specified type.
123  ///
124  /// Note that this is an extremely dangerous operation which can create
125  /// completely invalid IR very easily. It is strongly recommended that you
126  /// recreate IR objects with the right types instead of mutating them in
127  /// place.
128  void setType(Type newType) { impl->setType(newType); }
129 
130  /// If this value is the result of an operation, return the operation that
131  /// defines it.
132  Operation *getDefiningOp() const;
133 
134  /// If this value is the result of an operation of type OpTy, return the
135  /// operation that defines it.
136  template <typename OpTy>
137  OpTy getDefiningOp() const {
138  return llvm::dyn_cast_or_null<OpTy>(getDefiningOp());
139  }
140 
141  /// Return the location of this value.
142  Location getLoc() const;
143  void setLoc(Location loc);
144 
145  /// Return the Region in which this Value is defined.
146  Region *getParentRegion();
147 
148  /// Return the Block in which this Value is defined.
149  Block *getParentBlock();
150 
151  //===--------------------------------------------------------------------===//
152  // UseLists
153  //===--------------------------------------------------------------------===//
154 
155  /// Drop all uses of this object from their respective owners.
156  void dropAllUses() const { return impl->dropAllUses(); }
157 
158  /// Replace all uses of 'this' value with the new value, updating anything in
159  /// the IR that uses 'this' to use the other value instead. When this returns
160  /// there are zero uses of 'this'.
161  void replaceAllUsesWith(Value newValue) const {
162  impl->replaceAllUsesWith(newValue);
163  }
164 
165  /// Replace all uses of 'this' value with 'newValue', updating anything in the
166  /// IR that uses 'this' to use the other value instead except if the user is
167  /// listed in 'exceptions' .
168  void
169  replaceAllUsesExcept(Value newValue,
170  const SmallPtrSetImpl<Operation *> &exceptions) const;
171 
172  /// Replace all uses of 'this' value with 'newValue', updating anything in the
173  /// IR that uses 'this' to use the other value instead except if the user is
174  /// 'exceptedUser'.
175  void replaceAllUsesExcept(Value newValue, Operation *exceptedUser) const;
176 
177  /// Replace all uses of 'this' value with 'newValue' if the given callback
178  /// returns true.
179  void replaceUsesWithIf(Value newValue,
180  function_ref<bool(OpOperand &)> shouldReplace);
181 
182  /// Returns true if the value is used outside of the given block.
183  bool isUsedOutsideOfBlock(Block *block);
184 
185  //===--------------------------------------------------------------------===//
186  // Uses
187 
188  /// This class implements an iterator over the uses of a value.
191 
192  use_iterator use_begin() const { return impl->use_begin(); }
193  use_iterator use_end() const { return use_iterator(); }
194 
195  /// Returns a range of all uses, which is useful for iterating over all uses.
196  use_range getUses() const { return {use_begin(), use_end()}; }
197 
198  /// Returns true if this value has exactly one use.
199  bool hasOneUse() const { return impl->hasOneUse(); }
200 
201  /// Returns true if this value has no uses.
202  bool use_empty() const { return impl->use_empty(); }
203 
204  //===--------------------------------------------------------------------===//
205  // Users
206 
209 
210  user_iterator user_begin() const { return use_begin(); }
211  user_iterator user_end() const { return use_end(); }
212  user_range getUsers() const { return {user_begin(), user_end()}; }
213 
214  //===--------------------------------------------------------------------===//
215  // Utilities
216 
217  void print(raw_ostream &os);
218  void print(raw_ostream &os, AsmState &state);
219  void dump();
220 
221  /// Print this value as if it were an operand.
222  void printAsOperand(raw_ostream &os, AsmState &state);
223 
224  /// Methods for supporting PointerLikeTypeTraits.
225  void *getAsOpaquePointer() const { return impl; }
226  static Value getFromOpaquePointer(const void *pointer) {
227  return reinterpret_cast<detail::ValueImpl *>(const_cast<void *>(pointer));
228  }
229  detail::ValueImpl *getImpl() const { return impl; }
230 
231  friend ::llvm::hash_code hash_value(Value arg);
232 
233 protected:
234  /// A pointer to the internal implementation of the value.
236 };
237 
238 inline raw_ostream &operator<<(raw_ostream &os, Value value) {
239  value.print(os);
240  return os;
241 }
242 
243 //===----------------------------------------------------------------------===//
244 // OpOperand
245 //===----------------------------------------------------------------------===//
246 
247 /// This class represents an operand of an operation. Instances of this class
248 /// contain a reference to a specific `Value`.
249 class OpOperand : public IROperand<OpOperand, Value> {
250 public:
251  /// Provide the use list that is attached to the given value.
253  return value.getImpl();
254  }
255 
256  /// Return which operand this is in the OpOperand list of the Operation.
257  unsigned getOperandNumber();
258 
259 private:
260  /// Keep the constructor private and accessible to the OperandStorage class
261  /// only to avoid hard-to-debug typo/programming mistakes.
262  friend class OperandStorage;
264 };
265 
266 //===----------------------------------------------------------------------===//
267 // BlockArgument
268 //===----------------------------------------------------------------------===//
269 
270 namespace detail {
271 /// The internal implementation of a BlockArgument.
272 class BlockArgumentImpl : public ValueImpl {
273 public:
274  static bool classof(const ValueImpl *value) {
275  return value->getKind() == ValueImpl::Kind::BlockArgument;
276  }
277 
278 private:
279  BlockArgumentImpl(Type type, Block *owner, int64_t index, Location loc)
280  : ValueImpl(type, Kind::BlockArgument), owner(owner), index(index),
281  loc(loc) {}
282 
283  /// The owner of this argument.
284  Block *owner;
285 
286  /// The position in the argument list.
287  int64_t index;
288 
289  /// The source location of this argument.
290  Location loc;
291 
292  /// Allow access to owner and constructor.
293  friend BlockArgument;
294 };
295 } // namespace detail
296 
297 /// This class represents an argument of a Block.
298 class BlockArgument : public Value {
299 public:
300  using Value::Value;
301 
302  static bool classof(Value value) {
303  return llvm::isa<detail::BlockArgumentImpl>(value.getImpl());
304  }
305 
306  /// Returns the block that owns this argument.
307  Block *getOwner() const { return getImpl()->owner; }
308 
309  /// Returns the number of this argument.
310  unsigned getArgNumber() const { return getImpl()->index; }
311 
312  /// Return the location for this argument.
313  Location getLoc() const { return getImpl()->loc; }
314  void setLoc(Location loc) { getImpl()->loc = loc; }
315 
316 private:
317  /// Allocate a new argument with the given type and owner.
318  static BlockArgument create(Type type, Block *owner, int64_t index,
319  Location loc) {
320  return new detail::BlockArgumentImpl(type, owner, index, loc);
321  }
322 
323  /// Destroy and deallocate this argument.
324  void destroy() { delete getImpl(); }
325 
326  /// Get a raw pointer to the internal implementation.
327  detail::BlockArgumentImpl *getImpl() const {
328  return reinterpret_cast<detail::BlockArgumentImpl *>(impl);
329  }
330 
331  /// Cache the position in the block argument list.
332  void setArgNumber(int64_t index) { getImpl()->index = index; }
333 
334  /// Allow access to `create`, `destroy` and `setArgNumber`.
335  friend Block;
336 
337  /// Allow access to 'getImpl'.
338  friend Value;
339 };
340 
341 //===----------------------------------------------------------------------===//
342 // OpResult
343 //===----------------------------------------------------------------------===//
344 
345 namespace detail {
346 /// This class provides the implementation for an operation result.
347 class alignas(8) OpResultImpl : public ValueImpl {
348 public:
349  using ValueImpl::ValueImpl;
350 
351  static bool classof(const ValueImpl *value) {
352  return value->getKind() != ValueImpl::Kind::BlockArgument;
353  }
354 
355  /// Returns the parent operation of this result.
356  Operation *getOwner() const;
357 
358  /// Returns the result number of this op result.
359  unsigned getResultNumber() const;
360 
361  /// Returns the next operation result at `offset` after this result. This
362  /// method is useful when indexing the result storage of an operation, given
363  /// that there is more than one kind of operation result (with the different
364  /// kinds having different sizes) and that operations are stored in reverse
365  /// order.
366  OpResultImpl *getNextResultAtOffset(intptr_t offset);
367 
368  /// Returns the maximum number of results that can be stored inline.
369  static unsigned getMaxInlineResults() {
370  return static_cast<unsigned>(Kind::OutOfLineOpResult);
371  }
372 };
373 
374 /// This class provides the implementation for an operation result whose index
375 /// can be represented "inline" in the underlying ValueImpl.
376 struct InlineOpResult : public OpResultImpl {
377 public:
378  InlineOpResult(Type type, unsigned resultNo)
379  : OpResultImpl(type, static_cast<ValueImpl::Kind>(resultNo)) {
380  assert(resultNo < getMaxInlineResults());
381  }
382 
383  /// Return the result number of this op result.
384  unsigned getResultNumber() const { return static_cast<unsigned>(getKind()); }
385 
386  static bool classof(const OpResultImpl *value) {
387  return value->getKind() != ValueImpl::Kind::OutOfLineOpResult;
388  }
389 };
390 
391 /// This class provides the implementation for an operation result whose index
392 /// cannot be represented "inline", and thus requires an additional index field.
394 public:
395  OutOfLineOpResult(Type type, uint64_t outOfLineIndex)
397  outOfLineIndex(outOfLineIndex) {}
398 
399  static bool classof(const OpResultImpl *value) {
400  return value->getKind() == ValueImpl::Kind::OutOfLineOpResult;
401  }
402 
403  /// Return the result number of this op result.
404  unsigned getResultNumber() const {
405  return outOfLineIndex + getMaxInlineResults();
406  }
407 
408  /// The trailing result number, or the offset from the beginning of the
409  /// `OutOfLineOpResult` array.
410  uint64_t outOfLineIndex;
411 };
412 
413 /// Return the result number of this op result.
414 inline unsigned OpResultImpl::getResultNumber() const {
415  if (const auto *outOfLineResult = dyn_cast<OutOfLineOpResult>(this))
416  return outOfLineResult->getResultNumber();
417  return cast<InlineOpResult>(this)->getResultNumber();
418 }
419 
420 } // namespace detail
421 
422 /// This is a value defined by a result of an operation.
423 class OpResult : public Value {
424 public:
425  using Value::Value;
426 
427  static bool classof(Value value) {
428  return llvm::isa<detail::OpResultImpl>(value.getImpl());
429  }
430 
431  /// Returns the operation that owns this result.
432  Operation *getOwner() const { return getImpl()->getOwner(); }
433 
434  /// Returns the number of this result.
435  unsigned getResultNumber() const { return getImpl()->getResultNumber(); }
436 
437 private:
438  /// Get a raw pointer to the internal implementation.
439  detail::OpResultImpl *getImpl() const {
440  return reinterpret_cast<detail::OpResultImpl *>(impl);
441  }
442 
443  /// Given a number of operation results, returns the number that need to be
444  /// stored inline.
445  static unsigned getNumInline(unsigned numResults);
446 
447  /// Given a number of operation results, returns the number that need to be
448  /// stored as trailing.
449  static unsigned getNumTrailing(unsigned numResults);
450 
451  /// Allow access to constructor.
452  friend Operation;
453 };
454 
455 /// Make Value hashable.
456 inline ::llvm::hash_code hash_value(Value arg) {
458 }
459 
460 } // namespace mlir
461 
462 namespace llvm {
463 
464 template <>
465 struct DenseMapInfo<mlir::Value> {
467  void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
468  return mlir::Value::getFromOpaquePointer(pointer);
469  }
472  return mlir::Value::getFromOpaquePointer(pointer);
473  }
474  static unsigned getHashValue(mlir::Value val) {
475  return mlir::hash_value(val);
476  }
477  static bool isEqual(mlir::Value lhs, mlir::Value rhs) { return lhs == rhs; }
478 };
479 template <>
480 struct DenseMapInfo<mlir::BlockArgument> : public DenseMapInfo<mlir::Value> {
482  void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
483  return reinterpret_cast<mlir::detail::BlockArgumentImpl *>(pointer);
484  }
487  return reinterpret_cast<mlir::detail::BlockArgumentImpl *>(pointer);
488  }
489 };
490 template <>
491 struct DenseMapInfo<mlir::OpResult> : public DenseMapInfo<mlir::Value> {
493  void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
494  return reinterpret_cast<mlir::detail::OpResultImpl *>(pointer);
495  }
498  return reinterpret_cast<mlir::detail::OpResultImpl *>(pointer);
499  }
500 };
501 
502 /// Allow stealing the low bits of a value.
503 template <>
504 struct PointerLikeTypeTraits<mlir::Value> {
505 public:
506  static inline void *getAsVoidPointer(mlir::Value value) {
507  return const_cast<void *>(value.getAsOpaquePointer());
508  }
509  static inline mlir::Value getFromVoidPointer(void *pointer) {
510  return mlir::Value::getFromOpaquePointer(pointer);
511  }
512  enum {
513  NumLowBitsAvailable =
514  PointerLikeTypeTraits<mlir::detail::ValueImpl *>::NumLowBitsAvailable
515  };
516 };
517 template <>
518 struct PointerLikeTypeTraits<mlir::BlockArgument>
519  : public PointerLikeTypeTraits<mlir::Value> {
520 public:
521  static inline mlir::BlockArgument getFromVoidPointer(void *pointer) {
522  return reinterpret_cast<mlir::detail::BlockArgumentImpl *>(pointer);
523  }
524 };
525 template <>
526 struct PointerLikeTypeTraits<mlir::OpResult>
527  : public PointerLikeTypeTraits<mlir::Value> {
528 public:
529  static inline mlir::OpResult getFromVoidPointer(void *pointer) {
530  return reinterpret_cast<mlir::detail::OpResultImpl *>(pointer);
531  }
532 };
533 
534 } // namespace llvm
535 
536 #endif
Include the generated interface declarations.
void setLoc(Location loc)
Definition: Value.h:314
OutOfLineOpResult(Type type, uint64_t outOfLineIndex)
Definition: Value.h:395
This class contains a list of basic blocks and a link to the parent operation it is attached to...
Definition: Region.h:26
static mlir::OpResult getFromVoidPointer(void *pointer)
Definition: Value.h:529
static bool classof(const ValueImpl *value)
Definition: Value.h:351
constexpr Value(detail::ValueImpl *impl=nullptr)
Definition: Value.h:86
static bool classof(Value value)
Definition: Value.h:302
Operation is a basic unit of execution within MLIR.
Definition: Operation.h:28
unsigned getResultNumber() const
Return the result number of this op result.
Definition: Value.h:384
The internal implementation of a BlockArgument.
Definition: Value.h:272
This is a value defined by a result of an operation.
Definition: Value.h:423
Block represents an ordered list of Operations.
Definition: Block.h:29
llvm::PointerIntPair< Type, 3, Kind > typeAndKind
The type of this result and the kind.
Definition: Value.h:74
static mlir::OpResult getTombstoneKey()
Definition: Value.h:496
void print(OpAsmPrinter &p, FunctionLibraryOp op)
Definition: Shape.cpp:1112
Kind getKind() const
Return the kind of this value.
Definition: Value.h:68
An iterator over the users of an IRObject.
Definition: UseDefLists.h:25
static mlir::Value getTombstoneKey()
Definition: Value.h:470
ValueUseIterator< OpOperand > use_iterator
Definition: UseDefLists.h:194
InlineOpResult(Type type, unsigned resultNo)
Definition: Value.h:378
ValueImpl(Type type, Kind kind)
Definition: Value.h:71
unsigned getArgNumber() const
Returns the number of this argument.
Definition: Value.h:310
void dropAllUses() const
Drop all uses of this object from their respective owners.
Definition: Value.h:156
raw_ostream & operator<<(raw_ostream &os, const AliasResult &result)
Definition: AliasAnalysis.h:78
static bool isEqual(mlir::Value lhs, mlir::Value rhs)
Definition: Value.h:477
user_range getUsers() const
Definition: Value.h:212
void replaceAllUsesWith(Value newValue) const
Replace all uses of &#39;this&#39; value with the new value, updating anything in the IR that uses &#39;this&#39; to ...
Definition: Value.h:161
bool operator!=(const Value &other) const
Definition: Value.h:114
static constexpr const bool value
void * getAsOpaquePointer() const
Methods for supporting PointerLikeTypeTraits.
Definition: Value.h:225
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition: Location.h:48
The next kind represents a &#39;out-of-line&#39; operation result.
Operation * getOwner() const
Returns the operation that owns this result.
Definition: Value.h:432
uint64_t outOfLineIndex
The trailing result number, or the offset from the beginning of the OutOfLineOpResult array...
Definition: Value.h:410
static IRObjectWithUseList< OpOperand > * getUseList(Value value)
Provide the use list that is attached to the given value.
Definition: Value.h:252
Block * getOwner() const
Returns the block that owns this argument.
Definition: Value.h:307
static mlir::OpResult getEmptyKey()
Definition: Value.h:492
This class represents a single IR object that contains a use list.
Definition: UseDefLists.h:167
static Value getFromOpaquePointer(const void *pointer)
Definition: Value.h:226
void print(raw_ostream &os)
void setType(Type type)
Set the type of this value.
Definition: Value.h:65
static unsigned getHashValue(mlir::Value val)
Definition: Value.h:474
bool hasOneUse() const
Returns true if this value has exactly one use.
Definition: Value.h:199
U dyn_cast() const
Definition: Value.h:99
user_iterator user_begin() const
Definition: Value.h:210
unsigned getResultNumber() const
Returns the number of this result.
Definition: Value.h:435
static mlir::BlockArgument getEmptyKey()
Definition: Value.h:481
static mlir::Value getFromVoidPointer(void *pointer)
Definition: Value.h:509
bool operator==(const Value &other) const
Definition: Value.h:113
The last kind represents a block argument.
bool isa() const
Definition: Value.h:95
This class represents an argument of a Block.
Definition: Value.h:298
unsigned getResultNumber() const
Returns the result number of this op result.
Definition: Value.h:414
use_iterator use_begin() const
Definition: Value.h:192
Type getType() const
Return the type of this value.
Definition: Value.h:62
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition: Types.h:72
use_iterator use_end() const
Definition: Value.h:193
user_iterator user_end() const
Definition: Value.h:211
OpTy getDefiningOp() const
If this value is the result of an operation of type OpTy, return the operation that defines it...
Definition: Value.h:137
static bool classof(const ValueImpl *value)
Definition: Value.h:274
MLIRContext * getContext() const
Return the MLIRContext in which this type was uniqued.
Definition: Types.cpp:19
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Definition: Value.h:84
bool use_empty() const
Returns true if this value has no uses.
Definition: Value.h:202
static mlir::BlockArgument getFromVoidPointer(void *pointer)
Definition: Value.h:521
inline ::llvm::hash_code hash_value(AffineExpr arg)
Make AffineExpr hashable.
Definition: AffineExpr.h:240
The base class for all derived Value classes.
Definition: Value.h:39
bool isa() const
Definition: Value.h:89
static bool classof(const OpResultImpl *value)
Definition: Value.h:399
inline ::llvm::hash_code hash_value(Value arg)
Make Value hashable.
Definition: Value.h:456
Type getType() const
Return the type of this value.
Definition: Value.h:117
This class provides the implementation for an operation result whose index cannot be represented "inl...
Definition: Value.h:393
static void * getAsVoidPointer(mlir::Value value)
Definition: Value.h:506
U dyn_cast_or_null() const
Definition: Value.h:103
MLIRContext is the top-level object for a collection of MLIR operations.
Definition: MLIRContext.h:55
This class represents an operand of an operation.
Definition: Value.h:249
static bool classof(Value value)
Definition: Value.h:427
This class provides the implementation for an operation result.
Definition: Value.h:347
U cast() const
Definition: Value.h:107
static mlir::BlockArgument getTombstoneKey()
Definition: Value.h:485
detail::ValueImpl * impl
A pointer to the internal implementation of the value.
Definition: Value.h:235
detail::ValueImpl * getImpl() const
Definition: Value.h:229
Kind
The enumeration represents the various different kinds of values the internal representation may take...
Definition: Value.h:44
A reference to a value, suitable for use as an operand of an operation.
Definition: UseDefLists.h:110
unsigned getResultNumber() const
Return the result number of this op result.
Definition: Value.h:404
use_range getUses() const
Returns a range of all uses, which is useful for iterating over all uses.
Definition: Value.h:196
This class provides the implementation for an operation result whose index can be represented "inline...
Definition: Value.h:376
void setType(Type newType)
Mutate the type of this Value to be of the specified type.
Definition: Value.h:128
static bool classof(const OpResultImpl *value)
Definition: Value.h:386
Location getLoc() const
Return the location for this argument.
Definition: Value.h:313
MLIRContext * getContext() const
Utility to get the associated MLIRContext that this value is defined in.
Definition: Value.h:120
static mlir::Value getEmptyKey()
Definition: Value.h:466
This class provides management for the lifetime of the state used when printing the IR...
Definition: AsmState.h:36
static unsigned getMaxInlineResults()
Returns the maximum number of results that can be stored inline.
Definition: Value.h:369