LLVM API Documentation

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 }
enum  TermOps
enum  BinaryOps
enum  MemoryOps
enum  CastOps
enum  OtherOps

Public Member Functions

 ~Instruction ()
Instructionuser_back ()
const Instructionuser_back () const
const BasicBlockgetParent () const
BasicBlockgetParent ()
const DataLayoutgetDataLayout () const
void removeFromParent ()
void eraseFromParent ()
void insertBefore (Instruction *InsertPos)
void insertAfter (Instruction *InsertPos)
void moveBefore (Instruction *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 isLogicalShift () const
bool isArithmeticShift () const
 isArithmeticShift - Return true if this is an arithmetic shift right.
bool hasMetadata () const
bool hasMetadataOtherThanDebugLoc () const
MDNodegetMetadata (unsigned KindID) const
MDNodegetMetadata (StringRef Kind) const
void getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const
void getAllMetadataOtherThanDebugLoc (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const
void getAAMetadata (AAMDNodes &N, bool Merge=false) const
void setMetadata (unsigned KindID, MDNode *Node)
void setMetadata (StringRef Kind, MDNode *Node)
void dropUnknownMetadata (ArrayRef< unsigned > KnownIDs)
 Drop unknown metadata. Passes are required to drop metadata they don't understand. This is a convenience method for passes to do so.
void dropUnknownMetadata ()
void dropUnknownMetadata (unsigned ID1)
void dropUnknownMetadata (unsigned ID1, unsigned ID2)
void setAAMetadata (const AAMDNodes &N)
void setDebugLoc (const 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)
void setHasNoNaNs (bool B)
void setHasNoInfs (bool B)
void setHasNoSignedZeros (bool B)
void setHasAllowReciprocal (bool B)
void setFastMathFlags (FastMathFlags FMF)
void copyFastMathFlags (FastMathFlags FMF)
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
void copyFastMathFlags (const Instruction *I)
 Copy I's fast-math flags.
bool isAssociative () const
bool isCommutative () const
bool isIdempotent () const
bool isNilpotent () const
bool mayWriteToMemory () const
bool mayReadFromMemory () const
bool mayReadOrWriteMemory () const
bool isAtomic () const
bool mayThrow () const
bool mayReturn () const
bool mayHaveSideEffects () const
Instructionclone () const
bool isIdenticalTo (const Instruction *I) const
bool isIdenticalToWhenDefined (const Instruction *I) const
bool isSameOperationAs (const Instruction *I, unsigned flags=0) const
 Determine if one instruction is the same operation as another.
bool isUsedOutsideOfBlock (const BasicBlock *BB) const

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 isAssociative (unsigned op)
static bool isCommutative (unsigned op)
static bool isIdempotent (unsigned op)
static bool isNilpotent (unsigned op)
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)
virtual Instructionclone_impl () const =0

Friends

class SymbolTableListTraits< Instruction, BasicBlock >

Detailed Description

Definition at line 33 of file Instruction.h.


Member Enumeration Documentation

Definition at line 425 of file Instruction.h.

Definition at line 439 of file Instruction.h.

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

Definition at line 446 of file Instruction.h.

Definition at line 418 of file Instruction.h.


Constructor & Destructor Documentation

Definition at line 55 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]

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

Definition at line 543 of file Instruction.cpp.

References clone_impl(), getAllMetadataOtherThanDebugLoc(), getDebugLoc(), hasMetadata(), setDebugLoc(), setMetadata(), and llvm::Value::SubclassOptionalData.

Referenced by llvm::CloneBasicBlock(), llvm::FoldBranchToCommonDest(), llvm::FoldReturnIntoUncondBranch(), HoistThenElseCodeToIf(), llvm::SplitLandingPadPredecessors(), and llvm::InstCombiner::visitGetElementPtrInst().

virtual Instruction* llvm::Instruction::clone_impl ( ) const [protected, pure virtual]

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

References copyFastMathFlags(), and getFastMathFlags().

Definition at line 187 of file Instruction.h.

References llvm::None.

Referenced by dropUnknownMetadata().

Definition at line 190 of file Instruction.h.

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

void llvm::Instruction::dropUnknownMetadata ( unsigned  ID1,
unsigned  ID2 
) [inline]

Definition at line 193 of file Instruction.h.

References dropUnknownMetadata().

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

Definition at line 76 of file Instruction.cpp.

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

Referenced by AddReachableCodeToWorklist(), BuildSubAggregate(), changeToCall(), checkCSEInPredecessor(), CleanupPointerRootUsers(), llvm::CloneAndPruneFunctionInto(), CloneLoopBlocks(), ConnectProlog(), llvm::ConstantFoldTerminator(), cse(), DeleteDeadInstruction(), deleteDeadInstruction(), DeleteTriviallyDeadInstructions(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::InstCombiner::DoOneIteration(), llvm::EliminateDuplicatePHINodes(), llvm::InstCombiner::EraseInstFromFunction(), llvm::objcarc::EraseInstruction(), EraseTerminatorInstAndDCECond(), llvm::expandDivision(), llvm::expandDivisionUpTo32Bits(), llvm::expandDivisionUpTo64Bits(), llvm::expandRemainder(), llvm::expandRemainderUpTo32Bits(), llvm::expandRemainderUpTo64Bits(), findPHIToPartitionLoops(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), getAdjustedPtr(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), INITIALIZE_PASS(), InlineCallIfPossible(), llvm::InlineFunction(), insertFastDiv(), LowerAtomicCmpXchgInst(), LowerAtomicRMWInst(), llvm::LowerDbgDeclare(), LowerFenceInst(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), markAliveBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), mergeEmptyReturnBlocks(), OptimizeCmpExpression(), OptimizeExtractBits(), OptimizeGlobalAddressOfMalloc(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateWithInsertion(), promoteSingleBlockAlloca(), llvm::RecursivelyDeleteTriviallyDeadInstructions(), llvm::PHINode::removeIncomingValue(), removeLifetimeIntrinsicUsers(), llvm::BasicBlock::removePredecessor(), removeUndefIntroducingPredecessor(), llvm::LibCallSimplifier::replaceAllUsesWith(), replaceAndRecursivelySimplifyImpl(), llvm::replaceDbgDeclareForAlloca(), ReplaceUsesOfMallocWithGlobal(), ReplaceUsesOfWith(), reuseOrInsertFastDiv(), rewriteSingleStoreAlloca(), RewriteUsesOfLoadForHeapSRoA(), llvm::LoadAndStorePromoter::run(), llvm::NVPTXLowerAggrCopies::runOnFunction(), llvm::Inliner::runOnSCC(), SimplifyBranchOnICmpChain(), simplifyOneLoop(), SinkCast(), SinkThenElseCodeToEnd(), speculatePHINodeLoads(), speculateSelectInstLoads(), llvm::SplitLandingPadPredecessors(), llvm::StripDebugInfo(), SwitchToLookupTable(), tryPromoteAllocaToVector(), tryToMakeAllocaBePromotable(), TryToOptimizeStoreOfMallocToGlobal(), TryToShrinkGlobalToBoolean(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::UnrollLoop(), llvm::UpgradeIntrinsicCall(), 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 159 of file Instruction.h.

References hasMetadata().

Referenced by llvm::AssemblyWriter::printInstruction(), 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 166 of file Instruction.h.

References hasMetadataOtherThanDebugLoc().

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

Definition at line 38 of file Instruction.cpp.

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

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

Referenced by llvm::BinaryOperator::andIRFlags(), ClearSubclassDataAfterReassociation(), copyFastMathFlags(), llvm::SimplifyInstruction(), llvm::InstCombiner::visitFAdd(), llvm::InstCombiner::visitFDiv(), llvm::InstCombiner::visitFMul(), llvm::InstCombiner::visitFSub(), and llvm::InstCombiner::visitSelectInst().

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

References hasMetadata().

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

References llvm::Value::getValueID(), and llvm::Value::InstructionVal.

Referenced by BuildNew(), CanEvaluateSExtd(), CanEvaluateShifted(), CanEvaluateShuffled(), CanEvaluateTruncated(), CanEvaluateZExtd(), CanPHITrans(), canVectorizeInst(), CheapToScalarize(), llvm::OverflowingBinaryOperator::classof(), llvm::UnaryInstruction::classof(), llvm::AllocaInst::classof(), llvm::PossiblyExactOperator::classof(), llvm::LoadInst::classof(), llvm::ConcreteOperator< Operator, Instruction::PtrToInt >::classof(), llvm::StoreInst::classof(), llvm::FenceInst::classof(), llvm::AtomicCmpXchgInst::classof(), llvm::AtomicRMWInst::classof(), llvm::CmpInst::classof(), llvm::GetElementPtrInst::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::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(), CollectBSwapParts(), collectFailStats(), CollectInsertionElements(), ConstantFold(), llvm::ConstantFoldInstruction(), detectLog2OfHalf(), determinePointerReadAttrs(), EvaluateExpression(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::InstCombiner::foldFMulConst(), FoldOperationIntoSelectOperand(), llvm::InstCombiner::FoldSelectOpOp(), GatherConstantCompares(), llvm::SCEVExpander::getIVIncOperand(), getLoopPhiForCounter(), llvm::AliasAnalysis::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(), isExtractBitsCandidateUse(), isFMulOrFDivWithConstant(), isHighCostExpansion(), isIdempotent(), isIdenticalToWhenDefined(), isLogicalShift(), isNilpotent(), isSameOperationAs(), isShift(), isTerminator(), isUnmovableInstruction(), LookThroughFPExtensions(), mayReadFromMemory(), mayWriteToMemory(), llvm::PointerMayBeCaptured(), PrintOps(), llvm::FastISel::selectInstruction(), SimplifyBranchOnICmpChain(), llvm::SimplifyInstruction(), SimplifyWithOpReplaced(), 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 89 of file Instruction.h.

References getOpcode(), and getOpcodeName().

Referenced by getOpcodeName(), llvm::AssemblyWriter::printInstruction(), and PrintOps().

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

Definition at line 54 of file Instruction.h.

Referenced by llvm::IVUsers::AddUsersImpl(), BlockIsSimpleEnoughToThreadThrough(), canConstantEvolve(), llvm::AliasAnalysis::canInstructionRangeModify(), CanSelectOperandBeMappingIntoPredBlock(), changeToCall(), changeToUnreachable(), llvm::CloneAndPruneFunctionInto(), ConstructSSAForLoadSet(), convertMemSetToLoop(), convertTransferToLoop(), createFree(), createMalloc(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::DependenceAnalysis::depends(), llvm::DominatorTree::dominates(), DominatesMergePoint(), llvm::InstCombiner::DoOneIteration(), llvm::Value::DoPHITranslation(), EliminateDeadSwitchCases(), eraseFromParent(), llvm::SCEVExpander::expandCodeFor(), FindInitTrampolineFromBB(), llvm::SelectionDAGBuilder::FindMergedConditions(), FindPhiPredForUseInBlock(), llvm::SimplifyFortifiedLibCalls::fold(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), FoldTwoEntryPHINode(), GetCaseResults(), getCommonReturnValue(), getDataLayout(), llvm::MemoryDependenceAnalysis::getDependency(), getFirstInst(), getInsertPointForUses(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), GetLoadValueForLoad(), getLoopPhiForCounter(), GetMemInstValueForLoad(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::DependenceAnalysis::getSplitIteration(), GetStoreValueForLoad(), HandleByValArgument(), HandleInlinedInvoke(), llvm::FastISel::hasTrivialKill(), llvm::SCEVExpander::hoistIVInc(), HoistThenElseCodeToIf(), InBlock(), InlineCallIfPossible(), llvm::InlineFunction(), insertAfter(), insertBefore(), llvm::InstCombiner::InsertNewInstBefore(), Instruction(), isDynamicConstant(), llvm::isInTailCallPosition(), isInteresting(), llvm::Loop::isLCSSAForm(), isLoopInvariant(), IsNonLocalValue(), llvm::isPotentiallyReachable(), isProfitableToFoldUnconditional(), llvm::DominatorTree::isReachableFromEntry(), isSafeAndProfitableToSinkLoad(), isSafePHIToSpeculate(), llvm::isSafeToLoadUnconditionally(), llvm::isSafeToSpeculativelyExecute(), llvm::AllocaInst::isStaticAlloca(), llvm::Value::isUsedInBasicBlock(), isUsedOutsideOfBlock(), isUsedOutsideOfDefiningBlock(), isValidAssumeForContext(), IVUseShouldUsePostIncValue(), LdStHasDebugValue(), LLVMGetNextInstruction(), LLVMGetPreviousInstruction(), LLVMPositionBuilderBefore(), LowerAtomicCmpXchgInst(), LowerAtomicRMWInst(), LowerBSWAP(), LowerCTLZ(), LowerCTPOP(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), moveBefore(), NegateValue(), OptimizeCmpExpression(), OptimizeExtractBits(), parentFunctionOfValue(), passingValueIsAlwaysUndefined(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateValue(), PrintOps(), processInstruction(), ProcessUAddIdiom(), ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), promoteSingleBlockAlloca(), llvm::AssumptionTracker::registerAssumption(), removeFromParent(), replaceAndRecursivelySimplifyImpl(), ReplaceCallWith(), llvm::replaceDbgDeclareForAlloca(), llvm::ReplaceInstWithInst(), llvm::LoopInfo::replacementPreservesLCSSAForm(), rewriteSingleStoreAlloca(), llvm::SSAUpdater::RewriteUse(), llvm::SSAUpdater::RewriteUseAfterInsertions(), RewriteUsesOfClonedInstructions(), llvm::LoadAndStorePromoter::run(), safeCxtI(), SafeToMergeTerminators(), llvm::FastISel::selectInstruction(), llvm::IRBuilderBase::SetInsertPoint(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), llvm::InstCombiner::SimplifyDivRemOfSelect(), simplifyOneLoop(), SimplifyTerminatorOnSelect(), llvm::simplifyUsersOfIV(), SinkCast(), SinkShiftAndTruncate(), SinkThenElseCodeToEnd(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), llvm::SparseSolver::Solve(), SpeculativelyExecuteBB(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitCriticalEdge(), 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::visitFPTrunc(), llvm::InstCombiner::visitGetElementPtrInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitLoadInst(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().

Definition at line 55 of file Instruction.h.

Determine whether the allow-reciprocal flag is set.

Definition at line 176 of file Instruction.cpp.

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

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

Definition at line 132 of file Instruction.h.

References llvm::DebugLoc::isUnknown().

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

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

Definition at line 138 of file Instruction.h.

Referenced by getAllMetadataOtherThanDebugLoc().

Determine whether the no-infs flag is set.

Definition at line 164 of file Instruction.cpp.

Referenced by SimplifyFAddInst().

Determine whether the no-NaNs flag is set.

Definition at line 158 of file Instruction.cpp.

Referenced by SimplifyFAddInst().

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

Definition at line 170 of file Instruction.cpp.

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

void Instruction::insertAfter ( Instruction InsertPos)

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

Definition at line 88 of file Instruction.cpp.

References llvm::BasicBlock::getInstList(), getParent(), and llvm::iplist< NodeTy, Traits >::insertAfter().

void Instruction::insertBefore ( Instruction InsertPos)

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

Definition at line 82 of file Instruction.cpp.

References llvm::BasicBlock::getInstList(), getParent(), and llvm::iplist< NodeTy, Traits >::insert().

Referenced by llvm::FoldBranchToCommonDest(), INITIALIZE_PASS(), and llvm::InstCombiner::visitUDiv().

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

Definition at line 117 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 484 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 479 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 446 of file Instruction.cpp.

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

Referenced by 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 101 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 122 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 302 of file Instruction.h.

References getOpcode(), and isCommutative().

Referenced by 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 505 of file Instruction.cpp.

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

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 311 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 526 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 326 of file Instruction.cpp.

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

Referenced by checkCSEInPredecessor().

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 334 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 112 of file Instruction.h.

References getOpcode(), and llvm::LShr.

Referenced by CollectBSwapParts(), and 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 323 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 539 of file Instruction.cpp.

References llvm::APIntOps::Xor().

Determine if one instruction is the same operation as another.

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.

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

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

Definition at line 97 of file Instruction.h.

isUsedOutsideOfBlock - 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.

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 388 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 used the returned value. For cases where this matters, isSafeToSpeculativelyExecute may be more appropriate.

Definition at line 362 of file Instruction.h.

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

Referenced by InstructionWillNotHaveChain(), 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 467 of file Instruction.cpp.

Referenced by mayHaveSideEffects().

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

Definition at line 461 of file Instruction.cpp.

Referenced by mayHaveSideEffects().

void Instruction::moveBefore ( Instruction MovePos)

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

Definition at line 72 of file Instruction.cpp.

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

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

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.

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 flats.

Definition at line 141 of file Instruction.cpp.

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

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

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.

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 110 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 125 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 103 of file Instruction.cpp.

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

Definition at line 474 of file Instruction.h.

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

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

setMetadata - Set the metadata of the specified kind to the specified node. This updates/replaces metadata if already present, or removes it if Node is null.

setMetadata - Set the metadata of of the specified kind to the specified node. This updates/replaces metadata if already present, or removes it if Node is null.

Definition at line 669 of file Metadata.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::count(), llvm::SmallVectorBase::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::erase(), llvm::Value::getContext(), llvm::DebugLoc::getFromDILocation(), hasMetadata(), llvm::LLVMContext::MD_dbg, llvm::LLVMContextImpl::MetadataStore, Node, P, llvm::LLVMContext::pImpl, llvm::SmallVectorTemplateBase< T, isPodLike >::pop_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::SmallVectorTemplateCommon< T, typename >::size().

Referenced by AddAliasScopeMetadata(), clone(), CloneAliasScopeMetadata(), llvm::combineMetadata(), llvm::ConstantFoldTerminator(), llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), EliminateDeadSwitchCases(), llvm::FoldBranchToCommonDest(), llvm::RemapInstruction(), setAAMetadata(), llvm::Loop::setLoopID(), setMetadata(), SimplifyCondBranchToCondBranch(), SimplifyTerminatorOnSelect(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::BranchInst::swapSuccessors(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::UpgradeInstWithTBAATag(), and llvm::UpgradeIntrinsicCall().

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

Definition at line 613 of file Metadata.cpp.

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

Reimplemented from llvm::Value.

Definition at line 52 of file Instruction.h.

References llvm::Value::user_begin().


Friends And Related Function Documentation

friend class SymbolTableListTraits< Instruction, BasicBlock > [friend]

Definition at line 467 of file Instruction.h.


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