LLVM 22.0.0git
|
A sandboxir::User has operands. More...
#include "llvm/SandboxIR/User.h"
Public Types | |
using | op_iterator = OperandUseIterator |
using | const_op_iterator = OperandUseIterator |
using | op_range = iterator_range<op_iterator> |
using | const_op_range = iterator_range<const_op_iterator> |
Public Types inherited from llvm::sandboxir::Value | |
enum class | ClassID : unsigned |
using | use_iterator = UserUseIterator |
using | const_use_iterator = UserUseIterator |
using | user_iterator = mapped_iterator<sandboxir::UserUseIterator, UseToUser> |
using | const_user_iterator = user_iterator |
Static Public Member Functions | |
static bool | classof (const Value *From) |
For isa/dyn_cast. |
Protected Member Functions | |
User (ClassID ID, llvm::Value *V, Context &Ctx) | |
Use | getOperandUseDefault (unsigned OpIdx, bool Verify) const |
\Returns the Use edge that corresponds to OpIdx . | |
virtual Use | getOperandUseInternal (unsigned OpIdx, bool Verify) const =0 |
\Returns the Use for the OpIdx'th operand. | |
unsigned | getUseOperandNoDefault (const Use &Use) const |
The default implementation works only for single-LLVMIR-instruction Users and only if they match exactly the LLVM instruction. | |
virtual unsigned | getUseOperandNo (const Use &Use) const =0 |
\Returns the operand index of Use . | |
void | swapOperandsInternal (unsigned OpIdxA, unsigned OpIdxB) |
void | verifyUserOfLLVMUse (const llvm::Use &Use) const |
Protected Member Functions inherited from llvm::sandboxir::Value | |
void | clearValue () |
LLVM_ABI | Value (ClassID SubclassID, llvm::Value *Val, Context &Ctx) |
Value (const Value &)=delete | |
Disable copies. | |
Value & | operator= (const Value &)=delete |
Friends | |
class | OperandUseIterator |
unsigned | Use::getOperandNo () const |
Additional Inherited Members | |
Static Protected Member Functions inherited from llvm::sandboxir::Value | |
static const char * | getSubclassIDStr (ClassID ID) |
Protected Attributes inherited from llvm::sandboxir::Value | |
ClassID | SubclassID |
For isa/dyn_cast. | |
unsigned | UID |
A unique ID used for forming the name (used for debugging). | |
llvm::Value * | Val = nullptr |
The LLVM Value that corresponds to this SandboxIR Value. | |
Context & | Ctx |
All values point to the context. |
A sandboxir::User has operands.
|
inlineprotected |
Definition at line 61 of file User.h.
References llvm::sandboxir::Value::Context, llvm::sandboxir::Value::Ctx, and llvm::sandboxir::Value::Value().
Referenced by llvm::sandboxir::Constant::Constant(), llvm::sandboxir::Constant::Constant(), getOperandUseDefault(), llvm::sandboxir::Instruction::Instruction(), op_begin(), and op_end().
For isa/dyn_cast.
Definition at line 76 of file User.cpp.
References llvm::sandboxir::Value::getSubclassID(), and llvm::sandboxir::Value::Value().
|
finalvirtual |
Reimplemented from llvm::sandboxir::Value.
Definition at line 115 of file User.cpp.
References llvm::sandboxir::Value::dumpCommonHeader().
|
inlineoverridevirtual |
Implements llvm::sandboxir::Value.
|
inlinevirtual |
Definition at line 129 of file User.h.
References llvm::cast(), llvm::isa(), and llvm::sandboxir::Value::Val.
Referenced by llvm::sandboxir::CatchSwitchInst::getNumSuccessors(), getOperandUseDefault(), op_end(), llvm::sandboxir::PHINode::replaceIncomingBlockWith(), replaceUsesOfWith(), and swapOperandsInternal().
Definition at line 123 of file User.h.
References getOperandUse(), OpIdx, and llvm::sandboxir::Value::Value().
Referenced by llvm::sandboxir::VecUtils::matchPack().
\Returns the operand edge for OpIdx
.
NOTE: This should also work for OpIdx == getNumOperands(), which is used for op_end().
Definition at line 126 of file User.h.
References getOperandUseInternal(), OpIdx, and llvm::sandboxir::Value::Use.
Referenced by llvm::sandboxir::ShuffleVectorInst::commute(), llvm::sandboxir::CallBase::getArgOperandUse(), llvm::sandboxir::CallBase::getArgOperandUse(), getOperand(), replaceUsesOfWith(), setOperand(), swapOperandsInternal(), and llvm::sandboxir::SelectInst::swapValues().
\Returns the Use edge that corresponds to OpIdx
.
Note: This is the default implementation that works for instructions that match the underlying LLVM instruction. All others should use a different implementation.
Definition at line 58 of file User.cpp.
References assert(), llvm::cast(), llvm::sandboxir::Value::Ctx, getNumOperands(), llvm::isa(), OpIdx, llvm::sandboxir::Value::Use, User(), llvm::sandboxir::Value::Val, and Verify.
Referenced by llvm::sandboxir::Constant::getOperandUseInternal(), and llvm::sandboxir::GlobalObject::getOperandUseInternal().
|
protectedpure virtual |
\Returns the Use for the OpIdx'th
operand.
This is virtual to allow instructions to deviate from the LLVM IR operands, which is a requirement for sandboxir Instructions that consist of more than one LLVM Instruction.
Implemented in llvm::sandboxir::Constant, and llvm::sandboxir::GlobalObject.
References OpIdx, llvm::sandboxir::Value::Use, and Verify.
Referenced by getOperandUse(), op_begin(), op_end(), llvm::sandboxir::OperandUseIterator::operator+(), and llvm::sandboxir::OperandUseIterator::operator-().
|
protectedpure virtual |
\Returns the operand index of Use
.
Implemented in llvm::sandboxir::Constant, llvm::sandboxir::ConstantAggregateZero, llvm::sandboxir::ConstantFP, llvm::sandboxir::ConstantInt, llvm::sandboxir::ConstantPointerNull, llvm::sandboxir::ConstantTokenNone, llvm::sandboxir::DSOLocalEquivalent, llvm::sandboxir::GlobalObject, llvm::sandboxir::NoCFIValue, llvm::sandboxir::SingleLLVMInstructionImpl< LLVMT >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::AtomicCmpXchgInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::AtomicRMWInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::BinaryOperator >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::BranchInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::CallBase >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::CatchReturnInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::CatchSwitchInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::CleanupReturnInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::CmpInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::ExtractElementInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::FenceInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::FuncletPadInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::GetElementPtrInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::InsertElementInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::InsertValueInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::Instruction >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::LandingPadInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::PHINode >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::ResumeInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::ReturnInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::SelectInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::ShuffleVectorInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::StoreInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::SwitchInst >, llvm::sandboxir::SingleLLVMInstructionImpl< llvm::UnaryInstruction >, llvm::sandboxir::UndefValue, and llvm::sandboxir::UnreachableInst.
References llvm::sandboxir::Value::Use.
The default implementation works only for single-LLVMIR-instruction Users and only if they match exactly the LLVM instruction.
Definition at line 76 of file User.h.
References llvm::sandboxir::Value::Use.
Referenced by llvm::sandboxir::Constant::getUseOperandNo(), llvm::sandboxir::GlobalObject::getUseOperandNo(), llvm::sandboxir::NoCFIValue::getUseOperandNo(), and llvm::sandboxir::SingleLLVMInstructionImpl< LLVMT >::getUseOperandNo().
|
inlinevirtual |
Definition at line 103 of file User.h.
References assert(), getOperandUseInternal(), llvm::isa(), and llvm::sandboxir::Value::Val.
Referenced by llvm::sandboxir::CallBase::arg_begin(), llvm::sandboxir::CallBase::arg_begin(), llvm::sandboxir::CallBase::data_operands_begin(), llvm::sandboxir::CallBase::data_operands_end(), llvm::sandboxir::CallBase::data_operands_end(), llvm::sandboxir::CatchSwitchInst::handler_begin(), llvm::sandboxir::CatchSwitchInst::handler_begin(), llvm::sandboxir::GetElementPtrInst::idx_begin(), op_begin(), operands(), and operands().
|
inlinevirtual |
Definition at line 112 of file User.h.
References op_begin(), and User().
|
inlinevirtual |
Definition at line 107 of file User.h.
References assert(), getNumOperands(), getOperandUseInternal(), llvm::isa(), and llvm::sandboxir::Value::Val.
Referenced by llvm::sandboxir::CatchSwitchInst::handler_end(), llvm::sandboxir::CatchSwitchInst::handler_end(), llvm::sandboxir::GetElementPtrInst::idx_end(), op_end(), operands(), and operands().
|
inlinevirtual |
|
inline |
Definition at line 119 of file User.h.
References llvm::make_range(), op_begin(), and op_end().
Referenced by llvm::sandboxir::PHINode::incoming_values(), and llvm::sandboxir::PHINode::incoming_values().
|
inline |
Definition at line 120 of file User.h.
References llvm::make_range(), op_begin(), and op_end().
Replaces any operands that match FromV
with ToV
.
Returns whether any operands were replaced.
Definition at line 100 of file User.cpp.
References llvm::sandboxir::Value::Ctx, getNumOperands(), getOperandUse(), OpIdx, llvm::seq(), llvm::sandboxir::Value::Use, and llvm::sandboxir::Value::Value().
Definition at line 91 of file User.cpp.
References assert(), llvm::sandboxir::Value::Ctx, getOperandUse(), llvm::isa(), llvm::sandboxir::Value::Val, and llvm::sandboxir::Value::Value().
Referenced by llvm::Instruction::isOnlyUserOfAnyOperand(), llvm::sandboxir::CallBase::setArgOperand(), llvm::sandboxir::BranchInst::setCondition(), llvm::sandboxir::SelectInst::setCondition(), llvm::sandboxir::SelectInst::setFalseValue(), llvm::sandboxir::InvokeInst::setNormalDest(), llvm::sandboxir::CatchSwitchInst::setSuccessor(), llvm::sandboxir::SelectInst::setTrueValue(), and llvm::sandboxir::InvokeInst::setUnwindDest().
|
inlineprotected |
Definition at line 83 of file User.h.
References assert(), getNumOperands(), and getOperandUse().
Referenced by llvm::sandboxir::BinaryOperator::swapOperands(), and llvm::sandboxir::BranchInst::swapSuccessors().
|
inlineoverridevirtual |
Should crash if there is something wrong with the instruction.
Implements llvm::sandboxir::Value.
Definition at line 139 of file User.h.
References assert(), llvm::isa(), and llvm::sandboxir::Value::Val.
Definition at line 70 of file User.cpp.
References assert(), llvm::sandboxir::Value::Ctx, and llvm::sandboxir::Value::Use.
|
friend |
Definition at line 72 of file User.h.
References OperandUseIterator.
Referenced by OperandUseIterator.
|
friend |
References llvm::sandboxir::Use::getOperandNo().