LLVM 19.0.0git
Classes | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::sandboxir::Value Class Referenceabstract

A SandboxIR Value has users. This is the base class. More...

#include "llvm/SandboxIR/SandboxIR.h"

Inheritance diagram for llvm::sandboxir::Value:
Inheritance graph
[legend]

Classes

struct  UseToUser
 Helper for mapped_iterator. More...
 

Public Types

enum class  ClassID : unsigned { DEF_VALUE , DEF_USER , DEF_INSTR }
 
using use_iterator = UserUseIterator
 
using const_use_iterator = UserUseIterator
 
using user_iterator = mapped_iterator< sandboxir::UserUseIterator, UseToUser >
 
using const_user_iterator = user_iterator
 

Public Member Functions

virtual ~Value ()=default
 
ClassID getSubclassID () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
iterator_range< use_iteratoruses ()
 
iterator_range< const_use_iteratoruses () const
 
user_iterator user_begin ()
 
user_iterator user_end ()
 
const_user_iterator user_begin () const
 
const_user_iterator user_end () const
 
iterator_range< user_iteratorusers ()
 
iterator_range< const_user_iteratorusers () const
 
unsigned getNumUses () const
 \Returns the number of user edges (not necessarily to unique users).
 
bool hasNUsesOrMore (unsigned Num) const
 Return true if this value has N uses or more.
 
bool hasNUses (unsigned Num) const
 Return true if this Value has exactly N uses.
 
TypegetType () const
 
ContextgetContext () const
 
void replaceUsesWithIf (Value *OtherV, llvm::function_ref< bool(const Use &)> ShouldReplace)
 
void replaceAllUsesWith (Value *Other)
 
virtual void verify () const =0
 Should crash if there is something wrong with the instruction.
 
std::string getName () const
 Returns the name in the form 'SB<number>.' like 'SB1.'.
 
virtual void dumpCommonHeader (raw_ostream &OS) const
 
void dumpCommonFooter (raw_ostream &OS) const
 
void dumpCommonPrefix (raw_ostream &OS) const
 
void dumpCommonSuffix (raw_ostream &OS) const
 
void printAsOperandCommon (raw_ostream &OS) const
 
virtual void dump (raw_ostream &OS) const =0
 
virtual LLVM_DUMP_METHOD void dump () const =0
 

Protected Member Functions

void clearValue ()
 
 Value (ClassID SubclassID, llvm::Value *Val, Context &Ctx)
 

Static Protected Member Functions

static const chargetSubclassIDStr (ClassID ID)
 

Protected Attributes

ClassID SubclassID
 For isa/dyn_cast.
 
unsigned UID
 A unique ID used for forming the name (used for debugging).
 
llvm::ValueVal = nullptr
 The LLVM Value that corresponds to this SandboxIR Value.
 
ContextCtx
 All values point to the context.
 

Friends

class Context
 
class User
 
template<typename ItTy , typename SBTy >
class LLVMOpUserItToSBTy
 
raw_ostreamoperator<< (raw_ostream &OS, const sandboxir::Value &V)
 

Detailed Description

A SandboxIR Value has users. This is the base class.

Definition at line 166 of file SandboxIR.h.

Member Typedef Documentation

◆ const_use_iterator

Definition at line 218 of file SandboxIR.h.

◆ const_user_iterator

Definition at line 242 of file SandboxIR.h.

◆ use_iterator

Definition at line 217 of file SandboxIR.h.

◆ user_iterator

Definition at line 241 of file SandboxIR.h.

Member Enumeration Documentation

◆ ClassID

Enumerator
DEF_VALUE 
DEF_USER 
DEF_INSTR 

Definition at line 168 of file SandboxIR.h.

Constructor & Destructor Documentation

◆ Value()

Value::Value ( ClassID  SubclassID,
llvm::Value Val,
Context Ctx 
)
protected

Definition at line 76 of file SandboxIR.cpp.

References Ctx, llvm::sandboxir::Context::getNumValues(), and UID.

◆ ~Value()

virtual llvm::sandboxir::Value::~Value ( )
virtualdefault

Member Function Documentation

◆ clearValue()

void llvm::sandboxir::Value::clearValue ( )
inlineprotected

Definition at line 208 of file SandboxIR.h.

References Val.

◆ dump() [1/2]

virtual LLVM_DUMP_METHOD void llvm::sandboxir::Value::dump ( ) const
pure virtual

◆ dump() [2/2]

virtual void llvm::sandboxir::Value::dump ( raw_ostream OS) const
pure virtual

◆ dumpCommonFooter()

void Value::dumpCommonFooter ( raw_ostream OS) const

Definition at line 136 of file SandboxIR.cpp.

References OS, and Val.

◆ dumpCommonHeader()

void Value::dumpCommonHeader ( raw_ostream OS) const
virtual

Reimplemented in llvm::sandboxir::User.

Definition at line 132 of file SandboxIR.cpp.

References getName(), getSubclassIDStr(), OS, and SubclassID.

Referenced by llvm::sandboxir::User::dumpCommonHeader().

◆ dumpCommonPrefix()

void Value::dumpCommonPrefix ( raw_ostream OS) const

◆ dumpCommonSuffix()

void Value::dumpCommonSuffix ( raw_ostream OS) const

◆ getContext()

Context & llvm::sandboxir::Value::getContext ( ) const
inline

Definition at line 287 of file SandboxIR.h.

References Ctx.

Referenced by llvm::sandboxir::Constant::getParent().

◆ getName()

std::string Value::getName ( ) const

Returns the name in the form 'SB<number>.' like 'SB1.'.

Definition at line 126 of file SandboxIR.cpp.

References UID.

Referenced by dumpCommonHeader(), and dumpCommonSuffix().

◆ getNumUses()

unsigned Value::getNumUses ( ) const

\Returns the number of user edges (not necessarily to unique users).

WARNING: This is a linear-time operation.

Definition at line 104 of file SandboxIR.cpp.

References llvm::range_size(), llvm::Value::users(), and Val.

◆ getSubclassID()

ClassID llvm::sandboxir::Value::getSubclassID ( ) const
inline

Definition at line 215 of file SandboxIR.h.

References SubclassID.

◆ getSubclassIDStr()

static const char * llvm::sandboxir::Value::getSubclassIDStr ( ClassID  ID)
inlinestaticprotected

Definition at line 176 of file SandboxIR.h.

References llvm_unreachable.

Referenced by dumpCommonHeader(), and dumpCommonSuffix().

◆ getType()

Type * llvm::sandboxir::Value::getType ( ) const
inline

Definition at line 285 of file SandboxIR.h.

References llvm::Value::getType(), and Val.

Referenced by replaceAllUsesWith(), and replaceUsesWithIf().

◆ hasNUses()

bool llvm::sandboxir::Value::hasNUses ( unsigned  Num) const
inline

Return true if this Value has exactly N uses.

Definition at line 276 of file SandboxIR.h.

References use_begin(), and use_end().

◆ hasNUsesOrMore()

bool llvm::sandboxir::Value::hasNUsesOrMore ( unsigned  Num) const
inline

Return true if this value has N uses or more.

This is logically equivalent to getNumUses() >= N. WARNING: This can be expensive, as it is linear to the number of users.

Definition at line 267 of file SandboxIR.h.

References use_begin(), and use_end().

◆ printAsOperandCommon()

void Value::printAsOperandCommon ( raw_ostream OS) const

Definition at line 156 of file SandboxIR.cpp.

References OS, llvm::Value::printAsOperand(), and Val.

Referenced by llvm::sandboxir::Argument::printAsOperand().

◆ replaceAllUsesWith()

void Value::replaceAllUsesWith ( Value Other)

Definition at line 119 of file SandboxIR.cpp.

References assert(), getType(), llvm::Other, llvm::Value::replaceAllUsesWith(), and Val.

◆ replaceUsesWithIf()

void Value::replaceUsesWithIf ( Value OtherV,
llvm::function_ref< bool(const Use &)>  ShouldReplace 
)

◆ use_begin() [1/2]

Value::use_iterator Value::use_begin ( )

◆ use_begin() [2/2]

const_use_iterator llvm::sandboxir::Value::use_begin ( ) const
inline

Definition at line 221 of file SandboxIR.h.

References use_begin().

◆ use_end() [1/2]

use_iterator llvm::sandboxir::Value::use_end ( )
inline

Definition at line 224 of file SandboxIR.h.

References Ctx.

Referenced by hasNUses(), hasNUsesOrMore(), use_end(), and uses().

◆ use_end() [2/2]

const_use_iterator llvm::sandboxir::Value::use_end ( ) const
inline

Definition at line 225 of file SandboxIR.h.

References use_end().

◆ user_begin() [1/2]

Value::user_iterator Value::user_begin ( )

◆ user_begin() [2/2]

const_user_iterator llvm::sandboxir::Value::user_begin ( ) const
inline

Definition at line 248 of file SandboxIR.h.

References user_begin().

◆ user_end() [1/2]

user_iterator llvm::sandboxir::Value::user_end ( )
inline

Definition at line 245 of file SandboxIR.h.

References Ctx.

Referenced by user_end(), and users().

◆ user_end() [2/2]

const_user_iterator llvm::sandboxir::Value::user_end ( ) const
inline

Definition at line 251 of file SandboxIR.h.

References user_end().

◆ users() [1/2]

iterator_range< user_iterator > llvm::sandboxir::Value::users ( )
inline

Definition at line 255 of file SandboxIR.h.

References user_begin(), and user_end().

◆ users() [2/2]

iterator_range< const_user_iterator > llvm::sandboxir::Value::users ( ) const
inline

Definition at line 258 of file SandboxIR.h.

References user_begin(), and user_end().

◆ uses() [1/2]

iterator_range< use_iterator > llvm::sandboxir::Value::uses ( )
inline

Definition at line 229 of file SandboxIR.h.

References use_begin(), and use_end().

◆ uses() [2/2]

iterator_range< const_use_iterator > llvm::sandboxir::Value::uses ( ) const
inline

Definition at line 232 of file SandboxIR.h.

References use_begin(), and use_end().

◆ verify()

virtual void llvm::sandboxir::Value::verify ( ) const
pure virtual

Friends And Related Function Documentation

◆ Context

friend class Context
friend

Definition at line 202 of file SandboxIR.h.

◆ LLVMOpUserItToSBTy

template<typename ItTy , typename SBTy >
friend class LLVMOpUserItToSBTy
friend

Definition at line 209 of file SandboxIR.h.

◆ operator<<

raw_ostream & operator<< ( raw_ostream OS,
const sandboxir::Value V 
)
friend

Definition at line 303 of file SandboxIR.h.

◆ User

friend class User
friend

Definition at line 203 of file SandboxIR.h.

Member Data Documentation

◆ Ctx

Context& llvm::sandboxir::Value::Ctx
protected

◆ SubclassID

ClassID llvm::sandboxir::Value::SubclassID
protected

For isa/dyn_cast.

Definition at line 193 of file SandboxIR.h.

Referenced by dumpCommonHeader(), dumpCommonSuffix(), and getSubclassID().

◆ UID

unsigned llvm::sandboxir::Value::UID
protected

A unique ID used for forming the name (used for debugging).

Definition at line 196 of file SandboxIR.h.

Referenced by getName(), and Value().

◆ Val

llvm::Value* llvm::sandboxir::Value::Val = nullptr
protected

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