LLVM  3.7.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
llvm::BinaryOperator Class Reference

#include <InstrTypes.h>

Inheritance diagram for llvm::BinaryOperator:
[legend]
Collaboration diagram for llvm::BinaryOperator:
[legend]

Public Member Functions

void * operator new (size_t s)
 
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Transparently provide more efficient getOperand methods. More...
 
 DEFINE_HELPERS (Add, NSW) DEFINE_HELPERS(Add
 
NUW DEFINE_HELPERS (Sub, NSW) DEFINE_HELPERS(Sub
 
NUW NUW DEFINE_HELPERS (Mul, NSW) DEFINE_HELPERS(Mul
 
NUW NUW NUW DEFINE_HELPERS (Shl, NSW) DEFINE_HELPERS(Shl
 
NUW NUW NUW NUW DEFINE_HELPERS (SDiv, Exact) DEFINE_HELPERS(UDiv
 
NUW NUW NUW NUW Exact DEFINE_HELPERS (AShr, Exact) DEFINE_HELPERS(LShr
 
BinaryOps getOpcode () const
 
bool swapOperands ()
 Exchange the two operands to this instruction. More...
 
void setHasNoUnsignedWrap (bool b=true)
 Set or clear the nsw flag on this instruction, which must be an operator which supports this flag. More...
 
void setHasNoSignedWrap (bool b=true)
 Set or clear the nsw flag on this instruction, which must be an operator which supports this flag. More...
 
void setIsExact (bool b=true)
 Set or clear the exact flag on this instruction, which must be an operator which supports this flag. More...
 
bool hasNoUnsignedWrap () const
 Determine whether the no unsigned wrap flag is set. More...
 
bool hasNoSignedWrap () const
 Determine whether the no signed wrap flag is set. More...
 
bool isExact () const
 Determine whether the exact flag is set. More...
 
void copyIRFlags (const Value *V)
 Convenience method to copy supported wrapping, exact, and fast-math flags from V to this instruction. More...
 
void andIRFlags (const Value *V)
 Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction. More...
 
- Public Member Functions inherited from llvm::Instruction
 ~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. More...
 
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. More...
 
ModulegetModule ()
 
void removeFromParent ()
 removeFromParent - This method unlinks 'this' from the containing basic block, but does not delete it. More...
 
iplist< Instruction >::iterator eraseFromParent ()
 eraseFromParent - This method unlinks 'this' from the containing basic block and deletes it. More...
 
void insertBefore (Instruction *InsertPos)
 Insert an unlinked instruction into a basic block immediately before the specified instruction. More...
 
void insertAfter (Instruction *InsertPos)
 Insert an unlinked instruction into a basic block immediately after the specified instruction. More...
 
void moveBefore (Instruction *MovePos)
 moveBefore - Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos. More...
 
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
 isLogicalShift - Return true if this is a logical shift left or a logical shift right. More...
 
bool isArithmeticShift () const
 isArithmeticShift - Return true if this is an arithmetic shift right. More...
 
bool hasMetadata () const
 hasMetadata() - Return true if this instruction has any metadata attached to it. More...
 
bool hasMetadataOtherThanDebugLoc () const
 hasMetadataOtherThanDebugLoc - Return true if this instruction has metadata attached to it other than a debug location. More...
 
MDNodegetMetadata (unsigned KindID) const
 getMetadata - Get the metadata of given kind attached to this Instruction. More...
 
MDNodegetMetadata (StringRef Kind) const
 getMetadata - Get the metadata of given kind attached to this Instruction. More...
 
void getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const
 getAllMetadata - Get all metadata attached to this Instruction. More...
 
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. More...
 
void getAAMetadata (AAMDNodes &N, bool Merge=false) const
 getAAMetadata - Fills the AAMDNodes structure with AA metadata from this instruction. More...
 
void setMetadata (unsigned KindID, MDNode *Node)
 setMetadata - Set the metadata of the specified kind to the specified node. More...
 
void setMetadata (StringRef Kind, MDNode *Node)
 
void dropUnknownMetadata (ArrayRef< unsigned > KnownIDs)
 Drop unknown metadata. More...
 
void dropUnknownMetadata ()
 
void dropUnknownMetadata (unsigned ID1)
 
void dropUnknownMetadata (unsigned ID1, unsigned ID2)
 
void setAAMetadata (const AAMDNodes &N)
 setAAMetadata - Sets the metadata on this instruction from the AAMDNodes structure. More...
 
void setDebugLoc (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)
 Set or clear the unsafe-algebra flag on this instruction, which must be an operator which supports this flag. More...
 
void setHasNoNaNs (bool B)
 Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag. More...
 
void setHasNoInfs (bool B)
 Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag. More...
 
void setHasNoSignedZeros (bool B)
 Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag. More...
 
void setHasAllowReciprocal (bool B)
 Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag. More...
 
void setFastMathFlags (FastMathFlags FMF)
 Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags. More...
 
void copyFastMathFlags (FastMathFlags FMF)
 Convenience function for transferring all fast-math flag values to this instruction, which must be an operator which supports these flags. More...
 
bool hasUnsafeAlgebra () const
 Determine whether the unsafe-algebra flag is set. More...
 
bool hasNoNaNs () const
 Determine whether the no-NaNs flag is set. More...
 
bool hasNoInfs () const
 Determine whether the no-infs flag is set. More...
 
bool hasNoSignedZeros () const
 Determine whether the no-signed-zeros flag is set. More...
 
bool hasAllowReciprocal () const
 Determine whether the allow-reciprocal flag is set. More...
 
FastMathFlags getFastMathFlags () const
 Convenience function for getting all the fast-math flags, which must be an operator which supports these flags. More...
 
void copyFastMathFlags (const Instruction *I)
 Copy I's fast-math flags. More...
 
bool isAssociative () const
 isAssociative - Return true if the instruction is associative: More...
 
bool isCommutative () const
 isCommutative - Return true if the instruction is commutative: More...
 
bool isIdempotent () const
 isIdempotent - Return true if the instruction is idempotent: More...
 
bool isNilpotent () const
 isNilpotent - Return true if the instruction is nilpotent: More...
 
bool mayWriteToMemory () const
 mayWriteToMemory - Return true if this instruction may modify memory. More...
 
bool mayReadFromMemory () const
 mayReadFromMemory - Return true if this instruction may read memory. More...
 
bool mayReadOrWriteMemory () const
 mayReadOrWriteMemory - Return true if this instruction may read or write memory. More...
 
bool isAtomic () const
 isAtomic - Return true if this instruction has an AtomicOrdering of unordered or higher. More...
 
bool mayThrow () const
 mayThrow - Return true if this instruction may throw an exception. More...
 
bool mayReturn () const
 mayReturn - Return true if this is a function that may return. More...
 
bool mayHaveSideEffects () const
 mayHaveSideEffects - Return true if the instruction may have side effects. More...
 
Instructionclone () const
 clone() - Create a copy of 'this' instruction that is identical in all ways except the following: More...
 
bool isIdenticalTo (const Instruction *I) const
 isIdenticalTo - Return true if the specified instruction is exactly identical to the current one. More...
 
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. More...
 
bool isSameOperationAs (const Instruction *I, unsigned flags=0) const
 This function determines if the specified instruction executes the same operation as the current one. More...
 
bool isUsedOutsideOfBlock (const BasicBlock *BB) const
 isUsedOutsideOfBlock - Return true if there are any uses of this instruction in blocks other than the specified block. More...
 
- Public Member Functions inherited from llvm::User
 ~User () override
 
void operator delete (void *Usr)
 Free memory allocated for User and Use objects. More...
 
void operator delete (void *, unsigned)
 Placement delete - required by std, but never called. More...
 
void operator delete (void *, unsigned, bool)
 Placement delete - required by std, but never called. More...
 
UsegetOperandList ()
 
const UsegetOperandList () const
 
ValuegetOperand (unsigned i) const
 
void setOperand (unsigned i, Value *Val)
 
const UsegetOperandUse (unsigned i) const
 
UsegetOperandUse (unsigned i)
 
unsigned getNumOperands () const
 
void setGlobalVariableNumOperands (unsigned NumOps)
 Set the number of operands on a GlobalVariable. More...
 
void setFunctionNumOperands (unsigned NumOps)
 Set the number of operands on a Function. More...
 
void setNumHungOffUseOperands (unsigned NumOps)
 Subclasses with hung off uses need to manage the operand count themselves. More...
 
op_iterator op_begin ()
 
const_op_iterator op_begin () const
 
op_iterator op_end ()
 
const_op_iterator op_end () const
 
op_range operands ()
 
const_op_range operands () const
 
value_op_iterator value_op_begin ()
 
value_op_iterator value_op_end ()
 
iterator_range< value_op_iteratoroperand_values ()
 
void dropAllReferences ()
 Drop all references to operands. More...
 
void replaceUsesOfWith (Value *From, Value *To)
 Replace uses of one Value with another. More...
 
- Public Member Functions inherited from llvm::Value
virtual ~Value ()
 
void dump () const
 Support for debugging, callable in GDB: V->dump() More...
 
TypegetType () const
 All values are typed, get the type of this value. More...
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 Return a constant reference to the value's name. More...
 
void setName (const Twine &Name)
 Change the name of the value. More...
 
void takeName (Value *V)
 Transfer the name from V to this value. More...
 
void replaceAllUsesWith (Value *V)
 Change all uses of this to point to a new Value. More...
 
void replaceUsesOutsideBlock (Value *V, BasicBlock *BB)
 replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V" instead of "this" when the use is outside the block. More...
 
bool use_empty () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
iterator_range< use_iteratoruses ()
 
iterator_range
< const_use_iterator
uses () const
 
bool user_empty () const
 
user_iterator user_begin ()
 
const_user_iterator user_begin () const
 
user_iterator user_end ()
 
const_user_iterator user_end () const
 
Useruser_back ()
 
const Useruser_back () const
 
iterator_range< user_iteratorusers ()
 
iterator_range
< const_user_iterator
users () const
 
bool hasOneUse () const
 Return true if there is exactly one user of this value. More...
 
bool hasNUses (unsigned N) const
 Return true if this Value has exactly N users. More...
 
bool hasNUsesOrMore (unsigned N) const
 Return true if this value has N users or more. More...
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 Check if this value is used in the specified basic block. More...
 
unsigned getNumUses () const
 This method computes the number of uses of this Value. More...
 
void addUse (Use &U)
 This method should only be used by the Use class. More...
 
unsigned getValueID () const
 Return an ID for the concrete type of this object. More...
 
unsigned getRawSubclassOptionalData () const
 Return the raw optional flags value contained in this value. More...
 
void clearSubclassOptionalData ()
 Clear the optional flags contained in this value. More...
 
bool hasSameSubclassOptionalData (const Value *V) const
 Check the optional flags for equality. More...
 
void intersectOptionalDataWith (const Value *V)
 Clear any optional flags not set in the given Value. More...
 
bool hasValueHandle () const
 Return true if there is a value handle associated with this value. More...
 
bool isUsedByMetadata () const
 Return true if there is metadata referencing this value. More...
 
ValuestripPointerCasts ()
 Strip off pointer casts, all-zero GEPs, and aliases. More...
 
const ValuestripPointerCasts () const
 
ValuestripPointerCastsNoFollowAliases ()
 Strip off pointer casts and all-zero GEPs. More...
 
const ValuestripPointerCastsNoFollowAliases () const
 
ValuestripInBoundsConstantOffsets ()
 Strip off pointer casts and all-constant inbounds GEPs. More...
 
const ValuestripInBoundsConstantOffsets () const
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 Accumulate offsets from stripInBoundsConstantOffsets(). More...
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 
ValuestripInBoundsOffsets ()
 Strip off pointer casts and inbounds GEPs. More...
 
const ValuestripInBoundsOffsets () const
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 Translate PHI node to its predecessor from the given basic block. More...
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 
void mutateType (Type *Ty)
 Mutate the type of this Value to be of the specified type. More...
 
template<class Compare >
void sortUseList (Compare Cmp)
 Sort the use-list. More...
 
void reverseUseList ()
 Reverse the use-list. More...
 
void print (raw_ostream &O) const
 Implement operator<< on Value. More...
 
void print (raw_ostream &O, ModuleSlotTracker &MST) const
 
void printAsOperand (raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
 Print the name of this Value out to the specified raw_ostream. More...
 
void printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const
 
- Public Member Functions inherited from llvm::ilist_node< 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 BinaryOperatorCreate (BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
 Construct a binary instruction, given the opcode and the two operands. More...
 
static BinaryOperatorCreate (BinaryOps Op, Value *S1, Value *S2, const Twine &Name, BasicBlock *InsertAtEnd)
 Construct a binary instruction, given the opcode and the two operands. More...
 
static BinaryOperatorCreateNSW (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
 
static BinaryOperatorCreateNSW (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
 
static BinaryOperatorCreateNSW (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
 
static BinaryOperatorCreateNUW (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
 
static BinaryOperatorCreateNUW (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
 
static BinaryOperatorCreateNUW (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
 
static BinaryOperatorCreateExact (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
 
static BinaryOperatorCreateExact (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
 
static BinaryOperatorCreateExact (BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
 
NUW NUW NUW NUW Exact static
Exact BinaryOperator
CreateNeg (Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
 Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and XOR: More...
 
static BinaryOperatorCreateNeg (Value *Op, const Twine &Name, BasicBlock *InsertAtEnd)
 
static BinaryOperatorCreateNSWNeg (Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
 
static BinaryOperatorCreateNSWNeg (Value *Op, const Twine &Name, BasicBlock *InsertAtEnd)
 
static BinaryOperatorCreateNUWNeg (Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
 
static BinaryOperatorCreateNUWNeg (Value *Op, const Twine &Name, BasicBlock *InsertAtEnd)
 
static BinaryOperatorCreateFNeg (Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
 
static BinaryOperatorCreateFNeg (Value *Op, const Twine &Name, BasicBlock *InsertAtEnd)
 
static BinaryOperatorCreateNot (Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
 
static BinaryOperatorCreateNot (Value *Op, const Twine &Name, BasicBlock *InsertAtEnd)
 
static bool isNeg (const Value *V)
 Check if the given Value is a NEG, FNeg, or NOT instruction. More...
 
static bool isFNeg (const Value *V, bool IgnoreZeroSign=false)
 
static bool isNot (const Value *V)
 
static const ValuegetNegArgument (const Value *BinOp)
 Helper functions to extract the unary argument of a NEG, FNEG or NOT operation implemented via Sub, FSub, or Xor. More...
 
static ValuegetNegArgument (Value *BinOp)
 
static const ValuegetFNegArgument (const Value *BinOp)
 
static ValuegetFNegArgument (Value *BinOp)
 
static const ValuegetNotArgument (const Value *BinOp)
 
static ValuegetNotArgument (Value *BinOp)
 
static bool classof (const Instruction *I)
 
static bool classof (const Value *V)
 
- Static Public Member Functions inherited from llvm::Instruction
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)
 isAssociative - Return true if the instruction is associative: More...
 
static bool isCommutative (unsigned op)
 isCommutative - Return true if the instruction is commutative: More...
 
static bool isIdempotent (unsigned op)
 isIdempotent - Return true if the instruction is idempotent: More...
 
static bool isNilpotent (unsigned op)
 isNilpotent - Return true if the instruction is nilpotent: More...
 
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 init (BinaryOps iType)
 
 BinaryOperator (BinaryOps iType, Value *S1, Value *S2, Type *Ty, const Twine &Name, Instruction *InsertBefore)
 
 BinaryOperator (BinaryOps iType, Value *S1, Value *S2, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
 
BinaryOperatorcloneImpl () const
 
- Protected Member Functions inherited from llvm::Instruction
void setInstructionSubclassData (unsigned short D)
 
unsigned getSubclassDataFromInstruction () const
 
 Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=nullptr)
 
 Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd)
 
- Protected Member Functions inherited from llvm::User
void * operator new (size_t Size)
 Allocate a User with an operand pointer co-allocated. More...
 
void * operator new (size_t Size, unsigned Us)
 Allocate a User with the operands co-allocated. More...
 
 User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps)
 
void allocHungoffUses (unsigned N, bool IsPhi=false)
 Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User. More...
 
void growHungoffUses (unsigned N, bool IsPhi=false)
 Grow the number of hung off uses. More...
 
template<int Idx>
UseOp ()
 
template<int Idx>
const UseOp () const
 
- Protected Member Functions inherited from llvm::Value
 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 Instruction
 

Additional Inherited Members

- Public Types inherited from llvm::Instruction
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  OtherOps
 
- Public Types inherited from llvm::User
typedef Useop_iterator
 
typedef const Useconst_op_iterator
 
typedef iterator_range
< op_iterator
op_range
 
typedef iterator_range
< const_op_iterator
const_op_range
 
- Public Types inherited from llvm::Value
enum  ValueTy
 Concrete subclass of this. More...
 
typedef use_iterator_impl< Useuse_iterator
 
typedef use_iterator_impl
< const Use
const_use_iterator
 
typedef user_iterator_impl< Useruser_iterator
 
typedef user_iterator_impl
< const User
const_user_iterator
 
- Static Public Attributes inherited from llvm::Value
static const unsigned MaxAlignmentExponent = 29
 The maximum alignment for instructions. More...
 
static const unsigned MaximumAlignment = 1u << MaxAlignmentExponent
 
- Protected Types inherited from llvm::Value
enum  : unsigned { NumUserOperandsBits = 29 }
 The number of operands in the subclass. More...
 
- Static Protected Member Functions inherited from llvm::User
template<int Idx, typename U >
static UseOpFrom (const U *that)
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 Hold subclass data that can be dropped. More...
 
unsigned NumUserOperands: NumUserOperandsBits
 
bool IsUsedByMD: 1
 
bool HasName: 1
 
bool HasHungOffUses: 1
 

Detailed Description

Definition at line 134 of file InstrTypes.h.

Constructor & Destructor Documentation

BinaryOperator::BinaryOperator ( BinaryOps  iType,
Value S1,
Value S2,
Type Ty,
const Twine Name,
Instruction InsertBefore 
)
protected

Definition at line 1594 of file Instructions.cpp.

References init(), and llvm::Value::setName().

Referenced by Create(), CreateFNeg(), CreateNeg(), and CreateNot().

BinaryOperator::BinaryOperator ( BinaryOps  iType,
Value S1,
Value S2,
Type Ty,
const Twine Name,
BasicBlock InsertAtEnd 
)
protected

Definition at line 1607 of file Instructions.cpp.

References init(), and llvm::Value::setName().

Member Function Documentation

void BinaryOperator::andIRFlags ( const Value V)

Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction.

Definition at line 1899 of file Instructions.cpp.

References llvm::Instruction::copyFastMathFlags(), llvm::Instruction::getFastMathFlags(), hasNoSignedWrap(), hasNoUnsignedWrap(), isExact(), llvm::X86II::OB, setHasNoSignedWrap(), setHasNoUnsignedWrap(), and setIsExact().

Referenced by NegateValue(), and patchReplacementInstruction().

static bool llvm::BinaryOperator::classof ( const Instruction I)
inlinestatic

Definition at line 364 of file InstrTypes.h.

References llvm::Instruction::isBinaryOp().

static bool llvm::BinaryOperator::classof ( const Value V)
inlinestatic

Definition at line 367 of file InstrTypes.h.

BinaryOperator * BinaryOperator::cloneImpl ( ) const
protected

Definition at line 3459 of file Instructions.cpp.

References Create(), and getOpcode().

void BinaryOperator::copyIRFlags ( const Value V)

Convenience method to copy supported wrapping, exact, and fast-math flags from V to this instruction.

Definition at line 1883 of file Instructions.cpp.

References llvm::Instruction::copyFastMathFlags(), llvm::X86II::OB, setHasNoSignedWrap(), setHasNoUnsignedWrap(), and setIsExact().

BinaryOperator * BinaryOperator::Create ( BinaryOps  Op,
Value S1,
Value S2,
const Twine Name = Twine(),
Instruction InsertBefore = nullptr 
)
static
BinaryOperator * BinaryOperator::Create ( BinaryOps  Op,
Value S1,
Value S2,
const Twine Name,
BasicBlock InsertAtEnd 
)
static

Construct a binary instruction, given the opcode and the two operands.

Also automatically insert this instruction to the end of the BasicBlock specified.

Definition at line 1704 of file Instructions.cpp.

References Create(), llvm::BasicBlock::getInstList(), and llvm::iplist< NodeTy, Traits >::push_back().

static BinaryOperator* llvm::BinaryOperator::CreateExact ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name = "" 
)
inlinestatic

Definition at line 232 of file InstrTypes.h.

References setIsExact().

static BinaryOperator* llvm::BinaryOperator::CreateExact ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name,
BasicBlock BB 
)
inlinestatic

Definition at line 238 of file InstrTypes.h.

References setIsExact().

static BinaryOperator* llvm::BinaryOperator::CreateExact ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name,
Instruction I 
)
inlinestatic

Definition at line 244 of file InstrTypes.h.

References setIsExact().

BinaryOperator * BinaryOperator::CreateFNeg ( Value Op,
const Twine Name = "",
Instruction InsertBefore = nullptr 
)
static
BinaryOperator * BinaryOperator::CreateFNeg ( Value Op,
const Twine Name,
BasicBlock InsertAtEnd 
)
static
BinaryOperator * BinaryOperator::CreateNeg ( Value Op,
const Twine Name = "",
Instruction InsertBefore = nullptr 
)
static

Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and XOR:

Create the NEG and NOT instructions out of SUB and XOR instructions.

Definition at line 1712 of file Instructions.cpp.

References BinaryOperator(), llvm::Value::getType(), and llvm::ConstantFP::getZeroValueForNegation().

Referenced by llvm::NoFolder::CreateNeg(), CreateNeg(), llvm::IRBuilder< true, TargetFolder >::CreateNeg(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitMul(), llvm::InstCombiner::visitSDiv(), and llvm::InstCombiner::visitSub().

BinaryOperator * BinaryOperator::CreateNeg ( Value Op,
const Twine Name,
BasicBlock InsertAtEnd 
)
static
BinaryOperator * BinaryOperator::CreateNot ( Value Op,
const Twine Name = "",
Instruction InsertBefore = nullptr 
)
static
BinaryOperator * BinaryOperator::CreateNot ( Value Op,
const Twine Name,
BasicBlock InsertAtEnd 
)
static
static BinaryOperator* llvm::BinaryOperator::CreateNSW ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name = "" 
)
inlinestatic

Definition at line 194 of file InstrTypes.h.

References setHasNoSignedWrap().

static BinaryOperator* llvm::BinaryOperator::CreateNSW ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name,
BasicBlock BB 
)
inlinestatic

Definition at line 200 of file InstrTypes.h.

References setHasNoSignedWrap().

static BinaryOperator* llvm::BinaryOperator::CreateNSW ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name,
Instruction I 
)
inlinestatic

Definition at line 206 of file InstrTypes.h.

References setHasNoSignedWrap().

BinaryOperator * BinaryOperator::CreateNSWNeg ( Value Op,
const Twine Name = "",
Instruction InsertBefore = nullptr 
)
static
BinaryOperator * BinaryOperator::CreateNSWNeg ( Value Op,
const Twine Name,
BasicBlock InsertAtEnd 
)
static
static BinaryOperator* llvm::BinaryOperator::CreateNUW ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name = "" 
)
inlinestatic

Definition at line 213 of file InstrTypes.h.

References setHasNoUnsignedWrap().

static BinaryOperator* llvm::BinaryOperator::CreateNUW ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name,
BasicBlock BB 
)
inlinestatic

Definition at line 219 of file InstrTypes.h.

References setHasNoUnsignedWrap().

static BinaryOperator* llvm::BinaryOperator::CreateNUW ( BinaryOps  Opc,
Value V1,
Value V2,
const Twine Name,
Instruction I 
)
inlinestatic

Definition at line 225 of file InstrTypes.h.

References setHasNoUnsignedWrap().

BinaryOperator * BinaryOperator::CreateNUWNeg ( Value Op,
const Twine Name = "",
Instruction InsertBefore = nullptr 
)
static
BinaryOperator * BinaryOperator::CreateNUWNeg ( Value Op,
const Twine Name,
BasicBlock InsertAtEnd 
)
static
llvm::BinaryOperator::DECLARE_TRANSPARENT_OPERAND_ACCESSORS ( Value  )

Transparently provide more efficient getOperand methods.

llvm::BinaryOperator::DEFINE_HELPERS ( Add  ,
NSW   
)
NUW llvm::BinaryOperator::DEFINE_HELPERS ( Sub  ,
NSW   
)
NUW NUW llvm::BinaryOperator::DEFINE_HELPERS ( Mul  ,
NSW   
)
NUW NUW NUW llvm::BinaryOperator::DEFINE_HELPERS ( Shl  ,
NSW   
)
NUW NUW NUW NUW llvm::BinaryOperator::DEFINE_HELPERS ( SDiv  ,
Exact   
)
NUW NUW NUW NUW Exact llvm::BinaryOperator::DEFINE_HELPERS ( AShr  ,
Exact   
)
const Value * BinaryOperator::getFNegArgument ( const Value BinOp)
static

Definition at line 1827 of file Instructions.cpp.

Referenced by llvm::FastISel::selectFNeg(), and SimplifyFDivInst().

Value * BinaryOperator::getFNegArgument ( Value BinOp)
static

Definition at line 1823 of file Instructions.cpp.

References llvm::User::getOperand().

const Value * BinaryOperator::getNegArgument ( const Value BinOp)
static

Helper functions to extract the unary argument of a NEG, FNEG or NOT operation implemented via Sub, FSub, or Xor.

Definition at line 1819 of file Instructions.cpp.

Value * BinaryOperator::getNegArgument ( Value BinOp)
static

Definition at line 1815 of file Instructions.cpp.

References llvm::User::getOperand().

const Value * BinaryOperator::getNotArgument ( const Value BinOp)
static

Definition at line 1842 of file Instructions.cpp.

Referenced by dyn_castNotVal(), and OptimizeAndOrXor().

Value * BinaryOperator::getNotArgument ( Value BinOp)
static

Definition at line 1831 of file Instructions.cpp.

References llvm::User::getOperand(), isConstantAllOnes(), and isNot().

BinaryOps llvm::BinaryOperator::getOpcode ( ) const
inline
bool BinaryOperator::hasNoSignedWrap ( ) const
bool BinaryOperator::hasNoUnsignedWrap ( ) const
void BinaryOperator::init ( BinaryOps  iType)
protected
bool BinaryOperator::isExact ( ) const
bool BinaryOperator::isFNeg ( const Value V,
bool  IgnoreZeroSign = false 
)
static
bool BinaryOperator::isNeg ( const Value V)
static

Check if the given Value is a NEG, FNeg, or NOT instruction.

Definition at line 1788 of file Instructions.cpp.

Referenced by llvm::getComplexity(), LinearizeExprTree(), NegateValue(), and ShouldBreakUpSubtract().

bool BinaryOperator::isNot ( const Value V)
static
void* llvm::BinaryOperator::operator new ( size_t  s)
inline

Definition at line 149 of file InstrTypes.h.

void BinaryOperator::setHasNoSignedWrap ( bool  b = true)
void BinaryOperator::setHasNoUnsignedWrap ( bool  b = true)
void BinaryOperator::setIsExact ( bool  b = true)
bool BinaryOperator::swapOperands ( )

Exchange the two operands to this instruction.

This instruction is safe to use on any binary instruction and does not modify the semantics of the instruction. If the instruction cannot be reversed (ie, it's a Div), then return true.

Definition at line 1852 of file Instructions.cpp.

References llvm::Instruction::isCommutative(), and std::swap().

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

Friends And Related Function Documentation

friend class Instruction
friend

Definition at line 144 of file InstrTypes.h.


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