LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
llvm::Instruction Class Referenceabstract

#include <Instruction.h>

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

Public Types

enum  OperationEquivalenceFlags { CompareIgnoringAlignment = 1<<0, CompareUsingScalarTypes = 1<<1 }
 
enum  TermOps
 
enum  BinaryOps
 
enum  MemoryOps
 
enum  CastOps
 
enum  OtherOps
 
- Public Types inherited from llvm::User
typedef Useop_iterator
 
typedef const Useconst_op_iterator
 
- Public Types inherited from llvm::Value
enum  ValueTy {
  ArgumentVal, BasicBlockVal, FunctionVal, GlobalAliasVal,
  GlobalVariableVal, UndefValueVal, BlockAddressVal, ConstantExprVal,
  ConstantAggregateZeroVal, ConstantDataArrayVal, ConstantDataVectorVal, ConstantIntVal,
  ConstantFPVal, ConstantArrayVal, ConstantStructVal, ConstantVectorVal,
  ConstantPointerNullVal, MDNodeVal, MDStringVal, InlineAsmVal,
  PseudoSourceValueVal, FixedStackPseudoSourceValueVal, InstructionVal, ConstantFirstVal = FunctionVal,
  ConstantLastVal = ConstantPointerNullVal
}
 
typedef value_use_iterator< Useruse_iterator
 
typedef value_use_iterator
< const User
const_use_iterator
 

Public Member Functions

 ~Instruction ()
 
Instructionuse_back ()
 
const Instructionuse_back () const
 
const BasicBlockgetParent () const
 
BasicBlockgetParent ()
 
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. More...
 
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. More...
 
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 setMetadata (unsigned KindID, MDNode *Node)
 
void setMetadata (StringRef Kind, MDNode *Node)
 
void setDebugLoc (const DebugLoc &Loc)
 setDebugLoc - Set the debug location information for this instruction. More...
 
const DebugLocgetDebugLoc () const
 getDebugLoc - Return the debug location for this node as a DebugLoc. More...
 
void setHasUnsafeAlgebra (bool B)
 
void setHasNoNaNs (bool B)
 
void setHasNoInfs (bool B)
 
void setHasNoSignedZeros (bool B)
 
void setHasAllowReciprocal (bool B)
 
void setFastMathFlags (FastMathFlags FMF)
 
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...
 
FastMathFlags getFastMathFlags () const
 
void copyFastMathFlags (const Instruction *I)
 Copy I's fast-math flags. More...
 
bool isAssociative () const
 
bool isCommutative () const
 
bool isIdempotent () const
 
bool isNilpotent () const
 
bool mayWriteToMemory () const
 
bool mayReadFromMemory () const
 
bool mayReadOrWriteMemory () 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. More...
 
bool isUsedOutsideOfBlock (const BasicBlock *BB) const
 
- Public Member Functions inherited from llvm::User
 ~User ()
 
void operator delete (void *Usr)
 operator delete - 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...
 
ValuegetOperand (unsigned i) const
 
void setOperand (unsigned i, Value *Val)
 
const UsegetOperandUse (unsigned i) const
 
UsegetOperandUse (unsigned i)
 
unsigned getNumOperands () const
 
op_iterator op_begin ()
 
const_op_iterator op_begin () const
 
op_iterator op_end ()
 
const_op_iterator op_end () const
 
value_op_iterator value_op_begin ()
 
value_op_iterator value_op_end ()
 
void dropAllReferences ()
 
void replaceUsesOfWith (Value *From, Value *To)
 
- Public Member Functions inherited from llvm::Value
virtual ~Value ()
 
void dump () const
 dump - Support for debugging, callable in GDB: V->dump() More...
 
void print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const
 
TypegetType () const
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 
void setName (const Twine &Name)
 
void takeName (Value *V)
 
void replaceAllUsesWith (Value *V)
 
bool use_empty () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
Useruse_back ()
 
const Useruse_back () const
 
bool hasOneUse () const
 
bool hasNUses (unsigned N) const
 
bool hasNUsesOrMore (unsigned N) const
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 
unsigned getNumUses () const
 
void addUse (Use &U)
 
unsigned getValueID () const
 
unsigned getRawSubclassOptionalData () const
 
void clearSubclassOptionalData ()
 
bool hasSameSubclassOptionalData (const Value *V) const
 
void intersectOptionalDataWith (const Value *V)
 
bool hasValueHandle () const
 
ValuestripPointerCasts ()
 Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCasts () const
 
ValuestripPointerCastsNoFollowAliases ()
 Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCastsNoFollowAliases () const
 
ValuestripInBoundsConstantOffsets ()
 Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsConstantOffsets () const
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More...
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 
ValuestripInBoundsOffsets ()
 Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsOffsets () const
 
bool isDereferenceablePointer () const
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 
void mutateType (Type *Ty)
 
- Public Member Functions inherited from llvm::ilist_node< Instruction >
InstructiongetPrevNode ()
 Get the previous node, or 0 for the list head. More...
 
const InstructiongetPrevNode () const
 Get the previous node, or 0 for the list head. More...
 
InstructiongetNextNode ()
 Get the next node, or 0 for the list tail. More...
 
const InstructiongetNextNode () const
 Get the next node, or 0 for the list tail. 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 isCast (unsigned OpCode)
 Determine if the OpCode is one of the CastInst instructions. More...
 
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: More...
 
- Static Public Member Functions inherited from llvm::User
static bool classof (const Value *V)
 

Protected Member Functions

void setInstructionSubclassData (unsigned short D)
 
unsigned getSubclassDataFromInstruction () const
 
 Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=0)
 
 Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd)
 
virtual Instructionclone_impl () const =0
 
- Protected Member Functions inherited from llvm::User
void * operator new (size_t s, unsigned Us)
 
 User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps)
 
UseallocHungoffUses (unsigned) const
 
void dropHungoffUses ()
 
template<int Idx>
UseOp ()
 
template<int Idx>
const UseOp () const
 
- Protected Member Functions inherited from llvm::Value
virtual void printCustom (raw_ostream &O) const
 
 Value (Type *Ty, unsigned scid)
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 
- Protected Member Functions inherited from llvm::ilist_node< Instruction >
 ilist_node ()
 

Friends

class SymbolTableListTraits< Instruction, BasicBlock >
 

Additional Inherited Members

- Static Public Attributes inherited from llvm::Value
static const unsigned MaximumAlignment = 1u << 29
 
- Static Protected Member Functions inherited from llvm::User
template<int Idx, typename U >
static UseOpFrom (const U *that)
 
- Protected Attributes inherited from llvm::User
UseOperandList
 
unsigned NumOperands
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 

Detailed Description

Definition at line 31 of file Instruction.h.

Member Enumeration Documentation

Definition at line 387 of file Instruction.h.

Definition at line 401 of file Instruction.h.

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

Definition at line 408 of file Instruction.h.

Definition at line 380 of file Instruction.h.

Constructor & Destructor Documentation

Instruction::~Instruction ( )

Definition at line 51 of file Instruction.cpp.

Instruction::Instruction ( Type Ty,
unsigned  iType,
Use Ops,
unsigned  NumOps,
Instruction InsertBefore = 0 
)
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)
inlinestatic

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

Definition at line 373 of file Instruction.h.

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

Instruction * Instruction::clone ( ) 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

Definition at line 541 of file Instruction.cpp.

References clone_impl(), getAllMetadataOtherThanDebugLoc(), getDebugLoc(), hasMetadata(), setDebugLoc(), setMetadata(), llvm::SmallVectorTemplateCommon< T >::size(), and llvm::Value::SubclassOptionalData.

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

virtual Instruction* llvm::Instruction::clone_impl ( ) const
protectedpure virtual
void Instruction::copyFastMathFlags ( const Instruction I)

Copy I's fast-math flags.

Definition at line 181 of file Instruction.cpp.

References getFastMathFlags(), and setFastMathFlags().

Referenced by llvm::InstCombiner::visitFMul(), and llvm::InstCombiner::visitFSub().

void Instruction::eraseFromParent ( )

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

Definition at line 72 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::expandRemainder(), llvm::expandRemainderUpTo32Bits(), 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::BitcodeReader::MaterializeModule(), llvm::MergeBasicBlockIntoOnlyPred(), mergeEmptyReturnBlocks(), OptimizeCmpExpression(), OptimizeGlobalAddressOfMalloc(), OptimizeNoopCopyExpression(), 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(), SinkThenElseCodeToEnd(), speculatePHINodeLoads(), speculateSelectInstLoads(), llvm::SplitLandingPadPredecessors(), StripDebugInfo(), SwitchToLookupTable(), tryToMakeAllocaBePromotable(), TryToOptimizeStoreOfMallocToGlobal(), TryToShrinkGlobalToBoolean(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::UnrollLoop(), llvm::UpgradeIntrinsicCall(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().

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

References hasMetadataOtherThanDebugLoc().

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

const DebugLoc& llvm::Instruction::getDebugLoc ( ) const
inline
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 flats.

Definition at line 175 of file Instruction.cpp.

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

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

References hasMetadata().

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

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

Definition at line 83 of file Instruction.h.

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

Referenced by BuildNew(), CanEvaluateSExtd(), CanEvaluateShifted(), CanEvaluateShuffled(), CanEvaluateTruncated(), CanEvaluateZExtd(), CanPHITrans(), CheapToScalarize(), llvm::OverflowingBinaryOperator::classof(), llvm::AllocaInst::classof(), llvm::UnaryInstruction::classof(), llvm::PossiblyExactOperator::classof(), llvm::LoadInst::classof(), llvm::ConcreteOperator< OverflowingBinaryOperator, Instruction::Mul >::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(), dyn_castFoldableMul(), 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::CmpInst::getOpcode(), llvm::SelectInst::getOpcode(), getOpcodeName(), GetSelectFoldableConstant(), GetSelectFoldableOperands(), GetShiftedValue(), llvm::InlineFunction(), isAllocSiteRemovable(), isArithmeticShift(), isAssociative(), isBinaryOp(), isCast(), isCommutative(), isFMulOrFDivWithConstant(), isHighCostExpansion(), isIdempotent(), isIdenticalToWhenDefined(), isLogicalShift(), isNilpotent(), isSameOperationAs(), isShift(), isTerminator(), isUnmovableInstruction(), LookThroughFPExtensions(), mayReadFromMemory(), mayWriteToMemory(), llvm::PointerMayBeCaptured(), PrintOps(), llvm::FastISel::SelectInstruction(), SimplifyBranchOnICmpChain(), llvm::SimplifyInstruction(), SimplifyWithOpReplaced(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), ThreadBinOpOverSelect(), 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
const char * Instruction::getOpcodeName ( unsigned  OpCode)
static
const BasicBlock* llvm::Instruction::getParent ( ) const
inline

Definition at line 52 of file Instruction.h.

Referenced by llvm::IVUsers::AddUsersImpl(), BlockIsSimpleEnoughToThreadThrough(), canConstantEvolve(), llvm::AliasAnalysis::canInstructionRangeModify(), CanSelectOperandBeMappingIntoPredBlock(), CanTRE(), changeToCall(), changeToUnreachable(), llvm::CloneAndPruneFunctionInto(), ConstructSSAForLoadSet(), llvm::Region::contains(), 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(), llvm::MemoryDependenceAnalysis::getDependency(), getInsertPointForUses(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), GetLoadValueForLoad(), getLoopPhiForCounter(), GetMemInstValueForLoad(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::DependenceAnalysis::getSplitIteration(), GetStoreValueForLoad(), HandleByValArgument(), HandleInlinedInvoke(), HasSafePathToPredecessorCall(), llvm::SCEVExpander::hoistIVInc(), HoistThenElseCodeToIf(), InBlock(), InlineCallIfPossible(), llvm::InlineFunction(), insertAfter(), insertBefore(), llvm::InstCombiner::InsertNewInstBefore(), Instruction(), isDynamicConstant(), llvm::isInTailCallPosition(), isInteresting(), isLoopInvariant(), IsNonLocalValue(), llvm::isPotentiallyReachable(), isProfitableToFoldUnconditional(), llvm::DominatorTree::isReachableFromEntry(), isSafeAndProfitableToSinkLoad(), isSafePHIToSpeculate(), llvm::isSafeToLoadUnconditionally(), llvm::AllocaInst::isStaticAlloca(), llvm::Value::isUsedInBasicBlock(), isUsedOutsideOfDefiningBlock(), IVUseShouldUsePostIncValue(), LdStHasDebugValue(), LLVMGetNextInstruction(), LLVMGetPreviousInstruction(), LLVMPositionBuilderBefore(), LowerAtomicCmpXchgInst(), LowerAtomicRMWInst(), LowerBSWAP(), LowerCTLZ(), LowerCTPOP(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), moveBefore(), NegateValue(), OptimizeCmpExpression(), OptimizeNoopCopyExpression(), passingValueIsAlwaysUndefined(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateValue(), PrintOps(), ProcessUAddIdiom(), ProcessUGT_ADDCST_ADD(), promoteSingleBlockAlloca(), removeFromParent(), replaceAndRecursivelySimplifyImpl(), ReplaceCallWith(), llvm::replaceDbgDeclareForAlloca(), llvm::ReplaceInstWithInst(), llvm::LoopInfo::replacementPreservesLCSSAForm(), rewriteSingleStoreAlloca(), llvm::SSAUpdater::RewriteUse(), llvm::SSAUpdater::RewriteUseAfterInsertions(), RewriteUsesOfClonedInstructions(), llvm::LoadAndStorePromoter::run(), llvm::NVPTXSplitBBatBar::runOnFunction(), SafeToMergeTerminators(), llvm::FastISel::SelectInstruction(), llvm::IRBuilderBase::SetInsertPoint(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), llvm::InstCombiner::SimplifyDivRemOfSelect(), SimplifyTerminatorOnSelect(), llvm::simplifyUsersOfIV(), SinkThenElseCodeToEnd(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), llvm::SparseSolver::Solve(), SpeculativelyExecuteBB(), llvm::SplitBlockAndInsertIfThen(), 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::visitICmpInst(), llvm::InstCombiner::visitLoadInst(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().

BasicBlock* llvm::Instruction::getParent ( )
inline

Definition at line 53 of file Instruction.h.

unsigned llvm::Instruction::getSubclassDataFromInstruction ( ) const
inlineprotected
bool Instruction::hasAllowReciprocal ( ) const

Determine whether the allow-reciprocal flag is set.

Definition at line 167 of file Instruction.cpp.

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

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

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

Definition at line 128 of file Instruction.h.

References llvm::DebugLoc::isUnknown().

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

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

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

Definition at line 134 of file Instruction.h.

Referenced by getAllMetadataOtherThanDebugLoc().

bool Instruction::hasNoInfs ( ) const

Determine whether the no-infs flag is set.

Definition at line 155 of file Instruction.cpp.

Referenced by SimplifyFAddInst(), and llvm::InstCombiner::visitFMul().

bool Instruction::hasNoNaNs ( ) const

Determine whether the no-NaNs flag is set.

Definition at line 149 of file Instruction.cpp.

Referenced by SimplifyFAddInst(), and llvm::InstCombiner::visitFMul().

bool Instruction::hasNoSignedZeros ( ) const

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

Definition at line 161 of file Instruction.cpp.

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

bool Instruction::hasUnsafeAlgebra ( ) const
void Instruction::insertAfter ( Instruction InsertPos)

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

Definition at line 84 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 78 of file Instruction.cpp.

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

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

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

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

Definition at line 113 of file Instruction.h.

References getOpcode().

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

bool Instruction::isAssociative ( ) const

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

References getOpcode(), and hasUnsafeAlgebra().

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

bool Instruction::isAssociative ( unsigned  Opcode)
static

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

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

bool llvm::Instruction::isBinaryOp ( ) const
inline
static bool llvm::Instruction::isBinaryOp ( unsigned  Opcode)
inlinestatic

Definition at line 97 of file Instruction.h.

bool llvm::Instruction::isCast ( ) const
inline
static bool llvm::Instruction::isCast ( unsigned  OpCode)
inlinestatic

Determine if the OpCode is one of the CastInst instructions.

Definition at line 118 of file Instruction.h.

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

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

References getOpcode(), and isCommutative().

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

bool Instruction::isCommutative ( unsigned  op)
static

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

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

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

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

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

bool Instruction::isIdenticalTo ( const Instruction I) const

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

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

Referenced by checkCSEInPredecessor().

bool Instruction::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.

Definition at line 272 of file Instruction.cpp.

References llvm::Intrinsic::getAttributes(), llvm::PHINode::getIncomingBlock(), llvm::User::getNumOperands(), getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), I, and LI.

Referenced by HoistThenElseCodeToIf(), and isIdenticalTo().

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

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

Definition at line 108 of file Instruction.h.

References getOpcode().

Referenced by CollectBSwapParts(), llvm::InstCombiner::FoldShiftByConstant(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().

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

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

References llvm::APIntOps::Xor().

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

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

References CompareIgnoringAlignment, CompareUsingScalarTypes, llvm::Intrinsic::getAttributes(), llvm::User::getNumOperands(), getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarType(), llvm::Value::getType(), I, and LI.

Referenced by SinkThenElseCodeToEnd().

bool llvm::Instruction::isShift ( )
inline
static bool llvm::Instruction::isShift ( unsigned  Opcode)
inlinestatic

Determine if the Opcode is one of the shift instructions.

Definition at line 102 of file Instruction.h.

bool llvm::Instruction::isTerminator ( ) const
inline
static bool llvm::Instruction::isTerminator ( unsigned  OpCode)
inlinestatic

Definition at line 93 of file Instruction.h.

bool Instruction::isUsedOutsideOfBlock ( const BasicBlock BB) const

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

References llvm::dyn_cast(), llvm::PHINode::getIncomingBlock(), llvm::Value::use_begin(), and llvm::Value::use_end().

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

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

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

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

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

mayReadOrWriteMemory - Return true if this instruction may read or write memory.

Definition at line 304 of file Instruction.h.

References mayReadFromMemory(), and mayWriteToMemory().

Referenced by llvm::AliasSetTracker::addUnknown(), llvm::AliasSet::aliasesUnknownInst(), llvm::AliasSetTracker::deleteValue(), llvm::AliasSetTracker::removeUnknown(), and SinkThenElseCodeToEnd().

bool Instruction::mayReturn ( ) const

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

Referenced by mayHaveSideEffects().

bool Instruction::mayThrow ( ) const

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

Definition at line 459 of file Instruction.cpp.

Referenced by mayHaveSideEffects().

bool Instruction::mayWriteToMemory ( ) const
void Instruction::moveBefore ( Instruction MovePos)
void Instruction::removeFromParent ( )

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

Definition at line 68 of file Instruction.cpp.

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

void llvm::Instruction::setDebugLoc ( const DebugLoc Loc)
inline
void Instruction::setFastMathFlags ( FastMathFlags  FMF)

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

Referenced by ClearSubclassDataAfterReassociation(), copyFastMathFlags(), 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 129 of file Instruction.cpp.

void Instruction::setHasNoInfs ( bool  B)

Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.

Definition at line 113 of file Instruction.cpp.

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.

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

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

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

void llvm::Instruction::setInstructionSubclassData ( unsigned short  D)
inlineprotected

Definition at line 436 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 577 of file Metadata.cpp.

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

Instruction* llvm::Instruction::use_back ( )
inline
const Instruction* llvm::Instruction::use_back ( ) const
inline

Definition at line 50 of file Instruction.h.

References llvm::Value::use_begin().

Friends And Related Function Documentation

friend class SymbolTableListTraits< Instruction, BasicBlock >
friend

Definition at line 429 of file Instruction.h.


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