LLVM
15.0.0git
|
#include "llvm/IR/Instruction.h"
Public Types | |
enum | OperationEquivalenceFlags { CompareIgnoringAlignment = 1<<0, CompareUsingScalarTypes = 1<<1 } |
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 | op_iterator = Use * |
using | const_op_iterator = const Use * |
using | op_range = iterator_range< op_iterator > |
using | const_op_range = iterator_range< const_op_iterator > |
![]() | |
enum | ValueTy |
Concrete subclass of this. More... | |
using | use_iterator = use_iterator_impl< Use > |
using | const_use_iterator = use_iterator_impl< const Use > |
using | user_iterator = user_iterator_impl< User > |
using | const_user_iterator = user_iterator_impl< const User > |
Public Member Functions | |
Instruction (const Instruction &)=delete | |
Instruction & | operator= (const Instruction &)=delete |
Instruction * | user_back () |
Specialize the methods defined in Value, as we know that an instruction can only be used by other instructions. More... | |
const Instruction * | user_back () const |
const BasicBlock * | getParent () const |
BasicBlock * | getParent () |
const Module * | getModule () const |
Return the module owning the function this instruction belongs to or nullptr it the function does not have a module. More... | |
Module * | getModule () |
const Function * | getFunction () const |
Return the function this instruction belongs to. More... | |
Function * | getFunction () |
void | removeFromParent () |
This method unlinks 'this' from the containing basic block, but does not delete it. More... | |
SymbolTableList< Instruction >::iterator | eraseFromParent () |
This method unlinks 'this' from the containing basic block and deletes it. More... | |
void | insertBefore (Instruction *InsertPos) |
Insert an unlinked instruction into a basic block immediately before the specified instruction. More... | |
void | insertAfter (Instruction *InsertPos) |
Insert an unlinked instruction into a basic block immediately after the specified instruction. More... | |
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. More... | |
void | moveBefore (BasicBlock &BB, SymbolTableList< Instruction >::iterator I) |
Unlink this instruction and insert into BB before I. More... | |
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. More... | |
bool | comesBefore (const Instruction *Other) const |
Given an instruction Other in the same basic block as this instruction, return true if this instruction comes before Other. More... | |
unsigned | getOpcode () const |
Returns a member of one of the enums like Instruction::Add. More... | |
const char * | getOpcodeName () const |
bool | isTerminator () const |
bool | isUnaryOp () const |
bool | isBinaryOp () const |
bool | isIntDivRem () const |
bool | isShift () const |
bool | isCast () const |
bool | isFuncletPad () const |
bool | isExceptionalTerminator () const |
bool | isOnlyUserOfAnyOperand () |
It checks if this instruction is the only user of at least one of its operands. More... | |
bool | isIndirectTerminator () const |
bool | isLogicalShift () const |
Return true if this is a logical shift left or a logical shift right. More... | |
bool | isArithmeticShift () const |
Return true if this is an arithmetic shift right. More... | |
bool | isBitwiseLogicOp () const |
Return true if this is and/or/xor. More... | |
bool | hasMetadata () const |
Return true if this instruction has any metadata attached to it. More... | |
bool | hasMetadataOtherThanDebugLoc () const |
Return true if this instruction has metadata attached to it other than a debug location. More... | |
bool | hasMetadata (unsigned KindID) const |
Return true if this instruction has the given type of metadata attached. More... | |
bool | hasMetadata (StringRef Kind) const |
Return true if this instruction has the given type of metadata attached. More... | |
MDNode * | getMetadata (unsigned KindID) const |
Get the metadata of given kind attached to this Instruction. More... | |
MDNode * | getMetadata (StringRef Kind) const |
Get the metadata of given kind attached to this Instruction. More... | |
void | getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const |
Get all metadata attached to this Instruction. More... | |
void | getAllMetadataOtherThanDebugLoc (SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const |
This does the same thing as getAllMetadata, except that it filters out the debug location. More... | |
void | setMetadata (unsigned KindID, MDNode *Node) |
Set the metadata of the specified kind to the specified node. More... | |
void | setMetadata (StringRef Kind, MDNode *Node) |
void | copyMetadata (const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >()) |
Copy metadata from SrcInst to this instruction. More... | |
void | swapProfMetadata () |
If the instruction has "branch_weights" MD_prof metadata and the MDNode has three operands (including name string), swap the order of the metadata. More... | |
void | addAnnotationMetadata (StringRef Annotation) |
Adds an !annotation metadata node with Annotation to this instruction. More... | |
AAMDNodes | getAAMetadata () const |
Returns the AA metadata for this instruction. More... | |
void | setAAMetadata (const AAMDNodes &N) |
Sets the AA metadata on this instruction from the AAMDNodes structure. More... | |
bool | extractProfMetadata (uint64_t &TrueVal, uint64_t &FalseVal) const |
Retrieve the raw weight values of a conditional branch or select. More... | |
bool | extractProfTotalWeight (uint64_t &TotalVal) const |
Retrieve total raw weight values of a branch. More... | |
void | setDebugLoc (DebugLoc Loc) |
Set the debug location information for this instruction. More... | |
const DebugLoc & | getDebugLoc () const |
Return the debug location for this node as a DebugLoc. More... | |
void | setHasNoUnsignedWrap (bool b=true) |
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag. More... | |
void | setHasNoSignedWrap (bool b=true) |
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag. More... | |
void | setIsExact (bool b=true) |
Set or clear the exact flag on this instruction, which must be an operator which supports this flag. More... | |
bool | hasNoUnsignedWrap () const |
Determine whether the no unsigned wrap flag is set. More... | |
bool | hasNoSignedWrap () const |
Determine whether the no signed wrap flag is set. More... | |
bool | hasPoisonGeneratingFlags () const |
Return true if this operator has flags which may cause this instruction to evaluate to poison despite having non-poison inputs. More... | |
void | dropPoisonGeneratingFlags () |
Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs. More... | |
void | dropUndefImplyingAttrsAndUnknownMetadata (ArrayRef< unsigned > KnownIDs={}) |
This function drops non-debug unknown metadata (through dropUnknownNonDebugMetadata). More... | |
bool | isExact () const |
Determine whether the exact flag is set. More... | |
void | setFast (bool B) |
Set or clear all fast-math-flags on this instruction, which must be an operator which supports this flag. More... | |
void | setHasAllowReassoc (bool B) |
Set or clear the reassociation flag on this instruction, which must be an operator which supports this flag. More... | |
void | setHasNoNaNs (bool B) |
Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag. More... | |
void | setHasNoInfs (bool B) |
Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag. More... | |
void | setHasNoSignedZeros (bool B) |
Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag. More... | |
void | setHasAllowReciprocal (bool B) |
Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag. More... | |
void | setHasAllowContract (bool B) |
Set or clear the allow-contract flag on this instruction, which must be an operator which supports this flag. More... | |
void | setHasApproxFunc (bool B) |
Set or clear the approximate-math-functions flag on this instruction, which must be an operator which supports this flag. More... | |
void | setFastMathFlags (FastMathFlags FMF) |
Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags. More... | |
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. More... | |
bool | isFast () const |
Determine whether all fast-math-flags are set. More... | |
bool | hasAllowReassoc () const |
Determine whether the allow-reassociation flag is set. More... | |
bool | hasNoNaNs () const |
Determine whether the no-NaNs flag is set. More... | |
bool | hasNoInfs () const |
Determine whether the no-infs flag is set. More... | |
bool | hasNoSignedZeros () const |
Determine whether the no-signed-zeros flag is set. More... | |
bool | hasAllowReciprocal () const |
Determine whether the allow-reciprocal flag is set. More... | |
bool | hasAllowContract () const |
Determine whether the allow-contract flag is set. More... | |
bool | hasApproxFunc () const |
Determine whether the approximate-math-functions flag is set. More... | |
FastMathFlags | getFastMathFlags () const |
Convenience function for getting all the fast-math flags, which must be an operator which supports these flags. More... | |
void | copyFastMathFlags (const Instruction *I) |
Copy I's fast-math flags. More... | |
void | copyIRFlags (const Value *V, bool IncludeWrapFlags=true) |
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this instruction. More... | |
void | andIRFlags (const Value *V) |
Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction. More... | |
void | applyMergedLocation (const DILocation *LocA, const DILocation *LocB) |
Merge 2 debug locations and apply it to the Instruction. More... | |
void | updateLocationAfterHoist () |
Updates the debug location given that the instruction has been hoisted from a block to a predecessor of that block. More... | |
void | dropLocation () |
Drop the instruction's debug location. More... | |
bool | isAssociative () const LLVM_READONLY |
Return true if the instruction is associative: More... | |
bool | isCommutative () const LLVM_READONLY |
Return true if the instruction is commutative: More... | |
bool | isIdempotent () const |
Return true if the instruction is idempotent: More... | |
bool | isNilpotent () const |
Return true if the instruction is nilpotent: More... | |
bool | mayWriteToMemory () const |
Return true if this instruction may modify memory. More... | |
bool | mayReadFromMemory () const |
Return true if this instruction may read memory. More... | |
bool | mayReadOrWriteMemory () const |
Return true if this instruction may read or write memory. More... | |
bool | isAtomic () const |
Return true if this instruction has an AtomicOrdering of unordered or higher. More... | |
bool | hasAtomicLoad () const |
Return true if this atomic instruction loads from memory. More... | |
bool | hasAtomicStore () const |
Return true if this atomic instruction stores to memory. More... | |
bool | isVolatile () const |
Return true if this instruction has a volatile memory access. More... | |
bool | mayThrow () const |
Return true if this instruction may throw an exception. More... | |
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. More... | |
bool | mayHaveSideEffects () const |
Return true if the instruction may have side effects. More... | |
bool | isSafeToRemove () const |
Return true if the instruction can be removed if the result is unused. More... | |
bool | willReturn () const |
Return true if the instruction will return (unwinding is considered as a form of returning control flow here). More... | |
bool | isEHPad () const |
Return true if the instruction is a variety of EH-block. More... | |
bool | isLifetimeStartOrEnd () const |
Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker. More... | |
bool | isLaunderOrStripInvariantGroup () const |
Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group. More... | |
bool | isDebugOrPseudoInst () const |
Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst. More... | |
const 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. More... | |
Instruction * | getNextNonDebugInstruction (bool SkipPseudoOp=false) |
const 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. More... | |
Instruction * | getPrevNonDebugInstruction (bool SkipPseudoOp=false) |
Instruction * | clone () const |
Create a copy of 'this' instruction that is identical in all ways except the following: More... | |
bool | isIdenticalTo (const Instruction *I) const |
Return true if the specified instruction is exactly identical to the current one. More... | |
bool | isIdenticalToWhenDefined (const Instruction *I) const |
This is like isIdenticalTo, except that it ignores the SubclassOptionalData flags, which may specify conditions under which the instruction's result is undefined. More... | |
bool | isSameOperationAs (const Instruction *I, unsigned flags=0) const |
This function determines if the specified instruction executes the same operation as the current one. More... | |
bool | isUsedOutsideOfBlock (const BasicBlock *BB) const |
Return true if there are any uses of this instruction in blocks other than the specified block. More... | |
unsigned | getNumSuccessors () const |
Return the number of successors that this instruction has. More... | |
BasicBlock * | getSuccessor (unsigned Idx) const |
Return the specified successor. This instruction must be a terminator. More... | |
void | setSuccessor (unsigned Idx, BasicBlock *BB) |
Update the specified successor to point at the provided block. More... | |
void | replaceSuccessorWith (BasicBlock *OldBB, BasicBlock *NewBB) |
Replace specified successor OldBB to point at the provided block. More... | |
void | dropUnknownNonDebugMetadata (ArrayRef< unsigned > KnownIDs) |
Drop all unknown metadata except for debug locations. More... | |
void | dropUnknownNonDebugMetadata () |
void | dropUnknownNonDebugMetadata (unsigned ID1) |
void | dropUnknownNonDebugMetadata (unsigned ID1, unsigned ID2) |
![]() | |
User (const User &)=delete | |
void | operator delete (void *Usr) |
Free memory allocated for User and Use objects. More... | |
void | operator delete (void *Usr, unsigned) |
Placement delete - required by std, called if the ctor throws. More... | |
void | operator delete (void *Usr, unsigned, unsigned) |
Placement delete - required by std, called if the ctor throws. More... | |
const Use * | getOperandList () const |
Use * | getOperandList () |
Value * | getOperand (unsigned i) const |
void | setOperand (unsigned i, Value *Val) |
const Use & | getOperandUse (unsigned i) const |
Use & | getOperandUse (unsigned i) |
unsigned | getNumOperands () const |
ArrayRef< const uint8_t > | getDescriptor () const |
Returns the descriptor co-allocated with this User instance. More... | |
MutableArrayRef< uint8_t > | getDescriptor () |
Returns the descriptor co-allocated with this User instance. More... | |
void | setGlobalVariableNumOperands (unsigned NumOps) |
Set the number of operands on a GlobalVariable. More... | |
void | setNumHungOffUseOperands (unsigned NumOps) |
Subclasses with hung off uses need to manage the operand count themselves. More... | |
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. More... | |
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_iterator > | operand_values () |
const_value_op_iterator | value_op_begin () const |
const_value_op_iterator | value_op_end () const |
iterator_range< const_value_op_iterator > | operand_values () const |
void | dropAllReferences () |
Drop all references to operands. More... | |
bool | replaceUsesOfWith (Value *From, Value *To) |
Replace uses of one Value with another. More... | |
![]() | |
Value (const Value &)=delete | |
Value & | operator= (const Value &)=delete |
void | deleteValue () |
Delete a pointer to a generic Value. More... | |
void | dump () const |
Support for debugging, callable in GDB: V->dump() More... | |
Type * | getType () const |
All values are typed, get the type of this value. More... | |
LLVMContext & | getContext () const |
All values hold a context through their type. More... | |
bool | hasName () const |
ValueName * | getValueName () const |
void | setValueName (ValueName *VN) |
StringRef | getName () const |
Return a constant reference to the value's name. More... | |
void | setName (const Twine &Name) |
Change the name of the value. More... | |
void | takeName (Value *V) |
Transfer the name from V to this value. More... | |
std::string | getNameOrAsOperand () const |
void | replaceAllUsesWith (Value *V) |
Change all uses of this to point to a new Value. More... | |
void | replaceNonMetadataUsesWith (Value *V) |
Change non-metadata uses of this to point to a new Value. More... | |
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 given Use. More... | |
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. More... | |
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_iterator > | materialized_uses () |
iterator_range< const_use_iterator > | materialized_uses () const |
iterator_range< use_iterator > | uses () |
iterator_range< const_use_iterator > | uses () 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 |
User * | user_back () |
const User * | user_back () const |
iterator_range< user_iterator > | materialized_users () |
iterator_range< const_user_iterator > | materialized_users () const |
iterator_range< user_iterator > | users () |
iterator_range< const_user_iterator > | users () const |
bool | hasOneUse () const |
Return true if there is exactly one use of this value. More... | |
bool | hasNUses (unsigned N) const |
Return true if this Value has exactly N uses. More... | |
bool | hasNUsesOrMore (unsigned N) const |
Return true if this value has N uses or more. More... | |
bool | hasOneUser () const |
Return true if there is exactly one user of this value. More... | |
Use * | getSingleUndroppableUse () |
Return true if there is exactly one use of this value that cannot be dropped. More... | |
const Use * | getSingleUndroppableUse () const |
User * | getUniqueUndroppableUser () |
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). More... | |
const User * | getUniqueUndroppableUser () const |
bool | hasNUndroppableUses (unsigned N) const |
Return true if there this value. More... | |
bool | hasNUndroppableUsesOrMore (unsigned N) const |
Return true if this value has N uses or more. More... | |
void | dropDroppableUses (llvm::function_ref< bool(const Use *)> ShouldDrop=[](const Use *) { return true;}) |
Remove every uses that can safely be removed. More... | |
void | dropDroppableUsesIn (User &Usr) |
Remove every use of this value in User that can safely be removed. More... | |
bool | isUsedInBasicBlock (const BasicBlock *BB) const |
Check if this value is used in the specified basic block. More... | |
unsigned | getNumUses () const |
This method computes the number of uses of this Value. More... | |
void | addUse (Use &U) |
This method should only be used by the Use class. More... | |
unsigned | getValueID () const |
Return an ID for the concrete type of this object. More... | |
unsigned | getRawSubclassOptionalData () const |
Return the raw optional flags value contained in this value. More... | |
void | clearSubclassOptionalData () |
Clear the optional flags contained in this value. More... | |
bool | hasSameSubclassOptionalData (const Value *V) const |
Check the optional flags for equality. More... | |
bool | hasValueHandle () const |
Return true if there is a value handle associated with this value. More... | |
bool | isUsedByMetadata () const |
Return true if there is metadata referencing this value. More... | |
bool | isTransitiveUsedByMetadataOnly () const |
bool | isSwiftError () const |
Return true if this value is a swifterror value. More... | |
const Value * | stripPointerCasts () const |
Strip off pointer casts, all-zero GEPs and address space casts. More... | |
Value * | stripPointerCasts () |
const Value * | stripPointerCastsAndAliases () const |
Strip off pointer casts, all-zero GEPs, address space casts, and aliases. More... | |
Value * | stripPointerCastsAndAliases () |
const Value * | stripPointerCastsSameRepresentation () const |
Strip off pointer casts, all-zero GEPs and address space casts but ensures the representation of the result stays the same. More... | |
Value * | stripPointerCastsSameRepresentation () |
const Value * | stripPointerCastsForAliasAnalysis () const |
Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info. More... | |
Value * | stripPointerCastsForAliasAnalysis () |
const Value * | stripInBoundsConstantOffsets () const |
Strip off pointer casts and all-constant inbounds GEPs. More... | |
Value * | stripInBoundsConstantOffsets () |
const Value * | stripAndAccumulateConstantOffsets (const DataLayout &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. More... | |
Value * | stripAndAccumulateConstantOffsets (const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false) |
const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
This is a wrapper around stripAndAccumulateConstantOffsets with the in-bounds requirement set to false. More... | |
Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
const Value * | stripInBoundsOffsets (function_ref< void(const Value *)> Func=[](const Value *) {}) const |
Strip off pointer casts and inbounds GEPs. More... | |
Value * | stripInBoundsOffsets (function_ref< void(const Value *)> Func=[](const Value *) {}) |
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. More... | |
uint64_t | getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull, bool &CanBeFreed) const |
Returns the number of bytes known to be dereferenceable for the pointer value. More... | |
Align | getPointerAlignment (const DataLayout &DL) const |
Returns an alignment of the pointer value. More... | |
const Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
Translate PHI node to its predecessor from the given basic block. More... | |
Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) |
void | mutateType (Type *Ty) |
Mutate the type of this Value to be of the specified type. More... | |
template<class Compare > | |
void | sortUseList (Compare Cmp) |
Sort the use-list. More... | |
void | reverseUseList () |
Reverse the use-list. More... | |
void | print (raw_ostream &O, bool IsForDebug=false) const |
Implement operator<< on Value. More... | |
void | print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug=false) const |
void | printAsOperand (raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const |
Print the name of this Value out to the specified raw_ostream. More... | |
void | printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const |
![]() | |
Instruction * | getPrevNode () |
const Instruction * | getPrevNode () const |
Get the previous node, or nullptr for the list head. More... | |
Instruction * | getNextNode () |
Get the next node, or nullptr for the list tail. More... | |
const Instruction * | getNextNode () const |
Get the next node, or nullptr for the list tail. More... | |
![]() | |
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. More... | |
Static Public Member Functions | |
static const char * | getOpcodeName (unsigned OpCode) |
static bool | isTerminator (unsigned OpCode) |
static bool | isUnaryOp (unsigned Opcode) |
static bool | isBinaryOp (unsigned Opcode) |
static bool | isIntDivRem (unsigned Opcode) |
static bool | isShift (unsigned Opcode) |
Determine if the Opcode is one of the shift instructions. More... | |
static bool | isBitwiseLogicOp (unsigned Opcode) |
Determine if the Opcode is and/or/xor. More... | |
static bool | isCast (unsigned OpCode) |
Determine if the OpCode is one of the CastInst instructions. More... | |
static bool | isFuncletPad (unsigned OpCode) |
Determine if the OpCode is one of the FuncletPadInst instructions. More... | |
static bool | isExceptionalTerminator (unsigned OpCode) |
Returns true if the OpCode is a terminator related to exception handling. More... | |
static bool | isIndirectTerminator (unsigned OpCode) |
Returns true if the OpCode is a terminator with indirect targets. More... | |
static bool | isAssociative (unsigned Opcode) |
static bool | isCommutative (unsigned Opcode) |
static bool | isIdempotent (unsigned Opcode) |
static bool | isNilpotent (unsigned Opcode) |
static bool | classof (const Value *V) |
Methods for support type inquiry through isa, cast, and dyn_cast: More... | |
![]() | |
static bool | classof (const Value *V) |
![]() | |
static void | dropDroppableUse (Use &U) |
Remove the droppable use U . More... | |
Protected Member Functions | |
~Instruction () | |
template<typename BitfieldElement > | |
BitfieldElement::Type | getSubclassData () const |
template<typename BitfieldElement > | |
void | setSubclassData (typename BitfieldElement::Type Value) |
Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=nullptr) | |
Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd) | |
![]() | |
void * | operator new (size_t Size) |
Allocate a User with an operand pointer co-allocated. More... | |
void * | operator new (size_t Size, unsigned Us) |
Allocate a User with the operands co-allocated. More... | |
void * | operator new (size_t Size, unsigned Us, unsigned DescBytes) |
Allocate a User with the operands co-allocated. More... | |
User (Type *ty, unsigned vty, Use *, unsigned NumOps) | |
void | allocHungoffUses (unsigned N, bool IsPhi=false) |
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User. More... | |
void | growHungoffUses (unsigned N, bool IsPhi=false) |
Grow the number of hung off uses. More... | |
~User ()=default | |
template<int Idx> | |
Use & | Op () |
template<int Idx> | |
const Use & | Op () const |
![]() | |
Value (Type *Ty, unsigned scid) | |
~Value () | |
Value's destructor should be virtual by design, but that would require that Value and all of its subclasses have a vtable that effectively duplicates the information in the value ID. More... | |
void | getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const |
Appends all metadata attached to this value to MDs , sorting by KindID. More... | |
bool | hasMetadata () const |
Return true if this value has any metadata attached to it. More... | |
bool | eraseMetadata (unsigned KindID) |
Erase all metadata attachments with the given kind. More... | |
void | clearMetadata () |
Erase all metadata attached to this Value. More... | |
unsigned short | getSubclassDataFromValue () const |
void | setValueSubclassData (unsigned short D) |
MDNode * | getMetadata (unsigned KindID) const |
Get the current metadata attachments for the given kind, if any. More... | |
MDNode * | getMetadata (StringRef Kind) const |
void | getMetadata (unsigned KindID, SmallVectorImpl< MDNode * > &MDs) const |
Appends all attachments with the given ID to MDs in insertion order. More... | |
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. More... | |
bool | hasMetadata (StringRef Kind) const |
void | setMetadata (unsigned KindID, MDNode *Node) |
Set a particular kind of metadata attachment. More... | |
void | setMetadata (StringRef Kind, MDNode *Node) |
void | addMetadata (unsigned KindID, MDNode &MD) |
Add a metadata attachment. More... | |
void | addMetadata (StringRef Kind, MDNode &MD) |
![]() | |
ilist_node_with_parent ()=default | |
![]() | |
ilist_node_impl ()=default | |
Friends | |
class | SymbolTableListTraits< Instruction > |
class | BasicBlock |
Various leaf nodes. More... | |
Additional Inherited Members | |
![]() | |
static constexpr unsigned | MaxAlignmentExponent = 32 |
The maximum alignment for instructions. More... | |
static constexpr uint64_t | MaximumAlignment = 1ULL << MaxAlignmentExponent |
![]() | |
template<int Idx, typename U > | |
static Use & | OpFrom (const U *that) |
![]() | |
unsigned char | SubclassOptionalData: 7 |
Hold subclass data that can be dropped. More... | |
unsigned | NumUserOperands: NumUserOperandsBits |
unsigned | IsUsedByMD: 1 |
unsigned | HasName: 1 |
unsigned | HasMetadata: 1 |
unsigned | HasHungOffUses: 1 |
unsigned | HasDescriptor: 1 |
Definition at line 42 of file Instruction.h.
|
protected |
Definition at line 64 of file Instruction.h.
|
protected |
Definition at line 72 of file Instruction.h.
|
protected |
Definition at line 67 of file Instruction.h.
|
protected |
Definition at line 54 of file Instruction.h.
Definition at line 786 of file Instruction.h.
Definition at line 800 of file Instruction.h.
Definition at line 807 of file Instruction.h.
Definition at line 793 of file Instruction.h.
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. |
Definition at line 726 of file Instruction.h.
Definition at line 814 of file Instruction.h.
Definition at line 772 of file Instruction.h.
Definition at line 779 of file Instruction.h.
|
protected |
Definition at line 44 of file Instruction.cpp.
References assert(), llvm::UndefValue::get(), llvm::Value::getType(), llvm::ValueAsMetadata::handleRAUW(), and llvm::Value::isUsedByMetadata().
|
delete |
|
protected |
Definition at line 23 of file Instruction.cpp.
References assert(), BB, llvm::ilist_node_impl< OptionsT >::getIterator(), and getParent().
|
protected |
Definition at line 35 of file Instruction.cpp.
References assert(), and llvm::BasicBlock::getInstList().
void Instruction::addAnnotationMetadata | ( | StringRef | Annotation | ) |
Adds an !annotation metadata node with Annotation
to this instruction.
If this instruction already has !annotation metadata, append Annotation
to the existing node.
Definition at line 1379 of file Metadata.cpp.
References llvm::MDBuilder::createString(), llvm::MDTuple::get(), llvm::Value::getContext(), getMetadata(), N, and setMetadata().
Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction.
Definition at line 322 of file Instruction.cpp.
References copyFastMathFlags(), FP, getFastMathFlags(), hasNoSignedWrap(), hasNoUnsignedWrap(), isExact(), llvm::X86II::OB, setHasNoSignedWrap(), setHasNoUnsignedWrap(), and setIsExact().
Referenced by foldFNegShuffle(), llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(), llvm::InstCombinerImpl::foldSelectOpOp(), NegateValue(), sinkLastInstruction(), and llvm::InstCombinerImpl::visitCallInst().
void Instruction::applyMergedLocation | ( | const DILocation * | LocA, |
const DILocation * | LocB | ||
) |
Merge 2 debug locations and apply it to the Instruction.
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. The DebugLoc attached to this instruction will be overwritten by the merged DebugLoc.
Definition at line 813 of file DebugInfo.cpp.
References llvm::DILocation::getMergedLocation().
Referenced by llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), sinkLastInstruction(), and updateForIncomingValueLocation().
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition at line 765 of file Instruction.h.
References llvm::Value::getValueID().
Instruction * Instruction::clone | ( | ) | const |
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition at line 862 of file Instruction.cpp.
References getOpcode(), llvm_unreachable, and llvm::Value::SubclassOptionalData.
Referenced by buildPartialInvariantUnswitchConditionalBranch(), CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), llvm::ehAwareSplitEdge(), findOrCreatePHIInBlock(), llvm::FoldReturnIntoUncondBranch(), MergeCompatibleInvokesImpl(), rematerializeLiveValues(), replaceGEPIdxWithZero(), rewriteMaterializableInstructions(), llvm::InnerLoopVectorizer::scalarizeInstruction(), SplitLandingPadPredecessorsImpl(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), and llvm::versionCallSite().
bool Instruction::comesBefore | ( | const Instruction * | Other | ) | 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 line 110 of file Instruction.cpp.
References assert(), llvm::BasicBlock::isInstrOrderValid(), Other, and llvm::BasicBlock::renumberInstructions().
Referenced by domTreeLevelBefore(), llvm::InstructionPrecedenceTracking::isPreceededBySpecialInstruction(), llvm::isValidAssumeForContext(), llvm::BasicBlock::validateInstrOrdering(), and llvm::slpvectorizer::BoUpSLP::vectorizeTree().
void Instruction::copyFastMathFlags | ( | const Instruction * | I | ) |
Copy I's fast-math flags.
Definition at line 294 of file Instruction.cpp.
References copyFastMathFlags(), and I.
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 line 244 of file Instruction.cpp.
References assert().
Referenced by andIRFlags(), copyFastMathFlags(), copyIRFlags(), llvm::GCNTTIImpl::instCombineIntrinsic(), modifyIntrinsicCall(), replaceWithTLIFunction(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFPTrunc(), and llvm::InnerLoopVectorizer::widenCallInstruction().
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this instruction.
Definition at line 298 of file Instruction.cpp.
References copyFastMathFlags(), FP, llvm::X86II::OB, setHasNoSignedWrap(), setHasNoUnsignedWrap(), and setIsExact().
Referenced by llvm::CmpInst::CmpInst(), llvm::UnaryOperator::CreateWithCopiedFlags(), llvm::BinaryOperator::CreateWithCopiedFlags(), foldFNegShuffle(), llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(), llvm::InstCombinerImpl::foldSelectIntoOp(), llvm::InstCombinerImpl::foldSelectOpOp(), foldSelectShuffleWith1Binop(), llvm::InstCombinerImpl::foldVariableSignZeroExtensionOfVariableHighBitExtract(), llvm::InstCombinerImpl::foldVectorBinop(), and llvm::InstCombinerImpl::visitCallInst().
void Instruction::copyMetadata | ( | const Instruction & | SrcInst, |
ArrayRef< unsigned > | WL = ArrayRef<unsigned>() |
||
) |
Copy metadata from SrcInst
to this instruction.
WL
, if not empty, specifies the list of meta data that needs to be copied. If WL
is empty, all meta data will be copied.
Definition at line 841 of file Instruction.cpp.
References getAllMetadataOtherThanDebugLoc(), getDebugLoc(), hasMetadata(), M, setDebugLoc(), setMetadata(), and llvm::ARMISD::WLS.
Referenced by llvm::ConstantFoldTerminator(), llvm::SelectInst::Create(), llvm::createCallMatchingInvoke(), llvm::IRBuilderBase::CreateCondBr(), doPromotion(), instCombineSVELD1(), instCombineSVEST1(), modifyIntrinsicCall(), simplifyAMDGCNMemoryIntrinsicDemanded(), and llvm::InstCombinerImpl::visitSub().
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 the setDebugLoc() API. Note: it is undefined behavior to call this on an instruction not currently inserted into a function.
Definition at line 820 of file DebugInfo.cpp.
References DL, llvm::MDNode::get(), getDebugLoc(), getFunction(), and llvm::Function::getSubprogram().
void Instruction::dropPoisonGeneratingFlags | ( | ) |
Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs.
Definition at line 147 of file Instruction.cpp.
References llvm::MCID::Add, assert(), getOpcode(), hasPoisonGeneratingFlags(), Mul, setHasNoInfs(), setHasNoNaNs(), and setHasNoUnsignedWrap().
Referenced by clearAssumptionsOfUsers(), foldSelectShuffleWith1Binop(), and llvm::InnerLoopVectorizer::scalarizeInstruction().
void Instruction::dropUndefImplyingAttrsAndUnknownMetadata | ( | ArrayRef< unsigned > | KnownIDs = {} | ) |
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 line 176 of file Instruction.cpp.
References llvm::AArch64CC::AL, dropUnknownNonDebugMetadata(), and llvm::AttributeFuncs::getUBImplyingAttributes().
Referenced by CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses().
|
inline |
Definition at line 330 of file Instruction.h.
References llvm::None.
Referenced by dropUndefImplyingAttrsAndUnknownMetadata(), and dropUnknownNonDebugMetadata().
void Instruction::dropUnknownNonDebugMetadata | ( | ArrayRef< unsigned > | KnownIDs | ) |
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. dropUndefImplyingAttrsAndUnknownMetadata should be used instead of this API if the Instruction being modified is a call.
Definition at line 1340 of file Metadata.cpp.
References assert(), llvm::ArrayRef< T >::begin(), llvm::Value::clearMetadata(), llvm::SmallSet< T, N, C >::count(), llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::end(), llvm::Value::getContext(), llvm::Value::hasMetadata(), I, Info, llvm::SmallSet< T, N, C >::insert(), llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::ValueMetadata.
Referenced by llvm::combineMetadata().
|
inline |
Definition at line 333 of file Instruction.h.
References dropUnknownNonDebugMetadata(), and llvm::makeArrayRef().
|
inline |
Definition at line 336 of file Instruction.h.
References dropUnknownNonDebugMetadata().
iplist< Instruction >::iterator Instruction::eraseFromParent | ( | ) |
This method unlinks 'this' from the containing basic block and deletes it.
Definition at line 77 of file Instruction.cpp.
References llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< Instruction, Options... >::type >::getIterator(), and getParent().
Referenced by llvm::LanaiInstrInfo::analyzeBranch(), buildClonedLoopBlocks(), BuildSubAggregate(), llvm::changeToCall(), llvm::CloneAndPruneIntoFromInst(), CloneLoopBlocks(), ConnectEpilog(), ConnectProlog(), GeneratedRTChecks::Create(), llvm::OpenMPIRBuilder::createAtomicCompare(), llvm::OpenMPIRBuilder::createCopyinClauseBlocks(), createMemMoveLoop(), createMemSetLoop(), llvm::OpenMPIRBuilder::createParallel(), llvm::OpenMPIRBuilder::createReductions(), llvm::OpenMPIRBuilder::createTask(), despeculateCountZeros(), DoFlattenLoopPair(), EliminateDuplicatePHINodesNaiveImpl(), GeneratedRTChecks::emitSCEVChecks(), llvm::objcarc::BundledRetainClaimRVs::eraseInst(), llvm::objcarc::EraseInstruction(), EraseTerminatorAndDCECond(), llvm::expandAtomicRMWToCmpXchg(), llvm::expandDivision(), llvm::expandDivisionUpTo32Bits(), llvm::expandDivisionUpTo64Bits(), llvm::expandRemainder(), llvm::expandRemainderUpTo32Bits(), llvm::expandRemainderUpTo64Bits(), findPHIToPartitionLoops(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), getStrlenWithNull(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::InlineFunction(), inlineRetainOrClaimRVCalls(), insertBoundsCheck(), insertSpills(), llvm::lowerAtomicCmpXchgInst(), llvm::lowerAtomicRMWInst(), llvm::LowerDbgDeclare(), lowerExpectIntrinsic(), LowerFenceInst(), lowerIntrinsic(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), llvm::MergeBasicBlockIntoOnlyPred(), mergeCleanupPad(), mergeConditionalStoreToAddress(), mergeInlinedArrayAllocas(), llvm::InstDeleterIRStrategy::mutate(), narrowSDivOrSRem(), optimizeDivRem(), OptimizeEmptyGlobalCXXDtors(), OptimizeExtractBits(), OptimizeGlobalAddressOfAllocation(), llvm::PHITransAddr::PHITranslateWithInsertion(), processAbsIntrinsic(), processAnd(), processAShr(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processBranchOnXOR(), processMinMaxIntrinsic(), processOverflowIntrinsic(), processSDiv(), processSExt(), processSRem(), processUDivOrURem(), promoteSingleBlockAlloca(), llvm::OutlinableRegion::reattachCandidate(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::LanaiInstrInfo::removeBranch(), llvm::PHINode::removeIncomingValue(), removeIntrinsicUsers(), removeNonFeasibleEdges(), RemovePreallocated(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), llvm::AMDGPULibCalls::replaceCall(), replaceCalledFunction(), replaceConditionalBranchesOnConstant(), replaceFrameSizeAndAlignment(), replaceOneDbgValueForAlloca(), replaceOperation(), replacePrepare(), llvm::rewriteLoopExitValues(), rewritePHIs(), rewriteSingleStoreAlloca(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifySuspendPoint(), sinkAndCmp0Expression(), SinkCast(), speculatePHINodeLoads(), speculateSelectInstLoads(), splitBeforeCatchSwitch(), splitCallSite(), SplitLandingPadPredecessorsImpl(), llvm::splitLoopBound(), stripDebugDeclareImpl(), llvm::InnerLoopVectorizer::truncateToMinimalBitwidths(), TryToMergeLandingPad(), TryToShrinkGlobalToBoolean(), tryToSimplifyOverflowMath(), turnToExplicitForm(), llvm::UnrollAndJamLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::UpgradeARCRuntime(), llvm::versionCallSite(), llvm::LoopVersioning::versionLoop(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().
Retrieve the raw weight values of a conditional branch or select.
Returns true on success with profile weights filled in. Returns false if no metadata or invalid metadata was found.
Definition at line 1435 of file Metadata.cpp.
References assert(), llvm::tgtok::FalseVal, getMetadata(), getOpcode(), llvm::MCID::Select, and llvm::tgtok::TrueVal.
Referenced by extractPredSuccWeights(), FoldTwoEntryPHINode(), getEstimatedTripCount(), initBranchWeights(), shouldFoldCondBranchesToCommonDestination(), updateLatchBranchWeightsForRemainderLoop(), and updatePredecessorProfileMetadata().
bool Instruction::extractProfTotalWeight | ( | uint64_t & | TotalVal | ) | 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 line 1460 of file Metadata.cpp.
References assert(), llvm::MCID::Call, getMetadata(), getOpcode(), i, and llvm::MCID::Select.
Referenced by llvm::createCallMatchingInvoke().
AAMDNodes Instruction::getAAMetadata | ( | ) | const |
Returns the AA metadata for this instruction.
Definition at line 1400 of file Metadata.cpp.
References getMetadata().
Referenced by llvm::MemoryLocation::get(), llvm::MemoryLocation::getForDest(), mergeConditionalStoreToAddress(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::promoteLoopAccessesToScalars(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), speculatePHINodeLoads(), speculateSelectInstLoads(), and unpackLoadToAggregate().
|
inline |
Get all metadata attached to this Instruction.
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 line 295 of file Instruction.h.
References hasMetadata().
|
inline |
This does the same thing as getAllMetadata, except that it filters out the debug location.
Definition at line 302 of file Instruction.h.
References llvm::Value::getAllMetadata().
Referenced by llvm::combineMetadata(), copyMetadata(), and llvm::propagateMetadata().
Return the debug location for this node as a DebugLoc.
Definition at line 367 of file Instruction.h.
Referenced by BreakUpSubtract(), buildFrameDebugInfo(), llvm::changeToInvokeAndSplitBasicBlock(), CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), computeCallStackHash(), ConvertShiftToMul(), copyMetadata(), llvm::CallInst::Create(), llvm::InvokeInst::Create(), llvm::CallBrInst::Create(), createAndInstr(), llvm::createCallMatchingInvoke(), llvm::VPRecipeBuilder::createEdgeMask(), llvm::InnerLoopVectorizer::createInductionResumeValues(), despeculateCountZeros(), llvm::VPWidenIntOrFpInductionRecipe::execute(), llvm::extractProbeFromDiscriminator(), fixupDebugInfoPostExtraction(), fixupLineNumbers(), FoldCondBranchOnValueKnownInPredecessorImpl(), llvm::ReplayInlineAdvisor::getAdviceImpl(), llvm::SampleContextTracker::getCalleeContextSamplesFor(), llvm::SelectionDAGBuilder::getCurDebugLoc(), getDebugValueLoc(), llvm::VNCoercion::getLoadValueForLoad(), getOrCreateDebugLoc(), llvm::hoistAllInstructionsInto(), llvm::InlineFunction(), llvm::InstCombinerImpl::InsertNewInstWith(), llvm::InstCombiner::InsertNewInstWith(), insertUniqueBackedgeBlock(), LowerNegateToMultiply(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), OptimizeExtractBits(), llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), processAShr(), processDbgDeclares(), processSDiv(), processSExt(), processSRem(), llvm::SampleContextTracker::promoteMergeContextSamplesTree(), llvm::removeUnwindEdge(), llvm::SCEVExpander::replaceCongruentIVs(), replaceOneDbgValueForAlloca(), llvm::IRTranslator::runOnMachineFunction(), llvm::InnerLoopVectorizer::scalarizeInstruction(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), llvm::FastISel::selectOperator(), llvm::setProbeDistributionFactor(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), sinkAndCmp0Expression(), SinkCast(), sinkLastInstruction(), SinkShiftAndTruncate(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockAndInsertIfThenImpl(), splitCallSite(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), TryToShrinkGlobalToBoolean(), llvm::JumpThreadingPass::unfoldSelectInstr(), llvm::UnrollRuntimeLoopRemainder(), updateForIncomingValueLocation(), llvm::sroa::AllocaSliceRewriter::visit(), and llvm::InstCombinerImpl::visitLoadInst().
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 line 289 of file Instruction.cpp.
References assert().
Referenced by llvm::RecurrenceDescriptor::AddReductionVar(), andIRFlags(), llvm::IRBuilderBase::CreateConstrainedFPBinOp(), llvm::IRBuilderBase::CreateConstrainedFPCast(), llvm::IRBuilderBase::CreateFAddFMF(), llvm::IRBuilderBase::CreateFDivFMF(), llvm::IRBuilderBase::CreateFMulFMF(), llvm::IRBuilderBase::CreateFNegFMF(), llvm::IRBuilderBase::CreateFRemFMF(), llvm::IRBuilderBase::CreateFSubFMF(), llvm::InnerLoopVectorizer::createInductionResumeValues(), llvm::InnerLoopVectorizer::fixupIVUsers(), foldFNegIntoConstant(), llvm::InstCombinerImpl::foldSelectOpOp(), FoldTwoEntryPHINode(), getISDForVPIntrinsic(), instCombineSVEVectorBinOp(), instCombineSVEVectorFMLA(), llvm::matchDecomposedSelectPattern(), optimizeDoubleFP(), replaceUnaryCall(), llvm::InstCombinerImpl::SimplifyAssociativeOrCommutative(), and llvm::InstCombinerImpl::visitCallInst().
|
inline |
Definition at line 110 of file Instruction.h.
References getFunction().
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 line 69 of file Instruction.cpp.
References getParent(), and llvm::BasicBlock::getParent().
Referenced by analyzeLoopUnrollCost(), canSimplifyNullLoadOrGEP(), canTransformToMemCmp(), fixupDebugInfoPostExtraction(), forwardStoredOnceStore(), llvm::InstCombinerImpl::freezeOtherUses(), genericValueTraversal(), llvm::ReplayInlineAdvisor::getAdviceImpl(), getFunction(), llvm::InformationCache::getPotentiallyReachable(), llvm::NVPTXTargetLowering::getPrototype(), llvm::coro::Shape::getRetconResultTypes(), getShape(), getSubprogramOrNull(), HandleByValArgument(), llvm::InlineFunction(), insertLifetimeMarkersSurroundingCall(), insertSpills(), IsOperandAMemoryOperand(), llvm::AA::isPotentiallyReachable(), isPotentiallyReachable(), llvm::AA::isValidAtPosition(), llvm::lowerObjectSizeCall(), llvm::LoopInfo::movementPreservesLCSSAForm(), llvm::mustSuppressSpeculation(), optimizeDoubleFP(), promoteArguments(), removeTailCallAttribute(), llvm::coro::salvageDebugInfo(), llvm::SITargetLowering::shouldExpandAtomicRMWInIR(), simplifyNvvmIntrinsic(), llvm::OutlinableRegion::splitCandidate(), tryToOptimizeStoreOfAllocationToGlobal(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitSExt(), llvm::InstCombinerImpl::visitTrunc(), and llvm::InstCombinerImpl::visitZExt().
Get the metadata of given kind attached to this Instruction.
If the metadata is not found then return null.
Definition at line 286 of file Instruction.h.
References hasMetadata().
|
inline |
Get the metadata of given kind attached to this Instruction.
If the metadata is not found then return null.
Definition at line 279 of file Instruction.h.
References hasMetadata().
Referenced by AddAliasScopeMetadata(), addAnnotationMetadata(), addLoopMetadata(), llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::changeToInvokeAndSplitBasicBlock(), checkBiasedBranch(), llvm::FunctionComparator::cmpOperations(), llvm::combineMetadata(), llvm::IRBuilderBase::CreateSelect(), llvm::diagnoseDontCall(), extractProfMetadata(), extractProfTotalWeight(), foldCtpop(), foldCttzCtlz(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), FoldTwoEntryPHINode(), getAAMetadata(), GetBranchWeights(), llvm::DOTGraphTraits< DOTFuncInfo * >::getEdgeAttributes(), getFromRangeMetadata(), llvm::BasicBlock::getIrrLoopHeaderWeight(), llvm::Loop::getLoopID(), llvm::ScopedNoAliasAAResult::getModRefInfo(), llvm::TypeBasedAAResult::getModRefInfo(), llvm::getValueProfDataFromInst(), hasMetadata(), insertUniqueBackedgeBlock(), llvm::ARMTTIImpl::instCombineIntrinsic(), llvm::intersectAccessGroups(), llvm::CallLowering::lowerCall(), llvm::FastISel::lowerCallTo(), llvm::makeGuardControlFlowExplicit(), performBranchToCommonDestFolding(), promoteSingleBlockAlloca(), PropagateCallSiteMetadata(), llvm::propagateMetadata(), rewriteSingleStoreAlloca(), shouldFoldCondBranchesToCommonDestination(), SplitBlockPredecessorsImpl(), swapProfMetadata(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), unswitchNontrivialInvariants(), and llvm::CallInst::updateProfWeight().
|
inline |
Definition at line 100 of file Instruction.h.
References getModule().
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 line 65 of file Instruction.cpp.
References llvm::BasicBlock::getModule(), and getParent().
Referenced by addAssumeNonNull(), llvm::addDiffRuntimeChecks(), addMappingsFromTLI(), llvm::addRuntimeChecks(), addVariantDeclaration(), llvm::buildAssumeFromKnowledge(), llvm::VPIntrinsic::canIgnoreVectorLengthParam(), computeRecurrenceType(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), createCoroSave(), CreateGCRelocates(), llvm::RISCVTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::VPWidenPointerInductionRecipe::execute(), factorizeMinMaxTree(), foldCtpop(), foldCttzCtlz(), foldGuardedFunnelShift(), llvm::SCEVExpander::generateOverflowCheck(), llvm::MemoryLocation::get(), llvm::memtag::getAllocaSizeInBytes(), llvm::getAllocSize(), getAtomicOpSize(), llvm::DemandedBits::getDemandedBits(), llvm::getGEPInductionOperand(), llvm::VNCoercion::getLoadLoadClobberFullWidthSize(), getModule(), llvm::LazyValueInfo::getPredicateAt(), llvm::InstrProfIncrementInst::getStep(), llvm::VFABI::getVectorVariantNames(), inlineRetainOrClaimRVCalls(), insertSpills(), llvm::GCNTTIImpl::instCombineIntrinsic(), instCombineLD1GatherIndex(), instCombineST1ScatterIndex(), llvm::TargetLibraryInfoImpl::isCallingConvCCompatible(), llvm::isDereferenceableAndAlignedInLoop(), llvm::InductionDescriptor::isInductionPHI(), llvm::GCNTTIImpl::isInlineAsmSourceOfDivergence(), isLoadInvariantInLoop(), isSafePHIToSpeculate(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), llvm::AArch64TargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedLoad(), lowerLocalAllocas(), llvm::IntrinsicLowering::LowerToByteSwap(), modifyIntrinsicCall(), llvm::LibCallSimplifier::optimizeCall(), optimizeDoubleFP(), promoteSingleBlockAlloca(), reassociateMinMaxWithConstantInOperand(), reassociateMinMaxWithConstants(), ReplaceCallWith(), replaceUnaryCall(), replaceWithCallToVeclib(), replaceWithTLIFunction(), rewriteSingleStoreAlloca(), llvm::VFABI::setVectorVariantNames(), simplifyNvvmIntrinsic(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), llvm::simplifyRetainedKnowledge(), simplifyTerminatorLeadingToRet(), simplifyX86immShift(), simplifyX86varShift(), upgradeAbs(), upgradeAVX512MaskToSelect(), UpgradeX86BinaryIntrinsics(), upgradeX86ConcatShift(), UpgradeX86MaskedShift(), upgradeX86Rotate(), UpgradeX86VPERMT2Intrinsics(), llvm::AMDGPULibCalls::useNative(), valueCoversEntireFragment(), llvm::InnerLoopVectorizer::vectorizeInterleaveGroup(), llvm::InstCombinerImpl::visitAllocSite(), llvm::InstCombinerImpl::visitBitCast(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFPTrunc(), and visitIVCast().
|
inline |
Definition at line 690 of file Instruction.h.
References getNextNonDebugInstruction().
const Instruction * 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 if SkipPseudoOp
is true.
Definition at line 740 of file Instruction.cpp.
References llvm::ilist_node_with_parent< Instruction, BasicBlock >::getNextNode(), and I.
Referenced by findStoresToUninstrumentedArgAllocas(), getNextNonDebugInstruction(), isPotentiallyReachable(), nextIRInstructionDataMatchesNextInst(), RemovePreallocated(), rewriteDebugUsers(), llvm::OutlinableRegion::splitCandidate(), llvm::InstCombinerImpl::visitCallInst(), and llvm::InstCombinerImpl::visitFenceInst().
unsigned Instruction::getNumSuccessors | ( | ) | const |
Return the number of successors that this instruction has.
The instruction must be a terminator.
Definition at line 777 of file Instruction.cpp.
References getOpcode(), and llvm_unreachable.
Referenced by llvm::FunctionComparator::compare(), llvm::CodeExtractor::extractCodeRegion(), FoldCondBranchOnValueKnownInPredecessorImpl(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), getBestDestForJumpOnUndef(), getBranchHint(), llvm::DOTGraphTraits< DOTFuncInfo * >::getEdgeAttributes(), getInstrBB(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::isCriticalEdge(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(), isSafePHIToSpeculate(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), llvm::JumpThreadingPass::processBlock(), replaceConstantExprOp(), replaceSuccessorWith(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), llvm::SplitAllCriticalEdges(), llvm::SplitCriticalEdge(), SplitCriticalSideEffectEdges(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), and llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB().
|
inline |
Returns a member of one of the enums like Instruction::Add.
Definition at line 157 of file Instruction.h.
References llvm::Value::getValueID().
Referenced by llvm::LanaiInstrInfo::analyzeBranch(), canEvaluateShiftedShift(), CanPHITrans(), checkIfSafeAddSequence(), checkOrderedReduction(), clone(), llvm::FunctionComparator::cmpOperations(), llvm::CallBase::Create(), llvm::InstCombinerImpl::Descale(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), dropPoisonGeneratingFlags(), llvm::VPWidenRecipe::execute(), extractProfMetadata(), extractProfTotalWeight(), findDemandedEltsBySingleUser(), findIBRPredecessor(), llvm::InstCombinerImpl::foldICmpInstWithConstantNotInt(), llvm::InstCombinerImpl::foldMultiplicationOverflowCheck(), llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(), llvm::InstCombinerImpl::foldSelectOpOp(), foldShiftIntoShiftInAnotherHandOfAndInICmp(), foldSignedTruncationCheck(), llvm::InstCombinerImpl::foldVariableSignZeroExtensionOfVariableHighBitExtract(), llvm::getConstrainedIntrinsicID(), getFromRangeMetadata(), getHashValueImpl(), llvm::SCEVExpander::getIVIncOperand(), getLoopPhiForCounter(), llvm::CallBase::getNumSubclassExtraOperands(), llvm::CallBase::getNumSubclassExtraOperandsDynamic(), getNumSuccessors(), llvm::UnaryOperator::getOpcode(), llvm::BinaryOperator::getOpcode(), llvm::CastInst::getOpcode(), llvm::CmpInst::getOpcode(), llvm::SelectInst::getOpcode(), getOpcodeName(), llvm::MemoryLocation::getOrNone(), getSuccessor(), hasAtomicLoad(), hasAtomicStore(), haveSameSpecialState(), llvm::InlineFunction(), InTreeUserNeedToExtract(), isAlternateInstruction(), isArithmeticShift(), isAssociative(), isAtomic(), isBinaryOp(), isBitwiseLogicOp(), isCast(), isCommutative(), isEHPad(), isEqualImpl(), isExceptionalTerminator(), isFenceLike(), llvm::SystemZTTIImpl::isFoldableLoad(), isFuncletPad(), isHighCostExpansion(), isIdempotent(), isIdenticalToWhenDefined(), isIndirectTerminator(), isIntDivRem(), isLogicalShift(), isMatchingStore(), isNilpotent(), isPromotedInstructionLegal(), isReachableFromPHI(), isReturnNonNull(), isSameOperationAs(), isShift(), isTerminator(), isUnaryOp(), isVolatile(), matchExpandedRem(), mayReadFromMemory(), mayWriteToMemory(), llvm::InstModificationIRStrategy::mutate(), needsFP(), NegateValue(), performBlockTailMerging(), llvm::JumpThreadingPass::processBlock(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::LanaiInstrInfo::removeBranch(), setSuccessor(), llvm::ARMTargetLowering::shouldSinkOperands(), llvm::AArch64TargetLowering::shouldSinkOperands(), llvm::InstCombinerImpl::simplifyShrShlDemandedBits(), SinkShiftAndTruncate(), llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(), llvm::InstCombinerImpl::visitFCmpInst(), and llvm::InstCombinerImpl::visitICmpInst().
|
inline |
Definition at line 159 of file Instruction.h.
References getOpcode(), and getOpcodeName().
Referenced by checkInstructions(), llvm::VPRecipeBuilder::createReplicateRegion(), getOpcodeName(), llvm::ConstantExpr::getOpcodeName(), llvm::VPInstruction::print(), llvm::VPReductionRecipe::print(), llvm::VPReplicateRecipe::print(), llvm::VPWidenMemoryInstructionRecipe::print(), and PrintOps().
|
static |
Definition at line 347 of file Instruction.cpp.
References llvm::And, llvm::FAdd, llvm::FMul, llvm::SPII::Load, Mul, llvm::Or, llvm::MipsISD::Ret, llvm::MCID::Select, llvm::SPII::Store, and llvm::Xor.
|
inline |
Definition at line 92 of file Instruction.h.
|
inline |
Definition at line 91 of file Instruction.h.
Referenced by Prefetch::addInstruction(), addNoRecurseAttrsTopDown(), llvm::RecurrenceDescriptor::AddReductionVar(), AddReturnAttributes(), allSameBlock(), AreEquivalentPhiNodes(), areInnerLoopLatchPHIsSupported(), areOuterLoopExitPHIsSupported(), areTwoInsertFromSameBuildVector(), BlockIsSimpleEnoughToThreadThrough(), BrPHIToSelect(), buildPartialInvariantUnswitchConditionalBranch(), llvm::PredicateInfoBuilder::buildPredicateInfo(), llvm::calculateClrEHStateNumbers(), calculateCXXStateNumbers(), calculateIterationsToInvariance(), calculateSEHStateNumbers(), CalculateUnswitchCostMultiplier(), llvm::AAResults::canInstructionRangeModRef(), CanPropagatePredecessorsForPHIs(), canSinkInstructions(), canSplitCallSite(), canSplitPredecessors(), llvm::changeToCall(), llvm::changeToInvokeAndSplitBasicBlock(), checkHoistValue(), checkPHIs(), llvm::cloneAndAdaptNoAliasScopes(), llvm::CloneAndPruneIntoFromInst(), cloneInstructionInExitBlock(), llvm::InnerLoopVectorizer::collectPoisonGeneratingRecipes(), llvm::computeConstantRange(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), ConnectEpilog(), llvm::ConvertDebugDeclareToDebugValue(), llvm::objcarc::createCallInstWithColors(), createFree(), createMalloc(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoop(), createMemSetLoop(), llvm::OpenMPIRBuilder::createParallel(), llvm::VPRecipeBuilder::createReplicateRegion(), createRetPHINode(), llvm::OpenMPIRBuilder::createSections(), createTileStore(), despeculateCountZeros(), DoFlattenLoopPair(), llvm::PostDominatorTree::dominates(), llvm::DominatorTree::dominates(), llvm::InstCombinerImpl::dominatesAllUses(), domTreeLevelBefore(), eraseFromParent(), llvm::ScalarEvolution::evaluatePredicateAt(), llvm::VPPredInstPHIRecipe::execute(), findCommonDominator(), llvm::findDevirtualizableCallsForTypeTest(), findDominatingLoad(), findExtractedOutputToOverallOutputMapping(), findInitTrampolineFromBB(), llvm::SCEVExpander::findInsertPointAfter(), findLiveSetAtInst(), llvm::SelectionDAGBuilder::FindMergedConditions(), findPotentialBlockers(), llvm::AMDGPULibCalls::fold(), llvm::InstCombinerImpl::foldBinopWithPhiOperands(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnValueKnownInPredecessorImpl(), llvm::InstCombinerImpl::foldFreezeIntoRecurrence(), foldGuardedFunnelShift(), llvm::InstCombinerImpl::foldICmpInstWithConstantNotInt(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), llvm::InstCombinerImpl::foldOpIntoPhi(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), llvm::InstCombinerImpl::foldPHIArgOpIntoPHI(), llvm::InstCombinerImpl::foldPHIArgZextsIntoPHI(), FoldTwoEntryPHINode(), fpModeMatchesGlobalFPAtomicMode(), llvm::InstCombinerImpl::freezeOtherUses(), llvm::InnerLoopVectorizer::getBroadcastInstrs(), llvm::CallBase::getCaller(), llvm::LazyValueInfo::getConstant(), llvm::ScalarEvolution::getConstantMaxTripCountFromArray(), llvm::LazyValueInfo::getConstantRange(), getDefaultInlineAdvice(), llvm::MemoryDependenceResults::getDependency(), getDomPredecessorCondition(), llvm::IRSimilarity::IRSimilarityCandidate::getEndBB(), getFunction(), getFunctionTypeFromAsyncSuspend(), getGVNForPHINode(), getInsertPointForUses(), llvm::MemoryDependenceResults::getInvariantGroupPointerDependency(), getInvertibleOperands(), getIVIncrement(), getJumpThreadDuplicationCost(), llvm::VNCoercion::getLoadLoadClobberFullWidthSize(), llvm::VNCoercion::getLoadValueForLoad(), getLoopPhiForCounter(), getModule(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedPrevInstruction(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), llvm::LazyValueInfo::getPredicateAt(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::IRSimilarity::IRSimilarityCandidate::getStartBB(), llvm::memtag::getUntagLocationIfFunctionExit(), getVarName(), HandleInlinedEHPad(), HandleInlinedLandingPad(), handlePhiDef(), hasCallsBetween(), llvm::SCEVExpander::hoistIVInc(), llvm::hoistRegion(), hoistValue(), llvm::InlineFunction(), inlineRetainOrClaimRVCalls(), insertAfter(), insertBefore(), insertCall(), llvm::DIBuilder::insertDbgAddrIntrinsic(), llvm::DIBuilder::insertDbgValueIntrinsic(), llvm::DIBuilder::insertDeclare(), llvm::DIBuilder::insertLabel(), insertLifetimeMarkersSurroundingCall(), llvm::InstCombinerImpl::InsertNewInstBefore(), llvm::InstCombiner::InsertNewInstBefore(), insertSpills(), llvm::GCNTTIImpl::instCombineIntrinsic(), Instruction(), llvm::invertCondition(), IsAcceptableTarget(), llvm::Loop::isAuxiliaryInductionVariable(), isBlockInLCSSAForm(), isColdCallSite(), llvm::isControlFlowEquivalent(), llvm::isCriticalEdge(), llvm::RecurrenceDescriptor::isFirstOrderRecurrence(), llvm::InductionDescriptor::isFPInductionPHI(), isFreeInLoop(), isGuaranteedNotToBeUndefOrPoison(), llvm::SimpleLoopSafetyInfo::isGuaranteedToExecute(), llvm::ICFLoopSafetyInfo::isGuaranteedToExecute(), isIntegerLoopHeaderPHI(), isKnownNonNullFromDominatingCondition(), llvm::ScalarEvolution::isKnownPredicateAt(), isLoadInvariantInLoop(), isLocalAlloca(), isLoopCounter(), isNonEqualPHIs(), isNotUsedOrFreeInLoop(), isPowerOfTwoRecurrence(), isPredicatedOnPHI(), llvm::isReachedBefore(), isSafeAndProfitableToSinkLoad(), isSafePHIToSpeculate(), llvm::isSafeToExpandAt(), llvm::isSafeToLoadUnconditionally(), isSameUnderlyingObjectInLoop(), llvm::AllocaInst::isStaticAlloca(), llvm::AMDGPULibCalls::isUnsafeMath(), llvm::isValidAssumeForContext(), llvm::AA::isValidAtPosition(), isValidCandidateForColdCC(), liesBetween(), LLVMGetNextInstruction(), LLVMGetPreviousInstruction(), llvm::SelectionDAGBuilder::LowerAsSTATEPOINT(), llvm::SelectionDAGBuilder::LowerCallTo(), llvm::makeGuardControlFlowExplicit(), llvm::Loop::makeLoopInvariant(), matchAddReduction(), llvm::SITargetLowering::mayBeEmittedAsTailCall(), memoryIsNotModifiedBetween(), mergeCleanupPad(), MergeCompatibleInvokesImpl(), mergeConditionalStores(), mergeConditionalStoreToAddress(), mergeInlinedArrayAllocas(), moveAfter(), moveBBContents(), moveBefore(), moveHeaderPhiOperandsToForeBlocks(), moveInstructionBefore(), llvm::LoopInfo::movementPreservesLCSSAForm(), llvm::InstDeleterIRStrategy::mutate(), NegateValue(), nextIRInstructionDataMatchesNextInst(), optimizeBranch(), optimizeDivRem(), OptimizeExtractBits(), optimizeSQRT(), performBranchToCommonDestFolding(), llvm::PHITransAddr::PHITranslateValue(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processBranchOnPHI(), llvm::JumpThreadingPass::processBranchOnXOR(), processUse(), llvm::promoteLoopAccessesToScalars(), llvm::AssumptionCache::registerAssumption(), removeEmptyCleanup(), removeFromParent(), llvm::InstructionPrecedenceTracking::removeInstruction(), removeSwitchAfterSelectFold(), removeTriviallyEmptyRange(), replaceArgumentUses(), replaceAsyncResumeFunction(), ReplaceCallWith(), replaceConditionalBranchesOnConstant(), llvm::SCEVExpander::replaceCongruentIVs(), replaceExtractElements(), returnEdge(), reuseTableCompare(), llvm::GCNTTIImpl::rewriteIntrinsicWithAddressSpace(), rewriteMaterializableInstructions(), rewriteSingleStoreAlloca(), RewriteUsesOfClonedInstructions(), llvm::SyntheticCountsPropagation::run(), llvm::InstCombinerImpl::run(), safeCxtI(), SafeToMergeTerminators(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scanPHIsAndUpdateValueMap(), llvm::IRSimilarity::IRInstructionData::setBranchSuccessors(), llvm::IRSimilarity::IRInstructionData::setPHIPredecessors(), llvm::setProfMetadata(), shouldFoldCondBranchesToCommonDestination(), shouldSplitOnPHIPredicatedArgument(), shouldSplitOnPredicatedArgument(), simplifyAMDGCNMemoryIntrinsicDemanded(), SimplifyCondBranchToCondBranch(), simplifyICmpWithDominatingAssume(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifyRelocatesOffABase(), simplifySuspendPoint(), simplifyTerminatorLeadingToRet(), llvm::simplifyUsersOfIV(), simplifyUsingControlFlow(), sink(), sinkAndCmp0Expression(), SinkCast(), SinkInstruction(), sinkInstruction(), sinkLifetimeStartMarkers(), llvm::InnerLoopVectorizer::sinkScalarOperands(), SinkShiftAndTruncate(), sinkSpillUsesAfterCoroBegin(), sinkThroughTriviallyReplaceablePHI(), llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockAndInsertIfThenImpl(), SplitBlockImpl(), splitCallSite(), llvm::OutlinableRegion::splitCandidate(), llvm::SplitKnownCriticalEdge(), splitPredecessorsOfLoopExit(), llvm::tryPromoteCall(), llvm::VPRecipeBuilder::tryToCreateWidenRecipe(), llvm::FastISel::tryToFoldLoad(), tryToMoveFreeBeforeNullTest(), tryToSimplifyOverflowMath(), llvm::JumpThreadingPass::tryToUnfoldSelect(), tryToVectorizeHorReductionOrInstOperands(), tryUnmergingGEPsAcrossIndirectBr(), tryWidenCondBranchToCondBranch(), turnGuardIntoBranch(), turnToExplicitForm(), unswitchBestCondition(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), updateIDTMetaData(), updateKillStatus(), updatePredecessorProfileMetadata(), llvm::CallInst::updateProfWeight(), updateSuccessor(), llvm::UpgradeARCRuntime(), llvm::UpgradeIntrinsicCall(), valueEscapes(), llvm::slpvectorizer::BoUpSLP::vectorizeTree(), llvm::versionCallSite(), llvm::InstCombinerImpl::visitAllocaInst(), llvm::InstCombinerImpl::visitAllocSite(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFCmpInst(), llvm::InstCombinerImpl::visitGEPOfBitcast(), llvm::InstCombinerImpl::visitLandingPadInst(), llvm::ObjectSizeOffsetVisitor::visitLoadInst(), and llvm::InstCombinerImpl::visitPHINode().
|
inline |
Definition at line 701 of file Instruction.h.
References getPrevNonDebugInstruction().
const Instruction * 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 if SkipPseudoOp
is true.
Definition at line 748 of file Instruction.cpp.
References llvm::ilist_node_with_parent< Instruction, BasicBlock >::getPrevNode(), and I.
Referenced by getPrevNonDebugInstruction(), and llvm::InstCombinerImpl::visitFenceInst().
|
inlineprotected |
Definition at line 842 of file Instruction.h.
BasicBlock * Instruction::getSuccessor | ( | unsigned | Idx | ) | const |
Return the specified successor. This instruction must be a terminator.
Definition at line 789 of file Instruction.cpp.
References getOpcode(), and llvm_unreachable.
Referenced by canSinkInstructions(), llvm::FunctionComparator::compare(), llvm::CodeExtractor::extractCodeRegion(), findLoopComponents(), FoldCondBranchOnValueKnownInPredecessorImpl(), getBestDestForJumpOnUndef(), getBranchHint(), llvm::DOTGraphTraits< DOTFuncInfo * >::getEdgeAttributes(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::isCriticalEdge(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), optimizeSQRT(), llvm::JumpThreadingPass::processBlock(), replaceSuccessorWith(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), llvm::SplitCriticalEdge(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), and llvm::UnrollAndJamLoop().
bool Instruction::hasAllowContract | ( | ) | const |
Determine whether the allow-contract flag is set.
Definition at line 279 of file Instruction.cpp.
References assert().
Referenced by llvm::GCNTTIImpl::getArithmeticInstrCost().
bool Instruction::hasAllowReassoc | ( | ) | const |
Determine whether the allow-reassociation flag is set.
Definition at line 254 of file Instruction.cpp.
References assert().
Referenced by llvm::InductionDescriptor::getExactFPMathInst(), simplifyUnaryIntrinsic(), and llvm::InstCombinerImpl::visitCallInst().
bool Instruction::hasAllowReciprocal | ( | ) | const |
Determine whether the allow-reciprocal flag is set.
Definition at line 274 of file Instruction.cpp.
References assert().
bool Instruction::hasApproxFunc | ( | ) | const |
Determine whether the approximate-math-functions flag is set.
Definition at line 284 of file Instruction.cpp.
References assert().
bool Instruction::hasAtomicLoad | ( | ) | const |
Return true if this atomic instruction loads from memory.
Definition at line 631 of file Instruction.cpp.
References assert(), getOpcode(), isAtomic(), and llvm::SPII::Load.
Referenced by llvm::PPCTargetLowering::emitTrailingFence().
bool Instruction::hasAtomicStore | ( | ) | const |
Return true if this atomic instruction stores to memory.
Definition at line 643 of file Instruction.cpp.
References assert(), getOpcode(), isAtomic(), and llvm::SPII::Store.
Referenced by llvm::VETargetLowering::emitLeadingFence(), llvm::ARMTargetLowering::emitLeadingFence(), and llvm::TargetLoweringBase::emitLeadingFence().
|
inline |
Return true if this instruction has any metadata attached to it.
Definition at line 261 of file Instruction.h.
References llvm::Value::hasMetadata().
Referenced by copyMetadata(), getAllMetadata(), llvm::MemoryDependenceResults::getInvariantGroupPointerDependency(), llvm::TargetLoweringBase::getLoadMemOperandFlags(), getMetadata(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), and llvm::SITargetLowering::getTgtMemIntrinsic().
|
inline |
Return true if this instruction has the given type of metadata attached.
Definition at line 273 of file Instruction.h.
References getMetadata().
|
inline |
Return true if this instruction has the given type of metadata attached.
Definition at line 268 of file Instruction.h.
References getMetadata().
|
inline |
Return true if this instruction has metadata attached to it other than a debug location.
Definition at line 265 of file Instruction.h.
References llvm::Value::hasMetadata().
bool Instruction::hasNoInfs | ( | ) | const |
Determine whether the no-infs flag is set.
Definition at line 264 of file Instruction.cpp.
References assert().
Referenced by foldFCmpReciprocalAndZero(), and simplifyBinaryIntrinsic().
bool Instruction::hasNoNaNs | ( | ) | const |
Determine whether the no-NaNs flag is set.
Definition at line 259 of file Instruction.cpp.
References assert().
Referenced by simplifyBinaryIntrinsic().
bool Instruction::hasNoSignedWrap | ( | ) | const |
Determine whether the no signed wrap flag is set.
Definition at line 139 of file Instruction.cpp.
Referenced by andIRFlags(), buildNew(), checkNoWrapFlags(), llvm::InstCombinerImpl::Descale(), detectShiftUntilZeroIdiom(), llvm::InstCombinerImpl::foldICmpBinOp(), llvm::InstCombinerImpl::foldICmpMulConstant(), llvm::InstCombinerImpl::foldICmpShlConstant(), llvm::InstCombinerImpl::foldICmpSubConstant(), isNonZeroRecurrence(), processBinOp(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), setLimitsForBinOp(), llvm::InstCombinerImpl::simplifyShrShlDemandedBits(), llvm::InstCombinerImpl::visitLShr(), and llvm::InstCombinerImpl::visitMul().
bool Instruction::hasNoSignedZeros | ( | ) | const |
Determine whether the no-signed-zeros flag is set.
Definition at line 269 of file Instruction.cpp.
References assert().
Referenced by foldSelectBinOpIdentity(), and simplifySelectWithFCmp().
bool Instruction::hasNoUnsignedWrap | ( | ) | const |
Determine whether the no unsigned wrap flag is set.
Definition at line 135 of file Instruction.cpp.
Referenced by andIRFlags(), buildNew(), checkNoWrapFlags(), detectShiftUntilZeroIdiom(), llvm::InstCombinerImpl::foldICmpBinOp(), llvm::InstCombinerImpl::foldICmpMulConstant(), llvm::InstCombinerImpl::foldICmpShlConstant(), llvm::InstCombinerImpl::foldICmpSubConstant(), llvm::ScalarEvolution::getUDivExactExpr(), isNonZeroRecurrence(), processBinOp(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::InstCombinerImpl::simplifyShrShlDemandedBits(), and llvm::InstCombinerImpl::visitMul().
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 line 143 of file Instruction.cpp.
Referenced by dropPoisonGeneratingFlags().
void Instruction::insertAfter | ( | Instruction * | InsertPos | ) |
Insert an unlinked instruction into a basic block immediately after the specified instruction.
Definition at line 89 of file Instruction.cpp.
References llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< OptionsT >::getIterator(), and getParent().
Referenced by addAssumeNonNull(), optimizeDivRem(), and rewritePHIsForCleanupPad().
void Instruction::insertBefore | ( | Instruction * | InsertPos | ) |
Insert an unlinked instruction into a basic block immediately before the specified instruction.
Definition at line 83 of file Instruction.cpp.
References llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< OptionsT >::getIterator(), and getParent().
Referenced by llvm::changeToCall(), findOrCreatePHIInBlock(), insertLifetimeMarkersSurroundingCall(), moveLCSSAPhis(), performBranchToCommonDestFolding(), rematerializeLiveValues(), replaceGEPIdxWithZero(), rewriteMaterializableInstructions(), sinkInstruction(), splitCallSite(), llvm::JumpThreadingPass::threadGuard(), and llvm::versionCallSite().
|
inline |
Return true if this is an arithmetic shift right.
Definition at line 207 of file Instruction.h.
References getOpcode().
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 line 755 of file Instruction.cpp.
References llvm::FAdd, llvm::FMul, and getOpcode().
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::InstCombinerImpl::foldVectorBinop(), and simplifyAssociativeBinOp().
|
inlinestatic |
bool Instruction::isAtomic | ( | ) | const |
Return true if this instruction has an AtomicOrdering of unordered or higher.
Definition at line 616 of file Instruction.cpp.
References getOpcode(), llvm::SPII::Load, llvm::NotAtomic, and llvm::SPII::Store.
Referenced by llvm::InstCombinerImpl::combineLoadToNewType(), combineLoadToOperationType(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), hasAtomicLoad(), hasAtomicStore(), llvm::LoadInst::isSimple(), llvm::StoreInst::isSimple(), llvm::TargetLowering::lowerAtomicLoadAsLoadSDNode(), and llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad().
|
inline |
Definition at line 162 of file Instruction.h.
References getOpcode(), and isBinaryOp().
Referenced by llvm::ConstantRange::binaryOp(), canCreateUndefOrPoison(), llvm::BinaryConstantExpr::classof(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldBinaryOpOperands(), llvm::ConstantFoldFPInstOperands(), llvm::IRBuilderBase::CreateNAryOp(), llvm::ConstantExpr::get(), llvm::ConstantExpr::getBinOpIdentity(), isBinaryOp(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), llvm::ConstantRange::makeGuaranteedNoWrapRegion(), and llvm::ConstantRange::overflowingBinaryOp().
|
inlinestatic |
Definition at line 188 of file Instruction.h.
|
inline |
Return true if this is and/or/xor.
Definition at line 217 of file Instruction.h.
References getOpcode().
Referenced by llvm::PatternMatch::is_bitwiselogic_op::isOpType(), rightDistributesOverLeft(), and simplifyLogicOfAddSub().
|
inlinestatic |
Determine if the Opcode is and/or/xor.
Definition at line 212 of file Instruction.h.
References llvm::And, llvm::Or, and llvm::Xor.
Referenced by foldBitCastBitwiseLogic(), and simplifyAssocCastAssoc().
|
inline |
Definition at line 165 of file Instruction.h.
References getOpcode(), and isCast().
Referenced by llvm::UnaryConstantExpr::classof(), llvm::ConstantFoldCastOperand(), llvm::ConstantExprKeyType::create(), foldConstantCastPair(), llvm::InstCombinerImpl::foldSelectOpOp(), llvm::ConstantExpr::getCast(), isCast(), and llvm::ConstantExpr::isCast().
|
inlinestatic |
Determine if the OpCode is one of the CastInst instructions.
Definition at line 222 of file Instruction.h.
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 line 770 of file Instruction.cpp.
References getOpcode().
Referenced by llvm::RecurrenceDescriptor::AddReductionVar(), areCommutative(), llvm::IRSimilarity::IRSimilarityCandidate::compareStructure(), llvm::ConstantFoldBinaryInstruction(), expandBinOp(), foldOrCommuteConstant(), foldSelectBinOpIdentity(), llvm::InstCombinerImpl::foldSelectOpOp(), llvm::InstCombinerImpl::foldVectorBinop(), llvm::ConstantExpr::getBinOpIdentity(), llvm::RISCVTTIImpl::getIntImmCostInst(), rightDistributesOverLeft(), simplifyAssociativeBinOp(), llvm::BinaryOperator::swapOperands(), llvm::InstCombinerImpl::tryFactorization(), and llvm::InstCombinerImpl::visitShl().
|
inlinestatic |
Definition at line 556 of file Instruction.h.
References llvm::And, llvm::FAdd, llvm::FMul, Mul, llvm::Or, and llvm::Xor.
bool Instruction::isDebugOrPseudoInst | ( | ) | const |
Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst.
Definition at line 735 of file Instruction.cpp.
Referenced by llvm::findAvailablePtrLoadStore(), and ProcessBlock().
|
inline |
Return true if the instruction is a variety of EH-block.
Definition at line 662 of file Instruction.h.
References getOpcode().
Referenced by llvm::BasicBlock::canSplitPredecessors(), cloneInstructionInExitBlock(), llvm::colorEHFunclets(), llvm::objcarc::createCallInstWithColors(), llvm::ehAwareSplitEdge(), getEHPadFromPredecessor(), HandleInlinedEHPad(), llvm::insertDebugValuesForPHIs(), llvm::BasicBlock::isEHPad(), isSafeToMove(), isSafeToRemove(), populateEHOperandBundle(), llvm::removeAllNonTerminatorAndEHPadInstructions(), SinkCast(), and llvm::SplitIndirectBrCriticalEdges().
bool Instruction::isExact | ( | ) | const |
Determine whether the exact flag is set.
Definition at line 195 of file Instruction.cpp.
Referenced by andIRFlags(), buildNew(), llvm::InstCombinerImpl::foldICmpBinOp(), llvm::InstCombinerImpl::foldICmpDivConstant(), llvm::InstCombinerImpl::foldICmpShrConstant(), isNonZeroRecurrence(), narrowSDivOrSRem(), processAShr(), processSDiv(), processUDivOrURem(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), and llvm::InstCombinerImpl::visitMul().
|
inline |
Definition at line 167 of file Instruction.h.
References getOpcode().
Referenced by IsAcceptableTarget(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), and llvm::MergeBlockIntoPredecessor().
|
inlinestatic |
Returns true if the OpCode is a terminator related to exception handling.
Definition at line 232 of file Instruction.h.
bool Instruction::isFast | ( | ) | const |
Determine whether all fast-math-flags are set.
Definition at line 249 of file Instruction.cpp.
References assert().
Referenced by llvm::LibCallSimplifier::optimizeCall(), and llvm::InstCombinerImpl::visitCallInst().
|
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 line 621 of file Instruction.h.
References llvm::MCID::Call, and getOpcode().
|
inline |
Definition at line 166 of file Instruction.h.
References getOpcode(), and isFuncletPad().
Referenced by isFuncletPad().
|
inlinestatic |
Determine if the OpCode is one of the FuncletPadInst instructions.
Definition at line 227 of file Instruction.h.
|
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 line 573 of file Instruction.h.
References getOpcode(), and isIdempotent().
Referenced by IncorporateWeight(), and isIdempotent().
|
inlinestatic |
Definition at line 574 of file Instruction.h.
bool Instruction::isIdenticalTo | ( | const Instruction * | I | ) | 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 line 502 of file Instruction.cpp.
References I, isIdenticalToWhenDefined(), and llvm::Value::SubclassOptionalData.
Referenced by TryToMergeLandingPad(), and llvm::InstCombinerImpl::visitFenceInst().
bool Instruction::isIdenticalToWhenDefined | ( | const Instruction * | I | ) | 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 line 507 of file Instruction.cpp.
References llvm::PHINode::block_begin(), llvm::lltok::equal, llvm::User::getNumOperands(), getOpcode(), llvm::Value::getType(), haveSameSpecialState(), I, llvm::User::op_begin(), and llvm::User::op_end().
Referenced by EliminateDuplicatePHINodesNaiveImpl(), isEqualImpl(), isIdenticalTo(), and llvm::InstCombinerImpl::visitPHINode().
|
inline |
Definition at line 175 of file Instruction.h.
References getOpcode().
Referenced by separateNestedLoop().
|
inlinestatic |
Returns true if the OpCode is a terminator with indirect targets.
Definition at line 246 of file Instruction.h.
|
inline |
Definition at line 163 of file Instruction.h.
References getOpcode(), and isIntDivRem().
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::InstCombinerImpl::foldSelectShuffle(), foldSelectShuffleWith1Binop(), llvm::InstCombinerImpl::foldVectorBinop(), generateKeySubkey(), isIntDivRem(), isValidForAlternation(), and llvm::InstCombinerImpl::SimplifyDemandedVectorElts().
|
inlinestatic |
Definition at line 192 of file Instruction.h.
bool Instruction::isLaunderOrStripInvariantGroup | ( | ) | const |
Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group.
Definition at line 726 of file Instruction.cpp.
bool Instruction::isLifetimeStartOrEnd | ( | ) | const |
Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker.
Definition at line 718 of file Instruction.cpp.
Referenced by llvm::CodeExtractor::findAllocas(), isIntegerWideningViableForSlice(), isUsedByLifetimeMarker(), isVectorPromotionViableForSlice(), onlyUsedByLifetimeMarkersOrDroppableInstsHelper(), llvm::AMDGPUSimplifyLibCallsPass::run(), and llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::visitIntrinsicInst().
|
inline |
Return true if this is a logical shift left or a logical shift right.
Definition at line 202 of file Instruction.h.
References getOpcode().
Referenced by canEvaluateShiftedShift().
|
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 line 587 of file Instruction.h.
References getOpcode(), and isNilpotent().
Referenced by IncorporateWeight(), and isNilpotent().
|
inlinestatic |
Definition at line 588 of file Instruction.h.
References llvm::Xor.
bool Instruction::isOnlyUserOfAnyOperand | ( | ) |
It checks if this instruction is the only user of at least one of its operands.
Definition at line 119 of file Instruction.cpp.
References llvm::any_of(), llvm::Value::hasOneUser(), and llvm::User::operands().
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 line 699 of file Instruction.cpp.
References isEHPad(), isTerminator(), and mayHaveSideEffects().
bool Instruction::isSameOperationAs | ( | const Instruction * | I, |
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.
Definition at line 534 of file Instruction.cpp.
References CompareIgnoringAlignment, CompareUsingScalarTypes, llvm::numbers::e, llvm::User::getNumOperands(), getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), haveSameSpecialState(), i, and I.
Referenced by llvm::InstCombinerImpl::foldSelectOpOp().
|
inline |
Definition at line 164 of file Instruction.h.
References getOpcode(), and isShift().
Referenced by detectShiftUntilZeroIdiom(), llvm::InstCombinerImpl::foldSelectShuffle(), foldSelectShuffleWith1Binop(), llvm::InstCombinerImpl::foldVectorBinop(), llvm::PatternMatch::is_shift_op::isOpType(), isShift(), rightDistributesOverLeft(), and llvm::InstCombinerImpl::SimplifyDemandedVectorElts().
|
inlinestatic |
Determine if the Opcode is one of the shift instructions.
Definition at line 197 of file Instruction.h.
|
inline |
Definition at line 160 of file Instruction.h.
References getOpcode(), and isTerminator().
Referenced by DeleteBasicBlock(), findLocationForEntrySafepoint(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::isCriticalEdge(), isRemovableWrite(), isSafeToMove(), isSafeToRemove(), isTerminator(), llvm::InstDeleterIRStrategy::mutate(), and llvm::OutlinableRegion::splitCandidate().
|
inlinestatic |
Definition at line 181 of file Instruction.h.
|
inline |
Definition at line 161 of file Instruction.h.
References getOpcode(), and isUnaryOp().
Referenced by llvm::UnaryConstantExpr::classof(), llvm::ConstantFoldUnaryInstruction(), llvm::ConstantFoldUnaryOpOperand(), llvm::IRBuilderBase::CreateNAryOp(), llvm::ConstantExpr::get(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), and isUnaryOp().
|
inlinestatic |
Definition at line 185 of file Instruction.h.
bool Instruction::isUsedOutsideOfBlock | ( | const BasicBlock * | BB | ) | 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 line 558 of file Instruction.cpp.
References BB, llvm::PHINode::getIncomingBlock(), I, and llvm::Value::uses().
Referenced by removeEmptyCleanup().
bool Instruction::isVolatile | ( | ) | const |
Return true if this instruction has a volatile memory access.
Definition at line 655 of file Instruction.cpp.
References llvm::MCID::Call, getOpcode(), llvm::SPII::Load, MI, and llvm::SPII::Store.
Referenced by llvm::expandAtomicMemCpyAsLoop(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), and llvm::MemoryDependenceResults::getSimplePointerDependencyFrom().
bool Instruction::mayHaveSideEffects | ( | ) | const |
Return true if the instruction may have side effects.
Side effects are:
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 line 695 of file Instruction.cpp.
References mayThrow(), mayWriteToMemory(), and willReturn().
Referenced by canMoveAboveCall(), hasHardUserWithinLoop(), isSafePHIToSpeculate(), isSafeToRemove(), and llvm::InstCombinerImpl::visitCallInst().
bool Instruction::mayReadFromMemory | ( | ) | const |
Return true if this instruction may read memory.
Definition at line 576 of file Instruction.cpp.
References llvm::MCID::Call, getOpcode(), llvm::SPII::Load, and llvm::SPII::Store.
Referenced by GetLocation(), IsAcceptableTarget(), llvm::Dependence::isAnti(), llvm::Dependence::isFlow(), llvm::Dependence::isInput(), and mayReadOrWriteMemory().
|
inline |
Return true if this instruction may read or write memory.
Definition at line 599 of file Instruction.h.
References mayReadFromMemory(), and mayWriteToMemory().
Referenced by llvm::AliasSetTracker::addUnknown(), llvm::AliasSet::aliasesUnknownInst(), and llvm::intersectAccessGroups().
bool Instruction::mayThrow | ( | ) | const |
Return true if this instruction may throw an exception.
Definition at line 685 of file Instruction.cpp.
Referenced by isSafeToMove(), mayHaveSideEffects(), and runImpl().
bool Instruction::mayWriteToMemory | ( | ) | const |
Return true if this instruction may modify memory.
Definition at line 596 of file Instruction.cpp.
References llvm::MCID::Call, getOpcode(), llvm::SPII::Load, and llvm::SPII::Store.
Referenced by llvm::findAvailablePtrLoadStore(), findInitTrampolineFromBB(), GetLocation(), llvm::Dependence::isAnti(), llvm::Dependence::isFlow(), llvm::Dependence::isOutput(), isSafeToMove(), mayHaveSideEffects(), and mayReadOrWriteMemory().
void Instruction::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.
Definition at line 100 of file Instruction.cpp.
References llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and moveBefore().
Referenced by optimizeDivRem(), rewriteDebugUsers(), llvm::coro::salvageDebugInfo(), and llvm::slpvectorizer::BoUpSLP::vectorizeTree().
void Instruction::moveBefore | ( | BasicBlock & | BB, |
SymbolTableList< Instruction >::iterator | I | ||
) |
Unlink this instruction and insert into BB before I.
Definition at line 104 of file Instruction.cpp.
References assert(), BB, llvm::ilist_node_impl< ilist_detail::compute_node_options< Instruction, Options... >::type >::getIterator(), getParent(), and I.
void Instruction::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.
Definition at line 96 of file Instruction.cpp.
References llvm::ilist_node_impl< OptionsT >::getIterator(), and getParent().
Referenced by GeneratedRTChecks::Create(), llvm::EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(), llvm::CodeExtractor::extractCodeRegion(), llvm::InstCombinerImpl::freezeOtherUses(), moveAfter(), NegateValue(), optimizeBranch(), optimizeDivRem(), removeEmptyCleanup(), llvm::coro::salvageDebugInfo(), llvm::setWidenableBranchCond(), simplifyRelocatesOffABase(), SinkInstruction(), sinkLastInstruction(), sinkSpillUsesAfterCoroBegin(), turnGuardIntoBranch(), llvm::UnrollAndJamLoop(), llvm::versionCallSite(), llvm::InstCombinerImpl::visitAllocaInst(), llvm::InstCombinerImpl::visitCallInst(), and llvm::widenWidenableBranch().
|
delete |
void Instruction::removeFromParent | ( | ) |
This method unlinks 'this' from the containing basic block, but does not delete it.
Definition at line 73 of file Instruction.cpp.
References llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< Instruction, Options... >::type >::getIterator(), and getParent().
Referenced by llvm::OpenMPIRBuilder::createParallel(), llvm::InstCombinerImpl::matchBSwapOrBitReverse(), rewritePHIsForCleanupPad(), and llvm::JumpThreadingPass::unfoldSelectInstr().
void Instruction::replaceSuccessorWith | ( | BasicBlock * | OldBB, |
BasicBlock * | NewBB | ||
) |
Replace specified successor OldBB to point at the provided block.
This instruction must be a terminator.
Definition at line 813 of file Instruction.cpp.
References getNumSuccessors(), getSuccessor(), and setSuccessor().
Referenced by GeneratedRTChecks::emitMemRuntimeChecks(), insertUniqueBackedgeBlock(), and llvm::BasicBlock::splitBasicBlockBefore().
Sets the AA metadata on this instruction from the AAMDNodes structure.
Definition at line 1409 of file Metadata.cpp.
References N, and setMetadata().
Referenced by doPromotion(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::promoteLoopAccessesToScalars(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), speculateSelectInstLoads(), unpackLoadToAggregate(), and unpackStoreToAggregate().
|
inline |
Set the debug location information for this instruction.
Definition at line 364 of file Instruction.h.
References move.
Referenced by addBoundsChecking(), llvm::changeToInvokeAndSplitBasicBlock(), CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), llvm::InnerLoopVectorizer::completeLoopSkeleton(), ConvertShiftToMul(), copyMetadata(), llvm::createCallMatchingInvoke(), createFFSIntrinsic(), llvm::InnerLoopVectorizer::createInductionResumeValues(), createPopcntIntrinsic(), llvm::InnerLoopVectorizer::createVectorLoopSkeleton(), GeneratedRTChecks::emitMemRuntimeChecks(), llvm::VPWidenIntOrFpInductionRecipe::execute(), llvm::VPCanonicalIVPHIRecipe::execute(), fixupDebugInfoPostExtraction(), FoldCondBranchOnValueKnownInPredecessorImpl(), llvm::formLCSSAForInstructions(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), INITIALIZE_PASS(), llvm::InlineFunction(), insertCall(), insertUniqueBackedgeBlock(), LowerNegateToMultiply(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), OptimizeExtractBits(), performBlockTailMerging(), llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), llvm::JumpThreadingPass::processImpliedCondition(), processSaturatingInst(), llvm::promoteLoopAccessesToScalars(), llvm::removeUnwindEdge(), replaceArgumentUses(), llvm::setProbeDistributionFactor(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), sinkAndCmp0Expression(), SinkCast(), sinkCmpExpression(), SinkShiftAndTruncate(), llvm::BasicBlock::splitBasicBlock(), llvm::BasicBlock::splitBasicBlockBefore(), SplitBlockAndInsertIfThenImpl(), SplitBlockPredecessorsImpl(), splitCallSite(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::splitLoopBound(), llvm::JumpThreadingPass::threadEdge(), tryToShorten(), TryToShrinkGlobalToBoolean(), llvm::UnrollRuntimeLoopRemainder(), and updateForIncomingValueLocation().
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 line 199 of file Instruction.cpp.
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 line 239 of file Instruction.cpp.
References assert().
Referenced by CreateAdd(), CreateMul(), llvm::InnerLoopVectorizer::fixReduction(), llvm::InstCombinerImpl::foldSelectOpOp(), and llvm::InstCombinerImpl::SimplifyAssociativeOrCommutative().
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 line 229 of file Instruction.cpp.
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 line 204 of file Instruction.cpp.
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 line 224 of file Instruction.cpp.
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 line 234 of file Instruction.cpp.
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 line 214 of file Instruction.cpp.
Referenced by dropPoisonGeneratingFlags(), and foldFNegIntoConstant().
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 line 209 of file Instruction.cpp.
Referenced by dropPoisonGeneratingFlags().
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 line 127 of file Instruction.cpp.
References b.
Referenced by andIRFlags(), llvm::InstCombinerImpl::commonIDivTransforms(), ConvertShiftToMul(), copyIRFlags(), llvm::NoFolder::CreateMul(), llvm::NoFolder::CreateNeg(), llvm::IRBuilderBase::CreateNeg(), llvm::BinaryOperator::CreateNSW(), llvm::NoFolder::CreateShl(), llvm::NoFolder::CreateSub(), llvm::InstCombinerImpl::Descale(), foldShiftedShift(), llvm::ConstantExpr::getAsInstruction(), llvm::InstModificationIRStrategy::mutate(), NegateValue(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::InstCombinerImpl::visitMul(), and llvm::InstCombinerImpl::visitSub().
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 line 219 of file Instruction.cpp.
Referenced by foldFNegIntoConstant().
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 line 123 of file Instruction.cpp.
References b.
Referenced by andIRFlags(), llvm::InstCombinerImpl::commonIDivTransforms(), llvm::InstCombinerImpl::commonShiftTransforms(), ConvertShiftToMul(), copyIRFlags(), llvm::NoFolder::CreateMul(), llvm::NoFolder::CreateNeg(), llvm::IRBuilderBase::CreateNeg(), llvm::BinaryOperator::CreateNUW(), llvm::NoFolder::CreateShl(), llvm::NoFolder::CreateSub(), dropPoisonGeneratingFlags(), foldShiftedShift(), llvm::ConstantExpr::getAsInstruction(), llvm::InstModificationIRStrategy::mutate(), NegateValue(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), and llvm::InstCombinerImpl::visitMul().
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 line 131 of file Instruction.cpp.
References b.
Referenced by andIRFlags(), llvm::InstCombinerImpl::commonShiftTransforms(), copyIRFlags(), llvm::BinaryOperator::CreateExact(), foldShiftedShift(), llvm::ConstantExpr::getAsInstruction(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), llvm::InstCombinerImpl::visitSDiv(), and llvm::InstCombinerImpl::visitUDiv().
Definition at line 1330 of file Metadata.cpp.
void Instruction::setMetadata | ( | unsigned | KindID, |
MDNode * | Node | ||
) |
Set the metadata of the specified kind to the specified node.
This updates or replaces metadata if already present, or removes it if Node is null.
Definition at line 1366 of file Metadata.cpp.
Referenced by AddAliasScopeMetadata(), addAnnotationMetadata(), addLoopMetadata(), llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::annotateValueSite(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::combineMetadata(), combineStoreToNewValue(), llvm::ConstantFoldTerminator(), copyMetadata(), llvm::copyMetadataForLoad(), llvm::copyNonnullMetadata(), llvm::copyRangeMetadata(), llvm::createCallMatchingInvoke(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), llvm::IRBuilderBase::CreateMemSetInline(), llvm::IRBuilderBase::CreateMemTransferInst(), llvm::IRBuilderBase::CreatePreserveArrayAccessIndex(), llvm::IRBuilderBase::CreatePreserveStructAccessIndex(), llvm::IRBuilderBase::CreatePreserveUnionAccessIndex(), fixupBranchWeights(), foldCtpop(), foldCttzCtlz(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), handlePhiDef(), insertUniqueBackedgeBlock(), llvm::ARMTTIImpl::instCombineIntrinsic(), performBranchToCommonDestFolding(), llvm::promoteCall(), llvm::pgo::promoteIndirectCall(), llvm::propagateMetadata(), setAAMetadata(), llvm::setIrrLoopHeaderMetadata(), llvm::setLoopEstimatedTripCount(), llvm::setProfMetadata(), llvm::InstCombinerImpl::SimplifyAnyMemTransfer(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockAndInsertIfThenImpl(), SplitBlockPredecessorsImpl(), swapProfMetadata(), unswitchNontrivialInvariants(), updateBranchWeights(), updatePredecessorProfileMetadata(), and llvm::CallInst::updateProfWeight().
|
inlineprotected |
Definition at line 851 of file Instruction.h.
void Instruction::setSuccessor | ( | unsigned | Idx, |
BasicBlock * | BB | ||
) |
Update the specified successor to point at the provided block.
This instruction must be a terminator.
Definition at line 801 of file Instruction.cpp.
References getOpcode(), and llvm_unreachable.
Referenced by CloneLoopBlocks(), cloneLoopBlocks(), llvm::createMemCpyLoopKnownSize(), FoldCondBranchOnValueKnownInPredecessorImpl(), replaceSuccessorWith(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), and llvm::JumpThreadingPass::threadThroughTwoBasicBlocks().
void Instruction::swapProfMetadata | ( | ) |
If the instruction has "branch_weights" MD_prof metadata and the MDNode has three operands (including name string), swap the order of the metadata.
Definition at line 824 of file Instruction.cpp.
References llvm::MDNode::get(), llvm::MDNode::getContext(), getMetadata(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), llvm::MDString::getString(), and setMetadata().
Referenced by llvm::BranchInst::swapSuccessors().
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 line 818 of file DebugInfo.cpp.
|
inline |
Specialize the methods defined in Value, as we know that an instruction can only be used by other instructions.
Definition at line 88 of file Instruction.h.
References llvm::Value::user_begin().
Referenced by combineLoadToOperationType(), llvm::InstCombinerImpl::Descale(), foldInsSequenceIntoSplat(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), llvm::ARMTTIImpl::getCmpSelInstrCost(), isDeadPHICycle(), isNotUsedOrFreeInLoop(), OptimizeGlobalAddressOfAllocation(), promoteSingleBlockAlloca(), replaceExtractElements(), ShouldBreakUpSubtract(), simplifyAMDGCNImageIntrinsic(), sinkLifetimeStartMarkers(), llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), speculateSelectInstLoads(), llvm::FastISel::tryToFoldLoad(), llvm::InstCombinerImpl::visitPHINode(), llvm::InstCombinerImpl::visitSExt(), and llvm::InstCombinerImpl::visitZExt().
|
inline |
Definition at line 89 of file Instruction.h.
References llvm::Value::user_begin().
bool Instruction::willReturn | ( | ) | const |
Return true if the instruction will return (unwinding is considered as a form of returning control flow here).
Definition at line 704 of file Instruction.cpp.
References SI.
Referenced by isRemovableWrite(), isSafeToMove(), and mayHaveSideEffects().
|
friend |
Various leaf nodes.
Definition at line 823 of file Instruction.h.
|
friend |
Definition at line 822 of file Instruction.h.