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)
 
StringRef getName () const
 \Returns the LLVM IR name of the bottom-most LLVM value.
 
virtual void verify () const =0
 Should crash if there is something wrong with the instruction.
 
std::string getUid () const
 Returns the unique id 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
 
class Use
 
class LoadInst
 
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 137 of file SandboxIR.h.

Member Typedef Documentation

◆ const_use_iterator

Definition at line 193 of file SandboxIR.h.

◆ const_user_iterator

Definition at line 217 of file SandboxIR.h.

◆ use_iterator

Definition at line 192 of file SandboxIR.h.

◆ user_iterator

Definition at line 216 of file SandboxIR.h.

Member Enumeration Documentation

◆ ClassID

Enumerator
DEF_VALUE 
DEF_USER 
DEF_INSTR 

Definition at line 139 of file SandboxIR.h.

Constructor & Destructor Documentation

◆ Value()

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

Definition at line 80 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 183 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 153 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 149 of file SandboxIR.cpp.

References getSubclassIDStr(), getUid(), 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 262 of file SandboxIR.h.

References Ctx.

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

◆ getName()

StringRef llvm::sandboxir::Value::getName ( ) const
inline

\Returns the LLVM IR name of the bottom-most LLVM value.

Definition at line 269 of file SandboxIR.h.

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

◆ 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 108 of file SandboxIR.cpp.

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

◆ getSubclassID()

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

Definition at line 190 of file SandboxIR.h.

References SubclassID.

◆ getSubclassIDStr()

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

Definition at line 147 of file SandboxIR.h.

References llvm_unreachable.

Referenced by dumpCommonHeader(), and dumpCommonSuffix().

◆ getType()

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

Definition at line 260 of file SandboxIR.h.

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

Referenced by replaceAllUsesWith(), and replaceUsesWithIf().

◆ getUid()

std::string Value::getUid ( ) const

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

Definition at line 143 of file SandboxIR.cpp.

References UID.

Referenced by dumpCommonHeader(), and dumpCommonSuffix().

◆ hasNUses()

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

Return true if this Value has exactly N uses.

Definition at line 251 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 242 of file SandboxIR.h.

References use_begin(), and use_end().

◆ printAsOperandCommon()

void Value::printAsOperandCommon ( raw_ostream OS) const

Definition at line 173 of file SandboxIR.cpp.

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

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

◆ replaceAllUsesWith()

void Value::replaceAllUsesWith ( Value Other)

◆ 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 196 of file SandboxIR.h.

References use_begin().

◆ use_end() [1/2]

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

Definition at line 199 of file SandboxIR.h.

References Ctx, and Use.

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 200 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 223 of file SandboxIR.h.

References user_begin().

◆ user_end() [1/2]

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

Definition at line 220 of file SandboxIR.h.

References Ctx, and Use.

Referenced by user_end(), and users().

◆ user_end() [2/2]

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

Definition at line 226 of file SandboxIR.h.

References user_end().

◆ users() [1/2]

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

Definition at line 230 of file SandboxIR.h.

References user_begin(), and user_end().

Referenced by llvm::sandboxir::Instruction::eraseFromParent().

◆ users() [2/2]

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

Definition at line 233 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 204 of file SandboxIR.h.

References use_begin(), and use_end().

Referenced by replaceAllUsesWith().

◆ uses() [2/2]

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

Definition at line 207 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 175 of file SandboxIR.h.

◆ LLVMOpUserItToSBTy

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

Definition at line 184 of file SandboxIR.h.

◆ LoadInst

friend class LoadInst
friend

Definition at line 178 of file SandboxIR.h.

◆ operator<<

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

Definition at line 281 of file SandboxIR.h.

◆ Use

friend class Use
friend

◆ User

friend class User
friend

Definition at line 176 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 164 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 167 of file SandboxIR.h.

Referenced by getUid(), and Value().

◆ Val

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

The LLVM Value that corresponds to this SandboxIR Value.

NOTE: Some sandboxir Instructions, like Packs, may include more than one value and in these cases Val points to the last instruction in program order.

Definition at line 173 of file SandboxIR.h.

Referenced by llvm::sandboxir::Function::arg_empty(), llvm::sandboxir::Function::arg_size(), llvm::sandboxir::BasicBlock::back(), llvm::sandboxir::BasicBlock::begin(), llvm::sandboxir::Function::begin(), clearValue(), llvm::sandboxir::LoadInst::create(), llvm::sandboxir::BasicBlock::dump(), llvm::sandboxir::Function::dump(), dumpCommonFooter(), dumpCommonPrefix(), llvm::sandboxir::Function::dumpNameAndArgs(), llvm::sandboxir::BasicBlock::end(), llvm::sandboxir::Function::end(), llvm::sandboxir::BasicBlock::front(), llvm::sandboxir::LoadInst::getAlign(), llvm::sandboxir::Function::getArg(), llvm::sandboxir::Instruction::getIterator(), getName(), llvm::sandboxir::Instruction::getNextNode(), llvm::sandboxir::User::getNumOperands(), getNumUses(), llvm::sandboxir::User::getOperandUseDefault(), llvm::sandboxir::Instruction::getParent(), llvm::sandboxir::BasicBlock::getParent(), llvm::sandboxir::LoadInst::getPointerOperand(), llvm::sandboxir::BasicBlock::getTerminator(), llvm::sandboxir::Instruction::getTopmostLLVMInstruction(), getType(), llvm::sandboxir::Instruction::insertInto(), llvm::sandboxir::LoadInst::isSimple(), llvm::sandboxir::LoadInst::isUnordered(), llvm::sandboxir::Instruction::moveBefore(), llvm::sandboxir::User::op_begin(), llvm::sandboxir::User::op_end(), printAsOperandCommon(), replaceAllUsesWith(), llvm::sandboxir::User::replaceUsesOfWith(), replaceUsesWithIf(), llvm::sandboxir::User::setOperand(), use_begin(), user_begin(), llvm::sandboxir::Argument::verify(), llvm::sandboxir::Constant::verify(), llvm::sandboxir::LoadInst::verify(), llvm::sandboxir::BasicBlock::verify(), llvm::sandboxir::Function::verify(), and llvm::sandboxir::User::verify().


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