|
LLVM
5.0.0
|
#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 | BinaryOps |
| enum | MemoryOps |
| enum | CastOps |
| enum | FuncletPadOps |
| enum | OtherOps |
Public Types inherited from llvm::User | |
| 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 > |
Public Types inherited from llvm::Value | |
| 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... | |
| unsigned | getOpcode () const |
| Returns a member of one of the enums like Instruction::Add. More... | |
| const char * | getOpcodeName () const |
| bool | isTerminator () const |
| bool | isBinaryOp () const |
| bool | isShift () |
| bool | isCast () const |
| bool | isFuncletPad () 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... | |
| 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 | getAAMetadata (AAMDNodes &N, bool Merge=false) const |
| Fills the AAMDNodes structure with AA metadata from this instruction. 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 | setAAMetadata (const AAMDNodes &N) |
| Sets the 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 | updateProfWeight (uint64_t S, uint64_t T) |
Updates branch_weights metadata by scaling it by S / T. More... | |
| void | setProfWeight (uint64_t W) |
Sets the branch_weights metadata to W for CallInst. 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 nsw 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... | |
| void | dropPoisonGeneratingFlags () |
| Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs. More... | |
| bool | isExact () const |
| Determine whether the exact flag is set. More... | |
| void | setHasUnsafeAlgebra (bool B) |
| Set or clear the unsafe-algebra 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 | 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 | hasUnsafeAlgebra () const |
| Determine whether the unsafe-algebra 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... | |
| 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... | |
| bool | isAssociative () const LLVM_READONLY |
| Return true if the instruction is associative: More... | |
| bool | isCommutative () const |
| 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 | 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 | isEHPad () const |
| Return true if the instruction is a variety of EH-block. More... | |
| 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... | |
| 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) |
Public Member Functions inherited from llvm::User | |
| User (const User &)=delete | |
| void | operator delete (void *Usr) |
| Free memory allocated for User and Use objects. More... | |
| void | operator delete (void *, unsigned) |
| Placement delete - required by std, but never called. More... | |
| void | operator delete (void *, unsigned, bool) |
| Placement delete - required by std, but never called. 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... | |
| 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... | |
| void | replaceUsesOfWith (Value *From, Value *To) |
| Replace uses of one Value with another. More... | |
Public Member Functions inherited from llvm::Value | |
| 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... | |
| 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 | 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 |
| 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 user of this value. More... | |
| bool | hasNUses (unsigned N) const |
| Return true if this Value has exactly N users. More... | |
| bool | hasNUsesOrMore (unsigned N) const |
| Return true if this value has N users or more. 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 | isSwiftError () const |
| Return true if this value is a swifterror value. More... | |
| const Value * | stripPointerCasts () const |
| Strip off pointer casts, all-zero GEPs, and aliases. More... | |
| Value * | stripPointerCasts () |
| const Value * | stripPointerCastsAndBarriers () const |
| Strip off pointer casts, all-zero GEPs, aliases and barriers. More... | |
| Value * | stripPointerCastsAndBarriers () |
| const Value * | stripPointerCastsNoFollowAliases () const |
| Strip off pointer casts and all-zero GEPs. More... | |
| Value * | stripPointerCastsNoFollowAliases () |
| const Value * | stripInBoundsConstantOffsets () const |
| Strip off pointer casts and all-constant inbounds GEPs. More... | |
| Value * | stripInBoundsConstantOffsets () |
| const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
| Accumulate offsets from stripInBoundsConstantOffsets(). More... | |
| Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
| const Value * | stripInBoundsOffsets () const |
| Strip off pointer casts and inbounds GEPs. More... | |
| Value * | stripInBoundsOffsets () |
| unsigned | getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull) const |
| Returns the number of bytes known to be dereferenceable for the pointer value. More... | |
| unsigned | 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 |
Public Member Functions inherited from llvm::ilist_node_with_parent< Instruction, BasicBlock > | |
| 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... | |
Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< Instruction, Options...>::type > | |
| self_iterator | getIterator () |
| const_self_iterator | getIterator () const |
| reverse_self_iterator | getReverseIterator () |
| const_reverse_self_iterator | getReverseIterator () const |
| bool | isSentinel () const |
| Check whether this is the sentinel node. More... | |
Static Public Member Functions | |
| static const char * | getOpcodeName (unsigned OpCode) |
| static bool | isTerminator (unsigned OpCode) |
| static bool | isBinaryOp (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 | 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 Public Member Functions inherited from llvm::User | |
| static bool | classof (const Value *V) |
Protected Member Functions | |
| ~Instruction () | |
| void | setInstructionSubclassData (unsigned short D) |
| unsigned | getSubclassDataFromInstruction () const |
| Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=nullptr) | |
| Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd) | |
Protected Member Functions inherited from llvm::User | |
| 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 |
Protected Member Functions inherited from llvm::Value | |
| 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... | |
| unsigned short | getSubclassDataFromValue () const |
| void | setValueSubclassData (unsigned short D) |
Protected Member Functions inherited from llvm::ilist_node_with_parent< Instruction, BasicBlock > | |
| ilist_node_with_parent ()=default | |
Protected Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< Instruction, Options...>::type > | |
| ilist_node_impl ()=default | |
Friends | |
| class | SymbolTableListTraits< Instruction > |
Definition at line 43 of file Instruction.h.
Definition at line 573 of file Instruction.h.
Definition at line 587 of file Instruction.h.
Definition at line 594 of file Instruction.h.
Definition at line 580 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 534 of file Instruction.h.
Definition at line 601 of file Instruction.h.
Definition at line 566 of file Instruction.h.
|
protected |
Definition at line 46 of file Instruction.cpp.
References assert().
|
delete |
|
protected |
Definition at line 25 of file Instruction.cpp.
References assert(), llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insert().
|
protected |
Definition at line 37 of file Instruction.cpp.
References assert(), llvm::BasicBlock::getInstList(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::push_back().
Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction.
Definition at line 243 of file Instruction.cpp.
References copyFastMathFlags(), getFastMathFlags(), hasNoSignedWrap(), hasNoUnsignedWrap(), isExact(), llvm::X86II::OB, setHasNoSignedWrap(), setHasNoUnsignedWrap(), and setIsExact().
Referenced by HoistThenElseCodeToIf(), NegateValue(), patchReplacementInstruction(), llvm::propagateIRFlags(), and sinkLastInstruction().
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition at line 559 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 627 of file Instruction.cpp.
References copyMetadata(), getOpcode(), llvm_unreachable(), and llvm::Value::SubclassOptionalData.
Referenced by llvm::CloneBasicBlock(), CloneInstructionInExitBlock(), createDirectCallInst(), ehAwareSplitEdge(), llvm::FoldBranchToCommonDest(), llvm::FoldReturnIntoUncondBranch(), HoistThenElseCodeToIf(), insertDebugValues(), optimizeSQRT(), rematerializeLiveValues(), replaceGEPIdxWithZero(), sinkInstruction(), llvm::SplitLandingPadPredecessors(), and llvm::InstCombiner::visitGetElementPtrInst().
| 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 175 of file Instruction.cpp.
References assert().
Referenced by andIRFlags(), copyFastMathFlags(), copyIRFlags(), foldOperationIntoPhiValue(), foldOperationIntoSelectOperand(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFAdd(), llvm::InstCombiner::visitFMul(), llvm::InstCombiner::visitFPTrunc(), and llvm::InstCombiner::visitFSub().
| void Instruction::copyFastMathFlags | ( | const Instruction * | I | ) |
Copy I's fast-math flags.
Definition at line 215 of file Instruction.cpp.
References copyFastMathFlags(), and getFastMathFlags().
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this instruction.
Definition at line 219 of file Instruction.cpp.
References copyFastMathFlags(), llvm::X86II::OB, setHasNoSignedWrap(), setHasNoUnsignedWrap(), and setIsExact().
Referenced by llvm::BinaryOperator::CreateWithCopiedFlags().
| 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 605 of file Instruction.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), getAllMetadataOtherThanDebugLoc(), getDebugLoc(), hasMetadata(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::LLVMContext::MD_dbg, setDebugLoc(), and setMetadata().
Referenced by clone(), llvm::SelectInst::Create(), and llvm::IRBuilder< TargetFolder >::CreateCondBr().
| void Instruction::dropPoisonGeneratingFlags | ( | ) |
Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs.
Definition at line 118 of file Instruction.cpp.
References llvm::MCID::Add, getOpcode(), setHasNoSignedWrap(), setHasNoUnsignedWrap(), and setIsExact().
Referenced by clearAssumptionsOfUsers().
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.
Definition at line 1187 of file Metadata.cpp.
References llvm::ArrayRef< T >::begin(), llvm::SmallSet< T, N, C >::count(), llvm::SmallSet< T, N, C >::empty(), llvm::ArrayRef< T >::end(), llvm::Value::getContext(), I, llvm::SmallSet< T, N, C >::insert(), llvm::LLVMContextImpl::InstructionMetadata, and llvm::LLVMContext::pImpl.
Referenced by llvm::combineMetadata(), llvm::FoldBranchToCommonDest(), hoist(), and llvm::Loop::makeLoopInvariant().
|
inline |
Definition at line 245 of file Instruction.h.
References llvm::None.
Referenced by dropUnknownNonDebugMetadata().
|
inline |
Definition at line 248 of file Instruction.h.
References dropUnknownNonDebugMetadata(), and llvm::makeArrayRef().
Definition at line 251 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 69 of file Instruction.cpp.
References llvm::iplist_impl< IntrusiveListT, TraitsT >::erase(), llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< Instruction, Options...>::type >::getIterator(), and getParent().
Referenced by AddReachableCodeToWorklist(), BuildSubAggregate(), changeToCall(), checkCSEInPredecessor(), CleanupPointerRootUsers(), llvm::CloneAndPruneIntoFromInst(), CombineUAddWithOverflow(), ConnectEpilog(), ConnectProlog(), llvm::ConstantFoldTerminator(), createIfThenElse(), llvm::createMemCpyLoop(), llvm::createMemCpyLoopUnknownSize(), createMemMoveLoop(), createMemSetLoop(), cse(), DCEInstruction(), deleteDeadInstruction(), DeleteTriviallyDeadInstructions(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), despeculateCountZeros(), doPromotion(), llvm::EliminateDuplicatePHINodes(), llvm::InstCombiner::eraseInstFromFunction(), llvm::objcarc::EraseInstruction(), EraseTerminatorInstAndDCECond(), llvm::expandAtomicRMWToCmpXchg(), llvm::expandDivision(), llvm::expandDivisionUpTo32Bits(), llvm::expandDivisionUpTo64Bits(), expandMemCmp(), llvm::expandRemainder(), llvm::expandRemainderUpTo32Bits(), llvm::expandRemainderUpTo64Bits(), findPHIToPartitionLoops(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), handleFinalSuspend(), HandleInlinedEHPad(), handleMemIntrinsicPtrUse(), handleNoSuspendCoroutine(), llvm::hoistRegion(), inlineCallsImpl(), llvm::InlineFunction(), LowerAtomicCmpXchgInst(), LowerAtomicRMWInst(), llvm::LowerDbgDeclare(), lowerExpectIntrinsic(), LowerFenceInst(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), MakeGuardControlFlowExplicit(), markAliveBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), mergeCleanupPad(), mergeConditionalStoreToAddress(), mergeEmptyReturnBlocks(), mergeInlinedArrayAllocas(), llvm::LibCallSimplifier::optimizeCall(), OptimizeEmptyGlobalCXXDtors(), OptimizeExtractBits(), OptimizeGlobalAddressOfMalloc(), optimizeSQRT(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateWithInsertion(), processAShr(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), processCmp(), llvm::JumpThreadingPass::ProcessImpliedCondition(), processPHI(), processSDiv(), processSelect(), processSRem(), llvm::JumpThreadingPass::ProcessThreadableEdges(), llvm::promoteLoopAccessesToScalars(), promoteSingleBlockAlloca(), PropagateConstantReturn(), llvm::RecursivelyDeleteTriviallyDeadInstructions(), llvm::safestack::StackColoring::removeAllMarkers(), llvm::removeAllNonTerminatorAndEHPadInstructions(), removeCoroEnds(), llvm::PHINode::removeIncomingValue(), removeLifetimeIntrinsicUsers(), llvm::BasicBlock::removePredecessor(), RemoveSwitchAfterSelectConversion(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceAndRecursivelySimplifyImpl(), llvm::replaceDbgDeclare(), replaceFallthroughCoroEnd(), ReplaceFoldableUses(), replaceFrameSize(), replaceOneDbgValueForAlloca(), ReplaceUsesOfMallocWithGlobal(), ReplaceUsesOfWith(), rewritePHIs(), rewriteSingleStoreAlloca(), RewriteUsesOfLoadForHeapSRoA(), runIPSCCP(), runSCCP(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), simplifyAndDCEInstruction(), SimplifyBranchOnICmpChain(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), simplifySuspendPoint(), sink(), sinkAndCmp0Expression(), SinkCast(), SinkCmpExpression(), llvm::sinkRegion(), speculatePHINodeLoads(), speculateSelectInstLoads(), splitBeforeCatchSwitch(), llvm::SplitLandingPadPredecessors(), splitMergedValStore(), llvm::stripDebugInfo(), SwitchToLookupTable(), tryPromoteAllocaToVector(), TryToMergeLandingPad(), tryToOptimizeStoreOfMallocToGlobal(), TryToShrinkGlobalToBoolean(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::JumpThreadingPass::TryToUnfoldSelect(), llvm::JumpThreadingPass::TryToUnfoldSelectInCurrBB(), TurnSwitchRangeIntoICmp(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::UpgradeIntrinsicCall(), llvm::LoopVersioning::versionLoop(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().
| bool Instruction::extractProfMetadata | ( | uint64_t & | TrueVal, |
| uint64_t & | FalseVal | ||
| ) | const |
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 1303 of file Metadata.cpp.
References assert(), llvm::dyn_cast(), getMetadata(), getOpcode(), llvm::LLVMContext::MD_prof, and llvm::MCID::Select.
Referenced by extractPredSuccWeights(), llvm::getLoopEstimatedTripCount(), hasProfileData(), isFormingBranchFromSelectProfitable(), and llvm::peelLoop().
| 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 1328 of file Metadata.cpp.
References assert(), llvm::MCID::Call, llvm::dyn_cast(), getMetadata(), getOpcode(), llvm::LLVMContext::MD_prof, llvm::MCID::Select, and Switch().
Referenced by llvm::ProfileSummaryInfo::getProfileCount().
Fills the AAMDNodes structure with AA metadata from this instruction.
When Merge is true, the existing AA metadata is merged with that from this instruction providing the most-general result.
Definition at line 473 of file TypeBasedAliasAnalysis.cpp.
References getMetadata(), llvm::MDNode::getMostGenericAliasScope(), llvm::MDNode::getMostGenericTBAA(), llvm::MDNode::intersect(), llvm::LLVMContext::MD_alias_scope, llvm::LLVMContext::MD_noalias, llvm::LLVMContext::MD_tbaa, llvm::AAMDNodes::NoAlias, llvm::AAMDNodes::Scope, and llvm::AAMDNodes::TBAA.
Referenced by llvm::AliasSetTracker::add(), checkFunctionMemoryAccess(), llvm::FastISel::createMachineMemOperandFor(), doPromotion(), llvm::MemoryLocation::get(), llvm::MemoryLocation::getForDest(), llvm::MemoryLocation::getForSource(), mergeConditionalStoreToAddress(), llvm::promoteLoopAccessesToScalars(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), speculatePHINodeLoads(), speculateSelectInstLoads(), unpackLoadToAggregate(), and unpackStoreToAggregate().
|
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 206 of file Instruction.h.
References hasMetadata().
Referenced by combineLoadToNewType(), and combineStoreToNewValue().
|
inline |
This does the same thing as getAllMetadata, except that it filters out the debug location.
Definition at line 213 of file Instruction.h.
References hasMetadataOtherThanDebugLoc().
Referenced by llvm::combineMetadata(), copyMetadata(), and llvm::propagateMetadata().
Return the debug location for this node as a DebugLoc.
Definition at line 280 of file Instruction.h.
Referenced by addDiscriminators(), changeToCall(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::changeToUnreachable(), llvm::ConvertDebugDeclareToDebugValue(), ConvertShiftToMul(), copyMetadata(), llvm::CallInst::Create(), llvm::InvokeInst::Create(), createAndInstr(), despeculateCountZeros(), eliminateRecursiveTailCall(), fixupLineNumbers(), llvm::SelectionDAGBuilder::getCurDebugLoc(), llvm::VNCoercion::getLoadValueForLoad(), HoistThenElseCodeToIf(), inlineCallsImpl(), llvm::InlineFunction(), llvm::InstCombiner::InsertNewInstWith(), llvm::LowerDbgDeclare(), makeStatepointExplicitImpl(), markTails(), MemCmpExpansion::MemCmpExpansion(), processDbgDeclares(), llvm::promoteIndirectCall(), llvm::removeUnwindEdge(), llvm::replaceDbgDeclare(), llvm::ReplaceInstWithInst(), replaceOneDbgValueForAlloca(), llvm::InstCombiner::run(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), llvm::SDLoc::SDLoc(), llvm::FastISel::selectInstruction(), llvm::FastISel::selectOperator(), llvm::FunctionLoweringInfo::set(), llvm::IRBuilderBase::SetInsertPoint(), llvm::setProfMetadata(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), SimplifyTerminatorOnSelect(), sinkAndCmp0Expression(), SinkCmpExpression(), sinkLastInstruction(), SpeculativelyExecuteBB(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), llvm::stripDebugInfo(), llvm::JumpThreadingPass::ThreadEdge(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::InstCombiner::visitFDiv(), llvm::InstCombiner::visitLoadInst(), and llvm::InstCombiner::visitXor().
| 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 210 of file Instruction.cpp.
References assert().
Referenced by andIRFlags(), ClearSubclassDataAfterReassociation(), copyFastMathFlags(), llvm::hoistRegion(), llvm::matchSelectPattern(), optimizeBinaryDoubleFP(), optimizeUnaryDoubleFP(), replaceUnaryCall(), llvm::SimplifyInstruction(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFAdd(), llvm::InstCombiner::visitFCmpInst(), llvm::InstCombiner::visitFDiv(), llvm::InstCombiner::visitFMul(), llvm::InstCombiner::visitFRem(), and llvm::InstCombiner::visitFSub().
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 61 of file Instruction.cpp.
References getParent(), and llvm::BasicBlock::getParent().
Referenced by expandMemCmp(), getFunction(), HandleByValArgument(), llvm::InlineFunction(), llvm::isSafeToSpeculativelyExecute(), llvm::LoopInfo::movementPreservesLCSSAForm(), optimizeUnaryDoubleFP(), removeTailCallAttribute(), SimplifyNVVMIntrinsic(), and llvm::InstCombiner::visitCallInst().
|
inline |
Definition at line 85 of file Instruction.h.
References getFunction().
Get the metadata of given kind attached to this Instruction.
If the metadata is not found then return null.
Definition at line 190 of file Instruction.h.
References hasMetadata().
Referenced by AddAliasScopeMetadata(), llvm::LoopVersioning::annotateInstWithNoAlias(), CloneAliasScopeMetadata(), llvm::combineMetadata(), llvm::FastISel::createMachineMemOperandFor(), llvm::DiagnosticInfoInlineAsm::DiagnosticInfoInlineAsm(), extractProfMetadata(), extractProfTotalWeight(), llvm::FoldBranchToCommonDest(), foldCtpop(), foldCttzCtlz(), getAAMetadata(), llvm::getAlign(), GetBranchWeights(), llvm::DOTGraphTraits< const Function * >::getEdgeAttributes(), llvm::ConstrainedFPIntrinsic::getExceptionBehavior(), getFromRangeMetadata(), llvm::MemoryDependenceResults::getInvariantGroupPointerDependency(), llvm::Loop::getLoopID(), llvm::AArch64TargetLowering::getMMOFlags(), llvm::TypeBasedAAResult::getModRefBehavior(), llvm::ScopedNoAliasAAResult::getModRefInfo(), llvm::TypeBasedAAResult::getModRefInfo(), GetRangeFromMetadata(), llvm::DbgDeclareInst::getRawExpression(), llvm::DbgValueInst::getRawExpression(), llvm::DbgDeclareInst::getRawVariable(), llvm::DbgValueInst::getRawVariable(), llvm::ConstrainedFPIntrinsic::getRoundingMode(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::getValueProfDataFromInst(), llvm::DbgInfoIntrinsic::getVariableLocation(), handleMemIntrinsicPtrUse(), HasBranchWeights(), llvm::objcarc::BottomUpPtrState::InitBottomUp(), insertUniqueBackedgeBlock(), isInstrUniform(), llvm::SITargetLowering::isMemOpHasNoClobberedMemOperand(), llvm::AMDGPU::isUniformMMO(), isVtableAccess(), llvm::SelectionDAGBuilder::lowerRangeToAssertZExt(), MakeGuardControlFlowExplicit(), llvm::objcarc::TopDownPtrState::MatchWithRelease(), promoteSingleBlockAlloca(), llvm::propagateMetadata(), PropagateParallelLoopAccessMetadata(), rewriteSingleStoreAlloca(), swapProfMetadata(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and updateProfWeight().
Get the metadata of given kind attached to this Instruction.
If the metadata is not found then return null.
Definition at line 197 of file Instruction.h.
References hasMetadata().
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 57 of file Instruction.cpp.
References llvm::BasicBlock::getModule(), and getParent().
Referenced by llvm::AliasSetTracker::add(), addAssumeNonNull(), llvm::IVUsers::AddUsersImpl(), llvm::AAResults::callCapturesBefore(), llvm::objcarc::CanAlterRefCount(), llvm::canSinkOrHoistInst(), llvm::objcarc::CanUse(), CombineUAddWithOverflow(), llvm::JumpThreadingPass::ComputeValueKnownInPredecessors(), llvm::ConvertDebugDeclareToDebugValue(), createCoroSave(), CreateGCRelocates(), createMaskInstrs(), llvm::DemotePHIToStack(), llvm::SCEVExpander::generateOverflowCheck(), llvm::MemoryLocation::get(), llvm::getGEPInductionOperand(), llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), getModule(), llvm::LazyValueInfo::getPredicateAt(), llvm::InstrProfIncrementInst::getStep(), llvm::AArch64TargetLowering::getTgtMemIntrinsic(), llvm::NVPTXTargetLowering::getTgtMemIntrinsic(), handleFree(), llvm::hoistRegion(), insertUseHolderAfter(), isCallingConvCCompatible(), llvm::InductionDescriptor::isInductionPHI(), isLoadInvariantInLoop(), llvm::AArch64TargetLowering::isProfitableToHoist(), isSafePHIToSpeculate(), isSafeSelectToSpeculate(), llvm::isSafeToSpeculativelyExecute(), llvm::AArch64TargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::AArch64TargetLowering::lowerInterleavedStore(), llvm::ARMTargetLowering::lowerInterleavedStore(), llvm::IntrinsicLowering::LowerToByteSwap(), llvm::gvn::AvailableValue::MaterializeAdjustedValue(), optimizeUnaryDoubleFP(), PrintOps(), processUGT_ADDCST_ADD(), processUMulZExtIdiom(), promoteSingleBlockAlloca(), llvm::recognizeBSwapOrBitReverseIdiom(), replaceAndRecursivelySimplifyImpl(), ReplaceCallWith(), replaceUnaryCall(), rewriteSingleStoreAlloca(), llvm::salvageDebugInfo(), llvm::HexagonTargetLowering::shouldExpandAtomicCmpXchgInIR(), SimplifyBSwap(), SimplifyNVVMIntrinsic(), simplifyX86extrq(), simplifyX86insertq(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFPTrunc(), and visitIVCast().
|
inline |
Definition at line 75 of file Instruction.h.
References getModule().
|
inline |
Returns a member of one of the enums like Instruction::Add.
Definition at line 121 of file Instruction.h.
References llvm::Value::getValueID().
Referenced by buildNew(), canEvaluateSExtd(), canEvaluateShifted(), canEvaluateShiftedShift(), CanEvaluateShuffled(), canEvaluateTruncated(), canEvaluateZExtd(), CanPHITrans(), llvm::canReplaceOperandWithVariable(), canVectorizeInst(), cheapToScalarize(), llvm::OverflowingBinaryOperator::classof(), llvm::AllocaInst::classof(), llvm::PossiblyExactOperator::classof(), llvm::LoadInst::classof(), llvm::UnaryInstruction::classof(), llvm::FPMathOperator::classof(), llvm::ConcreteOperator< Operator, Instruction::PtrToInt >::classof(), llvm::StoreInst::classof(), llvm::FenceInst::classof(), llvm::AtomicCmpXchgInst::classof(), llvm::AtomicRMWInst::classof(), llvm::GetElementPtrInst::classof(), llvm::CmpInst::classof(), llvm::ICmpInst::classof(), llvm::FCmpInst::classof(), llvm::CallInst::classof(), llvm::SelectInst::classof(), llvm::VAArgInst::classof(), llvm::ExtractElementInst::classof(), llvm::InsertElementInst::classof(), llvm::ShuffleVectorInst::classof(), llvm::ExtractValueInst::classof(), llvm::InsertValueInst::classof(), llvm::PHINode::classof(), llvm::LandingPadInst::classof(), llvm::ReturnInst::classof(), llvm::BranchInst::classof(), llvm::SwitchInst::classof(), llvm::IndirectBrInst::classof(), llvm::InvokeInst::classof(), llvm::ResumeInst::classof(), llvm::CatchSwitchInst::classof(), llvm::CleanupPadInst::classof(), llvm::CatchPadInst::classof(), llvm::CatchReturnInst::classof(), llvm::CleanupReturnInst::classof(), llvm::UnreachableInst::classof(), llvm::TruncInst::classof(), llvm::ZExtInst::classof(), llvm::SExtInst::classof(), llvm::FPTruncInst::classof(), llvm::FPExtInst::classof(), llvm::UIToFPInst::classof(), llvm::SIToFPInst::classof(), llvm::FPToUIInst::classof(), llvm::FPToSIInst::classof(), llvm::IntToPtrInst::classof(), llvm::PtrToIntInst::classof(), llvm::BitCastInst::classof(), llvm::AddrSpaceCastInst::classof(), clone(), cloneInstructionWithNewAddressSpace(), llvm::FunctionComparator::cmpOperations(), collectInsertionElements(), collectValuesToDemote(), llvm::JumpThreadingPass::ComputeValueKnownInPredecessors(), llvm::ConstantFoldInstOperands(), detectCTLZIdiom(), detectLog2OfHalf(), detectPopcountIdiom(), determinePointerReadAttrs(), dropPoisonGeneratingFlags(), extractProfMetadata(), extractProfTotalWeight(), findIBRPredecessor(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::InstCombiner::foldFMulConst(), foldOperationIntoSelectOperand(), llvm::AArch64TTIImpl::getCastInstrCost(), llvm::TargetTransformInfo::getCastInstrCost(), llvm::TargetTransformInfo::getCmpSelInstrCost(), getFromRangeMetadata(), llvm::getGuaranteedNonFullPoisonOp(), llvm::SCEVExpander::getIVIncOperand(), getLoopPhiForCounter(), llvm::SystemZTTIImpl::getMemoryOpCost(), llvm::TargetTransformInfo::getMemoryOpCost(), llvm::AAResults::getModRefInfo(), llvm::TerminatorInst::getNumSuccessors(), llvm::BinaryOperator::getOpcode(), llvm::CastInst::getOpcode(), llvm::CmpInst::getOpcode(), llvm::SelectInst::getOpcode(), getOpcodeName(), getSameOpcode(), getSelectFoldableConstant(), getSelectFoldableOperands(), getShiftedValue(), llvm::TerminatorInst::getSuccessor(), hasAtomicLoad(), hasAtomicStore(), llvm::FastISel::hasTrivialKill(), haveSameSpecialState(), llvm::hoistRegion(), llvm::InlineFunction(), InTreeUserNeedToExtract(), isAllocSiteRemovable(), isAltInst(), isArithmeticShift(), isAssociative(), isAtomic(), isBinaryOp(), isBitwiseLogicOp(), isCast(), isCommutative(), isEHPad(), llvm::TerminatorInst::isExceptional(), llvm::TargetLoweringBase::isExtFree(), isExtractBitsCandidateUse(), isFenceLike(), isFMulOrFDivWithConstant(), isFuncletPad(), isHighCostExpansion(), isIdempotent(), isIdenticalToWhenDefined(), isLogicalShift(), isNilpotent(), isPotentiallyNaryReassociable(), llvm::AArch64TargetLowering::isProfitableToHoist(), llvm::RecurrenceDescriptor::isRecurrenceInstr(), isReturnNonNull(), isSameOperationAs(), isShift(), isSimpleArithmeticOp(), isTerminator(), isVectorReductionOp(), llvm::GVN::ValueTable::lookupOrAdd(), mayDivideByZero(), mayReadFromMemory(), mayWriteToMemory(), needsFP(), llvm::PointerMayBeCaptured(), PrintOps(), llvm::JumpThreadingPass::ProcessBlock(), promotedOpIsNSW(), promotedOpIsNUW(), llvm::propagateIRFlags(), llvm::propagatesFullPoison(), runImpl(), llvm::FastISel::selectInstruction(), llvm::TerminatorInst::setSuccessor(), shouldReorderOperands(), SimplifyBranchOnICmpChain(), llvm::SimplifyInstruction(), SinkShiftAndTruncate(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), ThreadBinOpOverSelect(), tryPromoteAllocaToVector(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), llvm::SelectionDAGBuilder::visit(), llvm::Interpreter::visitAllocaInst(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFCmpInst(), llvm::InstCombiner::visitFMul(), and llvm::reassociate::XorOpnd::XorOpnd().
Definition at line 123 of file Instruction.h.
References getOpcode(), and getOpcodeName().
Referenced by getOpcodeName(), llvm::ConstantExpr::getOpcodeName(), and PrintOps().
Definition at line 268 of file Instruction.cpp.
References llvm::MCID::Add, llvm::SPII::Load, llvm::MipsISD::Ret, llvm::MCID::Select, llvm::SPII::Store, and Switch().
|
inline |
Definition at line 66 of file Instruction.h.
Referenced by llvm::addLandingPadInfo(), llvm::RecurrenceDescriptor::AddReductionVar(), llvm::IVUsers::AddUsersImpl(), allSameBlock(), AllUsesDominatedByBlock(), AreEquivalentPhiNodes(), BlockIsSimpleEnoughToThreadThrough(), BrPHIToSelect(), llvm::calculateClrEHStateNumbers(), calculateCXXStateNumbers(), calculateIterationsToInvariance(), calculateSEHStateNumbers(), canConstantEvolve(), llvm::AAResults::canInstructionRangeModRef(), canSinkInstructions(), changeToCall(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::changeToUnreachable(), llvm::CloneAndPruneIntoFromInst(), llvm::CodeMetrics::collectEphemeralValues(), CombineUAddWithOverflow(), computeKnownBitsFromAssume(), llvm::JumpThreadingPass::ComputeValueKnownInPredecessors(), ConstructSSAForLoadSet(), llvm::ConvertDebugDeclareToDebugValue(), createFree(), createIfThenElse(), createMalloc(), createMaskInstrs(), llvm::createMemCpyLoop(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemMoveLoop(), llvm::MemorySSAUpdater::createMemoryAccessAfter(), llvm::MemorySSAUpdater::createMemoryAccessBefore(), createMemSetLoop(), createResumeEntryBlock(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::DependenceInfo::depends(), despeculateCountZeros(), llvm::OrderedInstructions::dominates(), llvm::OrderedBasicBlock::dominates(), llvm::DominatorTree::dominates(), llvm::InstCombiner::dominatesAllUses(), DominatesMergePoint(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), EliminateDeadSwitchCases(), eliminateRecursiveTailCall(), eraseFromParent(), llvm::AlignmentFromAssumptionsPass::extractAlignmentInfo(), findBasePointer(), llvm::findDevirtualizableCallsForTypeTest(), findInitTrampolineFromBB(), findLiveSetAtInst(), llvm::SelectionDAGBuilder::FindMergedConditions(), FindPhiPredForUseInBlock(), findRetainForStoreStrongContraction(), findSafeStoreForStoreStrongContraction(), findTRECandidate(), first_use_of_in_block(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), foldReturnAndProcessPred(), FoldTwoEntryPHINode(), llvm::formLCSSAForInstructions(), getCallRetPHINode(), GetCaseResults(), getCommonReturnValue(), getConstantAt(), getCoroBeginPredBlocks(), llvm::DemandedBits::getDemandedBits(), llvm::MemoryDependenceResults::getDependency(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getEstimatedNumberOfCaseClusters(), getFirstInst(), getFunction(), getInsertPointForUses(), llvm::MemoryDependenceResults::getInvariantGroupPointerDependency(), getJumpThreadDuplicationCost(), llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), llvm::VNCoercion::getLoadValueForLoad(), getLoopPhiForCounter(), getModule(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), getNotRelocatableInstructions(), llvm::LazyValueInfo::getPredicateAt(), llvm::ProfileSummaryInfo::getProfileCount(), getReductionValue(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::DependenceInfo::getSplitIteration(), llvm::GCProjectionInst::getStatepoint(), getVarName(), handleFinalSuspend(), handleFree(), HandleInlinedEHPad(), HandleInlinedLandingPad(), handlePhiDef(), hasLocalDefs(), HasSafePathToPredecessorCall(), llvm::FastISel::hasTrivialKill(), llvm::SCEVExpander::hoistIVInc(), HoistThenElseCodeToIf(), InBlock(), llvm::InlineFunction(), insertAfter(), insertBefore(), insertCallRetPHI(), llvm::InstCombiner::InsertNewInstBefore(), Instruction(), IsAcceptableTarget(), isBlockInLCSSAForm(), isChainSelectCmpBranch(), isDynamicConstant(), llvm::RecurrenceDescriptor::isFirstOrderRecurrence(), llvm::InductionDescriptor::isFPInductionPHI(), llvm::isGuaranteedToExecute(), llvm::isGuaranteedToExecuteForEveryIteration(), llvm::isInTailCallPosition(), isIntegerLoopHeaderPHI(), isInteresting(), isKnownNonNullFromDominatingCondition(), isLoadInvariantInLoop(), isLoopInvariant(), IsNonLocalValue(), isPointerValueDeadOnEntryToFunction(), llvm::isPotentiallyReachable(), isProfitableToFoldUnconditional(), llvm::DominatorTree::isReachableFromEntry(), isSafeAndProfitableToSinkLoad(), isSafePHIToSpeculate(), llvm::isSafeToLoadUnconditionally(), isSameUnderlyingObjectInLoop(), llvm::AllocaInst::isStaticAlloca(), llvm::TargetLoweringBase::isSuitableForJumpTable(), isUsedOutsideOfBlock(), isUsedOutsideOfDefiningBlock(), llvm::isValidAssumeForContext(), IVUseShouldUsePostIncValue(), LdStHasDebugValue(), LLVMGetNextInstruction(), LLVMGetPreviousInstruction(), LLVMPositionBuilderBefore(), llvm::SelectionDAGBuilder::LowerAsSTATEPOINT(), llvm::SelectionDAGBuilder::LowerCallTo(), llvm::SelectionDAGBuilder::LowerStatepoint(), lowerStatepointMetaArgs(), MakeGuardControlFlowExplicit(), llvm::AMDGPUSubtarget::makeLIDRangeMetadata(), llvm::HexagonTargetLowering::mayBeEmittedAsTailCall(), MemCmpExpansion::MemCmpExpansion(), memoryIsNotModifiedBetween(), mergeCleanupPad(), mergeConditionalStores(), mergeConditionalStoreToAddress(), mergeInlinedArrayAllocas(), moveBBContents(), moveBefore(), llvm::LoopInfo::movementPreservesLCSSAForm(), moveUp(), NegateValue(), llvm::SortByDFSIn::operator()(), OptimizeExtractBits(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), passingValueIsAlwaysUndefined(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateValue(), llvm::PointerMayBeCapturedBefore(), llvm::DivergenceAnalysis::print(), llvm::Value::print(), processAdd(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessBranchOnPHI(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), processCmp(), processMemAccess(), processPHI(), processSelect(), processSwitch(), llvm::programUndefinedIfFullPoison(), llvm::promoteIndirectCall(), llvm::AssumptionCache::registerAssumption(), removeEmptyCleanup(), removeFromParent(), RemoveSwitchAfterSelectConversion(), removeTriviallyEmptyRange(), replaceAndRecursivelySimplifyImpl(), ReplaceCallWith(), llvm::SCEVExpander::replaceCongruentIVs(), llvm::InstCombiner::replacedSelectWithOperand(), replaceExtractElements(), replaceFallthroughCoroEnd(), ReplaceFoldableUses(), llvm::ReplaceInstWithInst(), llvm::LoopInfo::replacementPreservesLCSSAForm(), llvm::replaceNonLocalUsesWith(), reuseTableCompare(), rewriteSingleStoreAlloca(), llvm::SSAUpdater::RewriteUse(), llvm::SSAUpdater::RewriteUseAfterInsertions(), RewriteUsesOfClonedInstructions(), llvm::InstCombiner::run(), safeCxtI(), SafeToMergeTerminators(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scanInlinedCode(), scanOneBB(), llvm::FastISel::selectInstruction(), llvm::IRBuilderBase::SetInsertPoint(), llvm::setProfMetadata(), llvm::AArch64TTIImpl::shouldConsiderAddressTypePromotion(), false::Simplifier::simplify(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), llvm::InstCombiner::SimplifyDivRemOfSelect(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), simplifyRelocatesOffABase(), simplifySuspendPoint(), SimplifyTerminatorOnSelect(), llvm::simplifyUsersOfIV(), sink(), sinkAndCmp0Expression(), SinkCast(), SinkCmpExpression(), SinkInstruction(), sinkInstruction(), sinkLastInstruction(), SinkShiftAndTruncate(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), llvm::SparseSolver::Solve(), SpeculativelyExecuteBB(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), splitBlockIfNotFirst(), llvm::SplitCriticalEdge(), splitMergedValStore(), SwitchToLookupTable(), llvm::JumpThreadingPass::ThreadEdge(), false::Simplifier::Context::traverse(), llvm::FastISel::tryToFoldLoad(), tryToMoveFreeBeforeNullTest(), TryToSimplifyUncondBranchWithICmpInIt(), TryToSinkInstruction(), llvm::JumpThreadingPass::TryToUnfoldSelect(), llvm::JumpThreadingPass::TryToUnfoldSelectInCurrBB(), tryToVectorizeHorReductionOrInstOperands(), TurnSwitchRangeIntoICmp(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::UpgradeIntrinsicCall(), ValueDominatesPHI(), llvm::SelectionDAGBuilder::visit(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitCallInst(), llvm::Interpreter::visitCallSite(), llvm::InstCombiner::visitFCmpInst(), llvm::InstCombiner::visitGetElementPtrInst(), llvm::InstCombiner::visitLandingPadInst(), llvm::InstCombiner::visitLoadInst(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().
|
inline |
Definition at line 67 of file Instruction.h.
|
inlineprotected |
Definition at line 638 of file Instruction.h.
Referenced by llvm::AllocaInst::getAlignment(), llvm::LoadInst::getAlignment(), llvm::StoreInst::getAlignment(), llvm::CallInst::getCallingConv(), llvm::AtomicCmpXchgInst::getFailureOrdering(), llvm::LoadInst::getOrdering(), llvm::StoreInst::getOrdering(), llvm::CmpInst::getPredicate(), llvm::AtomicCmpXchgInst::getSuccessOrdering(), llvm::CallInst::getTailCallKind(), llvm::CallInst::isMustTailCall(), llvm::CallInst::isNoTailCall(), llvm::AllocaInst::isSwiftError(), llvm::CallInst::isTailCall(), llvm::AllocaInst::isUsedWithInAlloca(), llvm::LoadInst::isVolatile(), llvm::StoreInst::isVolatile(), llvm::AtomicCmpXchgInst::isVolatile(), llvm::AtomicCmpXchgInst::isWeak(), llvm::AllocaInst::setAlignment(), llvm::LoadInst::setAlignment(), llvm::StoreInst::setAlignment(), llvm::CallInst::setCallingConv(), llvm::AtomicCmpXchgInst::setFailureOrdering(), llvm::LoadInst::setOrdering(), llvm::StoreInst::setOrdering(), llvm::AtomicCmpXchgInst::setSuccessOrdering(), llvm::AllocaInst::setSwiftError(), llvm::CallInst::setTailCall(), llvm::CallInst::setTailCallKind(), llvm::AllocaInst::setUsedWithInAlloca(), llvm::LoadInst::setVolatile(), llvm::StoreInst::setVolatile(), llvm::AtomicCmpXchgInst::setVolatile(), and llvm::AtomicCmpXchgInst::setWeak().
| bool Instruction::hasAllowContract | ( | ) | const |
Determine whether the allow-contract flag is set.
Definition at line 205 of file Instruction.cpp.
References assert().
| bool Instruction::hasAllowReciprocal | ( | ) | const |
Determine whether the allow-reciprocal flag is set.
Definition at line 200 of file Instruction.cpp.
References assert().
Referenced by llvm::hoistRegion(), and llvm::InstCombiner::visitFDiv().
| bool Instruction::hasAtomicLoad | ( | ) | const |
Return true if this atomic instruction loads from memory.
Definition at line 536 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 548 of file Instruction.cpp.
References assert(), getOpcode(), isAtomic(), and llvm::SPII::Store.
Referenced by llvm::ARMTargetLowering::emitLeadingFence(), and llvm::TargetLoweringBase::emitLeadingFence().
|
inline |
Return true if this instruction has any metadata attached to it.
Definition at line 180 of file Instruction.h.
Referenced by copyMetadata(), getAllMetadata(), getMetadata(), and setMetadata().
|
inline |
Return true if this instruction has metadata attached to it other than a debug location.
Definition at line 184 of file Instruction.h.
Referenced by getAllMetadataOtherThanDebugLoc(), and hoist().
| bool Instruction::hasNoInfs | ( | ) | const |
Determine whether the no-infs flag is set.
Definition at line 190 of file Instruction.cpp.
References assert().
Referenced by SimplifyFAddInst().
| bool Instruction::hasNoNaNs | ( | ) | const |
Determine whether the no-NaNs flag is set.
Definition at line 185 of file Instruction.cpp.
References assert().
Referenced by SimplifyFAddInst().
| bool Instruction::hasNoSignedWrap | ( | ) | const |
Determine whether the no signed wrap flag is set.
Definition at line 114 of file Instruction.cpp.
Referenced by andIRFlags(), buildNew(), foldAddWithConstant(), processAdd(), setLimitsForBinOp(), simplifyICmpWithBinOp(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitMul(), llvm::InstCombiner::visitShl(), and llvm::InstCombiner::visitSub().
| bool Instruction::hasNoSignedZeros | ( | ) | const |
Determine whether the no-signed-zeros flag is set.
Definition at line 195 of file Instruction.cpp.
References assert().
Referenced by llvm::BinaryOperator::isFNeg(), llvm::InstCombiner::visitFAdd(), and llvm::InstCombiner::visitFMul().
| bool Instruction::hasNoUnsignedWrap | ( | ) | const |
Determine whether the no unsigned wrap flag is set.
Definition at line 110 of file Instruction.cpp.
Referenced by andIRFlags(), buildNew(), foldAddWithConstant(), processAdd(), promotedOpIsNSW(), promotedOpIsNUW(), setLimitsForBinOp(), simplifyICmpWithBinOp(), simplifyValueKnownNonZero(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitMul(), llvm::InstCombiner::visitShl(), and llvm::InstCombiner::visitSub().
| bool Instruction::hasUnsafeAlgebra | ( | ) | const |
Determine whether the unsafe-algebra flag is set.
Definition at line 180 of file Instruction.cpp.
References assert().
Referenced by detectLog2OfHalf(), isAssociative(), llvm::RecurrenceDescriptor::isRecurrenceInstr(), llvm::LibCallSimplifier::optimizeCall(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFAdd(), llvm::InstCombiner::visitFDiv(), llvm::InstCombiner::visitFMul(), and llvm::InstCombiner::visitFSub().
| void Instruction::insertAfter | ( | Instruction * | InsertPos | ) |
Insert an unlinked instruction into a basic block immediately after the specified instruction.
Definition at line 81 of file Instruction.cpp.
References llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insertAfter().
Referenced by addAssumeNonNull(), llvm::ConvertDebugDeclareToDebugValue(), insertRelocationStores(), insertRematerializationStores(), InsertRootInitializers(), relocationViaAlloca(), and replaceExtractElements().
| void Instruction::insertBefore | ( | Instruction * | InsertPos | ) |
Insert an unlinked instruction into a basic block immediately before the specified instruction.
Definition at line 75 of file Instruction.cpp.
References llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insert().
Referenced by llvm::DuplicateInstructionsInSplitBetween(), makeAllConstantUsesInstructions(), relocationViaAlloca(), rematerializeLiveValues(), replaceGEPIdxWithZero(), rewriteMaterializableInstructions(), sinkInstruction(), llvm::JumpThreadingPass::ThreadGuard(), and llvm::InstCombiner::visitUDiv().
|
inline |
Return true if this is an arithmetic shift right.
Definition at line 151 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 570 of file Instruction.cpp.
References getOpcode(), and hasUnsafeAlgebra().
Referenced by canTransformAccumulatorRecursion(), llvm::ConstantFoldBinaryInstruction(), LinearizeExprTree(), and SimplifyAssociativeBinOp().
Definition at line 404 of file Instruction.h.
References llvm::MCID::Add.
| bool Instruction::isAtomic | ( | ) | const |
Return true if this instruction has an AtomicOrdering of unordered or higher.
Definition at line 521 of file Instruction.cpp.
References getOpcode(), llvm::SPII::Load, llvm::NotAtomic, and llvm::SPII::Store.
Referenced by combineLoadToNewType(), combineLoadToOperationType(), combineStoreToNewValue(), combineStoreToValueType(), llvm::FindAvailableLoadedValue(), hasAtomicLoad(), hasAtomicStore(), llvm::LoadInst::isSimple(), llvm::StoreInst::isSimple(), and llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad().
|
inline |
Definition at line 125 of file Instruction.h.
References getOpcode(), and isBinaryOp().
Referenced by llvm::BinaryOperator::classof(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldBinaryOpOperands(), foldOperationIntoSelectOperand(), and isBinaryOp().
Definition at line 136 of file Instruction.h.
Determine if the Opcode is and/or/xor.
Definition at line 156 of file Instruction.h.
Referenced by canEvaluateZExtd(), foldBitCastBitwiseLogic(), simplifyAssocCastAssoc(), and SimplifyBSwap().
|
inline |
Return true if this is and/or/xor.
Definition at line 161 of file Instruction.h.
References getOpcode().
Referenced by llvm::PatternMatch::is_bitwiselogic_op::isOpType().
|
inline |
Definition at line 127 of file Instruction.h.
References getOpcode(), and isCast().
Referenced by llvm::CastInst::classof(), llvm::ConstantFoldCastOperand(), llvm::ConstantExprKeyType::create(), findArgumentCopyElisionCandidates(), foldConstantCastPair(), llvm::ConstantExpr::getCast(), isCast(), and llvm::ConstantExpr::isCast().
Determine if the OpCode is one of the CastInst instructions.
Definition at line 166 of file Instruction.h.
|
inline |
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 416 of file Instruction.h.
References getOpcode(), and isCommutative().
Referenced by llvm::RecurrenceDescriptor::AddReductionVar(), canTransformAccumulatorRecursion(), llvm::ConstantFoldBinaryInstruction(), ExpandBinOp(), foldOrCommuteConstant(), isCommutative(), LinearizeExprTree(), RightDistributesOverLeft(), SimplifyAssociativeBinOp(), llvm::BinaryOperator::swapOperands(), and ThreadBinOpOverSelect().
Definition at line 417 of file Instruction.h.
References llvm::MCID::Add.
|
inline |
Return true if the instruction is a variety of EH-block.
Definition at line 503 of file Instruction.h.
References getOpcode().
Referenced by llvm::BasicBlock::canSplitPredecessors(), CloneInstructionInExitBlock(), ehAwareSplitEdge(), getEHPadFromPredecessor(), HandleInlinedEHPad(), llvm::InlineFunction(), isAlwaysLive(), llvm::BasicBlock::isEHPad(), isFoldedOrDeadInstruction(), isSafeToMove(), llvm::Loop::makeLoopInvariant(), llvm::removeAllNonTerminatorAndEHPadInstructions(), replaceAndRecursivelySimplifyImpl(), SinkCast(), TryToSinkInstruction(), and llvm::wouldInstructionBeTriviallyDead().
| bool Instruction::isExact | ( | ) | const |
Determine whether the exact flag is set.
Definition at line 141 of file Instruction.cpp.
Referenced by andIRFlags(), buildNew(), llvm::InstCombiner::commonIDivTransforms(), foldUDivPow2Cst(), foldUDivShl(), processAShr(), processSDiv(), setLimitsForBinOp(), simplifyICmpWithBinOp(), simplifyValueKnownNonZero(), llvm::InstCombiner::visitAShr(), llvm::InstCombiner::visitLShr(), llvm::InstCombiner::visitMul(), llvm::InstCombiner::visitSDiv(), and llvm::InstCombiner::visitUDiv().
|
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 479 of file Instruction.h.
References llvm::MCID::Call, and getOpcode().
Referenced by llvm::MemorySSA::CachingWalker::getClobberingMemoryAccess(), and llvm::AAResults::getModRefInfo().
|
inline |
Definition at line 128 of file Instruction.h.
References getOpcode(), and isFuncletPad().
Referenced by llvm::FuncletPadInst::classof(), and isFuncletPad().
Determine if the OpCode is one of the FuncletPadInst instructions.
Definition at line 171 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 434 of file Instruction.h.
References getOpcode(), and isIdempotent().
Referenced by IncorporateWeight(), and isIdempotent().
Definition at line 435 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 408 of file Instruction.cpp.
References isIdenticalToWhenDefined(), and llvm::Value::SubclassOptionalData.
Referenced by checkCSEInPredecessor(), llvm::EliminateDuplicatePHINodes(), HasSameValue(), markAliveBlocks(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), TryToMergeLandingPad(), and llvm::InstCombiner::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 413 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 HoistThenElseCodeToIf(), and isIdenticalTo().
|
inline |
Return true if this is a logical shift left or a logical shift right.
Definition at line 146 of file Instruction.h.
References getOpcode().
Referenced by canEvaluateShiftedShift(), llvm::InstCombiner::FoldShiftByConstant(), and simplifyValueKnownNonZero().
|
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 448 of file Instruction.h.
References getOpcode(), and isNilpotent().
Referenced by IncorporateWeight(), and isNilpotent().
Definition at line 449 of file Instruction.h.
| 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 439 of file Instruction.cpp.
References CompareIgnoringAlignment, CompareUsingScalarTypes, llvm::User::getNumOperands(), getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarType(), llvm::Value::getType(), and haveSameSpecialState().
|
inline |
Definition at line 126 of file Instruction.h.
References getOpcode(), and isShift().
Referenced by llvm::InstCombiner::FoldShiftByConstant(), llvm::PatternMatch::is_shift_op::isOpType(), and isShift().
Determine if the Opcode is one of the shift instructions.
Definition at line 141 of file Instruction.h.
|
inline |
Definition at line 124 of file Instruction.h.
References getOpcode(), and isTerminator().
Referenced by llvm::TerminatorInst::classof(), findLocationForEntrySafepoint(), isTerminator(), llvm::MemoryDependenceResults::removeInstruction(), llvm::JumpThreadingPass::runImpl(), and SimplifyCondBranchToTwoReturns().
Definition at line 132 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 463 of file Instruction.cpp.
References llvm::dyn_cast(), getParent(), I, and llvm::Value::uses().
|
inline |
Return true if the instruction may have side effects.
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 500 of file Instruction.h.
References mayThrow(), and mayWriteToMemory().
Referenced by canMoveAboveCall(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), FoldCondBranchOnPHI(), isAlwaysLive(), llvm::isInTailCallPosition(), isLoopDead(), IsSafeComputationToRemove(), isSafePHIToSpeculate(), replaceAndRecursivelySimplifyImpl(), ReplaceFoldableUses(), ReplaceUsesOfWith(), SpeculativelyExecuteBB(), TryToSinkInstruction(), unswitchAllTrivialConditions(), and llvm::wouldInstructionBeTriviallyDead().
| bool Instruction::mayReadFromMemory | ( | ) | const |
Return true if this instruction may read memory.
Definition at line 481 of file Instruction.cpp.
References llvm::MCID::Call, getOpcode(), llvm::SPII::Load, and llvm::SPII::Store.
Referenced by checkFunctionMemoryAccess(), llvm::DependenceInfo::depends(), GetLocation(), llvm::DependenceInfo::getSplitIteration(), hasConcreteDefImpl(), llvm::Dependence::isAnti(), llvm::Dependence::isFlow(), llvm::Dependence::isInput(), llvm::isInTailCallPosition(), llvm::Loop::makeLoopInvariant(), mayReadOrWriteMemory(), and TryToSinkInstruction().
|
inline |
Return true if this instruction may read or write memory.
Definition at line 460 of file Instruction.h.
References mayReadFromMemory(), and mayWriteToMemory().
Referenced by llvm::AliasSetTracker::addUnknown(), llvm::AliasSet::aliasesUnknownInst(), CloneAliasScopeMetadata(), llvm::mayBeMemoryDependent(), mergeConditionalStoreToAddress(), and PropagateParallelLoopAccessMetadata().
| bool Instruction::mayThrow | ( | ) | const |
Return true if this instruction may throw an exception.
Definition at line 560 of file Instruction.cpp.
Referenced by eliminateDeadStores(), isSafeToMove(), mayHaveSideEffects(), and runImpl().
| bool Instruction::mayWriteToMemory | ( | ) | const |
Return true if this instruction may modify memory.
Definition at line 501 of file Instruction.cpp.
References llvm::MCID::Call, getOpcode(), llvm::SPII::Load, and llvm::SPII::Store.
Referenced by checkFunctionMemoryAccess(), llvm::DependenceInfo::depends(), llvm::FindAvailablePtrLoadStore(), findInitTrampolineFromBB(), GetLocation(), llvm::DependenceInfo::getSplitIteration(), llvm::Dependence::isAnti(), llvm::Dependence::isFlow(), isFoldedOrDeadInstruction(), llvm::Dependence::isOutput(), isSafeToMove(), mayHaveSideEffects(), mayReadOrWriteMemory(), and memoryIsNotModifiedBetween().
| 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 88 of file Instruction.cpp.
References llvm::ilist_node_impl< OptionsT >::getIterator(), and getParent().
Referenced by hoist(), llvm::Loop::makeLoopInvariant(), moveSpillUsesAfterCoroBegin(), NegateValue(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), relocateInstructionBefore(), removeEmptyCleanup(), SinkInstruction(), sinkInstruction(), sinkLastInstruction(), tryToMoveFreeBeforeNullTest(), TryToSinkInstruction(), and llvm::InstCombiner::visitAllocaInst().
| void Instruction::moveBefore | ( | BasicBlock & | BB, |
| SymbolTableList< Instruction >::iterator | I | ||
| ) |
Unlink this instruction and insert into BB before I.
Definition at line 92 of file Instruction.cpp.
References assert(), llvm::BasicBlock::end(), llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< Instruction, Options...>::type >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::splice().
|
delete |
| void Instruction::removeFromParent | ( | ) |
This method unlinks 'this' from the containing basic block, but does not delete it.
Definition at line 65 of file Instruction.cpp.
References llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< Instruction, Options...>::type >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::remove().
Referenced by llvm::promoteIndirectCall(), and llvm::JumpThreadingPass::TryToUnfoldSelect().
Sets the metadata on this instruction from the AAMDNodes structure.
Definition at line 1253 of file Metadata.cpp.
References llvm::LLVMContext::MD_alias_scope, llvm::LLVMContext::MD_noalias, llvm::LLVMContext::MD_tbaa, llvm::AAMDNodes::NoAlias, llvm::AAMDNodes::Scope, setMetadata(), and llvm::AAMDNodes::TBAA.
Referenced by doPromotion(), mergeConditionalStoreToAddress(), llvm::promoteLoopAccessesToScalars(), speculatePHINodeLoads(), speculateSelectInstLoads(), unpackLoadToAggregate(), unpackStoreToAggregate(), and llvm::InstCombiner::visitExtractValueInst().
|
inline |
Set the debug location information for this instruction.
Definition at line 277 of file Instruction.h.
Referenced by addDiscriminators(), changeToCall(), llvm::changeToInvokeAndSplitBasicBlock(), ConvertShiftToMul(), copyMetadata(), createAndInstr(), createCTLZIntrinsic(), createPopcntIntrinsic(), eliminateRecursiveTailCall(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), hoist(), HoistThenElseCodeToIf(), llvm::InlineFunction(), llvm::InstCombiner::InsertNewInstWith(), LowerNegateToMultiply(), llvm::promoteLoopAccessesToScalars(), llvm::removeUnwindEdge(), llvm::ReplaceInstWithInst(), llvm::IRBuilderBase::SetInstDebugLocation(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), sinkAndCmp0Expression(), SinkCmpExpression(), sinkLastInstruction(), SpeculativelyExecuteBB(), llvm::BasicBlock::splitBasicBlock(), llvm::SplitLandingPadPredecessors(), llvm::stripDebugInfo(), llvm::JumpThreadingPass::ThreadEdge(), llvm::InstCombiner::visitLoadInst(), and withDebugLoc().
| 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 170 of file Instruction.cpp.
References assert().
Referenced by ClearSubclassDataAfterReassociation(), CreateAdd(), CreateMul(), CreateNeg(), and llvm::InstCombiner::visitFDiv().
| 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 165 of file Instruction.cpp.
References assert().
| 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 155 of file Instruction.cpp.
References assert().
| 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 150 of file Instruction.cpp.
References assert().
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 102 of file Instruction.cpp.
Referenced by andIRFlags(), llvm::InstCombiner::commonIDivTransforms(), ConvertShiftToMul(), copyIRFlags(), llvm::NoFolder::CreateAdd(), llvm::NoFolder::CreateMul(), llvm::NoFolder::CreateNeg(), llvm::BinaryOperator::CreateNSW(), llvm::NoFolder::CreateShl(), llvm::NoFolder::CreateSub(), dropPoisonGeneratingFlags(), foldShiftedShift(), llvm::ConstantExpr::getAsInstruction(), NegateValue(), processAdd(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitMul(), llvm::InstCombiner::visitShl(), and llvm::InstCombiner::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 160 of file Instruction.cpp.
References assert().
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 98 of file Instruction.cpp.
Referenced by andIRFlags(), llvm::InstCombiner::commonIDivTransforms(), ConvertShiftToMul(), copyIRFlags(), llvm::NoFolder::CreateAdd(), llvm::NoFolder::CreateMul(), llvm::NoFolder::CreateNeg(), llvm::BinaryOperator::CreateNUW(), llvm::NoFolder::CreateShl(), llvm::NoFolder::CreateSub(), dropPoisonGeneratingFlags(), foldShiftedShift(), llvm::ConstantExpr::getAsInstruction(), NegateValue(), processAdd(), simplifyValueKnownNonZero(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitMul(), llvm::InstCombiner::visitShl(), and llvm::InstCombiner::visitSub().
| void Instruction::setHasUnsafeAlgebra | ( | bool | B | ) |
Set or clear the unsafe-algebra 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 145 of file Instruction.cpp.
References assert().
|
inlineprotected |
Definition at line 633 of file Instruction.h.
References assert().
Referenced by llvm::CmpInst::setPredicate().
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 106 of file Instruction.cpp.
Referenced by andIRFlags(), llvm::InstCombiner::commonIDivTransforms(), copyIRFlags(), llvm::BinaryOperator::CreateExact(), dropPoisonGeneratingFlags(), foldShiftedShift(), foldUDivPow2Cst(), foldUDivShl(), llvm::ConstantExpr::getAsInstruction(), simplifyValueKnownNonZero(), llvm::InstCombiner::visitAShr(), llvm::InstCombiner::visitLShr(), and llvm::InstCombiner::visitUDiv().
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 1214 of file Metadata.cpp.
References assert(), llvm::Value::getContext(), hasMetadata(), llvm::LLVMContextImpl::InstructionMetadata, llvm::LLVMContext::MD_dbg, and llvm::LLVMContext::pImpl.
Referenced by AddAliasScopeMetadata(), llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::annotateValueSite(), CloneAliasScopeMetadata(), combineLoadToNewType(), llvm::combineMetadata(), combineStoreToNewValue(), llvm::ConstantFoldTerminator(), copyMetadata(), llvm::copyNonnullMetadata(), llvm::copyRangeMetadata(), createDirectCallInst(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), EliminateDeadSwitchCases(), findBasePointer(), llvm::FoldBranchToCommonDest(), foldCtpop(), foldCttzCtlz(), handlePhiDef(), handleSwitchExpect(), insertUniqueBackedgeBlock(), llvm::AMDGPUSubtarget::makeLIDRangeMetadata(), llvm::MetadataLoader::MetadataLoaderImpl::parseMetadataAttachment(), llvm::peelLoop(), llvm::propagateMetadata(), PropagateParallelLoopAccessMetadata(), setAAMetadata(), llvm::Loop::setLoopID(), setMetadata(), setNoClobberMetadata(), llvm::setProfMetadata(), setProfWeight(), SimplifyCondBranchToCondBranch(), SimplifyTerminatorOnSelect(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), swapProfMetadata(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), updateBranchWeights(), updateProfWeight(), llvm::UpgradeIntrinsicCall(), and llvm::InstCombiner::visitCallInst().
Definition at line 1177 of file Metadata.cpp.
References llvm::Value::getContext(), hasMetadata(), and setMetadata().
| void Instruction::setProfWeight | ( | uint64_t | W | ) |
Sets the branch_weights metadata to W for CallInst.
Definition at line 688 of file Instruction.cpp.
References assert(), llvm::MDBuilder::createBranchWeights(), llvm::Value::getContext(), llvm::LLVMContext::MD_prof, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and setMetadata().
| 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 588 of file Instruction.cpp.
References llvm::MDNode::get(), llvm::MDNode::getContext(), getMetadata(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), llvm::MDString::getString(), llvm::LLVMContext::MD_prof, and setMetadata().
Referenced by llvm::BranchInst::swapSuccessors().
| void Instruction::updateProfWeight | ( | uint64_t | S, |
| uint64_t | T | ||
| ) |
Updates branch_weights metadata by scaling it by S / T.
Definition at line 645 of file Instruction.cpp.
References llvm::MDBuilder::createConstant(), llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::MDNode::get(), llvm::Value::getContext(), llvm::Type::getInt64Ty(), getMetadata(), llvm::LLVMContext::MD_prof, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and setMetadata().
|
inline |
Specialize the methods defined in Value, as we know that an instruction can only be used by other instructions.
Definition at line 63 of file Instruction.h.
References llvm::Value::user_begin().
Referenced by canTransformAccumulatorRecursion(), combineLoadToOperationType(), DeadPHICycle(), llvm::DemoteRegToStack(), doPromotion(), findBuildVector(), foldInsSequenceIntoBroadcast(), llvm::RecurrenceDescriptor::isFirstOrderRecurrence(), llvm::AArch64TargetLowering::isProfitableToHoist(), OptimizeGlobalAddressOfMalloc(), promoteSingleBlockAlloca(), llvm::recognizeBSwapOrBitReverseIdiom(), replaceExtractElements(), ShouldBreakUpSubtract(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), speculateSelectInstLoads(), SwitchToLookupTable(), llvm::FastISel::tryToFoldLoad(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::InstCombiner::visitInsertElementInst(), llvm::InstCombiner::visitPHINode(), llvm::InstCombiner::visitSExt(), and llvm::InstCombiner::visitZExt().
|
inline |
Definition at line 64 of file Instruction.h.
References llvm::Value::user_begin().
|
friend |
Definition at line 609 of file Instruction.h.
1.8.6