#include "llvm/SandboxIR/Instruction.h"
Public Types | |
using | const_block_iterator =mapped_iterator<llvm::PHINode::const_block_iterator, LLVMBBToBB > |
![]() | |
enum class | Opcode {OP,OPCODES,DEF_INSTR } |
![]() | |
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 > |
![]() | |
enum class | ClassID : unsigned {DEF_VALUE,DEF_USER,DEF_CONST,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 | |
const_block_iterator | block_begin ()const |
const_block_iterator | block_end ()const |
iterator_range<const_block_iterator > | blocks ()const |
op_range | incoming_values () |
const_op_range | incoming_values ()const |
unsigned | getNumIncomingValues ()const |
Value * | getIncomingValue (unsignedIdx)const |
void | setIncomingValue (unsignedIdx,Value *V) |
BasicBlock * | getIncomingBlock (unsignedIdx)const |
BasicBlock * | getIncomingBlock (constUse &U)const |
void | setIncomingBlock (unsignedIdx,BasicBlock *BB) |
void | addIncoming (Value *V,BasicBlock *BB) |
Value * | removeIncomingValue (unsignedIdx) |
Value * | removeIncomingValue (BasicBlock *BB) |
int | getBasicBlockIndex (constBasicBlock *BB)const |
Value * | getIncomingValueForBlock (constBasicBlock *BB)const |
Value * | hasConstantValue ()const |
bool | hasConstantOrUndefValue ()const |
bool | isComplete ()const |
void | replaceIncomingBlockWith (constBasicBlock *Old,BasicBlock *New) |
void | removeIncomingValueIf (function_ref<bool(unsigned)>Predicate) |
![]() | |
unsigned | getUseOperandNo (constUse &Use)const final |
\Returns the operand index ofUse . | |
unsigned | getNumOfIRInstrs ()const final |
This is used byBasicBlock::iterator. | |
void | verify ()const final |
Should crash if there is something wrong with the instruction. | |
void | dumpOS (raw_ostream &OS)const override |
![]() | |
virtualunsigned | getNumOfIRInstrs ()const =0 |
This is used byBasicBlock::iterator. | |
BBIterator | getIterator ()const |
\Returns aBasicBlock::iterator for thisInstruction. | |
Instruction * | getNextNode ()const |
\Returns the nextsandboxir::Instruction in the block, or nullptr if at the end of the block. | |
Instruction * | getPrevNode ()const |
\Returns the previoussandboxir::Instruction in the block, or nullptr if at the beginning of the block. | |
Opcode | getOpcode ()const |
\Returns thisInstruction's opcode. | |
constchar * | getOpcodeName ()const |
constDataLayout & | getDataLayout ()const |
bool | isTerminator ()const |
bool | isUnaryOp ()const |
bool | isBinaryOp ()const |
bool | isIntDivRem ()const |
bool | isShift ()const |
bool | isCast ()const |
bool | isFuncletPad ()const |
bool | isSpecialTerminator ()const |
bool | isOnlyUserOfAnyOperand ()const |
bool | isLogicalShift ()const |
bool | hasMetadata ()const |
Return true if the instruction has any metadata attached to it. | |
bool | hasMetadataOtherThanDebugLoc ()const |
Return true if this instruction has metadata attached to it other than a debug location. | |
bool | hasMetadata (unsigned KindID)const |
Return true if this instruction has the given type of metadata attached. | |
void | removeFromParent () |
Detach this from its parentBasicBlock without deleting it. | |
void | eraseFromParent () |
Detach thisValue from its parent and delete it. | |
void | insertBefore (Instruction *BeforeI) |
Insert this detached instruction beforeBeforeI . | |
void | insertAfter (Instruction *AfterI) |
Insert this detached instruction afterAfterI . | |
void | insertInto (BasicBlock *BB,constBBIterator &WhereIt) |
Insert this detached instruction intoBB atWhereIt . | |
void | moveBefore (BasicBlock &BB,constBBIterator &WhereIt) |
Move this instruction toWhereIt . | |
void | moveBefore (Instruction *Before) |
Move this instruction beforeBefore . | |
void | moveAfter (Instruction *After) |
Move this instruction afterAfter . | |
bool | comesBefore (constInstruction *Other)const |
Given an instruction Other in the same basic block as this instruction, return true if this instruction comes before Other. | |
BasicBlock * | getParent ()const |
\Returns theBasicBlock containing thisInstruction, or null if it is detached. | |
bool | hasNoUnsignedWrap ()const |
Determine whether the no signed wrap flag is set. | |
void | setHasNoUnsignedWrap (boolB=true) |
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag. | |
bool | hasNoSignedWrap ()const |
Determine whether the no signed wrap flag is set. | |
void | setHasNoSignedWrap (boolB=true) |
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag. | |
bool | isFast ()const |
Determine whether all fast-math-flags are set. | |
void | setFast (boolB) |
Set or clear all fast-math-flags on this instruction, which must be an operator which supports this flag. | |
bool | hasAllowReassoc ()const |
Determine whether the allow-reassociation flag is set. | |
void | setHasAllowReassoc (boolB) |
Set or clear the reassociation flag on this instruction, which must be an operator which supports this flag. | |
bool | isExact ()const |
Determine whether the exact flag is set. | |
void | setIsExact (boolB=true) |
Set or clear the exact flag on this instruction, which must be an operator which supports this flag. | |
bool | hasNoNaNs ()const |
Determine whether the no-NaNs flag is set. | |
void | setHasNoNaNs (boolB) |
Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag. | |
bool | hasNoInfs ()const |
Determine whether the no-infs flag is set. | |
void | setHasNoInfs (boolB) |
Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag. | |
bool | hasNoSignedZeros ()const |
Determine whether the no-signed-zeros flag is set. | |
void | setHasNoSignedZeros (boolB) |
Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag. | |
bool | hasAllowReciprocal ()const |
Determine whether the allow-reciprocal flag is set. | |
void | setHasAllowReciprocal (boolB) |
Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag. | |
bool | hasAllowContract ()const |
Determine whether the allow-contract flag is set. | |
void | setHasAllowContract (boolB) |
Set or clear the allow-contract flag on this instruction, which must be an operator which supports this flag. | |
bool | hasApproxFunc ()const |
Determine whether the approximate-math-functions flag is set. | |
void | setHasApproxFunc (boolB) |
Set or clear the approximate-math-functions flag on this instruction, which must be an operator which supports this flag. | |
FastMathFlags | getFastMathFlags ()const |
Convenience function for getting all the fast-math flags, which must be an operator which supports these flags. | |
void | setFastMathFlags (FastMathFlags FMF) |
Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags. | |
void | copyFastMathFlags (FastMathFlags FMF) |
Convenience function for transferring all fast-math flag values to this instruction, which must be an operator which supports these flags. | |
bool | isAssociative ()const |
bool | isCommutative ()const |
bool | isIdempotent ()const |
bool | isNilpotent ()const |
bool | mayWriteToMemory ()const |
bool | mayReadFromMemory ()const |
bool | mayReadOrWriteMemory ()const |
bool | isAtomic ()const |
bool | hasAtomicLoad ()const |
bool | hasAtomicStore ()const |
bool | isVolatile ()const |
Type * | getAccessType ()const |
bool | mayThrow (bool IncludePhaseOneUnwind=false)const |
bool | isFenceLike ()const |
bool | mayHaveSideEffects ()const |
void | dumpOS (raw_ostream &OS)const override |
![]() | |
virtualop_iterator | op_begin () |
virtualop_iterator | op_end () |
virtualconst_op_iterator | op_begin ()const |
virtualconst_op_iterator | op_end ()const |
op_range | operands () |
const_op_range | operands ()const |
Value * | getOperand (unsigned OpIdx)const |
Use | getOperandUse (unsigned OpIdx)const |
\Returns the operand edge forOpIdx . | |
virtualunsigned | getNumOperands ()const |
virtual void | setOperand (unsigned OperandIdx,Value *Operand) |
bool | replaceUsesOfWith (Value *FromV,Value *ToV) |
Replaces any operands that matchFromV withToV . | |
void | verify ()const override |
Should crash if there is something wrong with the instruction. | |
void | dumpCommonHeader (raw_ostream &OS)const final |
void | dumpOS (raw_ostream &OS)const override |
![]() | |
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_iterator > | uses () |
iterator_range<const_use_iterator > | uses ()const |
user_iterator | user_begin () |
user_iterator | user_end () |
const_user_iterator | user_begin ()const |
const_user_iterator | user_end ()const |
iterator_range<user_iterator > | users () |
iterator_range<const_user_iterator > | users ()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 thisValue has exactly N uses. | |
Type * | getType ()const |
Context & | getContext ()const |
void | replaceUsesWithIf (Value *OtherV,llvm::function_ref<bool(constUse &)> 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 | dumpOS (raw_ostream &OS)const =0 |
LLVM_DUMP_METHOD void | dump ()const |
Static Public Member Functions | |
staticPHINode * | create (Type *Ty,unsigned NumReservedValues,InsertPosition Pos,Context &Ctx,constTwine &Name="") |
staticbool | classof (constValue *From) |
For isa/dyn_cast. | |
staticunsigned | getOperandNumForIncomingValue (unsignedIdx) |
staticunsigned | getIncomingValueNumForOperand (unsignedIdx) |
![]() | |
staticconstchar * | getOpcodeName (OpcodeOpc) |
staticbool | classof (constsandboxir::Value *From) |
For isa/dyn_cast. | |
![]() | |
staticbool | classof (constValue *From) |
For isa/dyn_cast. | |
Additional Inherited Members | |
![]() | |
Instruction (ClassIDID,OpcodeOpc,llvm::Instruction *I,sandboxir::Context &SBCtx) | |
llvm::Instruction * | getTopmostLLVMInstruction ()const |
A SandboxIRInstruction may map to multiple LLVM IRInstruction. | |
virtualSmallVector<llvm::Instruction *, 1 > | getLLVMInstrs ()const =0 |
\Returns the LLVM IR Instructions that this SandboxIR maps to in program order. | |
![]() | |
User (ClassIDID,llvm::Value *V,Context &Ctx) | |
Use | getOperandUseDefault (unsigned OpIdx,boolVerify)const |
\Returns theUse edge that corresponds toOpIdx . | |
virtualUse | getOperandUseInternal (unsigned OpIdx,boolVerify)const =0 |
\Returns theUse for theOpIdx'th operand. | |
unsigned | getUseOperandNoDefault (constUse &Use)const |
The default implementation works only for single-LLVMIR-instruction Users and only if they match exactly the LLVM instruction. | |
virtualunsigned | getUseOperandNo (constUse &Use)const =0 |
\Returns the operand index ofUse . | |
void | swapOperandsInternal (unsigned OpIdxA,unsigned OpIdxB) |
void | verifyUserOfLLVMUse (constllvm::Use &Use)const |
![]() | |
void | clearValue () |
Value (ClassIDSubclassID,llvm::Value *Val,Context &Ctx) | |
Value (constValue &)=delete | |
Disable copies. | |
Value & | operator= (constValue &)=delete |
![]() | |
staticIRBuilder & | setInsertPos (InsertPosition Pos) |
Helper function for create(). | |
![]() | |
staticconstchar * | getSubclassIDStr (ClassIDID) |
![]() | |
Opcode | Opc |
![]() | |
ClassID | SubclassID |
For isa/dyn_cast. | |
unsigned | UID |
A unique ID used for forming the name (used for debugging). | |
llvm::Value * | Val = nullptr |
The LLVMValue that corresponds to this SandboxIRValue. | |
Context & | Ctx |
All values point to the context. | |
Definition at line2377 of fileInstruction.h.
usingllvm::sandboxir::PHINode::const_block_iterator =mapped_iterator<llvm::PHINode::const_block_iterator, LLVMBBToBB> |
Definition at line2396 of fileInstruction.h.
void llvm::sandboxir::PHINode::addIncoming | ( | Value * | V, |
BasicBlock * | BB | ||
) |
Definition at line868 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Tracker::emplaceIfTracking(),llvm::sandboxir::Context::getTracker(), andllvm::sandboxir::Value::Val.
Referenced byllvm::sandboxir::PHIRemoveIncoming::revert().
| inline |
Definition at line2399 of fileInstruction.h.
Referencesblock_begin(),llvm::sandboxir::Value::Ctx, andllvm::sandboxir::Value::Val.
Referenced byblock_begin(), andblocks().
| inline |
Definition at line2404 of fileInstruction.h.
Referencesblock_end(),llvm::sandboxir::Value::Ctx, andllvm::sandboxir::Value::Val.
Referenced byblock_end(), andblocks().
| inline |
Definition at line2409 of fileInstruction.h.
Referencesblock_begin(),block_end(), andllvm::make_range().
int llvm::sandboxir::PHINode::getBasicBlockIndex | ( | constBasicBlock * | BB | ) | const |
Definition at line893 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Val.
Referenced byremoveIncomingValue().
BasicBlock * llvm::sandboxir::PHINode::getIncomingBlock | ( | constUse & | U | ) | const |
Definition at line852 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Context::getValue(), andllvm::sandboxir::Value::Val.
BasicBlock * llvm::sandboxir::PHINode::getIncomingBlock | ( | unsigned | Idx | ) | const |
Definition at line848 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Context::getValue(),Idx, andllvm::sandboxir::Value::Val.
Referenced byreplaceIncomingBlockWith(),llvm::sandboxir::PHIRemoveIncoming::revert(), andsetIncomingBlock().
Definition at line838 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,getIncomingValue(),llvm::sandboxir::Context::getValue(),Idx, andllvm::sandboxir::Value::Val.
Referenced bygetIncomingValue(),llvm::sandboxir::PHIRemoveIncoming::revert(), andsetIncomingValue().
Value * llvm::sandboxir::PHINode::getIncomingValueForBlock | ( | constBasicBlock * | BB | ) | const |
Definition at line897 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Context::getValue(), andllvm::sandboxir::Value::Val.
Definition at line2425 of fileInstruction.h.
Referencesllvm::PHINode::getIncomingValueNumForOperand(), andIdx.
| inline |
Definition at line2417 of fileInstruction.h.
Referencesllvm::sandboxir::Value::Val.
Referenced byllvm::sandboxir::PHIRemoveIncoming::revert().
Definition at line2422 of fileInstruction.h.
Referencesllvm::PHINode::getOperandNumForIncomingValue(), andIdx.
| inline |
Definition at line2443 of fileInstruction.h.
Referencesllvm::sandboxir::Value::Val.
Value * llvm::sandboxir::PHINode::hasConstantValue | ( | ) | const |
Definition at line903 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Context::getValue(), andllvm::sandboxir::Value::Val.
| inline |
Definition at line2413 of fileInstruction.h.
Referencesllvm::sandboxir::User::operands().
| inline |
Definition at line2415 of fileInstruction.h.
Referencesllvm::sandboxir::User::operands().
| inline |
Definition at line2446 of fileInstruction.h.
Referencesllvm::sandboxir::Value::Val.
Value * llvm::sandboxir::PHINode::removeIncomingValue | ( | BasicBlock * | BB | ) |
Definition at line875 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Tracker::emplaceIfTracking(),llvm::sandboxir::Context::getTracker(),llvm::sandboxir::Context::getValue(),Idx, andllvm::sandboxir::Value::Val.
Referenced byllvm::sandboxir::PHIAddIncoming::revert().
void llvm::sandboxir::PHINode::removeIncomingValueIf | ( | function_ref<bool(unsigned)> | Predicate | ) |
Definition at line914 of fileInstruction.cpp.
void llvm::sandboxir::PHINode::replaceIncomingBlockWith | ( | constBasicBlock * | Old, |
BasicBlock * | New | ||
) |
Definition at line907 of fileInstruction.cpp.
Referencesassert(),getIncomingBlock(),llvm::sandboxir::User::getNumOperands(),Idx,setIncomingBlock(), andllvm::sandboxir::Value::Val.
void llvm::sandboxir::PHINode::setIncomingBlock | ( | unsigned | Idx, |
BasicBlock * | BB | ||
) |
Definition at line857 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Tracker::emplaceIfTracking(),getIncomingBlock(),llvm::sandboxir::Context::getTracker(),Idx, andllvm::sandboxir::Value::Val.
Referenced byreplaceIncomingBlockWith(), andllvm::sandboxir::PHIRemoveIncoming::revert().
Definition at line841 of fileInstruction.cpp.
Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Tracker::emplaceIfTracking(),getIncomingValue(),llvm::sandboxir::Context::getTracker(),Idx,setIncomingValue(), andllvm::sandboxir::Value::Val.
Referenced byllvm::sandboxir::PHIRemoveIncoming::revert(), andsetIncomingValue().