LLVM  mainline
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
llvm::Instruction Class Reference

#include <Instruction.h>

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

List of all members.

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 Member Functions

 ~Instruction () override
Instructionuser_back ()
 user_back - Specialize the methods defined in Value, as we know that an instruction can only be used by other instructions.
const Instructionuser_back () const
const BasicBlockgetParent () const
BasicBlockgetParent ()
const ModulegetModule () const
 Return the module owning the function this instruction belongs to or nullptr it the function does not have a module.
ModulegetModule ()
const FunctiongetFunction () const
 Return the function this instruction belongs to.
FunctiongetFunction ()
void removeFromParent ()
 removeFromParent - This method unlinks 'this' from the containing basic block, but does not delete it.
SymbolTableList< Instruction >
::iterator 
eraseFromParent ()
 eraseFromParent - This method unlinks 'this' from the containing basic block and deletes it.
void insertBefore (Instruction *InsertPos)
 Insert an unlinked instruction into a basic block immediately before the specified instruction.
void insertAfter (Instruction *InsertPos)
 Insert an unlinked instruction into a basic block immediately after the specified instruction.
void moveBefore (Instruction *MovePos)
 moveBefore - Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos.
unsigned getOpcode () const
 getOpcode() returns a member of one of the enums like Instruction::Add.
const char * getOpcodeName () const
bool isTerminator () const
bool isBinaryOp () const
bool isShift ()
bool isCast () const
bool isFuncletPad () const
bool isLogicalShift () const
 isLogicalShift - Return true if this is a logical shift left or a logical shift right.
bool isArithmeticShift () const
 isArithmeticShift - Return true if this is an arithmetic shift right.
bool hasMetadata () const
 hasMetadata() - Return true if this instruction has any metadata attached to it.
bool hasMetadataOtherThanDebugLoc () const
 hasMetadataOtherThanDebugLoc - Return true if this instruction has metadata attached to it other than a debug location.
MDNodegetMetadata (unsigned KindID) const
 getMetadata - Get the metadata of given kind attached to this Instruction.
MDNodegetMetadata (StringRef Kind) const
 getMetadata - Get the metadata of given kind attached to this Instruction.
void getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const
 getAllMetadata - Get all metadata attached to this Instruction.
void getAllMetadataOtherThanDebugLoc (SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const
 getAllMetadataOtherThanDebugLoc - This does the same thing as getAllMetadata, except that it filters out the debug location.
void getAAMetadata (AAMDNodes &N, bool Merge=false) const
 getAAMetadata - Fills the AAMDNodes structure with AA metadata from this instruction.
void setMetadata (unsigned KindID, MDNode *Node)
 setMetadata - Set the metadata of the specified kind to the specified node.
void setMetadata (StringRef Kind, MDNode *Node)
void setAAMetadata (const AAMDNodes &N)
 setAAMetadata - Sets the metadata on this instruction from the AAMDNodes structure.
void setDebugLoc (DebugLoc Loc)
 setDebugLoc - Set the debug location information for this instruction.
const DebugLocgetDebugLoc () const
 getDebugLoc - Return the debug location for this node as a DebugLoc.
void setHasUnsafeAlgebra (bool B)
 Set or clear the unsafe-algebra flag on this instruction, which must be an operator which supports this flag.
void setHasNoNaNs (bool B)
 Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag.
void setHasNoInfs (bool B)
 Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag.
void setHasNoSignedZeros (bool B)
 Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag.
void setHasAllowReciprocal (bool B)
 Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag.
void setFastMathFlags (FastMathFlags FMF)
 Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags.
void copyFastMathFlags (FastMathFlags FMF)
 Convenience function for transferring all fast-math flag values to this instruction, which must be an operator which supports these flags.
bool hasUnsafeAlgebra () const
 Determine whether the unsafe-algebra flag is set.
bool hasNoNaNs () const
 Determine whether the no-NaNs flag is set.
bool hasNoInfs () const
 Determine whether the no-infs flag is set.
bool hasNoSignedZeros () const
 Determine whether the no-signed-zeros flag is set.
bool hasAllowReciprocal () const
 Determine whether the allow-reciprocal flag is set.
FastMathFlags getFastMathFlags () const
 Convenience function for getting all the fast-math flags, which must be an operator which supports these flags.
void copyFastMathFlags (const Instruction *I)
 Copy I's fast-math flags.
bool isAssociative () const
 isAssociative - Return true if the instruction is associative:
bool isCommutative () const
 isCommutative - Return true if the instruction is commutative:
bool isIdempotent () const
 isIdempotent - Return true if the instruction is idempotent:
bool isNilpotent () const
 isNilpotent - Return true if the instruction is nilpotent:
bool mayWriteToMemory () const
 mayWriteToMemory - Return true if this instruction may modify memory.
bool mayReadFromMemory () const
 mayReadFromMemory - Return true if this instruction may read memory.
bool mayReadOrWriteMemory () const
 mayReadOrWriteMemory - Return true if this instruction may read or write memory.
bool isAtomic () const
 isAtomic - Return true if this instruction has an AtomicOrdering of unordered or higher.
bool mayThrow () const
 mayThrow - Return true if this instruction may throw an exception.
bool mayReturn () const
 mayReturn - Return true if this is a function that may return.
bool mayHaveSideEffects () const
 mayHaveSideEffects - Return true if the instruction may have side effects.
bool isEHPad () const
 Return true if the instruction is a variety of EH-block.
Instructionclone () const
 clone() - Create a copy of 'this' instruction that is identical in all ways except the following: The instruction has no parent The instruction has no name
bool isIdenticalTo (const Instruction *I) const
 isIdenticalTo - Return true if the specified instruction is exactly identical to the current one.
bool isIdenticalToWhenDefined (const Instruction *I) const
 isIdenticalToWhenDefined - This is like isIdenticalTo, except that it ignores the SubclassOptionalData flags, which specify conditions under which the instruction's result is undefined.
bool isSameOperationAs (const Instruction *I, unsigned flags=0) const
 This function determines if the specified instruction executes the same operation as the current one.
bool isUsedOutsideOfBlock (const BasicBlock *BB) const
 isUsedOutsideOfBlock - Return true if there are any uses of this instruction in blocks other than the specified block.
void dropUnknownNonDebugMetadata (ArrayRef< unsigned > KnownIDs)
 Drop all unknown metadata except for debug locations.
void dropUnknownNonDebugMetadata ()
void dropUnknownNonDebugMetadata (unsigned ID1)
void dropUnknownNonDebugMetadata (unsigned ID1, unsigned ID2)

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.
static bool isCast (unsigned OpCode)
 Determine if the OpCode is one of the CastInst instructions.
static bool isFuncletPad (unsigned OpCode)
 Determine if the OpCode is one of the FuncletPadInst instructions.
static bool isAssociative (unsigned op)
 isAssociative - Return true if the instruction is associative:
static bool isCommutative (unsigned op)
 isCommutative - Return true if the instruction is commutative:
static bool isIdempotent (unsigned op)
 isIdempotent - Return true if the instruction is idempotent:
static bool isNilpotent (unsigned op)
 isNilpotent - Return true if the instruction is nilpotent:
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast:

Protected Member Functions

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)

Friends

class SymbolTableListTraits< Instruction >

Detailed Description

Definition at line 36 of file Instruction.h.


Member Enumeration Documentation

Definition at line 464 of file Instruction.h.

Definition at line 478 of file Instruction.h.

Definition at line 485 of file Instruction.h.

Definition at line 471 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 424 of file Instruction.h.

Definition at line 492 of file Instruction.h.

Definition at line 457 of file Instruction.h.


Constructor & Destructor Documentation

Instruction::~Instruction ( ) [override]

Definition at line 46 of file Instruction.cpp.

Instruction::Instruction ( Type Ty,
unsigned  iType,
Use Ops,
unsigned  NumOps,
Instruction InsertBefore = nullptr 
) [protected]
Instruction::Instruction ( Type Ty,
unsigned  iType,
Use Ops,
unsigned  NumOps,
BasicBlock InsertAtEnd 
) [protected]

Member Function Documentation

static bool llvm::Instruction::classof ( const Value V) [inline, static]

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

Reimplemented from llvm::User.

Reimplemented in llvm::AddrSpaceCastInst, llvm::BitCastInst, llvm::PtrToIntInst, llvm::IntToPtrInst, llvm::FPToSIInst, llvm::FPToUIInst, llvm::SIToFPInst, llvm::UIToFPInst, llvm::FPExtInst, llvm::FPTruncInst, llvm::SExtInst, llvm::ZExtInst, llvm::TruncInst, llvm::UnreachableInst, llvm::CleanupReturnInst, llvm::CatchReturnInst, llvm::CatchPadInst, llvm::CleanupPadInst, llvm::CatchSwitchInst, llvm::ResumeInst, llvm::InvokeInst, llvm::IndirectBrInst, llvm::SwitchInst, llvm::BranchInst, llvm::ReturnInst, llvm::LandingPadInst, llvm::PHINode, llvm::InsertValueInst, llvm::ExtractValueInst, llvm::ShuffleVectorInst, llvm::InsertElementInst, llvm::ExtractElementInst, llvm::VAArgInst, llvm::SelectInst, llvm::CallInst, llvm::FCmpInst, llvm::ICmpInst, llvm::FuncletPadInst, llvm::CmpInst, llvm::GetElementPtrInst, llvm::CastInst, llvm::AtomicRMWInst, llvm::AtomicCmpXchgInst, llvm::BinaryOperator, llvm::FenceInst, llvm::StoreInst, llvm::InstrProfValueProfileInst, llvm::InstrProfIncrementInst, llvm::VACopyInst, llvm::VAEndInst, llvm::GCRelocateInst, llvm::UnaryInstruction, llvm::VAStartInst, llvm::MemMoveInst, llvm::LoadInst, llvm::MemCpyInst, llvm::MemTransferInst, llvm::MemSetInst, llvm::MemIntrinsic, llvm::AllocaInst, llvm::DbgValueInst, llvm::DbgDeclareInst, llvm::TerminatorInst, llvm::DbgInfoIntrinsic, and llvm::IntrinsicInst.

Definition at line 450 of file Instruction.h.

References llvm::Value::getValueID().

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 145 of file Instruction.cpp.

Referenced by llvm::BinaryOperator::andIRFlags(), copyFastMathFlags(), llvm::BinaryOperator::copyIRFlags(), FoldOperationIntoSelectOperand(), llvm::InstCombiner::visitFAdd(), llvm::InstCombiner::visitFMul(), llvm::InstCombiner::visitFPTrunc(), and llvm::InstCombiner::visitFSub().

Copy I's fast-math flags.

Definition at line 189 of file Instruction.cpp.

References copyFastMathFlags(), and getFastMathFlags().

Definition at line 211 of file Instruction.h.

References llvm::None.

Referenced by dropUnknownNonDebugMetadata().

Definition at line 214 of file Instruction.h.

References dropUnknownNonDebugMetadata(), and llvm::makeArrayRef().

Definition at line 217 of file Instruction.h.

References dropUnknownNonDebugMetadata().

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

Returns:
an iterator pointing to the element after the erased one

Definition at line 75 of file Instruction.cpp.

References llvm::iplist< NodeTy, Traits >::erase(), llvm::BasicBlock::getInstList(), llvm::ilist_node< Instruction >::getIterator(), and getParent().

Referenced by AddReachableCodeToWorklist(), BuildSubAggregate(), changeToCall(), checkCSEInPredecessor(), CleanupPointerRootUsers(), llvm::CloneAndPruneIntoFromInst(), CombineUAddWithOverflow(), ConnectProlog(), llvm::ConstantFoldTerminator(), cse(), DeleteDeadInstruction(), deleteDeadInstruction(), DeleteTriviallyDeadInstructions(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), despeculateCountZeros(), llvm::EliminateDuplicatePHINodes(), llvm::InstCombiner::EraseInstFromFunction(), llvm::objcarc::EraseInstruction(), EraseTerminatorInstAndDCECond(), llvm::expandAtomicRMWToCmpXchg(), llvm::expandDivision(), llvm::expandDivisionUpTo32Bits(), llvm::expandDivisionUpTo64Bits(), llvm::expandRemainder(), llvm::expandRemainderUpTo32Bits(), llvm::expandRemainderUpTo64Bits(), findPHIToPartitionLoops(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), getAdjustedPtr(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), llvm::hoistRegion(), InlineCallIfPossible(), llvm::InlineFunction(), insertFastDiv(), LowerAtomicCmpXchgInst(), LowerAtomicRMWInst(), llvm::LowerDbgDeclare(), lowerExpectIntrinsic(), LowerFenceInst(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), makeStatepointExplicitImpl(), markAliveBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), mergeConditionalStoreToAddress(), mergeEmptyReturnBlocks(), llvm::LibCallSimplifier::optimizeCall(), OptimizeExtractBits(), OptimizeGlobalAddressOfMalloc(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateWithInsertion(), llvm::promoteLoopAccessesToScalars(), promoteSingleBlockAlloca(), llvm::RecursivelyDeleteTriviallyDeadInstructions(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::PHINode::removeIncomingValue(), removeLifetimeIntrinsicUsers(), llvm::BasicBlock::removePredecessor(), RemoveSwitchAfterSelectConversion(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceAndRecursivelySimplifyImpl(), llvm::replaceDbgDeclare(), ReplaceUsesOfMallocWithGlobal(), ReplaceUsesOfWith(), reuseOrInsertFastDiv(), rewriteSingleStoreAlloca(), RewriteUsesOfLoadForHeapSRoA(), rotateLoop(), llvm::Inliner::runOnSCC(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), simplifyAndDCEInstruction(), SimplifyBranchOnICmpChain(), simplifyLoopLatch(), simplifyOneLoop(), SinkCast(), SinkCmpExpression(), llvm::sinkRegion(), SinkThenElseCodeToEnd(), speculatePHINodeLoads(), speculateSelectInstLoads(), llvm::SplitLandingPadPredecessors(), llvm::StripDebugInfo(), SwitchToLookupTable(), tryPromoteAllocaToVector(), tryToMakeAllocaBePromotable(), TryToMergeLandingPad(), tryToOptimizeStoreOfMallocToGlobal(), TryToShrinkGlobalToBoolean(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), llvm::UpgradeIntrinsicCall(), llvm::LoopVersioning::versionLoop(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().

void Instruction::getAAMetadata ( AAMDNodes N,
bool  Merge = false 
) const
void llvm::Instruction::getAllMetadata ( SmallVectorImpl< std::pair< unsigned, MDNode * >> &  MDs) const [inline]

getAllMetadata - 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 182 of file Instruction.h.

References hasMetadata().

Referenced by combineLoadToNewType(), combineStoreToNewValue(), copyMetadata(), and llvm::RemapInstruction().

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

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

Definition at line 189 of file Instruction.h.

References hasMetadataOtherThanDebugLoc().

Referenced by clone(), llvm::combineMetadata(), and llvm::TypeFinder::run().

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 67 of file Instruction.cpp.

References getParent(), and llvm::BasicBlock::getParent().

Referenced by llvm::LoopInfo::movementPreservesLCSSAForm().

Definition at line 65 of file Instruction.cpp.

References getParent(), and llvm::BasicBlock::getParent().

MDNode* llvm::Instruction::getMetadata ( unsigned  KindID) const [inline]
MDNode* llvm::Instruction::getMetadata ( StringRef  Kind) const [inline]

getMetadata - Get the metadata of given kind attached to this Instruction.

If the metadata is not found then return null.

Definition at line 173 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(), llvm::IVUsers::AddUsersImpl(), AnalyzeLoadFromClobberingStore(), llvm::AAResults::callCapturesBefore(), llvm::objcarc::CanAlterRefCount(), canSinkOrHoistInst(), llvm::objcarc::CanUse(), CombineUAddWithOverflow(), llvm::ConvertDebugDeclareToDebugValue(), CreateGCRelocates(), llvm::MemoryLocation::get(), llvm::getGEPInductionOperand(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), GetLoadValueForLoad(), llvm::LazyValueInfo::getPredicateAt(), llvm::AArch64TargetLowering::getTgtMemIntrinsic(), llvm::NVPTXTargetLowering::getTgtMemIntrinsic(), llvm::hoistRegion(), insertUseHolderAfter(), llvm::InductionDescriptor::isInductionPHI(), isLoadLoadClobberIfExtendedToFullWidth(), llvm::AArch64TargetLowering::isProfitableToHoist(), llvm::isSafeToLoadUnconditionally(), llvm::isSafeToSpeculativelyExecute(), llvm::AArch64TargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::AArch64TargetLowering::lowerInterleavedStore(), llvm::ARMTargetLowering::lowerInterleavedStore(), llvm::IntrinsicLowering::LowerToByteSwap(), optimizeUnaryDoubleFP(), PrintOps(), ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), promoteSingleBlockAlloca(), llvm::recognizeBitReverseOrBSwapIdiom(), llvm::AliasSetTracker::remove(), replaceAndRecursivelySimplifyImpl(), ReplaceCallWith(), ReplaceWithStatepoint(), rewriteSingleStoreAlloca(), SimplifyX86extrq(), SimplifyX86insertq(), llvm::InstCombiner::visitAnd(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFPTrunc(), and visitIVCast().

Definition at line 61 of file Instruction.cpp.

References llvm::BasicBlock::getModule(), and getParent().

getOpcode() returns a member of one of the enums like Instruction::Add.

Reimplemented in llvm::SelectInst, llvm::CmpInst, llvm::CastInst, and llvm::BinaryOperator.

Definition at line 105 of file Instruction.h.

References llvm::Value::getValueID().

Referenced by buildNew(), llvm::bypassSlowDivision(), canEvaluateSExtd(), CanEvaluateShifted(), CanEvaluateShuffled(), canEvaluateTruncated(), canEvaluateZExtd(), CanPHITrans(), canVectorizeInst(), cheapToScalarize(), llvm::OverflowingBinaryOperator::classof(), llvm::PossiblyExactOperator::classof(), llvm::AllocaInst::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(), collectFailStats(), collectInsertionElements(), collectUsesWithPtrTypes(), llvm::ConstantFoldInstOperands(), detectLog2OfHalf(), detectPopcountIdiom(), determinePointerReadAttrs(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::InstCombiner::foldFMulConst(), FoldOperationIntoSelectOperand(), llvm::InstCombiner::FoldSelectOpOp(), getFromRangeMetadata(), llvm::getGuaranteedNonFullPoisonOp(), llvm::SCEVExpander::getIVIncOperand(), getLoopPhiForCounter(), llvm::AAResults::getModRefInfo(), llvm::BinaryOperator::getOpcode(), llvm::CastInst::getOpcode(), llvm::SelectInst::getOpcode(), getOpcodeName(), GetSelectFoldableConstant(), GetSelectFoldableOperands(), GetShiftedValue(), llvm::FastISel::hasTrivialKill(), haveSameSpecialState(), llvm::InlineFunction(), isAllocSiteRemovable(), isArithmeticShift(), isAssociative(), isAtomic(), isBinaryOp(), isCast(), isCommutative(), isEHPad(), llvm::TerminatorInst::isExceptional(), llvm::TargetLoweringBase::isExtFree(), isExtractBitsCandidateUse(), isFMulOrFDivWithConstant(), isFuncletPad(), isHighCostExpansion(), isIdempotent(), isIdenticalToWhenDefined(), isLogicalShift(), isNilpotent(), isPotentiallyNaryReassociable(), llvm::AArch64TargetLowering::isProfitableToHoist(), llvm::RecurrenceDescriptor::isRecurrenceInstr(), isReturnNonNull(), isSameOperationAs(), isShift(), isSimpleArithmeticOp(), isTerminator(), lookThroughFPExtensions(), mayReadFromMemory(), mayWriteToMemory(), needsFP(), llvm::PointerMayBeCaptured(), PrintOps(), llvm::propagatesFullPoison(), llvm::FastISel::selectInstruction(), SimplifyBranchOnICmpChain(), llvm::SimplifyInstruction(), SinkShiftAndTruncate(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), ThreadBinOpOverSelect(), tryPromoteAllocaToVector(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), llvm::SelectionDAGBuilder::visit(), llvm::Interpreter::visitAllocaInst(), llvm::InstCombiner::visitFMul(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::InstCombiner::visitSwitchInst(), and WriteInstruction().

const char* llvm::Instruction::getOpcodeName ( ) const [inline]

Definition at line 107 of file Instruction.h.

References getOpcode(), and getOpcodeName().

Referenced by getOpcodeName(), and PrintOps().

const char * Instruction::getOpcodeName ( unsigned  OpCode) [static]

Definition at line 58 of file Instruction.h.

Referenced by AddAlignmentAssumptions(), llvm::AddLandingPadInfo(), llvm::RecurrenceDescriptor::AddReductionVar(), llvm::IVUsers::AddUsersImpl(), BlockIsSimpleEnoughToThreadThrough(), BrPHIToSelect(), llvm::calculateClrEHStateNumbers(), calculateCXXStateNumbers(), calculateSEHStateNumbers(), canConstantEvolve(), llvm::AAResults::canInstructionRangeModRef(), changeToCall(), llvm::changeToUnreachable(), llvm::CloneAndPruneIntoFromInst(), llvm::CodeMetrics::collectEphemeralValues(), CombineUAddWithOverflow(), computeKnownBitsFromAssume(), computeKnownBitsFromDominatingCondition(), ConstructSSAForLoadSet(), copyMetadata(), createFree(), createMalloc(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::DependenceAnalysis::depends(), despeculateCountZeros(), detectPopcountIdiom(), llvm::OrderedBasicBlock::dominates(), llvm::DominatorTree::dominates(), llvm::InstCombiner::dominatesAllUses(), DominatesMergePoint(), llvm::Value::DoPHITranslation(), EliminateDeadSwitchCases(), eraseFromParent(), llvm::expandAtomicRMWToCmpXchg(), findBasePointer(), FindInitTrampolineFromBB(), findLiveSetAtInst(), llvm::SelectionDAGBuilder::FindMergedConditions(), FindPhiPredForUseInBlock(), findRetainForStoreStrongContraction(), findSafeStoreForStoreStrongContraction(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), FoldTwoEntryPHINode(), GetCaseResults(), getCommonReturnValue(), llvm::DemandedBits::getDemandedBits(), llvm::MemoryDependenceAnalysis::getDependency(), getFirstInst(), getFunction(), getInsertPointForUses(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), GetLoadValueForLoad(), getLoopPhiForCounter(), getModule(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::MemoryDependenceAnalysis::getNonLocalPointerDependency(), llvm::LazyValueInfo::getPredicateAt(), llvm::DependenceAnalysis::getSplitIteration(), llvm::GCRelocateInst::getStatepoint(), HandleByValArgument(), HandleInlinedEHPad(), HandleInlinedLandingPad(), HasSafePathToPredecessorCall(), llvm::FastISel::hasTrivialKill(), llvm::SCEVExpander::hoistIVInc(), HoistThenElseCodeToIf(), InBlock(), InlineCallIfPossible(), llvm::InlineFunction(), insertAfter(), insertBefore(), insertFastDiv(), llvm::InstCombiner::InsertNewInstBefore(), Instruction(), isChainSelectCmpBranch(), isDynamicConstant(), isGuaranteedToExecute(), llvm::isGuaranteedToExecuteForEveryIteration(), llvm::InductionDescriptor::isInductionPHI(), llvm::isInTailCallPosition(), isInteresting(), isKnownNonNullFromDominatingCondition(), llvm::isKnownNotFullPoison(), llvm::Loop::isLCSSAForm(), isLoopInvariant(), IsNonLocalValue(), llvm::isPotentiallyReachable(), isProfitableToFoldUnconditional(), llvm::DominatorTree::isReachableFromEntry(), isSafeAndProfitableToSinkLoad(), isSafePHIToSpeculate(), llvm::isSafeToLoadUnconditionally(), llvm::isSafeToSpeculativelyExecute(), isSameUnderlyingObjectInLoop(), llvm::AllocaInst::isStaticAlloca(), llvm::Value::isUsedInBasicBlock(), isUsedOutsideOfBlock(), isUsedOutsideOfDefiningBlock(), isValidAssumeForContext(), IVUseShouldUsePostIncValue(), LdStHasDebugValue(), LLVMGetNextInstruction(), LLVMGetPreviousInstruction(), LLVMPositionBuilderBefore(), llvm::SelectionDAGBuilder::LowerStatepoint(), lowerStatepointMetaArgs(), llvm::HexagonTargetLowering::mayBeEmittedAsTailCall(), mergeConditionalStores(), mergeConditionalStoreToAddress(), moveBBContents(), moveBefore(), llvm::LoopInfo::movementPreservesLCSSAForm(), NegateValue(), OptimizeExtractBits(), parentFunctionOfValue(), passingValueIsAlwaysUndefined(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateValue(), llvm::PointerMayBeCapturedBefore(), llvm::DivergenceAnalysis::print(), llvm::Value::print(), processInstruction(), llvm::AssumptionCache::registerAssumption(), removeFromParent(), RemoveSwitchAfterSelectConversion(), replaceAndRecursivelySimplifyImpl(), ReplaceCallWith(), llvm::SCEVExpander::replaceCongruentIVs(), llvm::InstCombiner::replacedSelectWithOperand(), replaceExtractElements(), llvm::ReplaceInstWithInst(), llvm::LoopInfo::replacementPreservesLCSSAForm(), ReplaceWithStatepoint(), 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(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), llvm::InstCombiner::SimplifyDivRemOfSelect(), simplifyOneLoop(), simplifyRelocatesOffABase(), SimplifyTerminatorOnSelect(), llvm::simplifyUsersOfIV(), SinkCast(), SinkCmpExpression(), SinkShiftAndTruncate(), SinkThenElseCodeToEnd(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), llvm::SparseSolver::Solve(), SpeculativelyExecuteBB(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitCriticalEdge(), splitVectorValues(), SwitchToLookupTable(), llvm::FastISel::tryToFoldLoad(), tryToMoveFreeBeforeNullTest(), TryToSimplifyUncondBranchWithICmpInIt(), TryToSinkInstruction(), TurnSwitchRangeIntoICmp(), UpdateCallGraphAfterInlining(), llvm::UpgradeIntrinsicCall(), ValueDominatesPHI(), llvm::SelectionDAGBuilder::visit(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitCallInst(), llvm::Interpreter::visitCallSite(), llvm::InstCombiner::visitFCmpInst(), llvm::InstCombiner::visitGetElementPtrInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitLandingPadInst(), llvm::InstCombiner::visitLoadInst(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().

Definition at line 59 of file Instruction.h.

Determine whether the allow-reciprocal flag is set.

Definition at line 175 of file Instruction.cpp.

Referenced by llvm::InstCombiner::visitFDiv().

hasMetadata() - Return true if this instruction has any metadata attached to it.

Definition at line 156 of file Instruction.h.

Referenced by clone(), copyMetadata(), getAllMetadata(), getMetadata(), and setMetadata().

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

Definition at line 160 of file Instruction.h.

Referenced by getAllMetadataOtherThanDebugLoc().

Determine whether the no-infs flag is set.

Definition at line 163 of file Instruction.cpp.

Referenced by SimplifyFAddInst().

Determine whether the no-NaNs flag is set.

Definition at line 157 of file Instruction.cpp.

Referenced by SimplifyFAddInst().

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

Definition at line 169 of file Instruction.cpp.

Referenced by llvm::BinaryOperator::isFNeg(), llvm::InstCombiner::visitFAdd(), and llvm::InstCombiner::visitFMul().

void Instruction::insertAfter ( Instruction InsertPos)
void Instruction::insertBefore ( Instruction InsertPos)

isArithmeticShift - Return true if this is an arithmetic shift right.

Definition at line 136 of file Instruction.h.

References getOpcode().

Referenced by llvm::InstCombiner::visitICmpInstWithInstAndIntCst().

isAssociative - 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 497 of file Instruction.cpp.

References getOpcode(), and hasUnsafeAlgebra().

Referenced by llvm::ConstantFoldBinaryInstruction(), LinearizeExprTree(), SimplifyAssociativeBinOp(), and SimplifyBinOp().

isAssociative - 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 492 of file Instruction.cpp.

References llvm::APIntOps::And(), llvm::APIntOps::Or(), and llvm::APIntOps::Xor().

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

Definition at line 455 of file Instruction.cpp.

References getOpcode(), llvm::SPII::Load, llvm::NotAtomic, and llvm::SPII::Store.

Referenced by llvm::isGuaranteedToTransferExecutionToSuccessor(), llvm::LoadInst::isSimple(), and llvm::StoreInst::isSimple().

bool llvm::Instruction::isBinaryOp ( ) const [inline]
static bool llvm::Instruction::isBinaryOp ( unsigned  Opcode) [inline, static]

Definition at line 120 of file Instruction.h.

bool llvm::Instruction::isCast ( ) const [inline]
static bool llvm::Instruction::isCast ( unsigned  OpCode) [inline, static]

Determine if the OpCode is one of the CastInst instructions.

Definition at line 141 of file Instruction.h.

isCommutative - Return true if the instruction is commutative:

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

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

Reimplemented in llvm::FCmpInst, llvm::ICmpInst, and llvm::CmpInst.

Definition at line 328 of file Instruction.h.

References getOpcode(), and isCommutative().

Referenced by llvm::RecurrenceDescriptor::AddReductionVar(), llvm::ConstantFoldBinaryInstruction(), ExpandBinOp(), llvm::InstCombiner::FoldSelectOpOp(), isCommutative(), LinearizeExprTree(), RightDistributesOverLeft(), SimplifyAssociativeBinOp(), llvm::BinaryOperator::swapOperands(), ThreadBinOpOverSelect(), and tryFactorization().

isCommutative - Return true if the instruction is commutative:

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

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

Definition at line 518 of file Instruction.cpp.

References llvm::APIntOps::And(), llvm::APIntOps::Or(), and llvm::APIntOps::Xor().

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

Definition at line 112 of file Instruction.h.

References getOpcode(), and isFuncletPad().

Referenced by llvm::FuncletPadInst::classof(), and isFuncletPad().

static bool llvm::Instruction::isFuncletPad ( unsigned  OpCode) [inline, static]

Determine if the OpCode is one of the FuncletPadInst instructions.

Definition at line 146 of file Instruction.h.

isIdempotent - 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 337 of file Instruction.h.

References getOpcode(), and isIdempotent().

Referenced by IncorporateWeight(), and isIdempotent().

bool Instruction::isIdempotent ( unsigned  Opcode) [static]

isIdempotent - 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 539 of file Instruction.cpp.

References llvm::APIntOps::And(), and llvm::APIntOps::Or().

isIdenticalTo - 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 331 of file Instruction.cpp.

References isIdenticalToWhenDefined(), and llvm::Value::SubclassOptionalData.

Referenced by checkCSEInPredecessor(), llvm::EliminateDuplicatePHINodes(), findBasePointer(), HasSameValue(), markAliveBlocks(), and TryToMergeLandingPad().

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

Definition at line 339 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().

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

Definition at line 131 of file Instruction.h.

References getOpcode(), and llvm::LShr.

Referenced by llvm::InstCombiner::FoldShiftByConstant().

isNilpotent - 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 349 of file Instruction.h.

References getOpcode(), and isNilpotent().

Referenced by IncorporateWeight(), and isNilpotent().

bool Instruction::isNilpotent ( unsigned  Opcode) [static]

isNilpotent - 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 552 of file Instruction.cpp.

References llvm::APIntOps::Xor().

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

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

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

Definition at line 366 of file Instruction.cpp.

References CompareIgnoringAlignment, CompareUsingScalarTypes, llvm::User::getNumOperands(), getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarType(), llvm::Value::getType(), and haveSameSpecialState().

Referenced by SinkThenElseCodeToEnd().

static bool llvm::Instruction::isShift ( unsigned  Opcode) [inline, static]

Determine if the Opcode is one of the shift instructions.

Definition at line 125 of file Instruction.h.

static bool llvm::Instruction::isTerminator ( unsigned  OpCode) [inline, static]

Definition at line 116 of file Instruction.h.

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

isUsedOutsideOfBlock - Return true if there are any uses of I outside of the specified block.

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

Definition at line 393 of file Instruction.cpp.

References llvm::dyn_cast(), getParent(), I, and llvm::Value::uses().

mayHaveSideEffects - 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 388 of file Instruction.h.

References mayReturn(), mayThrow(), and mayWriteToMemory().

Referenced by InstructionWillNotHaveChain(), isAlwaysLive(), llvm::isInstructionTriviallyDead(), llvm::isInTailCallPosition(), IsSafeComputationToRemove(), isSafePHIToSpeculate(), isSafeToSpeculateStore(), SinkThenElseCodeToEnd(), SpeculativelyExecuteBB(), and TryToSinkInstruction().

mayReturn - Return true if this is a function that may return.

this is true for all normal instructions. The only exception is functions that are marked with the 'noreturn' attribute.

Definition at line 480 of file Instruction.cpp.

Referenced by mayHaveSideEffects().

mayThrow - Return true if this instruction may throw an exception.

Definition at line 470 of file Instruction.cpp.

Referenced by isSafeToMove(), and mayHaveSideEffects().

void Instruction::moveBefore ( Instruction MovePos)

moveBefore - Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before 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 94 of file Instruction.cpp.

References llvm::BasicBlock::getInstList(), llvm::ilist_node< Instruction >::getIterator(), llvm::ilist_node< NodeTy >::getIterator(), getParent(), and llvm::iplist< NodeTy, Traits >::splice().

Referenced by hoist(), hoistBeforePos(), llvm::SCEVExpander::hoistIVInc(), llvm::Loop::makeLoopInvariant(), NegateValue(), rotateLoop(), tryToMoveFreeBeforeNullTest(), TryToSinkInstruction(), and llvm::InstCombiner::visitAllocaInst().

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

Definition at line 71 of file Instruction.cpp.

References llvm::BasicBlock::getInstList(), llvm::ilist_node< Instruction >::getIterator(), getParent(), and llvm::iplist< NodeTy, Traits >::remove().

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

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

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

See LangRef.html for the meaning of these flags.

See LangRef.html for the meaning of these flats.

Definition at line 140 of file Instruction.cpp.

Referenced by ClearSubclassDataAfterReassociation(), CreateAdd(), CreateMul(), CreateNeg(), and llvm::InstCombiner::visitFDiv().

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 132 of file Instruction.cpp.

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 116 of file Instruction.cpp.

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

Set or clear the NoNaNs 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 109 of file Instruction.cpp.

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 124 of file Instruction.cpp.

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 102 of file Instruction.cpp.

void llvm::Instruction::setInstructionSubclassData ( unsigned short  D) [inline, protected]

Definition at line 520 of file Instruction.h.

Referenced by llvm::CmpInst::setPredicate().

void Instruction::setMetadata ( unsigned  KindID,
MDNode Node 
)
void Instruction::setMetadata ( StringRef  Kind,
MDNode Node 
)

Definition at line 1103 of file Metadata.cpp.

References llvm::Value::getContext(), hasMetadata(), and setMetadata().

Reimplemented from llvm::Value.

Definition at line 56 of file Instruction.h.

References llvm::Value::user_begin().


Friends And Related Function Documentation

friend class SymbolTableListTraits< Instruction > [friend]

Definition at line 513 of file Instruction.h.


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