My Project
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
mlir::Value Class Reference

#include <Value.h>

Inheritance diagram for mlir::Value:
Inheritance graph
[legend]

Classes

struct  ImplTypeTraits
 

Public Types

enum  Kind { Kind::OpResult0 = 0, Kind::OpResult1 = 1, Kind::TrailingOpResult = 2, Kind::BlockArgument = 3 }
 
using ImplType = llvm::PointerIntPair< void *, 2, Kind, ImplTypeTraits >
 
using use_iterator = FilteredValueUseIterator< OpOperand >
 This class implements an iterator over the uses of a value. More...
 
using use_range = iterator_range< use_iterator >
 
using user_iterator = ValueUserIterator< use_iterator, OpOperand >
 
using user_range = iterator_range< user_iterator >
 

Public Member Functions

 Value (std::nullptr_t)
 
 Value (ImplType ownerAndKind={})
 
 Value (const Value &)=default
 
Valueoperator= (const Value &)=default
 
template<typename U >
bool isa () const
 
template<typename U >
dyn_cast () const
 
template<typename U >
dyn_cast_or_null () const
 
template<typename U >
cast () const
 
Value operator* () const
 
Valueoperator-> () const
 
 operator bool () const
 
bool operator== (const Value &other) const
 
bool operator!= (const Value &other) const
 
Type getType () const
 Return the type of this value. More...
 
MLIRContextgetContext () const
 Utility to get the associated MLIRContext that this value is defined in. More...
 
void setType (Type newType)
 Mutate the type of this Value to be of the specified type. More...
 
OperationgetDefiningOp () const
 
Location getLoc ()
 
RegiongetParentRegion ()
 Return the Region in which this Value is defined. More...
 
IRObjectWithUseList< OpOperand > * getUseList () const
 Provide the use list that is attached to this value. More...
 
void dropAllUses () const
 Drop all uses of this object from their respective owners. More...
 
void replaceAllUsesWith (Value newValue) const
 
use_iterator use_begin () const
 
use_iterator use_end () const
 
use_range getUses () const
 Returns a range of all uses, which is useful for iterating over all uses. More...
 
bool hasOneUse () const
 Returns true if this value has exactly one use. More...
 
bool use_empty () const
 Returns true if this value has no uses. More...
 
user_iterator user_begin () const
 
user_iterator user_end () const
 
user_range getUsers () const
 
Kind getKind () const
 Returns the kind of this value. More...
 
void print (raw_ostream &os)
 
void dump ()
 
void * getAsOpaquePointer () const
 Methods for supporting PointerLikeTypeTraits. More...
 

Static Public Member Functions

static Value getFromOpaquePointer (const void *pointer)
 

Protected Member Functions

 Value (detail::BlockArgumentImpl *impl)
 Construct a value. More...
 
 Value (Operation *op, unsigned resultNo)
 

Static Protected Member Functions

static bool canPackResultInline (unsigned resultNo)
 Returns true if the given operation result can be packed inline. More...
 

Protected Attributes

ImplType ownerAndKind
 

Friends

::llvm::hash_code hash_value (Value arg)
 Make Value hashable. More...
 

Detailed Description

This class represents an instance of an SSA value in the MLIR system, representing a computable value that has a type and a set of users. An SSA value is either a BlockArgument or the result of an operation. Note: This class has value-type semantics and is just a simple wrapper around a ValueImpl that is either owner by a block(in the case of a BlockArgument) or an Operation(in the case of an OpResult).

Member Typedef Documentation

◆ ImplType

using mlir::Value::ImplType = llvm::PointerIntPair<void *, 2, Kind, ImplTypeTraits>

◆ use_iterator

This class implements an iterator over the uses of a value.

◆ use_range

◆ user_iterator

◆ user_range

Member Enumeration Documentation

◆ Kind

enum mlir::Value::Kind
strong

The enumeration represents the various different kinds of values the internal representation may take. We steal 2 bits to support a total of 4 possible values.

Enumerator
OpResult0 

The first N kinds are all inline operation results. An inline operation result means that the kind represents the result number, and the owner pointer is the owning Operation*. Note: These are packed first to make result number lookups more efficient.

OpResult1 
TrailingOpResult 

The next kind represents a 'trailing' operation result. This is for results with numbers larger than we can represent inline. The owner here is an TrailingOpResult* that points to a trailing storage on the parent operation.

BlockArgument 

The last kind represents a block argument. The owner here is a BlockArgumentImpl*.

Constructor & Destructor Documentation

◆ Value() [1/5]

mlir::Value::Value ( std::nullptr_t  )
inline

◆ Value() [2/5]

mlir::Value::Value ( ImplType  ownerAndKind = {})
inline

◆ Value() [3/5]

mlir::Value::Value ( const Value )
default

◆ Value() [4/5]

Value::Value ( detail::BlockArgumentImpl impl)
protected

Construct a value.

◆ Value() [5/5]

Value::Value ( Operation op,
unsigned  resultNo 
)
protected

Member Function Documentation

◆ canPackResultInline()

static bool mlir::Value::canPackResultInline ( unsigned  resultNo)
inlinestaticprotected

Returns true if the given operation result can be packed inline.

◆ cast()

template<typename U >
U mlir::Value::cast ( ) const
inline

◆ dropAllUses()

void Value::dropAllUses ( ) const

Drop all uses of this object from their respective owners.

◆ dump()

void Value::dump ( )

◆ dyn_cast()

template<typename U >
U mlir::Value::dyn_cast ( ) const
inline

◆ dyn_cast_or_null()

template<typename U >
U mlir::Value::dyn_cast_or_null ( ) const
inline

◆ getAsOpaquePointer()

void* mlir::Value::getAsOpaquePointer ( ) const
inline

Methods for supporting PointerLikeTypeTraits.

◆ getContext()

MLIRContext* mlir::Value::getContext ( ) const
inline

Utility to get the associated MLIRContext that this value is defined in.

◆ getDefiningOp()

Operation * Value::getDefiningOp ( ) const

If this value is the result of an operation, return the operation that defines it.

If this value is the result of an Operation, return the operation that defines it.

◆ getFromOpaquePointer()

static Value mlir::Value::getFromOpaquePointer ( const void *  pointer)
inlinestatic

◆ getKind()

Kind mlir::Value::getKind ( ) const
inline

Returns the kind of this value.

◆ getLoc()

Location Value::getLoc ( )

If this value is the result of an operation, use it as a location, otherwise return an unknown location.

◆ getParentRegion()

Region * Value::getParentRegion ( )

Return the Region in which this Value is defined.

◆ getType()

Type Value::getType ( ) const

Return the type of this value.

◆ getUseList()

IRObjectWithUseList< OpOperand > * Value::getUseList ( ) const

Provide the use list that is attached to this value.

◆ getUsers()

user_range mlir::Value::getUsers ( ) const
inline

◆ getUses()

use_range mlir::Value::getUses ( ) const
inline

Returns a range of all uses, which is useful for iterating over all uses.

◆ hasOneUse()

bool Value::hasOneUse ( ) const

Returns true if this value has exactly one use.

◆ isa()

template<typename U >
bool mlir::Value::isa ( ) const
inline

◆ operator bool()

mlir::Value::operator bool ( ) const
inline

◆ operator!=()

bool mlir::Value::operator!= ( const Value other) const
inline

◆ operator*()

Value mlir::Value::operator* ( void  ) const
inline

Temporary methods to enable transition of Value to being used as a value-type. TODO(riverriddle) Remove these when all usages have been removed.

◆ operator->()

Value* mlir::Value::operator-> ( ) const
inline

◆ operator=()

Value& mlir::Value::operator= ( const Value )
default

◆ operator==()

bool mlir::Value::operator== ( const Value other) const
inline

◆ print()

void Value::print ( raw_ostream &  os)

◆ replaceAllUsesWith()

void Value::replaceAllUsesWith ( Value  newValue) const

Replace all uses of 'this' value with the new value, updating anything in the IR that uses 'this' to use the other value instead. When this returns there are zero uses of 'this'.

◆ setType()

void Value::setType ( Type  newType)

Mutate the type of this Value to be of the specified type.

Mutate the type of this Value to be of the specified type.

Note that this is an extremely dangerous operation which can create completely invalid IR very easily. It is strongly recommended that you recreate IR objects with the right types instead of mutating them in place.

◆ use_begin()

auto Value::use_begin ( ) const

◆ use_empty()

bool Value::use_empty ( ) const

Returns true if this value has no uses.

◆ use_end()

use_iterator mlir::Value::use_end ( ) const
inline

◆ user_begin()

user_iterator mlir::Value::user_begin ( ) const
inline

◆ user_end()

user_iterator mlir::Value::user_end ( ) const
inline

Friends And Related Function Documentation

◆ hash_value

::llvm::hash_code hash_value ( Value  arg)
friend

Make Value hashable.

Member Data Documentation

◆ ownerAndKind

ImplType mlir::Value::ownerAndKind
protected

This value represents the 'owner' of the value and its kind. See the 'Kind' enumeration above for a more detailed description of each kind of owner.


The documentation for this class was generated from the following files: