Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Public Types |Public Member Functions |Static Public Member Functions |Public Attributes |Protected Types |Protected Member Functions |Friends |List of all members
llvm::Instruction Class Reference

#include "llvm/IR/Instruction.h"

Inheritance diagram for llvm::Instruction:
Inheritance graph
[legend]

Public Types

enum  OperationEquivalenceFlags {CompareIgnoringAlignment = 1 << 0,CompareUsingScalarTypes = 1 << 1,CompareUsingIntersectedAttrs = 1 << 2 }
 When checking for operation equivalence (using isSameOperationAs) it is sometimes useful to ignore certain attributes.More...
 
enum  TermOps
 
enum  UnaryOps
 
enum  BinaryOps
 
enum  MemoryOps
 
enum  CastOps
 
enum  FuncletPadOps
 
enum  OtherOps
 
using InstListType =SymbolTableList<Instruction,ilist_iterator_bits<true >,ilist_parent<BasicBlock > >
 
- Public Types inherited fromllvm::User
using op_iterator =Use *
 
using const_op_iterator =constUse *
 
using op_range =iterator_range<op_iterator >
 
using const_op_range =iterator_range<const_op_iterator >
 
- Public Types inherited fromllvm::Value
enum  ValueTy
 Concrete subclass of this.More...
 
using use_iterator = use_iterator_impl<Use >
 
using const_use_iterator = use_iterator_impl<constUse >
 
using user_iterator = user_iterator_impl<User >
 
using const_user_iterator = user_iterator_impl<constUser >
 

Public Member Functions

iterator_range<simple_ilist<DbgRecord >::iterator > cloneDebugInfoFrom (constInstruction *From, std::optional<simple_ilist<DbgRecord >::iterator > FromHere=std::nullopt,bool InsertAtHead=false)
 Clone any debug-info attached toFrom onto this instruction.
 
iterator_range<simple_ilist<DbgRecord >::iterator > getDbgRecordRange ()const
 Return a range over the DbgRecords attached to this instruction.
 
std::optional<simple_ilist<DbgRecord >::iterator > getDbgReinsertionPosition ()
 Return an iterator to the position of the "Next"DbgRecord after this instruction, or std::nullopt.
 
bool hasDbgRecords ()const
 Returns true if any DbgRecords are attached to this instruction.
 
void adoptDbgRecords (BasicBlock *BB,InstListType::iterator It,bool InsertAtHead)
 Transfer any DbgRecords on the positionIt onto this instruction, by simply adopting the sequence of DbgRecords (which is efficient) if possible, by merging two sequences otherwise.
 
void dropDbgRecords ()
 Erase any DbgRecords attached to this instruction.
 
void dropOneDbgRecord (DbgRecord *I)
 Erase a singleDbgRecordI that is attached to this instruction.
 
void handleMarkerRemoval ()
 Handle the debug-info implications of this instruction being removed.
 
 Instruction (constInstruction &)=delete
 
Instructionoperator= (constInstruction &)=delete
 
Instructionuser_back ()
 Specialize the methods defined inValue, as we know that an instruction can only be used by other instructions.
 
constInstructionuser_back ()const
 
constModulegetModule ()const
 Return the module owning the function this instruction belongs to or nullptr it the function does not have a module.
 
ModulegetModule ()
 
constFunctiongetFunction ()const
 Return the function this instruction belongs to.
 
FunctiongetFunction ()
 
constDataLayoutgetDataLayout ()const
 Get the data layout of the module this instruction belongs to.
 
void removeFromParent ()
 This method unlinks 'this' from the containing basic block, but does not delete it.
 
InstListType::iterator eraseFromParent ()
 This method unlinks 'this' from the containing basic block and deletes it.
 
void insertBefore (Instruction *InsertPos)
 Insert an unlinked instruction into a basic block immediately before the specified instruction.
 
void insertBefore (InstListType::iterator InsertPos)
 Insert an unlinked instruction into a basic block immediately before the specified position.
 
void insertAfter (Instruction *InsertPos)
 Insert an unlinked instruction into a basic block immediately after the specified instruction.
 
void insertAfter (InstListType::iterator InsertPos)
 Insert an unlinked instruction into a basic block immediately after the specified position.
 
InstListType::iterator insertInto (BasicBlock *ParentBB,InstListType::iterator It)
 Inserts an unlinked instruction intoParentBB at positionIt and returns the iterator of the inserted instruction.
 
void insertBefore (BasicBlock &BB,InstListType::iterator InsertPos)
 
void moveBefore (Instruction *MovePos)
 Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos.
 
void moveBefore (InstListType::iterator InsertPos)
 Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos.
 
void moveBeforePreserving (InstListType::iterator MovePos)
 Perform amoveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions.
 
void moveBeforePreserving (BasicBlock &BB,InstListType::iteratorI)
 Perform amoveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions.
 
void moveBeforePreserving (Instruction *MovePos)
 Perform amoveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions.
 
void moveBefore (BasicBlock &BB,InstListType::iteratorI)
 Unlink this instruction and insert into BB before I.
 
void moveAfter (Instruction *MovePos)
 Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos.
 
void moveAfter (InstListType::iterator MovePos)
 Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos.
 
void moveAfterPreserving (Instruction *MovePos)
 SeemoveBeforePreserving .
 
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.
 
std::optional<InstListType::iteratorgetInsertionPointAfterDef ()
 Get the first insertion point at which the result of this instruction is defined.
 
unsigned getOpcode ()const
 Returns a member of one of the enums like Instruction::Add.
 
constchargetOpcodeName ()const
 
bool isTerminator ()const
 
bool isUnaryOp ()const
 
bool isBinaryOp ()const
 
bool isIntDivRem ()const
 
bool isFPDivRem ()const
 
bool isShift ()const
 
bool isCast ()const
 
bool isFuncletPad ()const
 
bool isSpecialTerminator ()const
 
bool isOnlyUserOfAnyOperand ()
 It checks if this instruction is the only user of at least one of its operands.
 
bool isLogicalShift ()const
 Return true if this is a logical shift left or a logical shift right.
 
bool isArithmeticShift ()const
 Return true if this is an arithmetic shift right.
 
bool isBitwiseLogicOp ()const
 Return true if this is and/or/xor.
 
bool hasMetadata ()const
 Return true if this instruction has any metadata attached to it.
 
bool hasNonDebugLocLoopMetadata ()const
 
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.
 
bool hasMetadata (StringRef Kind)const
 Return true if this instruction has the given type of metadata attached.
 
MDNodegetMetadata (unsigned KindID)const
 Get the metadata of given kind attached to thisInstruction.
 
MDNodegetMetadata (StringRef Kind)const
 Get the metadata of given kind attached to thisInstruction.
 
void getAllMetadata (SmallVectorImpl< std::pair<unsigned,MDNode * > > &MDs)const
 Get all metadata attached to thisInstruction.
 
void getAllMetadataOtherThanDebugLoc (SmallVectorImpl< std::pair<unsigned,MDNode * > > &MDs)const
 This does the same thing as getAllMetadata, except that it filters out the debug location.
 
void setMetadata (unsigned KindID,MDNode *Node)
 Set the metadata of the specified kind to the specified node.
 
void setMetadata (StringRef Kind,MDNode *Node)
 
void copyMetadata (constInstruction &SrcInst,ArrayRef<unsigned > WL=ArrayRef<unsigned >())
 Copy metadata fromSrcInst to this instruction.
 
void eraseMetadataIf (function_ref<bool(unsigned,MDNode *)> Pred)
 Erase all metadata that matches the predicate.
 
void swapProfMetadata ()
 If the instruction has "branch_weights" MD_prof metadata and theMDNode has three operands (including name string), swap the order of the metadata.
 
void addAnnotationMetadata (StringRef Annotation)
 Adds an !annotation metadata node withAnnotation to this instruction.
 
void addAnnotationMetadata (SmallVector<StringRef >Annotations)
 Adds an !annotation metadata node with an array ofAnnotations as a tuple to this instruction.
 
AAMDNodes getAAMetadata ()const
 Returns theAA metadata for this instruction.
 
void setAAMetadata (constAAMDNodes &N)
 Sets theAA metadata on this instruction from theAAMDNodes structure.
 
void setNoSanitizeMetadata ()
 Sets the nosanitize metadata on this instruction.
 
bool extractProfTotalWeight (uint64_t &TotalVal)const
 Retrieve total raw weight values of a branch.
 
void setDebugLoc (DebugLoc Loc)
 Set the debug location information for this instruction.
 
constDebugLocgetDebugLoc ()const
 Return the debug location for this node as aDebugLoc.
 
constDebugLocgetStableDebugLoc ()const
 Fetch the debug location for this node, unless this is a debug intrinsic, in which case fetch the debug location of the next non-debug node.
 
void setHasNoUnsignedWrap (bool b=true)
 Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
 
void setHasNoSignedWrap (bool b=true)
 Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
 
void setIsExact (bool b=true)
 Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
 
void setNonNeg (bool b=true)
 Set or clear the nneg flag on this instruction, which must be a zext instruction.
 
bool hasNoUnsignedWrap ()constLLVM_READONLY
 Determine whether the no unsigned wrap flag is set.
 
bool hasNoSignedWrap ()constLLVM_READONLY
 Determine whether the no signed wrap flag is set.
 
bool hasNonNeg ()constLLVM_READONLY
 Determine whether the the nneg flag is set.
 
bool hasPoisonGeneratingFlags ()constLLVM_READONLY
 Return true if this operator has flags which may cause this instruction to evaluate to poison despite having non-poison inputs.
 
void dropPoisonGeneratingFlags ()
 Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs.
 
bool hasPoisonGeneratingMetadata ()constLLVM_READONLY
 Return true if this instruction has poison-generating metadata.
 
void dropPoisonGeneratingMetadata ()
 Drops metadata that may generate poison.
 
bool hasPoisonGeneratingReturnAttributes ()constLLVM_READONLY
 Return true if this instruction has poison-generating attribute.
 
void dropPoisonGeneratingReturnAttributes ()
 Drops return attributes that may generate poison.
 
bool hasPoisonGeneratingAnnotations ()const
 Return true if this instruction has poison-generating flags, return attributes or metadata.
 
void dropPoisonGeneratingAnnotations ()
 Drops flags, return attributes and metadata that may generate poison.
 
void dropUBImplyingAttrsAndUnknownMetadata (ArrayRef<unsigned > KnownIDs={})
 This function drops non-debug unknown metadata (through dropUnknownNonDebugMetadata).
 
void dropUBImplyingAttrsAndMetadata ()
 Drop any attributes or metadata that can cause immediate undefined behavior.
 
bool isExact ()constLLVM_READONLY
 Determine whether the exact flag is set.
 
void setFast (boolB)
 Set or clear all fast-math-flags on this instruction, which must be an operator which supports this flag.
 
void setHasAllowReassoc (boolB)
 Set or clear the reassociation flag on this instruction, which must be an operator which supports this flag.
 
void setHasNoNaNs (boolB)
 Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag.
 
void setHasNoInfs (boolB)
 Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag.
 
void setHasNoSignedZeros (boolB)
 Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag.
 
void setHasAllowReciprocal (boolB)
 Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag.
 
void setHasAllowContract (boolB)
 Set or clear the allow-contract flag on this instruction, which must be an operator which supports this flag.
 
void setHasApproxFunc (boolB)
 Set or clear the approximate-math-functions flag on this instruction, which must be an operator which supports this flag.
 
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 isFast ()constLLVM_READONLY
 Determine whether all fast-math-flags are set.
 
bool hasAllowReassoc ()constLLVM_READONLY
 Determine whether the allow-reassociation flag is set.
 
bool hasNoNaNs ()constLLVM_READONLY
 Determine whether the no-NaNs flag is set.
 
bool hasNoInfs ()constLLVM_READONLY
 Determine whether the no-infs flag is set.
 
bool hasNoSignedZeros ()constLLVM_READONLY
 Determine whether the no-signed-zeros flag is set.
 
bool hasAllowReciprocal ()constLLVM_READONLY
 Determine whether the allow-reciprocal flag is set.
 
bool hasAllowContract ()constLLVM_READONLY
 Determine whether the allow-contract flag is set.
 
bool hasApproxFunc ()constLLVM_READONLY
 Determine whether the approximate-math-functions flag is set.
 
FastMathFlags getFastMathFlags ()constLLVM_READONLY
 Convenience function for getting all the fast-math flags, which must be an operator which supports these flags.
 
void copyFastMathFlags (constInstruction *I)
 Copy I's fast-math flags.
 
void copyIRFlags (constValue *V,bool IncludeWrapFlags=true)
 Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this instruction.
 
void andIRFlags (constValue *V)
 Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction.
 
void applyMergedLocation (DILocation *LocA,DILocation *LocB)
 Merge 2 debug locations and apply it to theInstruction.
 
void updateLocationAfterHoist ()
 Updates the debug location given that the instruction has been hoisted from a block to a predecessor of that block.
 
void dropLocation ()
 Drop the instruction's debug location.
 
void mergeDIAssignID (ArrayRef<constInstruction * > SourceInstructions)
 Merge theDIAssignID metadata from this instruction and those attached to instructions inSourceInstructions.
 
bool isAssociative ()constLLVM_READONLY
 Return true if the instruction is associative:
 
bool isCommutative ()constLLVM_READONLY
 Return true if the instruction is commutative:
 
bool isIdempotent ()const
 Return true if the instruction is idempotent:
 
bool isNilpotent ()const
 Return true if the instruction is nilpotent:
 
bool mayWriteToMemory ()constLLVM_READONLY
 Return true if this instruction may modify memory.
 
bool mayReadFromMemory ()constLLVM_READONLY
 Return true if this instruction may read memory.
 
bool mayReadOrWriteMemory ()const
 Return true if this instruction may read or write memory.
 
bool isAtomic ()constLLVM_READONLY
 Return true if this instruction has an AtomicOrdering of unordered or higher.
 
bool hasAtomicLoad ()constLLVM_READONLY
 Return true if this atomic instruction loads from memory.
 
bool hasAtomicStore ()constLLVM_READONLY
 Return true if this atomic instruction stores to memory.
 
bool isVolatile ()constLLVM_READONLY
 Return true if this instruction has a volatile memory access.
 
TypegetAccessType ()constLLVM_READONLY
 Return the type this instruction accesses in memory, if any.
 
bool mayThrow (bool IncludePhaseOneUnwind=false)constLLVM_READONLY
 Return true if this instruction may throw an exception.
 
bool isFenceLike ()const
 Return true if this instruction behaves like a memory fence: it can load or store to memory location without being given a memory location.
 
bool mayHaveSideEffects ()constLLVM_READONLY
 Return true if the instruction may have side effects.
 
bool isSafeToRemove ()constLLVM_READONLY
 Return true if the instruction can be removed if the result is unused.
 
bool willReturn ()constLLVM_READONLY
 Return true if the instruction will return (unwinding is considered as a form of returning control flow here).
 
bool isEHPad ()const
 Return true if the instruction is a variety of EH-block.
 
bool isLifetimeStartOrEnd ()constLLVM_READONLY
 Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker.
 
bool isLaunderOrStripInvariantGroup ()constLLVM_READONLY
 Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group.
 
bool isDebugOrPseudoInst ()constLLVM_READONLY
 Return true if the instruction is aDbgInfoIntrinsic orPseudoProbeInst.
 
constInstructiongetNextNonDebugInstruction (bool SkipPseudoOp=false)const
 Return a pointer to the next non-debug instruction in the same basic block as 'this', or nullptr if no such instruction exists.
 
InstructiongetNextNonDebugInstruction (bool SkipPseudoOp=false)
 
constInstructiongetPrevNonDebugInstruction (bool SkipPseudoOp=false)const
 Return a pointer to the previous non-debug instruction in the same basic block as 'this', or nullptr if no such instruction exists.
 
InstructiongetPrevNonDebugInstruction (bool SkipPseudoOp=false)
 
Instructionclone ()const
 Create a copy of 'this' instruction that is identical in all ways except the following:
 
bool isIdenticalTo (constInstruction *I)constLLVM_READONLY
 Return true if the specified instruction is exactly identical to the current one.
 
bool isIdenticalToWhenDefined (constInstruction *I,bool IntersectAttrs=false)constLLVM_READONLY
 This is like isIdenticalTo, except that it ignores the SubclassOptionalData flags, which may specify conditions under which the instruction's result is undefined.
 
bool isSameOperationAs (constInstruction *I,unsigned flags=0)constLLVM_READONLY
 This function determines if the specified instruction executes the same operation as the current one.
 
bool hasSameSpecialState (constInstruction *I2,bool IgnoreAlignment=false,bool IntersectAttrs=false)constLLVM_READONLY
 This function determines if the speficied instruction has the same "special" characteristics as the current one.
 
bool isUsedOutsideOfBlock (constBasicBlock *BB)constLLVM_READONLY
 Return true if there are any uses of this instruction in blocks other than the specified block.
 
unsigned getNumSuccessors ()constLLVM_READONLY
 Return the number of successors that this instruction has.
 
BasicBlockgetSuccessor (unsignedIdx)constLLVM_READONLY
 Return the specified successor. This instruction must be a terminator.
 
void setSuccessor (unsignedIdx,BasicBlock *BB)
 Update the specified successor to point at the provided block.
 
void replaceSuccessorWith (BasicBlock *OldBB,BasicBlock *NewBB)
 Replace specified successor OldBB to point at the provided block.
 
void dropUnknownNonDebugMetadata (ArrayRef<unsigned > KnownIDs={})
 Drop all unknown metadata except for debug locations.
 
- Public Member Functions inherited fromllvm::User
 User (constUser &)=delete
 
void operator delete (void *Usr)
 Free memory allocated forUser andUse objects.
 
void operator delete (void *Usr,HungOffOperandsAllocMarker)
 Placement delete - required by std, called if the ctor throws.
 
void operator delete (void *Usr,IntrusiveOperandsAllocMarker)
 Placement delete - required by std, called if the ctor throws.
 
void operator delete (void *Usr,IntrusiveOperandsAndDescriptorAllocMarker)
 Placement delete - required by std, called if the ctor throws.
 
constUsegetOperandList ()const
 
UsegetOperandList ()
 
ValuegetOperand (unsigned i)const
 
void setOperand (unsigned i,Value *Val)
 
constUsegetOperandUse (unsigned i)const
 
UsegetOperandUse (unsigned i)
 
unsigned getNumOperands ()const
 
ArrayRef<constuint8_tgetDescriptor ()const
 Returns the descriptor co-allocated with thisUser instance.
 
MutableArrayRef<uint8_tgetDescriptor ()
 Returns the descriptor co-allocated with thisUser instance.
 
void setNumHungOffUseOperands (unsigned NumOps)
 Subclasses with hung off uses need to manage the operand count themselves.
 
bool isDroppable ()const
 A droppable user is a user for which uses can be dropped without affecting correctness and should be dropped rather than preventing a transformation from happening.
 
op_iterator op_begin ()
 
const_op_iterator op_begin ()const
 
op_iterator op_end ()
 
const_op_iterator op_end ()const
 
op_range operands ()
 
const_op_range operands ()const
 
value_op_iterator value_op_begin ()
 
value_op_iterator value_op_end ()
 
iterator_range<value_op_iteratoroperand_values ()
 
const_value_op_iterator value_op_begin ()const
 
const_value_op_iterator value_op_end ()const
 
iterator_range<const_value_op_iteratoroperand_values ()const
 
void dropAllReferences ()
 Drop all references to operands.
 
bool replaceUsesOfWith (Value *From,Value *To)
 Replace uses of oneValue with another.
 
- Public Member Functions inherited fromllvm::Value
 Value (constValue &)=delete
 
Valueoperator= (constValue &)=delete
 
void deleteValue ()
 Delete a pointer to a genericValue.
 
void dump ()const
 Support for debugging, callable in GDB: V->dump()
 
TypegetType ()const
 All values are typed, get the type of this value.
 
LLVMContextgetContext ()const
 All values hold a context through their type.
 
bool hasName ()const
 
ValueNamegetValueName ()const
 
void setValueName (ValueName *VN)
 
StringRef getName ()const
 Return a constant reference to the value's name.
 
void setName (constTwine &Name)
 Change the name of the value.
 
void takeName (Value *V)
 Transfer the name from V to this value.
 
std::string getNameOrAsOperand ()const
 
void replaceAllUsesWith (Value *V)
 Change all uses of this to point to a newValue.
 
void replaceNonMetadataUsesWith (Value *V)
 Change non-metadata uses of this to point to a newValue.
 
void replaceUsesWithIf (Value *New,llvm::function_ref<bool(Use &U)> ShouldReplace)
 Go through the uses list for this definition and make each use point to "V" if the callback ShouldReplace returns true for the givenUse.
 
void replaceUsesOutsideBlock (Value *V,BasicBlock *BB)
 replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V" instead of "this" when the use is outside the block.
 
void assertModuleIsMaterializedImpl ()const
 
void assertModuleIsMaterialized ()const
 
bool use_empty ()const
 
bool materialized_use_empty ()const
 
use_iterator materialized_use_begin ()
 
const_use_iterator materialized_use_begin ()const
 
use_iterator use_begin ()
 
const_use_iterator use_begin ()const
 
use_iterator use_end ()
 
const_use_iterator use_end ()const
 
iterator_range<use_iteratormaterialized_uses ()
 
iterator_range<const_use_iteratormaterialized_uses ()const
 
iterator_range<use_iteratoruses ()
 
iterator_range<const_use_iteratoruses ()const
 
bool user_empty ()const
 
user_iterator materialized_user_begin ()
 
const_user_iterator materialized_user_begin ()const
 
user_iterator user_begin ()
 
const_user_iterator user_begin ()const
 
user_iterator user_end ()
 
const_user_iterator user_end ()const
 
Useruser_back ()
 
constUseruser_back ()const
 
iterator_range<user_iteratormaterialized_users ()
 
iterator_range<const_user_iteratormaterialized_users ()const
 
iterator_range<user_iteratorusers ()
 
iterator_range<const_user_iteratorusers ()const
 
bool hasOneUse ()const
 Return true if there is exactly one use of this value.
 
bool hasNUses (unsignedN)const
 Return true if thisValue has exactly N uses.
 
bool hasNUsesOrMore (unsignedN)const
 Return true if this value has N uses or more.
 
bool hasOneUser ()const
 Return true if there is exactly one user of this value.
 
UsegetSingleUndroppableUse ()
 Return true if there is exactly one use of this value that cannot be dropped.
 
constUsegetSingleUndroppableUse ()const
 
UsergetUniqueUndroppableUser ()
 Return true if there is exactly one unique user of this value that cannot be dropped (that user can have multiple uses of this value).
 
constUsergetUniqueUndroppableUser ()const
 
bool hasNUndroppableUses (unsignedN)const
 Return true if there this value.
 
bool hasNUndroppableUsesOrMore (unsignedN)const
 Return true if this value has N uses or more.
 
void dropDroppableUses (llvm::function_ref<bool(constUse *)> ShouldDrop=[](constUse *) { returntrue;})
 Remove every uses that can safely be removed.
 
void dropDroppableUsesIn (User &Usr)
 Remove every use of this value inUser that can safely be removed.
 
bool isUsedInBasicBlock (constBasicBlock *BB)const
 Check if this value is used in the specified basic block.
 
unsigned getNumUses ()const
 This method computes the number of uses of thisValue.
 
void addUse (Use &U)
 This method should only be used by theUse class.
 
unsigned getValueID ()const
 Return an ID for the concrete type of this object.
 
unsigned getRawSubclassOptionalData ()const
 Return the raw optional flags value contained in this value.
 
void clearSubclassOptionalData ()
 Clear the optional flags contained in this value.
 
bool hasSameSubclassOptionalData (constValue *V)const
 Check the optional flags for equality.
 
bool hasValueHandle ()const
 Return true if there is a value handle associated with this value.
 
bool isUsedByMetadata ()const
 Return true if there is metadata referencing this value.
 
bool isSwiftError ()const
 Return true if this value is a swifterror value.
 
constValuestripPointerCasts ()const
 Strip off pointer casts, all-zero GEPs and address space casts.
 
ValuestripPointerCasts ()
 
constValuestripPointerCastsAndAliases ()const
 Strip off pointer casts, all-zero GEPs, address space casts, and aliases.
 
ValuestripPointerCastsAndAliases ()
 
constValuestripPointerCastsSameRepresentation ()const
 Strip off pointer casts, all-zero GEPs and address space casts but ensures the representation of the result stays the same.
 
ValuestripPointerCastsSameRepresentation ()
 
constValuestripPointerCastsForAliasAnalysis ()const
 Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info.
 
ValuestripPointerCastsForAliasAnalysis ()
 
constValuestripInBoundsConstantOffsets ()const
 Strip off pointer casts and all-constant inbounds GEPs.
 
ValuestripInBoundsConstantOffsets ()
 
constValuestripAndAccumulateConstantOffsets (constDataLayout &DL,APInt &Offset,bool AllowNonInbounds,bool AllowInvariantGroup=false,function_ref<bool(Value &Value,APInt &Offset)> ExternalAnalysis=nullptr)const
 Accumulate the constant offset this value has compared to a base pointer.
 
ValuestripAndAccumulateConstantOffsets (constDataLayout &DL,APInt &Offset,bool AllowNonInbounds,bool AllowInvariantGroup=false,function_ref<bool(Value &Value,APInt &Offset)> ExternalAnalysis=nullptr)
 
constValuestripAndAccumulateInBoundsConstantOffsets (constDataLayout &DL,APInt &Offset)const
 This is a wrapper around stripAndAccumulateConstantOffsets with the in-bounds requirement set to false.
 
ValuestripAndAccumulateInBoundsConstantOffsets (constDataLayout &DL,APInt &Offset)
 
constValuestripInBoundsOffsets (function_ref< void(constValue *)> Func=[](constValue *) {})const
 Strip off pointer casts and inbounds GEPs.
 
ValuestripInBoundsOffsets (function_ref< void(constValue *)> Func=[](constValue *) {})
 
std::optional< int64_t > getPointerOffsetFrom (constValue *Other,constDataLayout &DL)const
 If this ptr is provably equal toOther plus a constant offset, return that offset in bytes.
 
bool canBeFreed ()const
 Return true if the memory object referred to by V can by freed in the scope for which the SSA value defining the allocation is statically defined.
 
uint64_t getPointerDereferenceableBytes (constDataLayout &DL,bool &CanBeNull,bool &CanBeFreed)const
 Returns the number of bytes known to be dereferenceable for the pointer value.
 
Align getPointerAlignment (constDataLayout &DL)const
 Returns an alignment of the pointer value.
 
constValueDoPHITranslation (constBasicBlock *CurBB,constBasicBlock *PredBB)const
 Translate PHI node to its predecessor from the given basic block.
 
ValueDoPHITranslation (constBasicBlock *CurBB,constBasicBlock *PredBB)
 
void mutateType (Type *Ty)
 Mutate the type of thisValue to be of the specified type.
 
template<class Compare >
void sortUseList (Compare Cmp)
 Sort the use-list.
 
void reverseUseList ()
 Reverse the use-list.
 
void print (raw_ostream &O,bool IsForDebug=false)const
 Implement operator<< onValue.
 
void print (raw_ostream &O,ModuleSlotTracker &MST,bool IsForDebug=false)const
 
void printAsOperand (raw_ostream &O,bool PrintType=true,constModule *M=nullptr)const
 Print the name of thisValue out to the specifiedraw_ostream.
 
void printAsOperand (raw_ostream &O,bool PrintType,ModuleSlotTracker &MST)const
 
- Public Member Functions inherited fromllvm::ilist_node_with_parent< Instruction, BasicBlock, ilist_iterator_bits< true >, ilist_parent< BasicBlock > >
InstructiongetPrevNode ()
 
constInstructiongetPrevNode ()const
 Get the previous node, ornullptr for the list head.
 
InstructiongetNextNode ()
 Get the next node, ornullptr for the list tail.
 
constInstructiongetNextNode ()const
 Get the next node, ornullptr for the list tail.
 
- Public Member Functions inherited fromllvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
self_iterator getIterator ()
 
const_self_iterator getIterator ()const
 
reverse_self_iterator getReverseIterator ()
 
const_reverse_self_iterator getReverseIterator ()const
 
bool isSentinel ()const
 Check whether this is the sentinel node.
 
- Public Member Functions inherited fromllvm::ilist_detail::node_parent_access< NodeTy, ParentTy >
const ParentTy * getParent ()const
 
ParentTy * getParent ()
 
void setParent (ParentTy *Parent)
 

Static Public Member Functions

staticconstchargetOpcodeName (unsigned Opcode)
 
staticbool isTerminator (unsigned Opcode)
 
staticbool isUnaryOp (unsigned Opcode)
 
staticbool isBinaryOp (unsigned Opcode)
 
staticbool isIntDivRem (unsigned Opcode)
 
staticbool isFPDivRem (unsigned Opcode)
 
staticbool isShift (unsigned Opcode)
 Determine if the Opcode is one of the shift instructions.
 
staticbool isBitwiseLogicOp (unsigned Opcode)
 Determine if the Opcode is and/or/xor.
 
staticbool isCast (unsigned Opcode)
 Determine if the Opcode is one of theCastInst instructions.
 
staticbool isFuncletPad (unsigned Opcode)
 Determine if the Opcode is one of theFuncletPadInst instructions.
 
staticbool isSpecialTerminator (unsigned Opcode)
 Returns true if the Opcode is a "special" terminator that does more than branch to a successor (e.g.
 
staticbool isAssociative (unsigned Opcode)
 
staticbool isCommutative (unsigned Opcode)
 
staticbool isIdempotent (unsigned Opcode)
 
staticbool isNilpotent (unsigned Opcode)
 
staticbool classof (constValue *V)
 Methods for support type inquiry through isa, cast, and dyn_cast:
 
- Static Public Member Functions inherited fromllvm::User
staticbool classof (constValue *V)
 
- Static Public Member Functions inherited fromllvm::Value
static void dropDroppableUse (Use &U)
 Remove the droppable useU.
 

Public Attributes

DbgMarkerDebugMarker = nullptr
 Optional marker recording the position for debugging information that takes effect immediately before this instruction.
 

Protected Types

using OpaqueField =Bitfield::Element<uint16_t, 0, 15 >
 
template<unsigned Offset>
using AlignmentBitfieldElementT = typenameBitfield::Element<unsigned,Offset, 6,Value::MaxAlignmentExponent >
 
template<unsigned Offset>
using BoolBitfieldElementT = typenameBitfield::Element<bool,Offset, 1 >
 
template<unsigned Offset>
using AtomicOrderingBitfieldElementT = typenameBitfield::Element<AtomicOrdering,Offset, 3,AtomicOrdering::LAST >
 
- Protected Types inherited fromllvm::Value
enum  : unsigned {NumUserOperandsBits = 27 }
 The number of operands in the subclass.More...
 
- Protected Types inherited fromllvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
using self_iterator = typenameilist_select_iterator_type< OptionsT::has_iterator_bits,ilist_detail::compute_node_options<T, Options... >::type, false, false >::type
 
using const_self_iterator = typenameilist_select_iterator_type< OptionsT::has_iterator_bits,ilist_detail::compute_node_options<T, Options... >::type, false,true >::type
 
using reverse_self_iterator = typenameilist_select_iterator_type< OptionsT::has_iterator_bits,ilist_detail::compute_node_options<T, Options... >::type,true, false >::type
 
using const_reverse_self_iterator = typenameilist_select_iterator_type< OptionsT::has_iterator_bits,ilist_detail::compute_node_options<T, Options... >::type,true,true >::type
 

Protected Member Functions

 ~Instruction ()
 
template<typename BitfieldElement >
BitfieldElement::Type getSubclassData ()const
 
template<typename BitfieldElement >
void setSubclassData (typename BitfieldElement::TypeValue)
 
 Instruction (Type *Ty,unsigned iType,AllocInfoAllocInfo,InsertPosition InsertBefore=nullptr)
 
- Protected Member Functions inherited fromllvm::User
void * operator new (size_tSize)=delete
 
void * operator new (size_tSize,HungOffOperandsAllocMarker)
 Allocate aUser with an operand pointer co-allocated.
 
void * operator new (size_tSize,IntrusiveOperandsAllocMarker allocTrait)
 Allocate aUser with the operands co-allocated.
 
void * operator new (size_tSize,IntrusiveOperandsAndDescriptorAllocMarker allocTrait)
 Allocate aUser with the operands co-allocated.
 
 User (Type *ty,unsigned vty,AllocInfoAllocInfo)
 
void allocHungoffUses (unsignedN,bool IsPhi=false)
 Allocate the array of Uses, followed by a pointer (with bottom bit set) to theUser.
 
void growHungoffUses (unsignedN,bool IsPhi=false)
 Grow the number of hung off uses.
 
 ~User ()=default
 
template<int Idx>
UseOp ()
 
template<int Idx>
constUseOp ()const
 
- Protected Member Functions inherited fromllvm::Value
 Value (Type *Ty,unsigned scid)
 
 ~Value ()
 Value's destructor should be virtual by design, but that would require thatValue and all of its subclasses have a vtable that effectively duplicates the information in the value ID.
 
void getAllMetadata (SmallVectorImpl< std::pair<unsigned,MDNode * > > &MDs)const
 Appends all metadata attached to this value toMDs, sorting by KindID.
 
bool hasMetadata ()const
 Return true if this value has any metadata attached to it.
 
bool eraseMetadata (unsigned KindID)
 Erase all metadata attachments with the given kind.
 
void eraseMetadataIf (function_ref<bool(unsigned,MDNode *)> Pred)
 Erase all metadata attachments matching the given predicate.
 
void clearMetadata ()
 Erase all metadata attached to thisValue.
 
MDNodegetMetadataImpl (unsigned KindID)const
 Get metadata for the given kind, if any.
 
unsigned short getSubclassDataFromValue ()const
 
void setValueSubclassData (unsigned shortD)
 
MDNodegetMetadata (unsigned KindID)const
 Get the current metadata attachments for the given kind, if any.
 
MDNodegetMetadata (StringRef Kind)const
 
void getMetadata (unsigned KindID,SmallVectorImpl<MDNode * > &MDs)const
 Appends all attachments with the given ID toMDs in insertion order.
 
void getMetadata (StringRef Kind,SmallVectorImpl<MDNode * > &MDs)const
 
bool hasMetadata (unsigned KindID)const
 Return true if this value has the given type of metadata attached.
 
bool hasMetadata (StringRef Kind)const
 
void setMetadata (unsigned KindID,MDNode *Node)
 Set a particular kind of metadata attachment.
 
void setMetadata (StringRef Kind,MDNode *Node)
 
void addMetadata (unsigned KindID,MDNode &MD)
 Add a metadata attachment.
 
void addMetadata (StringRef Kind,MDNode &MD)
 
- Protected Member Functions inherited fromllvm::ilist_node_with_parent< Instruction, BasicBlock, ilist_iterator_bits< true >, ilist_parent< BasicBlock > >
 ilist_node_with_parent ()=default
 
- Protected Member Functions inherited fromllvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
 ilist_node_impl ()=default
 

Friends

class SymbolTableListTraits< Instruction, ilist_iterator_bits< true >, ilist_parent< BasicBlock > >
 
class BasicBlock
 Various leaf nodes.
 

Additional Inherited Members

- Static Public Attributes inherited fromllvm::Value
static constexprunsigned MaxAlignmentExponent = 32
 The maximum alignment for instructions.
 
static constexpruint64_t MaximumAlignment = 1ULL <<MaxAlignmentExponent
 
- Static Protected Member Functions inherited fromllvm::User
template<int Idx, typename U >
staticUseOpFrom (const U *that)
 
- Protected Attributes inherited fromllvm::Value
unsignedchar SubclassOptionalData: 7
 Hold subclass data that can be dropped.
 
unsigned NumUserOperands:NumUserOperandsBits
 
unsigned IsUsedByMD: 1
 
unsigned HasName: 1
 
unsigned HasMetadata: 1
 
unsigned HasHungOffUses: 1
 
unsigned HasDescriptor: 1
 

Detailed Description

Definition at line65 of fileInstruction.h.

Member Typedef Documentation

◆ AlignmentBitfieldElementT

template<unsigned Offset>
usingllvm::Instruction::AlignmentBitfieldElementT = typenameBitfield::Element<unsigned,Offset, 6,Value::MaxAlignmentExponent>
protected

Definition at line143 of fileInstruction.h.

◆ AtomicOrderingBitfieldElementT

template<unsigned Offset>
usingllvm::Instruction::AtomicOrderingBitfieldElementT = typenameBitfield::Element<AtomicOrdering,Offset, 3,AtomicOrdering::LAST>
protected

Definition at line151 of fileInstruction.h.

◆ BoolBitfieldElementT

template<unsigned Offset>
usingllvm::Instruction::BoolBitfieldElementT = typenameBitfield::Element<bool,Offset, 1>
protected

Definition at line148 of fileInstruction.h.

◆ InstListType

usingllvm::Instruction::InstListType =SymbolTableList<Instruction,ilist_iterator_bits<true>,ilist_parent<BasicBlock> >

Definition at line70 of fileInstruction.h.

◆ OpaqueField

usingllvm::Instruction::OpaqueField =Bitfield::Element<uint16_t, 0, 15>
protected

Definition at line135 of fileInstruction.h.

Member Enumeration Documentation

◆ BinaryOps

enumllvm::Instruction::BinaryOps

Definition at line1008 of fileInstruction.h.

◆ CastOps

enumllvm::Instruction::CastOps

Definition at line1022 of fileInstruction.h.

◆ FuncletPadOps

enumllvm::Instruction::FuncletPadOps

Definition at line1029 of fileInstruction.h.

◆ MemoryOps

enumllvm::Instruction::MemoryOps

Definition at line1015 of fileInstruction.h.

◆ OperationEquivalenceFlags

enumllvm::Instruction::OperationEquivalenceFlags

When checking for operation equivalence (using isSameOperationAs) it is sometimes useful to ignore certain attributes.

Enumerator
CompareIgnoringAlignment 

Check for equivalence ignoring load/store alignment.

CompareUsingScalarTypes 

Check for equivalence treating a type and a vector of that type as equivalent.

CompareUsingIntersectedAttrs 

Check for equivalence with intersected callbase attrs.

Definition at line935 of fileInstruction.h.

◆ OtherOps

enumllvm::Instruction::OtherOps

Definition at line1036 of fileInstruction.h.

◆ TermOps

enumllvm::Instruction::TermOps

Definition at line994 of fileInstruction.h.

◆ UnaryOps

enumllvm::Instruction::UnaryOps

Definition at line1001 of fileInstruction.h.

Constructor & Destructor Documentation

◆ ~Instruction()

Instruction::~Instruction()
protected

Definition at line48 of fileInstruction.cpp.

◆ Instruction()[1/2]

llvm::Instruction::Instruction(constInstruction)
delete

◆ Instruction()[2/2]

Instruction::Instruction(TypeTy,
unsigned iType,
AllocInfo AllocInfo,
InsertPosition InsertBefore =nullptr 
)
protected

Definition at line37 of fileInstruction.cpp.

Member Function Documentation

◆ addAnnotationMetadata()[1/2]

void Instruction::addAnnotationMetadata(SmallVector<StringRefAnnotations)

Adds an !annotation metadata node with an array ofAnnotations as a tuple to this instruction.

If this instruction already has !annotation metadata, append the tuple to the existing node.

Definition at line1702 of fileMetadata.cpp.

Referencesllvm::any_of(),llvm::MDBuilder::createString(),llvm::MDTuple::get(),llvm::Value::getContext(),getMetadata(),N,llvm::SmallVectorTemplateBase< T, bool >::push_back(), andsetMetadata().

◆ addAnnotationMetadata()[2/2]

void Instruction::addAnnotationMetadata(StringRef Annotation)

Adds an !annotation metadata node withAnnotation to this instruction.

If this instruction already has !annotation metadata, appendAnnotation to the existing node.

Definition at line1732 of fileMetadata.cpp.

Referencesllvm::MDBuilder::createString(),llvm::MDTuple::get(),llvm::Value::getContext(),getMetadata(),N,Name,llvm::SmallVectorTemplateBase< T, bool >::push_back(), andsetMetadata().

◆ adoptDbgRecords()

void Instruction::adoptDbgRecords(BasicBlockBB,
InstListType::iterator It,
bool InsertAtHead 
)

Transfer any DbgRecords on the positionIt onto this instruction, by simply adopting the sequence of DbgRecords (which is efficient) if possible, by merging two sequences otherwise.

Definition at line282 of fileInstruction.cpp.

◆ andIRFlags()

void Instruction::andIRFlags(constValueV)

Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction.

Definition at line704 of fileInstruction.cpp.

Referenced byllvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(),llvm::InstCombinerImpl::foldSelectOpOp(),foldShuffleOfUnaryOps(),NegateValue(), andsinkLastInstruction().

◆ applyMergedLocation()

void Instruction::applyMergedLocation(DILocationLocA,
DILocationLocB 
)

Merge 2 debug locations and apply it to theInstruction.

If the instruction is a CallIns, we need to traverse the inline chain to find the common scope. This is not efficient for N-way merging as each time you merge 2 iterations, you need to rebuild the hashmap to find the common scope. However, we still choose this API because: 1) Simplicity: it takes 2 locations instead of a list of locations. 2) In worst case, it increases the complexity from O(N*I) to O(2*N*I), where N is # of Instructions to merge, and I is the maximum level of inline stack. So it is still linear. 3) Merging of call instructions should be extremely rare in real applications, thus the N-way merging should be in code path. TheDebugLoc attached to this instruction will be overwritten by the mergedDebugLoc.

Definition at line949 of fileDebugInfo.cpp.

Referencesllvm::DILocation::getMergedLocation(), andsetDebugLoc().

Referenced byllvm::InstCombinerImpl::PHIArgMergedDebugLoc(),sinkLastInstruction(), andupdateForIncomingValueLocation().

◆ classof()

staticbool llvm::Instruction::classof(constValueV)
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition at line987 of fileInstruction.h.

◆ clone()

Instruction * Instruction::clone() const

Create a copy of 'this' instruction that is identical in all ways except the following:

  • The instruction has no parent
  • The instruction has no name

Definition at line1364 of fileInstruction.cpp.

Referenced bybuildPartialInvariantUnswitchConditionalBranch(),cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(),convertFSqrtDivIntoFMul(),llvm::ehAwareSplitEdge(),llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(),expandToSwitch(),findOrCreatePHIInBlock(),llvm::FoldReturnIntoUncondBranch(),mergeCompatibleInvokesImpl(),replaceGEPIdxWithZero(),SinkCast(),SplitLandingPadPredecessorsImpl(),unswitchNontrivialInvariants(),unswitchTrivialBranch(), andversionCallSiteWithCond().

◆ cloneDebugInfoFrom()

iterator_range<DbgRecord::self_iterator > Instruction::cloneDebugInfoFrom(constInstructionFrom,
std::optional<simple_ilist<DbgRecord >::iterator > FromHere =std::nullopt,
bool InsertAtHead =false 
)

Clone any debug-info attached toFrom onto this instruction.

Used to copy debugging information from one block to another, when copying entire blocks.

See also
DebugProgramInstruction.h , because the ordering of DbgRecords is still important, fine grain control of whichinstructions are moved and where they go is necessary.From The instruction toclone debug-info from.from_here Optional iterator to limit DbgRecords cloned to be a range from from_here to end().InsertAtHead Whether the cloned DbgRecords should be placedat the end or the beginning of existing DbgRecords attached to this.
Returns
A range over the newly cloned DbgRecords.

Definition at line249 of fileInstruction.cpp.

ReferencesB,llvm::sandboxir::Value::Ctx,llvm::sandboxir::Tracker::emplaceIfTracking(),llvm::sandboxir::Context::getTracker(),llvm::sandboxir::Instruction::hasAllowContract(),llvm::sandboxir::Instruction::setHasAllowContract(), andllvm::sandboxir::Value::Val.

Referenced byllvm::CloneBasicBlock(),llvm::JumpThreadingPass::cloneInstructions(),cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(),llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), andperformBranchToCommonDestFolding().

◆ comesBefore()

bool Instruction::comesBefore(constInstructionOther) const

Given an instruction Other in the same basic block as this instruction, return true if this instruction comes before Other.

In this worst case, this takes linear time in the number of instructions in the block. The results are cached, so in common cases when the block remains unmodified, it takes constant time.

Definition at line334 of fileInstruction.cpp.

Referenced bydomTreeLevelBefore(),llvm::slpvectorizer::BoUpSLP::getReorderingData(),llvm::InstructionPrecedenceTracking::isPreceededBySpecialInstruction(), andllvm::isValidAssumeForContext().

◆ copyFastMathFlags()[1/2]

void Instruction::copyFastMathFlags(constInstructionI)

Copy I's fast-math flags.

Definition at line656 of fileInstruction.cpp.

◆ copyFastMathFlags()[2/2]

void Instruction::copyFastMathFlags(FastMathFlags FMF)

Convenience function for transferring all fast-math flag values to this instruction, which must be an operator which supports these flags.

See LangRef.html for the meaning of these flags.

Definition at line606 of fileInstruction.cpp.

Referenced bymodifyIntrinsicCall(),llvm::InstCombinerImpl::visitFNeg(), andllvm::InstCombinerImpl::visitFPTrunc().

◆ copyIRFlags()

void Instruction::copyIRFlags(constValueV,
bool IncludeWrapFlags =true 
)

Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this instruction.

Definition at line660 of fileInstruction.cpp.

Referenced byllvm::CmpInst::CmpInst(),llvm::BinaryOperator::CreateWithCopiedFlags(),llvm::CmpInst::CreateWithCopiedFlags(),llvm::UnaryOperator::CreateWithCopiedFlags(),llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(),llvm::InstCombinerImpl::foldSelectIntoOp(),llvm::InstCombinerImpl::foldSelectOpOp(),foldSelectShuffleWith1Binop(),foldShuffleOfUnaryOps(),llvm::InstCombinerImpl::foldVariableSignZeroExtensionOfVariableHighBitExtract(),llvm::InstCombinerImpl::foldVectorBinop(), andllvm::InstCombinerImpl::visitCallInst().

◆ copyMetadata()

void Instruction::copyMetadata(constInstructionSrcInst,
ArrayRef<unsignedWL =ArrayRef<unsigned>() 
)

Copy metadata fromSrcInst to this instruction.

WL, if not empty, specifies the list of meta data that needs to be copied. IfWL is empty, all meta data will be copied.

Definition at line1345 of fileInstruction.cpp.

Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Tracker::emplaceIfTracking(),llvm::sandboxir::Context::getTracker(),llvm::sandboxir::AtomicCmpXchgInst::isVolatile(),llvm::sandboxir::AtomicCmpXchgInst::setVolatile(), andllvm::sandboxir::Value::Val.

Referenced byllvm::breakLoopBackedge(),llvm::ConstantFoldTerminator(),llvm::SelectInst::Create(),llvm::createCallMatchingInvoke(),llvm::IRBuilderBase::CreateCondBr(),doPromotion(),llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(),hoistConditionalLoadsStores(),instCombineSVELD1(),instCombineSVEST1(),llvm::SITargetLowering::lowerIdempotentRMWIntoFencedLoad(),modifyIntrinsicCall(),scalarizeMaskedLoad(),simplifyAMDGCNMemoryIntrinsicDemanded(),llvm::InstCombinerImpl::SimplifyAnyMemSet(),llvm::InstCombinerImpl::SimplifyAnyMemTransfer(),llvm::InstCombinerImpl::visitLoadInst(), andllvm::InstCombinerImpl::visitSub().

◆ dropDbgRecords()

void Instruction::dropDbgRecords()

Erase any DbgRecords attached to this instruction.

Definition at line325 of fileInstruction.cpp.

Referenced byllvm::removeAllNonTerminatorAndEHPadInstructions(), andsplitCallSite().

◆ dropLocation()

void Instruction::dropLocation()

Drop the instruction's debug location.

This does not guarantee removal of the !dbg source location attachment, as it must set a line 0 location with scope information attached on call instructions. To guarantee removal of the !dbg attachment, use thesetDebugLoc() API. Note: it is undefined behavior to call this on an instruction not currently inserted into a function.

Definition at line984 of fileDebugInfo.cpp.

ReferencesDL,llvm::MDNode::get(),llvm::Value::getContext(),getDebugLoc(),getFunction(),llvm::Function::getSubprogram(),II,llvm::IntrinsicInst::mayLowerToFunctionCall(), andsetDebugLoc().

Referenced byNegateValue(),unswitchNontrivialInvariants(), andupdateLocationAfterHoist().

◆ dropOneDbgRecord()

void Instruction::dropOneDbgRecord(DbgRecordI)

Erase a singleDbgRecordI that is attached to this instruction.

Definition at line330 of fileInstruction.cpp.

ReferencesCond,Name,llvm::sandboxir::Instruction::setInsertPos(), andllvm::sandboxir::Value::Val.

◆ dropPoisonGeneratingAnnotations()

void llvm::Instruction::dropPoisonGeneratingAnnotations()
inline

Drops flags, return attributes and metadata that may generate poison.

Definition at line571 of fileInstruction.h.

Referenced byclearAssumptionsOfUsers().

◆ dropPoisonGeneratingFlags()

void Instruction::dropPoisonGeneratingFlags()

Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs.

Definition at line426 of fileInstruction.cpp.

Referenced byfoldSelectShuffleWith1Binop(),optimizeBranch(),llvm::patchReplacementInstruction(), andsimplifyAssocCastAssoc().

◆ dropPoisonGeneratingMetadata()

void Instruction::dropPoisonGeneratingMetadata()

Drops metadata that may generate poison.

Definition at line502 of fileInstruction.cpp.

◆ dropPoisonGeneratingReturnAttributes()

void Instruction::dropPoisonGeneratingReturnAttributes()

Drops return attributes that may generate poison.

Definition at line517 of fileInstruction.cpp.

Referencesllvm::IRBuilderBase::CreateCall(),llvm::sandboxir::Context::createCallInst(),llvm::sandboxir::Value::Ctx,llvm::sandboxir::Type::LLVMTy,llvm::SmallVectorTemplateBase< T, bool >::push_back(),llvm::SmallVectorImpl< T >::reserve(), andllvm::sandboxir::Instruction::setInsertPos().

◆ dropUBImplyingAttrsAndMetadata()

void Instruction::dropUBImplyingAttrsAndMetadata()

Drop any attributes or metadata that can cause immediate undefined behavior.

Retain other attributes/metadata on a best-effort basis. This should be used when speculating instructions.

Definition at line547 of fileInstruction.cpp.

Referenced bycloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), andfoldOperationIntoSelectOperand().

◆ dropUBImplyingAttrsAndUnknownMetadata()

void Instruction::dropUBImplyingAttrsAndUnknownMetadata(ArrayRef<unsignedKnownIDs ={})

This function drops non-debug unknown metadata (through dropUnknownNonDebugMetadata).

For calls, it also drops parameter and return attributes that can cause undefined behaviour. Both of these should be done by passes which move instructions in IR.

Definition at line528 of fileInstruction.cpp.

◆ dropUnknownNonDebugMetadata()

void Instruction::dropUnknownNonDebugMetadata(ArrayRef<unsignedKnownIDs ={})

Drop all unknown metadata except for debug locations.

Passes are required to drop metadata they don't understand. This is a convenience method for passes to do so. dropUBImplyingAttrsAndUnknownMetadata should be used instead of this API if theInstruction being modified is a call.

Definition at line1633 of fileMetadata.cpp.

Referencesllvm::ArrayRef< T >::begin(),llvm::SmallSet< T, N, C >::count(),llvm::ArrayRef< T >::end(),llvm::Value::eraseMetadataIf(),llvm::Value::hasMetadata(), andllvm::SmallSet< T, N, C >::insert().

Referenced bygenerateReproducer(), andllvm::gvn::AvailableValue::MaterializeAdjustedValue().

◆ eraseFromParent()

BasicBlock::iterator Instruction::eraseFromParent()

This method unlinks 'this' from the containing basic block and deletes it.

Returns
an iterator pointing to the element after the erased one

Definition at line94 of fileInstruction.cpp.

Referenced byllvm::LanaiInstrInfo::analyzeBranch(),buildClonedLoopBlocks(),BuildSubAggregate(),llvm::changeToInvokeAndSplitBasicBlock(),llvm::CloneAndPruneIntoFromInst(),cloneLoopBlocks(),CloneLoopBlocks(),ConnectEpilog(),ConnectProlog(),llvm::ConstantFoldTerminator(),llvm::coro::BaseCloner::create(),llvm::OpenMPIRBuilder::createAtomicCompare(),llvm::OpenMPIRBuilder::createAtomicRead(),llvm::OpenMPIRBuilder::createCopyinClauseBlocks(),createMemMoveLoopKnownSize(),createMemMoveLoopUnknownSize(),createMemSetLoop(),llvm::OpenMPIRBuilder::createReductions(),llvm::OpenMPIRBuilder::createTargetInit(),llvm::OpenMPIRBuilder::createTask(),createTblForTrunc(),llvm::deleteDeadLoop(),despeculateCountZeros(),DoLowering(),doPromotion(),llvm::dropDebugUsers(),dropTypeTests(),llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(),llvm::OpenMPIRBuilder::emitCancelationCheckImpl(),llvm::LoongArchTargetLowering::emitExpandAtomicRMW(),llvm::OpenMPIRBuilder::emitTargetTask(),llvm::objcarc::BundledRetainClaimRVs::eraseInst(),llvm::objcarc::EraseInstruction(),eraseTerminatorAndDCECond(),llvm::VPlan::execute(),llvm::expandAtomicRMWToCmpXchg(),llvm::expandDivision(),llvm::expandDivisionUpTo32Bits(),llvm::expandDivisionUpTo64Bits(),expandFPToI(),expandIntrinsic(),expandIToFP(),llvm::expandRemainder(),llvm::expandRemainderUpTo32Bits(),llvm::expandRemainderUpTo64Bits(),expandToSwitch(),llvm::RandomIRBuilder::findOrCreateSource(),findPHIToPartitionLoops(),foldMemChr(),llvm::FoldReturnIntoUncondBranch(),foldTwoEntryPHINode(),foldURemOfLoopIncrement(),generateUnsignedDivisionCode(),getStrlenWithNull(),llvm::SSAUpdater::GetValueInMiddleOfBlock(),llvm::coro::BaseCloner::handleFinalSuspend(),hostParallelCallback(),injectPendingInvariantConditions(),llvm::InlineFunction(),insertBoundsCheck(),insertSpills(),insertUniqueBackedgeBlock(),llvm::lowerAtomicCmpXchgInst(),llvm::lowerAtomicRMWInst(),lowerAwaitSuspend(),lowerExpectIntrinsic(),LowerFenceInst(),llvm::SITargetLowering::lowerIdempotentRMWIntoFencedLoad(),llvm::IntrinsicLowering::LowerIntrinsicCall(),llvm::IntrinsicLowering::LowerToByteSwap(),llvm::lowerUnaryVectorIntrinsicAsLoop(),llvm::MergeBasicBlockIntoOnlyPred(),llvm::MergeBlockIntoPredecessor(),mergeCleanupPad(),mergeConditionalStoreToAddress(),llvm::InstDeleterIRStrategy::mutate(),optimizeDivRem(),OptimizeEmptyGlobalAtExitDtors(),OptimizeExtractBits(),OptimizeGlobalAddressOfAllocation(),processAnd(),processAShr(),llvm::JumpThreadingPass::processBlock(),llvm::JumpThreadingPass::processBranchOnXOR(),processCall(),processCmpIntrinsic(),processMinMaxIntrinsic(),processOverflowIntrinsic(),processSDiv(),processSelect(),processSExt(),processSIToFP(),processSRem(),promoteSingleBlockAlloca(),llvm::OutlinableRegion::reattachCandidate(),llvm::removeAllNonTerminatorAndEHPadInstructions(),llvm::LanaiInstrInfo::removeBranch(),llvm::PHINode::removeIncomingValue(),llvm::PHINode::removeIncomingValueIf(),removeIntrinsicUsers(),removeMarkerCall(),llvm::SCCPSolver::removeNonFeasibleEdges(),RemovePreallocated(),removeUndefIntroducingPredecessor(),llvm::removeUnwindEdge(),replaceCalledFunction(),replaceConditionalBranchesOnConstant(),replaceFrameSizeAndAlignment(),replaceOperation(),replacePrepare(),llvm::replaceSignedInst(),llvm::rewriteLoopExitValues(),rewritePHIs(),rewriteSingleStoreAlloca(),runImpl(),RunTermFold(),scalarize(),scalarizeMaskedCompressStore(),scalarizeMaskedExpandLoad(),scalarizeMaskedGather(),scalarizeMaskedLoad(),scalarizeMaskedScatter(),scalarizeMaskedStore(),scalarizeMaskedVectorHistogram(),simplifyOneLoop(),llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(),simplifySuspendPoint(),sinkAndCmp0Expression(),SinkCast(),speculatePHINodeLoads(),llvm::SplitBlockAndInsertSimpleForLoop(),splitCallSite(),llvm::SplitIndirectBrCriticalEdges(),SplitLandingPadPredecessorsImpl(),llvm::splitLoopBound(),stripDebugDeclareImpl(),targetParallelCallback(),tryToMergeLandingPad(),TryToShrinkGlobalToBoolean(),llvm::TryToSimplifyUncondBranchFromEmptyBlock(),turnToExplicitForm(),llvm::UnrollAndJamLoop(),llvm::UnrollLoop(),llvm::UnrollRuntimeLoopRemainder(),unswitchNontrivialInvariants(),unswitchTrivialBranch(),unswitchTrivialSwitch(),llvm::UpgradeARCRuntime(),llvm::UpgradeIntrinsicCall(),versionCallSiteWithCond(),llvm::LoopVersioning::versionLoop(),DataScalarizerVisitor::visitGetElementPtrInst(),DataScalarizerVisitor::visitLoadInst(),llvm::ObjectSizeOffsetEvaluator::visitPHINode(), andworkshareLoopTargetCallback().

◆ eraseMetadataIf()

void Instruction::eraseMetadataIf(function_ref<bool(unsigned,MDNode *)> Pred)

Erase all metadata that matches the predicate.

Definition at line1626 of fileMetadata.cpp.

Referencesllvm::Value::eraseMetadataIf(), andllvm::DebugLoc::getAsMDNode().

◆ extractProfTotalWeight()

bool Instruction::extractProfTotalWeight(uint64_tTotalVal) const

Retrieve total raw weight values of a branch.

Returns true on success with profile total weights filled in. Returns false if no metadata was found.

Definition at line1788 of fileMetadata.cpp.

Referencesassert(), andgetOpcode().

Referenced byllvm::createCallMatchingInvoke().

◆ getAAMetadata()

AAMDNodes Instruction::getAAMetadata() const

Returns theAA metadata for this instruction.

Definition at line1750 of fileMetadata.cpp.

Referencesllvm::Value::getContext(),llvm::Value::hasMetadata(),Info,llvm::LLVMContext::pImpl, andllvm::LLVMContextImpl::ValueMetadata.

Referenced byfoldLoadsRecursive(),llvm::MemoryLocation::get(),llvm::MemoryLocation::getForDest(),mergeConditionalStoreToAddress(),llvm::InstCombinerImpl::mergeStoreIntoSuccessor(),llvm::promoteLoopAccessesToScalars(),llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(),speculatePHINodeLoads(),speculateSelectInstLoads(), andunpackLoadToAggregate().

◆ getAccessType()

Type * Instruction::getAccessType() const

Return the type this instruction accesses in memory, if any.

Definition at line1100 of fileInstruction.cpp.

Referenced bygetAccessType().

◆ getAllMetadata()

void llvm::Instruction::getAllMetadata(SmallVectorImpl< std::pair<unsigned,MDNode * > > & MDs) const
inline

Get all metadata attached to thisInstruction.

The first element of each pair returned is the KindID, the second element is the metadata value. This list is returned sorted by the KindID.

Definition at line444 of fileInstruction.h.

◆ getAllMetadataOtherThanDebugLoc()

void llvm::Instruction::getAllMetadataOtherThanDebugLoc(SmallVectorImpl< std::pair<unsigned,MDNode * > > & MDs) const
inline

This does the same thing as getAllMetadata, except that it filters out the debug location.

Definition at line451 of fileInstruction.h.

Referenced byllvm::propagateMetadata().

◆ getDataLayout()

constDataLayout & Instruction::getDataLayout() const

Get the data layout of the module this instruction belongs to.

Requires the instruction to have a parent module.

Definition at line76 of fileInstruction.cpp.

Referenced byAddAlignmentAssumptions(),llvm::addDiffRuntimeChecks(),llvm::addRuntimeChecks(),llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(),llvm::VPlanTransforms::createInterleaveGroups(),llvm::LoongArchTargetLowering::emitExpandAtomicRMW(),llvm::LoongArchTargetLowering::emitMaskedAtomicRMWIntrinsic(),llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(),llvm::expandAtomicRMWToCmpXchg(),foldSelectICmpAnd(),llvm::MemoryLocation::get(),llvm::memtag::getAllocaSizeInBytes(),llvm::getAllocSize(),getAtomicOpSize(),llvm::DemandedBits::getDemandedBits(),getGEPInductionOperand(),llvm::isDereferenceableAndAlignedInLoop(),llvm::GCNTTIImpl::isInlineAsmSourceOfDivergence(),isLoadInvariantInLoop(),isSafePHIToSpeculate(),llvm::isSafeToSpeculativelyExecuteWithOpcode(),lookThroughCastConst(),llvm::RISCVTargetLowering::lowerDeinterleaveIntrinsicToLoad(),llvm::AArch64TargetLowering::lowerInterleavedLoad(),llvm::ARMTargetLowering::lowerInterleavedLoad(),llvm::RISCVTargetLowering::lowerInterleavedLoad(),NegateValue(),shortenAssignment(),llvm::SITargetLowering::shouldExpandAtomicCmpXchgInIR(),llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(),trackInlinedStores(),valueCoversEntireFragment(), andvisitIVCast().

◆ getDbgRecordRange()

iterator_range<simple_ilist<DbgRecord >::iterator > llvm::Instruction::getDbgRecordRange() const
inline

Return a range over the DbgRecords attached to this instruction.

Definition at line104 of fileInstruction.h.

Referencesllvm::getDbgRecordRange().

Referenced bygetNextNode(),performBranchToCommonDestFolding(),llvm::remapDebugVariable(), andllvm::memtag::StackInfoBuilder::visit().

◆ getDbgReinsertionPosition()

std::optional<DbgRecord::self_iterator > Instruction::getDbgReinsertionPosition()

Return an iterator to the position of the "Next"DbgRecord after this instruction, or std::nullopt.

This is the position to pass toBasicBlock::reinsertInstInDbgRecords when re-inserting an instruction.

Definition at line267 of fileInstruction.cpp.

◆ getDebugLoc()

constDebugLoc & llvm::Instruction::getDebugLoc() const
inline

Return the debug location for this node as aDebugLoc.

Definition at line511 of fileInstruction.h.

Referenced byBreakUpSubtract(),buildClonedLoopBlocks(),llvm::changeToInvokeAndSplitBasicBlock(),checkIfSupported(),cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(),computeCallStackHash(),ConvertShiftToMul(),llvm::CallBrInst::Create(),llvm::CallInst::Create(),llvm::VPRecipeBuilder::createEdgeMask(),llvm::OpenMPIRBuilder::createTask(),despeculateCountZeros(),diagnoseInvalidFormatString(),dropLocation(),llvm::OpenMPIRBuilder::emitTargetTask(),llvm::extractProbe(),llvm::extractProbeFromDiscriminator(),fixupDebugInfoPostExtraction(),fixupLineNumbers(),foldCondBranchOnValueKnownInPredecessorImpl(),llvm::InstCombinerImpl::foldOpIntoPhi(),llvm::ReplayInlineAdvisor::getAdviceImpl(),getAggregate(),getAggregateVariable(),llvm::SampleContextTracker::getCalleeContextSamplesFor(),llvm::SelectionDAGBuilder::getCurDebugLoc(),llvm::getDebugValueLoc(),getOrCreateDebugLoc(),HandleByValArgumentInit(),llvm::hoistAllInstructionsInto(),llvm::InlineFunction(),insertNewDbgInst(),llvm::AMDGPU::instrumentAddressImpl(),LowerNegateToMultiply(),llvm::InstCombinerImpl::mergeStoreIntoSuccessor(),NegateValue(),operandWithNewAddressSpaceOrCreatePoison(),optimizeDivRem(),OptimizeExtractBits(),llvm::InstCombinerImpl::PHIArgMergedDebugLoc(),processAShr(),llvm::JumpThreadingPass::processBlock(),processCall(),processSDiv(),processSExt(),processSIToFP(),processSRem(),llvm::SampleContextTracker::promoteMergeContextSamplesTree(),llvm::SCCPSolver::removeNonFeasibleEdges(),llvm::removeUnwindEdge(),replaceConditionalBranchesOnConstant(),llvm::replaceSignedInst(),llvm::IRTranslator::runOnMachineFunction(),llvm::coro::salvageDebugInfo(),scalarizeMaskedCompressStore(),scalarizeMaskedExpandLoad(),scalarizeMaskedGather(),scalarizeMaskedLoad(),scalarizeMaskedScatter(),scalarizeMaskedStore(),scalarizeMaskedVectorHistogram(),llvm::FastISel::selectOperator(),llvm::setProbeDistributionFactor(),llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(),sinkAndCmp0Expression(),sinkLastInstruction(),SinkShiftAndTruncate(),splitCallSite(),llvm::SplitKnownCriticalEdge(),llvm::JumpThreadingPass::threadEdge(),TryToShrinkGlobalToBoolean(),llvm::JumpThreadingPass::unfoldSelectInstr(),unswitchNontrivialInvariants(),unswitchTrivialBranch(),unswitchTrivialSwitch(),updateForIncomingValueLocation(),updateScopeLine(),upgradeDbgIntrinsicToDbgRecord(), andworkshareLoopTargetCallback().

◆ getFastMathFlags()

FastMathFlags Instruction::getFastMathFlags() const

Convenience function for getting all the fast-math flags, which must be an operator which supports these flags.

See LangRef.html for the meaning of these flags.

Definition at line651 of fileInstruction.cpp.

Referenced byllvm::RecurrenceDescriptor::AddReductionVar(),expandAtan2Intrinsic(),llvm::InstCombinerImpl::foldFMulReassoc(),foldFNegIntoConstant(),llvm::InstCombinerImpl::foldSelectOpOp(),getISDForVPIntrinsic(),llvm::matchDecomposedSelectPattern(),llvm::InstModificationIRStrategy::mutate(),optimizeDoubleFP(),llvm::VPReductionRecipe::print(),llvm::VPReductionEVLRecipe::print(),llvm::InstCombinerImpl::SimplifyAssociativeOrCommutative(), andllvm::InstCombinerImpl::visitFPTrunc().

◆ getFunction()[1/2]

Function * llvm::Instruction::getFunction()
inline

Definition at line188 of fileInstruction.h.

ReferencesgetFunction().

◆ getFunction()[2/2]

constFunction * Instruction::getFunction() const

Return the function this instruction belongs to.

Note: it is undefined behavior to call this on an instruction not currently inserted into a function.

Definition at line72 of fileInstruction.cpp.

Referenced byanalyzeLoopUnrollCost(),atomicIgnoresDenormalModeOrFPModeIsFTZ(),canSimplifyNullLoadOrGEP(),canTransformToMemCmp(),dropLocation(),llvm::expandAtomicRMWToCmpXchg(),llvm::AArch64TargetLowering::fallBackToDAGISel(),findCallsAtConstantOffset(),fixupDebugInfoPostExtraction(),forwardStoredOnceStore(),llvm::InstCombinerImpl::freezeOtherUses(),llvm::ReplayInlineAdvisor::getAdviceImpl(),getInstrDenormalMode(),llvm::coro::Shape::getRetconResultTypes(),HandleByValArgument(),llvm::InlineFunction(),insertLifetimeMarkersSurroundingCall(),insertSpills(),llvm::InstrumentationIRBuilder::InstrumentationIRBuilder(),isAtomicRMWLegalXChgTy(),isKnownNonZeroFromAssume(),llvm::isKnownToBeAPowerOfTwo(),IsOperandAMemoryOperand(),llvm::AA::isPotentiallyReachable(),isPotentiallyReachable(),llvm::AA::isValidAtPosition(),llvm::lowerAtomicRMWInst(),llvm::lowerObjectSizeCall(),mergeDIAssignID(),llvm::LoopInfo::movementPreservesLCSSAForm(),NegateValue(),optimizeDoubleFP(),llvm::AlignmentFromAssumptionsPass::processAssumption(),promoteArguments(),llvm::promoteCallWithIfThenElse(),removeTailCallAttribute(),llvm::coro::salvageDebugInfo(),llvm::CoroIdInst::setCoroutineSelf(),llvm::SITargetLowering::shouldExpandAtomicRMWInIR(),simplifyFCmpInst(),simplifyInstructionWithOperands(),llvm::OutlinableRegion::splitCandidate(),suppressSpeculativeLoadForSanitizers(),tryToOptimizeStoreOfAllocationToGlobal(),llvm::InstCombinerImpl::visitCallInst(),llvm::InstCombinerImpl::visitReturnInst(),llvm::InstCombinerImpl::visitSExt(),llvm::InstCombinerImpl::visitTrunc(), andllvm::InstCombinerImpl::visitZExt().

◆ getInsertionPointAfterDef()

std::optional<BasicBlock::iterator > Instruction::getInsertionPointAfterDef()

Get the first insertion point at which the result of this instruction is defined.

This isnot the directly following instruction in a number of cases, e.g. phi nodes or terminators that return values. This function may return null if the insertion after the definition is not possible, e.g. due to a catchswitch terminator.

Definition at line344 of fileInstruction.cpp.

◆ getMetadata()[1/2]

MDNode * llvm::Instruction::getMetadata(StringRef Kind) const
inline

Get the metadata of given kind attached to thisInstruction.

If the metadata is not found then return null.

Definition at line435 of fileInstruction.h.

◆ getMetadata()[2/2]

MDNode * llvm::Instruction::getMetadata(unsigned KindID) const
inline

Get the metadata of given kind attached to thisInstruction.

If the metadata is not found then return null.

Definition at line426 of fileInstruction.h.

Referencesllvm::DebugLoc::getAsMDNode().

Referenced byAddAliasScopeMetadata(),addAnnotationMetadata(),addBasicBlockMetadata(),llvm::LoopVersioning::annotateInstWithNoAlias(),llvm::changeToInvokeAndSplitBasicBlock(),combineMetadata(),convertMetadataToAssumes(),llvm::DbgVariableRecord::createLinkedDVRAssign(),llvm::SPIRVStructurizer::createOpSelectMerge(),llvm::IRBuilderBase::CreateSelectFMF(),llvm::diagnoseDontCall(),emitDbgAssign(),foldTwoEntryPHINode(),llvm::at::getAssignmentMarkers(),getBranchWeights(),llvm::at::getDVRAssignmentMarkers(),getFromRangeMetadata(),llvm::Loop::getLoopID(),llvm::MDNode::getMergedProfMetadata(),llvm::ScopedNoAliasAAResult::getModRefInfo(),llvm::TypeBasedAAResult::getModRefInfo(),hasOnlyUniformBranches(),llvm::DIBuilder::insertDbgAssign(),insertUniqueBackedgeBlock(),llvm::intersectAccessGroups(),isProfitableToSpeculate(),llvm::CallLowering::lowerCall(),llvm::FastISel::lowerCallTo(),llvm::makeGuardControlFlowExplicit(),llvm::mayHaveValueProfileOfKind(),mergeDIAssignID(),migrateDebugInfo(),llvm::LoopStructure::parseLoopStructure(),performBranchToCommonDestFolding(),PropagateCallSiteMetadata(),propagateMemProfHelper(),propagateMemProfMetadata(),llvm::propagateMetadata(),shouldFoldCondBranchesToCommonDestination(),SimplifyCondBranchToCondBranch(),SplitBlockPredecessorsImpl(),translateBranchMetadata(),turnGuardIntoBranch(), andunswitchNontrivialInvariants().

◆ getModule()[1/2]

Module * llvm::Instruction::getModule()
inline

Definition at line178 of fileInstruction.h.

◆ getModule()[2/2]

constModule * Instruction::getModule() const

Return the module owning the function this instruction belongs to or nullptr it the function does not have a module.

Note: this is undefined behavior if the instruction does not have a parent, or the parent basic block does not have a parent function.

Definition at line68 of fileInstruction.cpp.

Referenced byaddAssumeNonNull(),addMappingsFromTLI(),addVariantDeclaration(),llvm::buildAssumeFromKnowledge(),cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(),llvm::OpenMPIRBuilder::createAtomicRead(),createCoroSave(),CreateGCRelocates(),llvm::LoongArchTargetLowering::emitMaskedAtomicRMWIntrinsic(),llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(),llvm::AMDGPULibCalls::fold(),foldShuffleOfUnaryOps(),llvm::InstCombinerImpl::foldVectorBinop(),llvm::LazyValueInfo::getPredicateAt(),llvm::InstrProfIncrementInst::getStep(),llvm::VFABI::getVectorVariantNames(),llvm::DIBuilder::insertDbgAssign(),insertSpills(),llvm::TargetLibraryInfoImpl::isCallingConvCCompatible(),llvm::AArch64TargetLowering::lowerDeinterleaveIntrinsicToLoad(),lowerFunnelShifts(),llvm::AArch64TargetLowering::lowerInterleavedLoad(),llvm::IntrinsicLowering::LowerToByteSwap(),migrateDebugInfo(),llvm::LibCallSimplifier::optimizeCall(),promoteSingleBlockAlloca(),ReplaceCallWith(),rewriteSingleStoreAlloca(),llvm::LoopVectorizationCostModel::setVectorizedCallDecision(),llvm::VFABI::setVectorVariantNames(),tryToReplaceWithGEPBuiltin(),llvm::UpgradeIntrinsicCall(),upgradeX86IntrinsicCall(),llvm::AMDGPULibCalls::useNative(),llvm::InstCombinerImpl::visitBitCast(),llvm::InstCombinerImpl::visitCallInst(), andllvm::InstCombinerImpl::visitFPTrunc().

◆ getNextNonDebugInstruction()[1/2]

Instruction * llvm::Instruction::getNextNonDebugInstruction(bool SkipPseudoOp =false)
inline

Definition at line897 of fileInstruction.h.

◆ getNextNonDebugInstruction()[2/2]

constInstruction * Instruction::getNextNonDebugInstruction(bool SkipPseudoOp =false) const

Return a pointer to the next non-debug instruction in the same basic block as 'this', or nullptr if no such instruction exists.

Skip any pseudo operations ifSkipPseudoOp is true.

Definition at line1226 of fileInstruction.cpp.

Referenced byfindStoresToUninstrumentedArgAllocas(),isPotentiallyReachable(),RemovePreallocated(),rewriteDebugUsers(),llvm::OutlinableRegion::splitCandidate(),updateScopeLine(),llvm::InstCombinerImpl::visitCallInst(), andllvm::InstCombinerImpl::visitFenceInst().

◆ getNumSuccessors()

unsigned Instruction::getNumSuccessors() const

Return the number of successors that this instruction has.

The instruction must be a terminator.

Definition at line1275 of fileInstruction.cpp.

Referenced byllvm::BranchProbabilityInfo::calculate(),llvm::FunctionComparator::compare(),llvm::deleteDeadLoop(),getBestDestForJumpOnUndef(),getBranchHint(),llvm::DOTGraphTraits< DOTFuncInfo * >::getEdgeAttributes(),getInstrBB(),llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(),llvm::RegionTraits< Function >::getNumSuccessors(),llvm::isCriticalEdge(),llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(),isSafePHIToSpeculate(),llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(),llvm::JumpThreadingPass::processBlock(),llvm::JumpThreadingPass::processThreadableEdges(),replaceConstantExprOp(),llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(),skipPGOUse(),llvm::SplitAllCriticalEdges(),llvm::SplitCriticalEdge(),llvm::SplitEdge(),llvm::SplitKnownCriticalEdge(),llvm::JumpThreadingPass::threadEdge(),llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), andllvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB().

◆ getOpcode()

unsigned llvm::Instruction::getOpcode() const
inline

Returns a member of one of the enums like Instruction::Add.

Definition at line310 of fileInstruction.h.

Referenced byllvm::LanaiInstrInfo::analyzeBranch(),canEvaluateShiftedShift(),canPHITrans(),llvm::SCEVExpander::canReuseFlagsFromOriginalIVInc(),checkIfSafeAddSequence(),llvm::VPInterleaveRecipe::computeCost(),llvm::VPWidenMemoryRecipe::computeCost(),llvm::VPWidenLoadEVLRecipe::computeCost(),llvm::VPWidenStoreEVLRecipe::computeCost(),llvm::InstCombinerImpl::convertOrOfShiftsToFunnelShift(),llvm::CallBase::Create(),detectPopcountIdiom(),detectShiftUntilLessThanIdiom(),detectShiftUntilZeroIdiom(),doesInTreeUserNeedToExtract(),expandFPToI(),expandIToFP(),extractProfTotalWeight(),llvm::RISCVTargetLowering::fallBackToDAGISel(),findDemandedEltsBySingleUser(),findIBRPredecessor(),foldFPtoI(),llvm::InstCombinerImpl::foldICmpInstWithConstantNotInt(),llvm::InstCombinerImpl::foldICmpUsingBoolRange(),llvm::InstCombinerImpl::foldMultiplicationOverflowCheck(),llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(),llvm::InstCombinerImpl::foldSelectOpOp(),foldShiftIntoShiftInAnotherHandOfAndInICmp(),foldSignedTruncationCheck(),llvm::InstCombinerImpl::foldVariableSignZeroExtensionOfVariableHighBitExtract(),getExtractIndex(),getFromRangeMetadata(),getHashValueImpl(),llvm::SCEVExpander::getIVIncOperand(),getLoopPhiForCounter(),llvm::CallBase::getNumSubclassExtraOperands(),llvm::CallBase::getNumSubclassExtraOperandsDynamic(),llvm::UnaryOperator::getOpcode(),llvm::BinaryOperator::getOpcode(),llvm::CastInst::getOpcode(),llvm::CmpInst::getOpcode(),llvm::SelectInst::getOpcode(),llvm::VPReplicateRecipe::getOpcode(),llvm::MemoryLocation::getOrNone(),llvm::LoopVectorizationCostModel::getReductionPatternCost(),getSameOpcode(),hashCallInst(),llvm::InlineFunction(),isAlternateInstruction(),isEqualImpl(),llvm::AArch64TTIImpl::isExtPartOfAvgExpr(),llvm::SystemZTTIImpl::isFoldableLoad(),isHighCostExpansion(),isMatchingStore(),llvm::AArch64TTIImpl::isProfitableToSinkOperands(),llvm::ARMTTIImpl::isProfitableToSinkOperands(),isPromotedInstructionLegal(),isReturnNonNull(),llvm::isSafeToSpeculativelyExecute(),llvm::isSafeToSpeculativelyExecuteWithOpcode(),matchExpandedRem(),llvm::InstModificationIRStrategy::mutate(),needsFP(),NegateValue(),performBlockTailMerging(),llvm::BasicTTIImplBase< T >::preferToKeepConstantsAttached(),llvm::JumpThreadingPass::processBlock(),promoteAllocaUserToVector(),llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(),llvm::refineInstruction(),llvm::LanaiInstrInfo::removeBranch(),llvm::replaceSignedInst(),llvm::InstCombinerImpl::simplifyShrShlDemandedBits(),SinkShiftAndTruncate(),llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(),llvm::VPRecipeBuilder::tryToCreateWidenRecipe(),llvm::InstCombinerImpl::visitCallInst(),llvm::InstCombinerImpl::visitFCmpInst(), andllvm::InstCombinerImpl::visitICmpInst().

◆ getOpcodeName()[1/2]

constchar * llvm::Instruction::getOpcodeName() const
inline

Definition at line312 of fileInstruction.h.

ReferencesgetOpcode(), andgetOpcodeName().

Referenced bycheckInstructions(),llvm::LoopVectorizationPlanner::emitInvalidCostRemarks(),llvm::VPWidenRecipe::execute(),llvm::ConstantExpr::getOpcodeName(),getOpcodeName(),llvm::VPInstruction::print(),llvm::VPWidenRecipe::print(),llvm::VPWidenCastRecipe::print(),llvm::VPScalarCastRecipe::print(),llvm::VPPartialReductionRecipe::print(),llvm::VPReductionRecipe::print(),llvm::VPReductionEVLRecipe::print(),llvm::VPReplicateRecipe::print(),llvm::VPWidenEVLRecipe::print(), andPrintOps().

◆ getOpcodeName()[2/2]

constchar * Instruction::getOpcodeName(unsigned Opcode)
static

Definition at line749 of fileInstruction.cpp.

Referencesllvm::IRBuilderBase::CreateCleanupRet(),llvm::sandboxir::Context::createCleanupReturnInst(),llvm::sandboxir::Value::Ctx,llvm::sandboxir::Instruction::setInsertPos(), andllvm::sandboxir::Value::Val.

◆ getPrevNonDebugInstruction()[1/2]

Instruction * llvm::Instruction::getPrevNonDebugInstruction(bool SkipPseudoOp =false)
inline

Definition at line908 of fileInstruction.h.

◆ getPrevNonDebugInstruction()[2/2]

constInstruction * Instruction::getPrevNonDebugInstruction(bool SkipPseudoOp =false) const

Return a pointer to the previous non-debug instruction in the same basic block as 'this', or nullptr if no such instruction exists.

Skip any pseudo operations ifSkipPseudoOp is true.

Definition at line1234 of fileInstruction.cpp.

Referenced byfindDominatingValue(),InsertStackProtectors(), andllvm::InstCombinerImpl::visitFenceInst().

◆ getStableDebugLoc()

constDebugLoc & Instruction::getStableDebugLoc() const

Fetch the debug location for this node, unless this is a debug intrinsic, in which case fetch the debug location of the next non-debug node.

Definition at line1244 of fileInstruction.cpp.

◆ getSubclassData()

template<typename BitfieldElement >
BitfieldElement::Type llvm::Instruction::getSubclassData() const
inlineprotected

Definition at line1063 of fileInstruction.h.

◆ getSuccessor()

BasicBlock * Instruction::getSuccessor(unsigned Idx) const

Return the specified successor. This instruction must be a terminator.

Definition at line1287 of fileInstruction.cpp.

Referenced byllvm::FunctionComparator::compare(),llvm::OpenMPIRBuilder::createSection(),findLoopComponents(),getBestDestForJumpOnUndef(),getBranchHint(),llvm::DOTGraphTraits< DOTFuncInfo * >::getEdgeAttributes(),llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(),getOnlyLiveSuccessor(),llvm::isCriticalEdge(),llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(),llvm::InstCombinerImpl::mergeStoreIntoSuccessor(),optimizeSQRT(),llvm::JumpThreadingPass::processBlock(),scalarizeMaskedCompressStore(),scalarizeMaskedExpandLoad(),scalarizeMaskedGather(),scalarizeMaskedLoad(),scalarizeMaskedScatter(),scalarizeMaskedStore(),scalarizeMaskedVectorHistogram(),llvm::SplitCriticalEdge(),llvm::SplitKnownCriticalEdge(),llvm::JumpThreadingPass::threadEdge(),llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), andllvm::UnrollAndJamLoop().

◆ handleMarkerRemoval()

void Instruction::handleMarkerRemoval()

Handle the debug-info implications of this instruction being removed.

Any attached DbgRecords need to "fall" down onto the next instruction.

Definition at line87 of fileInstruction.cpp.

◆ hasAllowContract()

bool Instruction::hasAllowContract() const

Determine whether the allow-contract flag is set.

Definition at line641 of fileInstruction.cpp.

Referenced byllvm::GCNTTIImpl::getArithmeticInstrCost(), andllvm::InstModificationIRStrategy::mutate().

◆ hasAllowReassoc()

bool Instruction::hasAllowReassoc() const

Determine whether the allow-reassociation flag is set.

Definition at line616 of fileInstruction.cpp.

Referenced byllvm::InductionDescriptor::getExactFPMathInst(),isFSqrtDivToFMulLegal(), andllvm::InstModificationIRStrategy::mutate().

◆ hasAllowReciprocal()

bool Instruction::hasAllowReciprocal() const

Determine whether the allow-reciprocal flag is set.

Definition at line636 of fileInstruction.cpp.

Referencesllvm::IRBuilderBase::CreateLandingPad(),llvm::sandboxir::Context::createLandingPadInst(),llvm::sandboxir::Value::Ctx,Name,RetTy, andllvm::sandboxir::Instruction::setInsertPos().

Referenced byllvm::InstModificationIRStrategy::mutate().

◆ hasApproxFunc()

bool Instruction::hasApproxFunc() const

Determine whether the approximate-math-functions flag is set.

Definition at line646 of fileInstruction.cpp.

Referenced byllvm::GCNTTIImpl::getArithmeticInstrCost(), andllvm::InstModificationIRStrategy::mutate().

◆ hasAtomicLoad()

bool Instruction::hasAtomicLoad() const

Return true if this atomic instruction loads from memory.

Definition at line1046 of fileInstruction.cpp.

Referenced byllvm::PPCTargetLowering::emitTrailingFence().

◆ hasAtomicStore()

bool Instruction::hasAtomicStore() const

Return true if this atomic instruction stores to memory.

Definition at line1058 of fileInstruction.cpp.

Referenced byllvm::TargetLoweringBase::emitLeadingFence(),llvm::ARMTargetLowering::emitLeadingFence(), andllvm::VETargetLowering::emitLeadingFence().

◆ hasDbgRecords()

bool Instruction::hasDbgRecords() const

Returns true if any DbgRecords are attached to this instruction.

Definition at line280 of fileInstruction.cpp.

Referenced bygetNextNode().

◆ hasMetadata()[1/3]

bool llvm::Instruction::hasMetadata() const
inline

Return true if this instruction has any metadata attached to it.

Definition at line404 of fileInstruction.h.

Referenced byatomicIgnoresDenormalModeOrFPModeIsFTZ(),convertMetadataToAssumes(),doPromotion(),llvm::MemoryDependenceResults::getInvariantGroupPointerDependency(),llvm::TargetLoweringBase::getLoadMemOperandFlags(),llvm::SITargetLowering::getTgtMemIntrinsic(),globalMemoryFPAtomicIsLegal(),insertNewDbgInst(),IsAcceptableTarget(),llvm::gvn::AvailableValue::MaterializeAdjustedValue(),setMetadata(), andupdateMemprofMetadata().

◆ hasMetadata()[2/3]

bool llvm::Instruction::hasMetadata(StringRef Kind) const
inline

Return true if this instruction has the given type of metadata attached.

Definition at line420 of fileInstruction.h.

◆ hasMetadata()[3/3]

bool llvm::Instruction::hasMetadata(unsigned KindID) const
inline

Return true if this instruction has the given type of metadata attached.

Definition at line415 of fileInstruction.h.

◆ hasMetadataOtherThanDebugLoc()

bool llvm::Instruction::hasMetadataOtherThanDebugLoc() const
inline

Return true if this instruction has metadata attached to it other than a debug location.

Definition at line412 of fileInstruction.h.

◆ hasNoInfs()

bool Instruction::hasNoInfs() const

Determine whether the no-infs flag is set.

Definition at line626 of fileInstruction.cpp.

Referenced byfoldFCmpFSubIntoFCmp(),foldFCmpReciprocalAndZero(),llvm::InstCombinerImpl::foldSelectIntoOp(),isFSqrtDivToFMulLegal(), andllvm::InstModificationIRStrategy::mutate().

◆ hasNoNaNs()

bool Instruction::hasNoNaNs() const

Determine whether the no-NaNs flag is set.

Definition at line621 of fileInstruction.cpp.

Referencesllvm::sandboxir::Value::Ctx,llvm::sandboxir::Tracker::emplaceIfTracking(),llvm::sandboxir::CallBrInst::getIndirectDest(),llvm::sandboxir::Context::getTracker(),Idx, andllvm::sandboxir::CallBrInst::setIndirectDest().

Referenced byfoldFCmpFSubIntoFCmp(),llvm::InstCombinerImpl::foldSelectIntoOp(),llvm::CmpInst::isEquivalence(),isFSqrtDivToFMulLegal(), andllvm::InstModificationIRStrategy::mutate().

◆ hasNonDebugLocLoopMetadata()

bool Instruction::hasNonDebugLocLoopMetadata() const

Definition at line479 of fileInstruction.cpp.

◆ hasNonNeg()

bool Instruction::hasNonNeg() const

Determine whether the the nneg flag is set.

Definition at line417 of fileInstruction.cpp.

Referenced byllvm::refineInstruction(),llvm::InstCombinerImpl::visitUIToFP(), andllvm::InstCombinerImpl::visitZExt().

◆ hasNoSignedWrap()

bool Instruction::hasNoSignedWrap() const

Determine whether the no signed wrap flag is set.

Definition at line410 of fileInstruction.cpp.

Referenced bybuildNew(),checkNoWrapFlags(),llvm::InstCombinerImpl::commonIDivTransforms(),detectShiftUntilZeroIdiom(),llvm::InstCombinerImpl::foldICmpBinOp(),llvm::InstCombinerImpl::foldICmpShlConstant(),llvm::InstCombinerImpl::foldICmpSubConstant(),foldMulShl1(),llvm::InstCombinerImpl::FoldShiftByConstant(),isNonZeroRecurrence(),llvm::InstModificationIRStrategy::mutate(),processBinOp(),llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(),llvm::refineInstruction(),setLimitsForBinOp(), andllvm::InstCombinerImpl::simplifyShrShlDemandedBits().

◆ hasNoSignedZeros()

bool Instruction::hasNoSignedZeros() const

Determine whether the no-signed-zeros flag is set.

Definition at line631 of fileInstruction.cpp.

Referenced byfoldSelectBinOpIdentity(),llvm::InstCombinerImpl::foldSelectIntoOp(),isFSqrtDivToFMulLegal(),llvm::InstModificationIRStrategy::mutate(), andsimplifySelectWithFCmp().

◆ hasNoUnsignedWrap()

bool Instruction::hasNoUnsignedWrap() const

Determine whether the no unsigned wrap flag is set.

Definition at line403 of fileInstruction.cpp.

Referenced bybuildNew(),checkNoWrapFlags(),detectShiftUntilZeroIdiom(),llvm::InstCombinerImpl::foldICmpBinOp(),llvm::InstCombinerImpl::foldICmpShlConstant(),llvm::InstCombinerImpl::foldICmpSubConstant(),foldMulShl1(),llvm::InstCombinerImpl::FoldShiftByConstant(),isNonZeroRecurrence(),llvm::InstModificationIRStrategy::mutate(),processBinOp(),llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(),llvm::refineInstruction(),llvm::InstCombinerImpl::simplifyShrShlDemandedBits(), andllvm::InstCombinerImpl::visitSub().

◆ hasPoisonGeneratingAnnotations()

bool llvm::Instruction::hasPoisonGeneratingAnnotations() const
inline

Return true if this instruction has poison-generating flags, return attributes or metadata.

Definition at line564 of fileInstruction.h.

◆ hasPoisonGeneratingFlags()

bool Instruction::hasPoisonGeneratingFlags() const

Return true if this operator has flags which may cause this instruction to evaluate to poison despite having non-poison inputs.

Definition at line422 of fileInstruction.cpp.

Referenced bycanFoldTermCondOfLoop().

◆ hasPoisonGeneratingMetadata()

bool Instruction::hasPoisonGeneratingMetadata() const

Return true if this instruction has poison-generating metadata.

Definition at line474 of fileInstruction.cpp.

◆ hasPoisonGeneratingReturnAttributes()

bool Instruction::hasPoisonGeneratingReturnAttributes() const

Return true if this instruction has poison-generating attribute.

Definition at line507 of fileInstruction.cpp.

◆ hasSameSpecialState()

bool Instruction::hasSameSpecialState(constInstructionI2,
bool IgnoreAlignment =false,
bool IntersectAttrs =false 
) const

This function determines if the speficied instruction has the same "special" characteristics as the current one.

This must be kept in sync withFunctionComparator::cmpOperations inlib/Transforms/IPO/MergeFunctions.cpp.

This means that opcode specific details are the same. As a common example, if we are comparing loads, then hasSameSpecialState would compare the alignments (among other things).

Returns
true if the specific instruction has the same opcde specific characteristics as the current one. Determine if one instruction has the same state as another.

Definition at line836 of fileInstruction.cpp.

◆ insertAfter()[1/2]

void Instruction::insertAfter(InstListType::iterator InsertPos)

Insert an unlinked instruction into a basic block immediately after the specified position.

Definition at line117 of fileInstruction.cpp.

◆ insertAfter()[2/2]

void Instruction::insertAfter(InstructionInsertPos)

Insert an unlinked instruction into a basic block immediately after the specified instruction.

Definition at line111 of fileInstruction.cpp.

Referenced byaddAssumeNonNull(),llvm::OpenMPIRBuilder::createParallel(),DbgInserterHelper(),optimizeDivRem(), andrewritePHIsForCleanupPad().

◆ insertBefore()[1/3]

void Instruction::insertBefore(BasicBlockBB,
InstListType::iterator InsertPos 
)

Definition at line134 of fileInstruction.cpp.

◆ insertBefore()[2/3]

void Instruction::insertBefore(InstListType::iterator InsertPos)

Insert an unlinked instruction into a basic block immediately before the specified position.

Insert an unlinked instruction into a basic block immediately before the specified instruction.

Definition at line105 of fileInstruction.cpp.

◆ insertBefore()[3/3]

void Instruction::insertBefore(InstructionInsertPos)

Insert an unlinked instruction into a basic block immediately before the specified instruction.

Deprecated in favour of the iterator-accepting flavour. Iterators at the start of a block such asBasicBlock::getFirstNonPHIIt must be passed into insertBefore without unwrapping/rewrapping. For all other positions, call getIterator to fetch the instruction iterator.

Definition at line99 of fileInstruction.cpp.

Referenced byllvm::changeToCall(),llvm::CloneBasicBlock(),cloneInstructionInExitBlock(),CloneLoopBlocks(),ConnectEpilog(),ConnectProlog(),llvm::DbgVariableRecord::createDebugIntrinsic(),llvm::createPHIsForSplitLoopExit(),DbgInserterHelper(),llvm::VPWidenIntOrFpInductionRecipe::execute(),llvm::expandUser(),findBasePointer(),findOrCreatePHIInBlock(),formLCSSAForInstructionsImpl(),generateReproducer(),llvm::SSAUpdater::GetValueInMiddleOfBlock(),HandleByValArgument(),insertLifetimeMarkersSurroundingCall(),llvm::BPFCoreSharedInfo::insertPassThrough(),insertTrivialPHIs(),moveLCSSAPhis(),movePHIValuesToInsertedBlock(),OptimizeExtractBits(),rematerializeChain(),replaceConstantExprOp(),rewriteMaterializableInstructions(),rewritePHIs(),llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(),SinkCast(),sinkCmpExpression(),sinkInstruction(),SinkShiftAndTruncate(),splitCallSite(),llvm::SplitIndirectBrCriticalEdges(),llvm::JumpThreadingPass::threadGuard(),tryToReplaceWithGEPBuiltin(),llvm::UnrollRuntimeLoopRemainder(),versionCallSiteWithCond(),DataScalarizerVisitor::visitLoadInst(), andDataScalarizerVisitor::visitStoreInst().

◆ insertInto()

BasicBlock::iterator Instruction::insertInto(BasicBlockParentBB,
InstListType::iterator It 
)

Inserts an unlinked instruction intoParentBB at positionIt and returns the iterator of the inserted instruction.

Definition at line123 of fileInstruction.cpp.

Referenced bybuildPartialInvariantUnswitchConditionalBranch(),cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(),createWrapper(),llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(),llvm::FoldReturnIntoUncondBranch(),mergeCompatibleInvokesImpl(),performBlockTailMerging(),replaceArgumentUses(),SplitLandingPadPredecessorsImpl(),llvm::JumpThreadingPass::unfoldSelectInstr(),unswitchNontrivialInvariants(), andunswitchTrivialBranch().

◆ isArithmeticShift()

bool llvm::Instruction::isArithmeticShift() const
inline

Return true if this is an arithmetic shift right.

Definition at line359 of fileInstruction.h.

ReferencesgetOpcode().

Referenced byllvm::InstCombinerImpl::foldICmpAndShift().

◆ isAssociative()[1/2]

bool Instruction::isAssociative() const

Return true if the instruction is associative:

Associative operators satisfy: x op (y op z) === (x op y) op z

In LLVM, the Add, Mul, And, Or, and Xor operators are associative.

Definition at line1251 of fileInstruction.cpp.

Referenced byllvm::ConstantFoldBinaryInstruction(),llvm::InstCombinerImpl::foldVectorBinop(), andsimplifyAssociativeBinOp().

◆ isAssociative()[2/2]

staticbool llvm::Instruction::isAssociative(unsigned Opcode)
inlinestatic

Definition at line743 of fileInstruction.h.

Referencesllvm::And,Mul,llvm::Or, andllvm::Xor.

◆ isAtomic()

bool Instruction::isAtomic() const

Return true if this instruction has an AtomicOrdering of unordered or higher.

Definition at line1031 of fileInstruction.cpp.

Referenced byllvm::InstCombinerImpl::combineLoadToNewType(),llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(),llvm::LoadInst::isSimple(),llvm::StoreInst::isSimple(), andllvm::JumpThreadingPass::simplifyPartiallyRedundantLoad().

◆ isBinaryOp()[1/2]

bool llvm::Instruction::isBinaryOp() const
inline

Definition at line315 of fileInstruction.h.

ReferencesgetOpcode(), andisBinaryOp().

Referenced byllvm::ConstantRange::binaryOp(),canCreateUndefOrPoison(),llvm::BinaryConstantExpr::classof(),llvm::ConstantFoldBinaryInstruction(),llvm::ConstantFoldBinaryOpOperands(),llvm::ConstantFoldFPInstOperands(),llvm::ConstantExprKeyType::create(),createEVLRecipe(),llvm::IRBuilderBase::CreateNAryOp(),llvm::VPWidenEVLRecipe::execute(),llvm::ConstantExpr::get(),llvm::ConstantExpr::getBinOpIdentity(),isBinaryOp(),isConstExprSupported(),llvm::isSafeToSpeculativelyExecuteWithOpcode(),llvm::vputils::isUniformAfterVectorization(),llvm::ConstantRange::makeGuaranteedNoWrapRegion(),llvm::VPInstruction::onlyFirstLaneUsed(),llvm::VPInstruction::onlyFirstPartUsed(),llvm::VPInstruction::opcodeMayReadOrWriteFromMemory(), andllvm::ConstantRange::overflowingBinaryOp().

◆ isBinaryOp()[2/2]

staticbool llvm::Instruction::isBinaryOp(unsigned Opcode)
inlinestatic

Definition at line336 of fileInstruction.h.

◆ isBitwiseLogicOp()[1/2]

bool llvm::Instruction::isBitwiseLogicOp() const
inline

Return true if this is and/or/xor.

Definition at line369 of fileInstruction.h.

ReferencesgetOpcode().

Referenced byllvm::InstCombinerImpl::foldBinOpShiftWithShift(),getBinOpsForFactorization(),llvm::PatternMatch::is_bitwiselogic_op::isOpType(), andrightDistributesOverLeft().

◆ isBitwiseLogicOp()[2/2]

staticbool llvm::Instruction::isBitwiseLogicOp(unsigned Opcode)
inlinestatic

Determine if the Opcode is and/or/xor.

Definition at line364 of fileInstruction.h.

Referencesllvm::And,llvm::Or, andllvm::Xor.

Referenced byfoldBitCastBitwiseLogic(), andsimplifyAssocCastAssoc().

◆ isCast()[1/2]

bool llvm::Instruction::isCast() const
inline

Definition at line319 of fileInstruction.h.

ReferencesgetOpcode(), andisCast().

Referenced byllvm::CastConstantExpr::classof(),llvm::ConstantFoldCastOperand(),llvm::ConstantExprKeyType::create(),llvm::InstCombinerImpl::foldSelectOpOp(),llvm::ConstantExpr::getCast(),llvm::ConstantExpr::isCast(),isCast(),isConstExprSupported(), andllvm::VPCastIntrinsic::isVPCast().

◆ isCast()[2/2]

staticbool llvm::Instruction::isCast(unsigned Opcode)
inlinestatic

Determine if the Opcode is one of theCastInst instructions.

Definition at line374 of fileInstruction.h.

◆ isCommutative()[1/2]

bool Instruction::isCommutative() const

Return true if the instruction is commutative:

Commutative operators satisfy: (x op y) === (y op x)

In LLVM, these are the commutative operators, plus SetEQ and SetNE, when applied to any type.

Definition at line1268 of fileInstruction.cpp.

Referenced byllvm::RecurrenceDescriptor::AddReductionVar(),areCommutative(),llvm::ConstantFoldBinaryInstruction(),expandBinOp(),foldOrCommuteConstant(),foldSelectBinOpIdentity(),llvm::InstCombinerImpl::foldSelectOpOp(),llvm::InstCombinerImpl::foldVectorBinop(),llvm::ConstantExpr::getBinOpIdentity(),llvm::RISCVTTIImpl::getIntImmCostInst(),llvm::OverflowingBinaryOperator::isCommutative(),matchStridedStart(),rightDistributesOverLeft(),simplifyAssociativeBinOp(),llvm::InstCombinerImpl::SimplifyDemandedVectorElts(),llvm::BinaryOperator::swapOperands(),tryFactorization(), andllvm::InstCombinerImpl::visitShl().

◆ isCommutative()[2/2]

staticbool llvm::Instruction::isCommutative(unsigned Opcode)
inlinestatic

Definition at line756 of fileInstruction.h.

Referencesllvm::And,llvm::FAdd,llvm::FMul,Mul,llvm::Or, andllvm::Xor.

◆ isDebugOrPseudoInst()

bool Instruction::isDebugOrPseudoInst() const

Return true if the instruction is aDbgInfoIntrinsic orPseudoProbeInst.

Definition at line1221 of fileInstruction.cpp.

Referenced byllvm::findAvailablePtrLoadStore(), andProcessBlock().

◆ isEHPad()

bool llvm::Instruction::isEHPad() const
inline

Return true if the instruction is a variety of EH-block.

Definition at line869 of fileInstruction.h.

ReferencesgetOpcode().

Referenced byllvm::ehAwareSplitEdge(),getEHPadFromPredecessor(),isSafeToMove(),llvm::removeAllNonTerminatorAndEHPadInstructions(), andSinkCast().

◆ isExact()

bool Instruction::isExact() const

Determine whether the exact flag is set.

Definition at line557 of fileInstruction.cpp.

Referenced bybuildNew(),llvm::InstCombinerImpl::foldICmpBinOp(),llvm::InstCombinerImpl::foldICmpBinOpEqualityWithConstant(),llvm::InstCombinerImpl::foldICmpDivConstant(),llvm::InstCombinerImpl::foldICmpShrConstant(),llvm::InstCombinerImpl::FoldShiftByConstant(),isNonZeroRecurrence(),llvm::InstModificationIRStrategy::mutate(),processAShr(),processSDiv(),llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(),llvm::replaceSignedInst(), andllvm::InstCombinerImpl::visitMul().

◆ isFast()

bool Instruction::isFast() const

Determine whether all fast-math-flags are set.

Definition at line611 of fileInstruction.cpp.

Referenced byllvm::LibCallSimplifier::optimizeCall().

◆ isFenceLike()

bool llvm::Instruction::isFenceLike() const
inline

Return true if this instruction behaves like a memory fence: it can load or store to memory location without being given a memory location.

Definition at line828 of fileInstruction.h.

ReferencesgetOpcode().

◆ isFPDivRem()[1/2]

bool llvm::Instruction::isFPDivRem() const
inline

Definition at line317 of fileInstruction.h.

ReferencesgetOpcode(), andisFPDivRem().

Referenced byisFPDivRem().

◆ isFPDivRem()[2/2]

staticbool llvm::Instruction::isFPDivRem(unsigned Opcode)
inlinestatic

Definition at line344 of fileInstruction.h.

◆ isFuncletPad()[1/2]

bool llvm::Instruction::isFuncletPad() const
inline

Definition at line320 of fileInstruction.h.

ReferencesgetOpcode(), andisFuncletPad().

Referenced byisFuncletPad().

◆ isFuncletPad()[2/2]

staticbool llvm::Instruction::isFuncletPad(unsigned Opcode)
inlinestatic

Determine if the Opcode is one of theFuncletPadInst instructions.

Definition at line379 of fileInstruction.h.

◆ isIdempotent()[1/2]

bool llvm::Instruction::isIdempotent() const
inline

Return true if the instruction is idempotent:

Idempotent operators satisfy: x op x === x

In LLVM, the And and Or operators are idempotent.

Definition at line773 of fileInstruction.h.

ReferencesgetOpcode(), andisIdempotent().

Referenced byisIdempotent().

◆ isIdempotent()[2/2]

staticbool llvm::Instruction::isIdempotent(unsigned Opcode)
inlinestatic

Definition at line774 of fileInstruction.h.

Referencesllvm::And, andllvm::Or.

◆ isIdenticalTo()

bool Instruction::isIdenticalTo(constInstructionI) const

Return true if the specified instruction is exactly identical to the current one.

This means that all operands match and any extra information (e.g. load is volatile) agree.

Definition at line914 of fileInstruction.cpp.

Referenced bytryToMergeLandingPad(), andllvm::InstCombinerImpl::visitFenceInst().

◆ isIdenticalToWhenDefined()

bool Instruction::isIdenticalToWhenDefined(constInstructionI,
bool IntersectAttrs =false 
) const

This is like isIdenticalTo, except that it ignores the SubclassOptionalData flags, which may specify conditions under which the instruction's result is undefined.

Definition at line919 of fileInstruction.cpp.

Referenced byEliminateDuplicatePHINodesNaiveImpl(), andisEqualImpl().

◆ isIntDivRem()[1/2]

bool llvm::Instruction::isIntDivRem() const
inline

Definition at line316 of fileInstruction.h.

ReferencesgetOpcode(), andisIntDivRem().

Referenced byllvm::ConstantFoldBinaryInstruction(),llvm::InstCombinerImpl::foldSelectShuffle(),foldSelectShuffleWith1Binop(),llvm::InstCombinerImpl::foldVectorBinop(),generateKeySubkey(),isIntDivRem(),isValidForAlternation(), andllvm::InstCombinerImpl::SimplifyDemandedVectorElts().

◆ isIntDivRem()[2/2]

staticbool llvm::Instruction::isIntDivRem(unsigned Opcode)
inlinestatic

Definition at line340 of fileInstruction.h.

◆ isLaunderOrStripInvariantGroup()

bool Instruction::isLaunderOrStripInvariantGroup() const

Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group.

Definition at line1212 of fileInstruction.cpp.

◆ isLifetimeStartOrEnd()

bool Instruction::isLifetimeStartOrEnd() const

Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker.

Definition at line1204 of fileInstruction.cpp.

Referenced byllvm::CodeExtractor::findAllocas().

◆ isLogicalShift()

bool llvm::Instruction::isLogicalShift() const
inline

Return true if this is a logical shift left or a logical shift right.

Definition at line354 of fileInstruction.h.

ReferencesgetOpcode().

Referenced bycanEvaluateShiftedShift(), andcanShiftBinOpWithConstantRHS().

◆ isNilpotent()[1/2]

bool llvm::Instruction::isNilpotent() const
inline

Return true if the instruction is nilpotent:

Nilpotent operators satisfy: x op x === Id,

where Id is the identity for the operator, i.e. a constant such that x op Id === x and Id op x === x for all x.

In LLVM, the Xor operator is nilpotent.

Definition at line787 of fileInstruction.h.

ReferencesgetOpcode(), andisNilpotent().

Referenced byisNilpotent().

◆ isNilpotent()[2/2]

staticbool llvm::Instruction::isNilpotent(unsigned Opcode)
inlinestatic

Definition at line788 of fileInstruction.h.

Referencesllvm::Xor.

◆ isOnlyUserOfAnyOperand()

bool Instruction::isOnlyUserOfAnyOperand()

It checks if this instruction is the only user of at least one of its operands.

Definition at line375 of fileInstruction.cpp.

◆ isSafeToRemove()

bool Instruction::isSafeToRemove() const

Return true if the instruction can be removed if the result is unused.

When constant folding some instructions cannot be removed even if their results are unused. Specifically terminator instructions and calls that may have side effects cannot be removed without semantically changing the generated program.

Definition at line1189 of fileInstruction.cpp.

◆ isSameOperationAs()

bool Instruction::isSameOperationAs(constInstructionI,
unsigned flags =0 
) const

This function determines if the specified instruction executes the same operation as the current one.

This means that the opcodes, type, operand types and any other factors affecting the operation must be the same. This is similar to isIdenticalTo except the operands themselves don't have to be identical.

Returns
true if the specified instruction is the same operation as the current one. Determine if one instruction is the same operation as another.

Definition at line948 of fileInstruction.cpp.

Referenced byllvm::InstCombinerImpl::foldSelectOpOp().

◆ isShift()[1/2]

bool llvm::Instruction::isShift() const
inline

Definition at line318 of fileInstruction.h.

ReferencesgetOpcode(), andisShift().

Referenced bydetectShiftUntilZeroIdiom(),llvm::InstCombinerImpl::foldICmpAndShift(),llvm::InstCombinerImpl::foldSelectShuffle(),foldSelectShuffleWith1Binop(),llvm::InstCombinerImpl::foldVectorBinop(),llvm::ARMTTIImpl::getArithmeticInstrCost(),llvm::PatternMatch::is_shift_op::isOpType(),isShift(),rightDistributesOverLeft(), andllvm::InstCombinerImpl::SimplifyDemandedVectorElts().

◆ isShift()[2/2]

staticbool llvm::Instruction::isShift(unsigned Opcode)
inlinestatic

Determine if the Opcode is one of the shift instructions.

Definition at line349 of fileInstruction.h.

◆ isSpecialTerminator()[1/2]

bool llvm::Instruction::isSpecialTerminator() const
inline

Definition at line321 of fileInstruction.h.

ReferencesgetOpcode(), andisSpecialTerminator().

Referenced byisSpecialTerminator(),llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), andllvm::MergeBlockIntoPredecessor().

◆ isSpecialTerminator()[2/2]

staticbool llvm::Instruction::isSpecialTerminator(unsigned Opcode)
inlinestatic

Returns true if the Opcode is a "special" terminator that does more than branch to a successor (e.g.

have a side effect or return a value).

Definition at line385 of fileInstruction.h.

◆ isTerminator()[1/2]

bool llvm::Instruction::isTerminator() const
inline

Definition at line313 of fileInstruction.h.

ReferencesgetOpcode(), andisTerminator().

Referenced byCalculateUnswitchCostMultiplier(),findLocationForEntrySafepoint(),llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(),llvm::isCriticalEdge(),isRemovableWrite(),isSafeToMove(),isTerminator(),llvm::InstDeleterIRStrategy::mutate(),llvm::MemoryDependenceResults::removeInstruction(), andllvm::OutlinableRegion::splitCandidate().

◆ isTerminator()[2/2]

staticbool llvm::Instruction::isTerminator(unsigned Opcode)
inlinestatic

Definition at line329 of fileInstruction.h.

◆ isUnaryOp()[1/2]

bool llvm::Instruction::isUnaryOp() const
inline

Definition at line314 of fileInstruction.h.

ReferencesgetOpcode(), andisUnaryOp().

Referenced byllvm::ConstantFoldUnaryInstruction(),llvm::ConstantFoldUnaryOpOperand(),createEVLRecipe(),llvm::IRBuilderBase::CreateNAryOp(),llvm::VPWidenEVLRecipe::execute(),llvm::isSafeToSpeculativelyExecuteWithOpcode(), andisUnaryOp().

◆ isUnaryOp()[2/2]

staticbool llvm::Instruction::isUnaryOp(unsigned Opcode)
inlinestatic

Definition at line333 of fileInstruction.h.

◆ isUsedOutsideOfBlock()

bool Instruction::isUsedOutsideOfBlock(constBasicBlockBB) const

Return true if there are any uses of this instruction in blocks other than the specified block.

Note that PHI nodes are considered to evaluate their operands in the corresponding predecessor block.

Definition at line973 of fileInstruction.cpp.

Referenced byremoveEmptyCleanup().

◆ isVolatile()

bool Instruction::isVolatile() const

Return true if this instruction has a volatile memory access.

Definition at line1070 of fileInstruction.cpp.

Referenced byllvm::expandAtomicMemCpyAsLoop(),llvm::MemoryDependenceResults::getNonLocalPointerDependency(), andllvm::MemoryDependenceResults::getSimplePointerDependencyFrom().

◆ mayHaveSideEffects()

bool Instruction::mayHaveSideEffects() const

Return true if the instruction may have side effects.

Side effects are:

  • Writing to memory.
  • Unwinding.
  • Not returning (e.g. an infinite loop).

Note that this does not consider malloc and alloca to have side effects because the newly allocated memory is completely invisible to instructions which don't use the returned value. For cases where this matters, isSafeToSpeculativelyExecute may be more appropriate.

Definition at line1185 of fileInstruction.cpp.

Referenced bycanMoveAboveCall(),llvm::deleteDeadLoop(),hasHardUserWithinLoop(),isSafePHIToSpeculate(), andllvm::MergeBlockIntoPredecessor().

◆ mayReadFromMemory()

bool Instruction::mayReadFromMemory() const

Return true if this instruction may read memory.

Definition at line991 of fileInstruction.cpp.

Referenced byGetLocation(),IsAcceptableTarget(),llvm::Dependence::isAnti(),llvm::Dependence::isFlow(), andllvm::Dependence::isInput().

◆ mayReadOrWriteMemory()

bool llvm::Instruction::mayReadOrWriteMemory() const
inline

Return true if this instruction may read or write memory.

Definition at line799 of fileInstruction.h.

Referenced byllvm::AliasSetTracker::addUnknown(),llvm::AliasSet::aliasesUnknownInst(), andllvm::intersectAccessGroups().

◆ mayThrow()

bool Instruction::mayThrow(bool IncludePhaseOneUnwind =false) const

Return true if this instruction may throw an exception.

If IncludePhaseOneUnwind is set, this will also include cases where phase one unwinding may unwind past this frame due to skipping of cleanup landingpads.

Definition at line1158 of fileInstruction.cpp.

Referenced byisSafeToMove().

◆ mayWriteToMemory()

bool Instruction::mayWriteToMemory() const

Return true if this instruction may modify memory.

Definition at line1011 of fileInstruction.cpp.

Referenced byllvm::findAvailablePtrLoadStore(),findInitTrampolineFromBB(),GetLocation(),llvm::Dependence::isAnti(),llvm::Dependence::isFlow(),llvm::Dependence::isOutput(), andisSafeToMove().

◆ mergeDIAssignID()

void Instruction::mergeDIAssignID(ArrayRef<constInstruction * > SourceInstructions)

Merge theDIAssignID metadata from this instruction and those attached to instructions inSourceInstructions.

This process performs a RAUW on theMetadataAsValue uses of the mergedDIAssignID nodes. Not every instruction inSourceInstructions needs to haveDIAssignID metadata. If none of them do then nothing happens. If this instruction does not have aDIAssignID attachment but at least one inSourceInstructions does then the merged one will be attached to it. However, instructions without attachments inSourceInstructions are not modified.

Definition at line953 of fileDebugInfo.cpp.

Referencesassert(),llvm::SmallVectorTemplateCommon< T, typename >::begin(),llvm::SmallVectorBase< Size_T >::empty(),llvm::SmallVectorTemplateCommon< T, typename >::end(),End,getFunction(),getMetadata(),I,llvm::SmallVectorTemplateBase< T, bool >::push_back(),llvm::at::RAUW(), andsetMetadata().

Referenced byllvm::InstCombinerImpl::mergeStoreIntoSuccessor().

◆ moveAfter()[1/2]

void llvm::Instruction::moveAfter(InstListType::iterator MovePos)

Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos.

◆ moveAfter()[2/2]

void Instruction::moveAfter(InstructionMovePos)

Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos.

Definition at line191 of fileInstruction.cpp.

Referenced byrewriteDebugUsers(), andllvm::slpvectorizer::BoUpSLP::vectorizeTree().

◆ moveAfterPreserving()

void Instruction::moveAfterPreserving(InstructionMovePos)

SeemoveBeforePreserving .

Definition at line199 of fileInstruction.cpp.

◆ moveBefore()[1/3]

void Instruction::moveBefore(BasicBlockBB,
InstListType::iterator I 
)

Unlink this instruction and insert into BB before I.

Precondition
I is a valid iterator into BB.

Definition at line207 of fileInstruction.cpp.

◆ moveBefore()[2/3]

void Instruction::moveBefore(InstListType::iterator InsertPos)

Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos.

Definition at line179 of fileInstruction.cpp.

◆ moveBefore()[3/3]

void Instruction::moveBefore(InstructionMovePos)

Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos.

Deprecated in favour of the iterator-accepting flavour. Iterators at the start of a block such asBasicBlock::getFirstNonPHIIt must be passed into moveBefore without unwrapping/rewrapping. For all other positions, call getIterator to fetch the instruction iterator.

Definition at line175 of fileInstruction.cpp.

Referenced byllvm::VPlan::execute(),llvm::CodeExtractor::extractCodeRegion(),llvm::InstCombinerImpl::freezeOtherUses(),NegateValue(),optimizeBranch(),removeEmptyCleanup(),llvm::coro::salvageDebugInfo(),llvm::setWidenableBranchCond(),simplifyRelocatesOffABase(),SinkInstruction(),sinkLastInstruction(),llvm::coro::sinkSpillUsesAfterCoroBegin(),turnGuardIntoBranch(),unswitchNontrivialInvariants(),unswitchTrivialBranch(),versionCallSiteWithCond(),llvm::InstCombinerImpl::visitAllocaInst(),llvm::InstCombinerImpl::visitCallInst(), andllvm::widenWidenableBranch().

◆ moveBeforePreserving()[1/3]

void Instruction::moveBeforePreserving(BasicBlockBB,
InstListType::iterator I 
)

Perform amoveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions.

This implicitly means that any adjacent debug-info should move with this instruction.

Definition at line211 of fileInstruction.cpp.

◆ moveBeforePreserving()[2/3]

void Instruction::moveBeforePreserving(InstListType::iterator MovePos)

Perform amoveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions.

This implicitly means that any adjacent debug-info should move with this instruction.

Definition at line187 of fileInstruction.cpp.

Referenced byllvm::MergeBlockIntoPredecessor(), andraiseUserConstantDataAllocasToEntryBlock().

◆ moveBeforePreserving()[3/3]

void Instruction::moveBeforePreserving(InstructionMovePos)

Perform amoveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions.

This implicitly means that any adjacent debug-info should move with this instruction.

Deprecated in favour of the iterator-accepting flavour of moveBeforePreserving, as all insertions should be at iterator positions.

Definition at line183 of fileInstruction.cpp.

◆ operator=()

Instruction & llvm::Instruction::operator=(constInstruction)
delete

◆ removeFromParent()

void Instruction::removeFromParent()

This method unlinks 'this' from the containing basic block, but does not delete it.

Definition at line80 of fileInstruction.cpp.

Referencesllvm::sandboxir::Tracker::track().

Referenced byDbgInserterHelper(),llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(),llvm::InstCombinerImpl::matchBSwapOrBitReverse(),rewritePHIsForCleanupPad(), andllvm::JumpThreadingPass::unfoldSelectInstr().

◆ replaceSuccessorWith()

void Instruction::replaceSuccessorWith(BasicBlockOldBB,
BasicBlockNewBB 
)

Replace specified successor OldBB to point at the provided block.

This instruction must be a terminator.

Definition at line1311 of fileInstruction.cpp.

Referenced byinsertUniqueBackedgeBlock().

◆ setAAMetadata()

void Instruction::setAAMetadata(constAAMDNodesN)

Sets theAA metadata on this instruction from theAAMDNodes structure.

Definition at line1764 of fileMetadata.cpp.

ReferencesN, andsetMetadata().

Referenced bydoPromotion(),foldConsecutiveLoads(),llvm::InstCombinerImpl::mergeStoreIntoSuccessor(),llvm::promoteLoopAccessesToScalars(),llvm::InstCombinerImpl::SimplifyAnyMemTransfer(),llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(),speculateSelectInstLoads(),unpackLoadToAggregate(),unpackStoreToAggregate(), andllvm::InstCombinerImpl::visitExtractValueInst().

◆ setDebugLoc()

void llvm::Instruction::setDebugLoc(DebugLoc Loc)
inline

Set the debug location information for this instruction.

Definition at line508 of fileInstruction.h.

Referenced byaddBoundsChecking(),applyFirstDebugLoc(),applyMergedLocation(),buildClonedLoopBlocks(),cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(),llvm::createCallMatchingInvoke(),llvm::DbgVariableRecord::createDebugIntrinsic(),createFFSIntrinsic(),createPopcntIntrinsic(),llvm::OpenMPIRBuilder::createTask(),DoFlattenLoopPair(),dropLocation(),llvm::OpenMPIRBuilder::emitTargetTask(),llvm::VPWidenIntOrFpInductionRecipe::execute(),llvm::VPWidenPointerInductionRecipe::execute(),fixupDebugInfoPostExtraction(),foldCondBranchOnValueKnownInPredecessorImpl(),llvm::InstCombinerImpl::foldOpIntoPhi(),formLCSSAForInstructionsImpl(),generateReproducer(),llvm::SSAUpdater::GetValueInMiddleOfBlock(),HandleByValArgumentInit(),INITIALIZE_PASS(),llvm::InlineFunction(),insertCall(),insertUniqueBackedgeBlock(),llvm::AMDGPU::instrumentAddressImpl(),LowerNegateToMultiply(),llvm::InstCombinerImpl::mergeStoreIntoSuccessor(),NegateValue(),optimizeDivRem(),OptimizeExtractBits(),performBlockTailMerging(),llvm::InstCombinerImpl::PHIArgMergedDebugLoc(),llvm::JumpThreadingPass::processBlock(),processCall(),llvm::JumpThreadingPass::processImpliedCondition(),processSaturatingInst(),llvm::JumpThreadingPass::processThreadableEdges(),llvm::promoteLoopAccessesToScalars(),llvm::SCCPSolver::removeNonFeasibleEdges(),llvm::removeUnwindEdge(),replaceArgumentUses(),replaceConditionalBranchesOnConstant(),llvm::replaceSignedInst(),llvm::coro::salvageDebugInfo(),llvm::setProbeDistributionFactor(),llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(),sinkAndCmp0Expression(),sinkCmpExpression(),SinkShiftAndTruncate(),llvm::SplitBlockAndInsertIfThenElse(),SplitBlockPredecessorsImpl(),splitCallSite(),llvm::SplitKnownCriticalEdge(),SplitLandingPadPredecessorsImpl(),llvm::splitLoopBound(),llvm::JumpThreadingPass::threadEdge(),llvm::JumpThreadingPass::threadGuard(),tryToShorten(),TryToShrinkGlobalToBoolean(),llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(),llvm::UnrollRuntimeLoopRemainder(),unswitchNontrivialInvariants(),unswitchTrivialBranch(),unswitchTrivialSwitch(), andupdateForIncomingValueLocation().

◆ setFast()

void Instruction::setFast(bool B)

Set or clear all fast-math-flags on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line561 of fileInstruction.cpp.

Referenced byllvm::InstModificationIRStrategy::mutate().

◆ setFastMathFlags()

void Instruction::setFastMathFlags(FastMathFlags FMF)

Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags.

See LangRef.html for the meaning of these flags.

Definition at line601 of fileInstruction.cpp.

Referenced byCreateAdd(),CreateMul(),llvm::BinaryOperator::CreateWithFMF(),llvm::InstCombinerImpl::foldSelectOpOp(),foldShuffleOfUnaryOps(),llvm::InstCombinerImpl::SimplifyAssociativeOrCommutative(), andllvm::InstCombinerImpl::visitFNeg().

◆ setHasAllowContract()

void Instruction::setHasAllowContract(bool B)

Set or clear the allow-contract flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line591 of fileInstruction.cpp.

Referenced byllvm::InstModificationIRStrategy::mutate().

◆ setHasAllowReassoc()

void Instruction::setHasAllowReassoc(bool B)

Set or clear the reassociation flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line566 of fileInstruction.cpp.

Referenced byllvm::InstModificationIRStrategy::mutate().

◆ setHasAllowReciprocal()

void Instruction::setHasAllowReciprocal(bool B)

Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line586 of fileInstruction.cpp.

Referenced byllvm::InstModificationIRStrategy::mutate().

◆ setHasApproxFunc()

void Instruction::setHasApproxFunc(bool B)

Set or clear the approximate-math-functions flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line596 of fileInstruction.cpp.

Referenced byllvm::InstModificationIRStrategy::mutate().

◆ setHasNoInfs()

void Instruction::setHasNoInfs(bool B)

Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line576 of fileInstruction.cpp.

Referenced byfoldFNegIntoConstant(),llvm::InstCombinerImpl::foldSelectIntoOp(), andllvm::InstModificationIRStrategy::mutate().

◆ setHasNoNaNs()

void Instruction::setHasNoNaNs(bool B)

Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line571 of fileInstruction.cpp.

Referencesllvm::sandboxir::Instruction::setInsertPos().

Referenced byllvm::InstCombinerImpl::foldSelectIntoOp(), andllvm::InstModificationIRStrategy::mutate().

◆ setHasNoSignedWrap()

void Instruction::setHasNoSignedWrap(bool b =true)

Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line386 of fileInstruction.cpp.

Referenced byllvm::InstCombinerImpl::commonShiftTransforms(),llvm::BinaryOperator::CreateNSW(),llvm::InstCombinerImpl::foldAddWithConstant(),foldCttzCtlz(),foldIntrinsicUsingDistributiveLaws(),foldShiftedShift(),llvm::ConstantExpr::getAsInstruction(),llvm::SCEVExpander::hoistIVInc(),llvm::InstModificationIRStrategy::mutate(),NegateValue(),llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(),llvm::refineInstruction(),simplifyIRemMulShl(),llvm::InstCombinerImpl::visitMul(), andllvm::InstCombinerImpl::visitSub().

◆ setHasNoSignedZeros()

void Instruction::setHasNoSignedZeros(bool B)

Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line581 of fileInstruction.cpp.

Referenced byfoldFNegIntoConstant(),llvm::InstCombinerImpl::foldSelectIntoOp(),llvm::InstModificationIRStrategy::mutate(), andllvm::InstCombinerImpl::visitFNeg().

◆ setHasNoUnsignedWrap()

void Instruction::setHasNoUnsignedWrap(bool b =true)

Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line379 of fileInstruction.cpp.

Referenced byllvm::InstCombinerImpl::commonShiftTransforms(),llvm::BinaryOperator::CreateNUW(),llvm::InstCombinerImpl::foldAddWithConstant(),foldCttzCtlz(),foldIntrinsicUsingDistributiveLaws(),foldShiftedShift(),llvm::ConstantExpr::getAsInstruction(),llvm::SCEVExpander::hoistIVInc(),llvm::InstModificationIRStrategy::mutate(),NegateValue(),llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(),llvm::refineInstruction(),simplifyIRemMulShl(),llvm::InstCombinerImpl::visitMul(), andllvm::InstCombinerImpl::visitSub().

◆ setIsExact()

void Instruction::setIsExact(bool b =true)

Set or clear the exact flag on this instruction, which must be an operator which supports this flag.

See LangRef.html for the meaning of this flag.

Definition at line393 of fileInstruction.cpp.

Referenced byllvm::InstCombinerImpl::commonIDivTransforms(),llvm::InstCombinerImpl::commonShiftTransforms(),llvm::BinaryOperator::CreateExact(),foldShiftedShift(),llvm::ConstantExpr::getAsInstruction(),llvm::InstModificationIRStrategy::mutate(),llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(),llvm::replaceSignedInst(),llvm::InstCombinerImpl::SimplifyDemandedUseBits(),llvm::InstCombinerImpl::visitAShr(),llvm::InstCombinerImpl::visitSDiv(), andllvm::InstCombinerImpl::visitUDiv().

◆ setMetadata()[1/2]

void Instruction::setMetadata(StringRef Kind,
MDNodeNode 
)

Definition at line1612 of fileMetadata.cpp.

Referencesllvm::Value::getContext(),hasMetadata(), andsetMetadata().

◆ setMetadata()[2/2]

void Instruction::setMetadata(unsigned KindID,
MDNodeNode 
)

Set the metadata of the specified kind to the specified node.

This updates or replaces metadata if already present, or removes it ifNode is null.

Definition at line1679 of fileMetadata.cpp.

Referencesassert(),hasMetadata(), andllvm::Value::setMetadata().

Referenced byAddAliasScopeMetadata(),addAnnotationMetadata(),addBasicBlockMetadata(),llvm::LoopVersioning::annotateInstWithNoAlias(),llvm::annotateValueSite(),llvm::memprof::CallStackTrie::buildAndAttachMIBMetadata(),combineStoreToNewValue(),llvm::ConstantFoldTerminator(),convertFSqrtDivIntoFMul(),copyMetadataForAtomic(),llvm::copyMetadataForLoad(),llvm::copyNonnullMetadata(),llvm::copyRangeMetadata(),llvm::createCallMatchingInvoke(),llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(),llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(),llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(),llvm::IRBuilderBase::CreateMemSet(),llvm::IRBuilderBase::CreateMemSetInline(),llvm::IRBuilderBase::CreateMemTransferInst(),llvm::IRBuilderBase::CreatePreserveArrayAccessIndex(),llvm::IRBuilderBase::CreatePreserveStructAccessIndex(),llvm::IRBuilderBase::CreatePreserveUnionAccessIndex(),llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(),findBasePointer(),handlePhiDef(),insertNewDbgInst(),insertUniqueBackedgeBlock(),mergeDIAssignID(),migrateDebugInfo(),llvm::MetadataLoader::MetadataLoaderImpl::parseMetadataAttachment(),performBranchToCommonDestFolding(),llvm::promoteCall(),propagateMemProfHelper(),llvm::propagateMetadata(),setAAMetadata(),llvm::setIrrLoopHeaderMetadata(),llvm::setLoopEstimatedTripCount(),setMetadata(),setNoSanitizeMetadata(),llvm::InstCombinerImpl::SimplifyAnyMemTransfer(),llvm::SplitBlockAndInsertIfThenElse(),SplitBlockPredecessorsImpl(),translateBranchMetadata(),unswitchNontrivialInvariants(),upgradeAMDGCNIntrinsicCall(), andupgradeX86IntrinsicCall().

◆ setNonNeg()

void Instruction::setNonNeg(bool b =true)

Set or clear the nneg flag on this instruction, which must be a zext instruction.

Definition at line397 of fileInstruction.cpp.

Referenced byllvm::refineInstruction(),llvm::replaceSignedInst(),llvm::InstCombinerImpl::visitUIToFP(), andllvm::InstCombinerImpl::visitZExt().

◆ setNoSanitizeMetadata()

void Instruction::setNoSanitizeMetadata()

Sets the nosanitize metadata on this instruction.

Definition at line1771 of fileMetadata.cpp.

Referencesllvm::MDNode::get(),llvm::Value::getContext(), andsetMetadata().

◆ setSubclassData()

template<typename BitfieldElement >
void llvm::Instruction::setSubclassData(typename BitfieldElement::Type Value)
inlineprotected

Definition at line1072 of fileInstruction.h.

◆ setSuccessor()

void Instruction::setSuccessor(unsigned Idx,
BasicBlockBB 
)

Update the specified successor to point at the provided block.

This instruction must be a terminator.

Definition at line1299 of fileInstruction.cpp.

Referenced bycloneLoopBlocks(),CloneLoopBlocks(),llvm::createMemCpyLoopKnownSize(),llvm::lowerUnaryVectorIntrinsicAsLoop(),llvm::SPIRVMergeRegionExitTargets::replaceBranchTargets(),llvm::SplitKnownCriticalEdge(),llvm::JumpThreadingPass::threadEdge(), andllvm::JumpThreadingPass::threadThroughTwoBasicBlocks().

◆ swapProfMetadata()

void Instruction::swapProfMetadata()

If the instruction has "branch_weights" MD_prof metadata and theMDNode has three operands (including name string), swap the order of the metadata.

Definition at line1322 of fileInstruction.cpp.

Referenced byllvm::BranchInst::swapSuccessors().

◆ updateLocationAfterHoist()

void Instruction::updateLocationAfterHoist()

Updates the debug location given that the instruction has been hoisted from a block to a predecessor of that block.

Note: it is undefined behavior to call this on an instruction not currently inserted into a function.

Definition at line982 of fileDebugInfo.cpp.

ReferencesdropLocation().

◆ user_back()[1/2]

Instruction * llvm::Instruction::user_back()
inline

Specialize the methods defined inValue, as we know that an instruction can only be used by other instructions.

Definition at line169 of fileInstruction.h.

Referenced byfoldInsSequenceIntoSplat(),llvm::InstCombinerImpl::foldIntegerTypedPHI(),llvm::ARMTTIImpl::getArithmeticInstrCost(),llvm::ARMTTIImpl::getCmpSelInstrCost(),llvm::LoopVectorizationCostModel::getReductionPatternCost(),isNotUsedOrFoldableInLoop(),promoteSingleBlockAlloca(),replaceExtractElements(),ShouldBreakUpSubtract(),shouldExpandCmpArithRMWInIR(),llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(),speculatePHINodeLoads(),llvm::FastISel::tryToFoldLoad(),llvm::InstCombinerImpl::visitPHINode(),llvm::InstCombinerImpl::visitSExt(), andllvm::InstCombinerImpl::visitZExt().

◆ user_back()[2/2]

constInstruction * llvm::Instruction::user_back() const
inline

Definition at line170 of fileInstruction.h.

◆ willReturn()

bool Instruction::willReturn() const

Return true if the instruction will return (unwinding is considered as a form of returning control flow here).

Definition at line1194 of fileInstruction.cpp.

Referenced byisRemovableWrite(), andisSafeToMove().

Friends And Related Function Documentation

◆ BasicBlock

friend classBasicBlock
friend

Various leaf nodes.

Definition at line1046 of fileInstruction.h.

◆ SymbolTableListTraits< Instruction, ilist_iterator_bits< true >, ilist_parent< BasicBlock > >

friend classSymbolTableListTraits<Instruction,ilist_iterator_bits<true >,ilist_parent<BasicBlock > >
friend

Definition at line987 of fileInstruction.h.

Member Data Documentation

◆ DebugMarker

DbgMarker* llvm::Instruction::DebugMarker = nullptr

Optional marker recording the position for debugging information that takes effect immediately before this instruction.

Null unless there is debugging information present.

Definition at line84 of fileInstruction.h.

Referenced byllvm::DbgMarker::removeFromParent(), andllvm::DbgMarker::removeMarker().


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

Generated on Sun Jul 20 2025 16:39:01 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp