LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::BinaryOperator Class Reference

#include <InstrTypes.h>

Inheritance diagram for llvm::BinaryOperator:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 HANDLE_MEMORY_INST (21, Malloc, MallocInst) HANDLE_MEMORY_INST(23
AllocaInst HANDLE_MEMORY_INST (24, Load, LoadInst) HANDLE_OTHER_INST(27
AllocaInst PHINode HANDLE_OTHER_INST (28, Cast, CastInst) HANDLE_OTHER_INST(29
AllocaInst PHINode CallInst HANDLE_OTHER_INST (30, Shl, ShiftInst) HANDLE_OTHER_INST(32
AllocaInst PHINode CallInst
VANextInst 
HANDLE_OTHER_INST (33, VAArg, VAArgInst) HANDLE_OTHER_INST(34
AllocaInst PHINode CallInst
VANextInst SelectInst 
HANDLE_OTHER_INST (35, UserOp1, Instruction) HANDLE_MEMORY_INST(21
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst 
HANDLE_MEMORY_INST (23, Alloca, AllocaInst) HANDLE_MEMORY_INST(24
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst
LoadInst 
HANDLE_OTHER_INST (27, PHI, PHINode) HANDLE_OTHER_INST(28
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst
LoadInst CastInst 
HANDLE_OTHER_INST (29, Call, CallInst) HANDLE_OTHER_INST(30
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst
LoadInst CastInst ShiftInst 
HANDLE_OTHER_INST (32, VANext, VANextInst) HANDLE_OTHER_INST(33
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst
LoadInst CastInst ShiftInst
VAArgInst 
HANDLE_OTHER_INST (34, Select, SelectInst) HANDLE_OTHER_INST(35
 HANDLE_MEMORY_INST (21, Malloc, MallocInst) HANDLE_MEMORY_INST(23
AllocaInst HANDLE_MEMORY_INST (24, Load, LoadInst) HANDLE_OTHER_INST(27
AllocaInst PHINode HANDLE_OTHER_INST (28, Cast, CastInst) HANDLE_OTHER_INST(29
AllocaInst PHINode CallInst HANDLE_OTHER_INST (30, Shl, ShiftInst) HANDLE_OTHER_INST(32
AllocaInst PHINode CallInst
VANextInst 
HANDLE_OTHER_INST (33, VAArg, VAArgInst) HANDLE_OTHER_INST(34
AllocaInst PHINode CallInst
VANextInst SelectInst 
HANDLE_OTHER_INST (35, UserOp1, Instruction) static BinaryOperator *createNeg(Value *Op
BinaryOps getOpcode () const
virtual BinaryOperatorclone () const
bool swapOperands ()

Static Public Member Functions

static BinaryOperatorcreate (BinaryOps Op, Value *S1, Value *S2, const std::string &Name="", Instruction *InsertBefore=0)
static BinaryOperatorcreate (BinaryOps Op, Value *S1, Value *S2, const std::string &Name, BasicBlock *InsertAtEnd)
static BinaryOperatorcreateNeg (Value *Op, const std::string &Name, BasicBlock *InsertAtEnd)
static BinaryOperatorcreateNot (Value *Op, const std::string &Name="", Instruction *InsertBefore=0)
static BinaryOperatorcreateNot (Value *Op, const std::string &Name, BasicBlock *InsertAtEnd)
static bool isNeg (const Value *V)
static bool isNot (const Value *V)
static const ValuegetNegArgument (const BinaryOperator *Bop)
static ValuegetNegArgument (BinaryOperator *Bop)
static const ValuegetNotArgument (const BinaryOperator *Bop)
static ValuegetNotArgument (BinaryOperator *Bop)
static bool classof (const BinaryOperator *)
static bool classof (const Instruction *I)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Value *V)

Public Attributes

 Alloca
AllocaInst PHI
AllocaInst PHINode Call
AllocaInst PHINode CallInst VANext
AllocaInst PHINode CallInst
VANextInst 
Select
AllocaInst PHINode CallInst
VANextInst SelectInst 
Malloc
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst 
Load
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst
LoadInst 
Cast
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst
LoadInst CastInst 
Shl
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst
LoadInst CastInst ShiftInst 
VAArg
AllocaInst PHINode CallInst
VANextInst SelectInst MallocInst
LoadInst CastInst ShiftInst
VAArgInst 
UserOp1
AllocaInst PHINode CallInst
VANextInst SelectInst const
std::string & 
Name = ""
AllocaInst PHINode CallInst
VANextInst SelectInst const
std::string Instruction
InsertBefore = 0)

Protected Member Functions

void init (BinaryOps iType, Value *S1, Value *S2)
 BinaryOperator (BinaryOps iType, Value *S1, Value *S2, const Type *Ty, const std::string &Name, Instruction *InsertBefore)
 BinaryOperator (BinaryOps iType, Value *S1, Value *S2, const Type *Ty, const std::string &Name, BasicBlock *InsertAtEnd)

Detailed Description

Definition at line 77 of file InstrTypes.h.


Constructor & Destructor Documentation

llvm::BinaryOperator::BinaryOperator BinaryOps  iType,
Value S1,
Value S2,
const Type Ty,
const std::string &  Name,
Instruction InsertBefore
[inline, protected]
 

Definition at line 80 of file InstrTypes.h.

References init().

Referenced by create(), createNeg(), and createNot().

llvm::BinaryOperator::BinaryOperator BinaryOps  iType,
Value S1,
Value S2,
const Type Ty,
const std::string &  Name,
BasicBlock InsertAtEnd
[inline, protected]
 

Definition at line 85 of file InstrTypes.h.

References init().


Member Function Documentation

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

Reimplemented from llvm::Instruction.

Reimplemented in llvm::SetCondInst.

Definition at line 649 of file InstrTypes.h.

static bool llvm::BinaryOperator::classof const Instruction I  )  [inline, static]
 

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

Reimplemented from llvm::Instruction.

Reimplemented in llvm::SetCondInst.

Definition at line 646 of file InstrTypes.h.

static bool llvm::BinaryOperator::classof const BinaryOperator  )  [inline, static]
 

Definition at line 645 of file InstrTypes.h.

BinaryOperator * BinaryOperator::clone  )  const [virtual]
 

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

Implements llvm::Instruction.

Definition at line 801 of file Instructions.cpp.

References create(), getOpcode(), and llvm::User::Operands.

Referenced by llvm::SimplifyCFG().

BinaryOperator * BinaryOperator::create BinaryOps  Op,
Value S1,
Value S2,
const std::string &  Name,
BasicBlock InsertAtEnd
[static]
 

create() - 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 591 of file Instructions.cpp.

References create(), and llvm::BasicBlock::getInstList().

BinaryOperator * BinaryOperator::create BinaryOps  Op,
Value S1,
Value S2,
const std::string &  Name = "",
Instruction InsertBefore = 0
[static]
 

create() - Construct a binary instruction, given the opcode and the two operands. Optionally (if InstBefore is specified) insert the instruction into a BasicBlock right before the specified instruction. The specified Instruction is allowed to be a dereferenced end iterator.

Definition at line 575 of file Instructions.cpp.

References BinaryOperator(), llvm::Value::getType(), llvm::ISD::SetEQ, llvm::ISD::SetGE, llvm::ISD::SetGT, llvm::ISD::SetLE, llvm::ISD::SetLT, and llvm::ISD::SetNE.

Referenced by clone(), llvm::ConvertExpressionToType(), ConvertMallocToType(), ConvertOperandToType(), create(), llvm::IncrementCounterInBlock(), OperandConvertibleToType(), llvm::BytecodeReader::ParseInstruction(), and llvm::SimplifyCFG().

BinaryOperator * BinaryOperator::createNeg Value Op,
const std::string &  Name,
BasicBlock InsertAtEnd
[static]
 

Definition at line 611 of file Instructions.cpp.

References BinaryOperator(), llvm::ConstantFP::get(), llvm::Constant::getNullValue(), llvm::Value::getType(), and llvm::Type::isFloatingPoint().

BinaryOperator * BinaryOperator::createNot Value Op,
const std::string &  Name,
BasicBlock InsertAtEnd
[static]
 

Definition at line 630 of file Instructions.cpp.

References BinaryOperator(), llvm::ConstantIntegral::getAllOnesValue(), llvm::Value::getType(), and llvm::ISD::Xor.

BinaryOperator * BinaryOperator::createNot Value Op,
const std::string &  Name = "",
Instruction InsertBefore = 0
[static]
 

Definition at line 623 of file Instructions.cpp.

References BinaryOperator(), llvm::ConstantIntegral::getAllOnesValue(), llvm::Value::getType(), and llvm::ISD::Xor.

Referenced by llvm::SimplifyCFG().

Value * BinaryOperator::getNegArgument BinaryOperator Bop  )  [static]
 

Definition at line 661 of file Instructions.cpp.

References llvm::User::getOperand(), and isNeg().

const Value * BinaryOperator::getNegArgument const BinaryOperator Bop  )  [static]
 

getNegArgument, getNotArgument - Helper functions to extract the unary argument of a NEG or NOT operation implemented via Sub or Xor.

Definition at line 666 of file Instructions.cpp.

Value * BinaryOperator::getNotArgument BinaryOperator Bop  )  [static]
 

Definition at line 670 of file Instructions.cpp.

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

const Value * BinaryOperator::getNotArgument const BinaryOperator Bop  )  [static]
 

Definition at line 680 of file Instructions.cpp.

BinaryOps llvm::BinaryOperator::getOpcode  )  const [inline]
 

Subclass classification... getOpcode() returns a member of one of the enums that is coming soon (down below)...

Reimplemented from llvm::Instruction.

Definition at line 629 of file InstrTypes.h.

Referenced by FoldSetCCLogical::apply(), AssociativeOpt(), clone(), dyn_castFoldableMul(), llvm::SetCondInst::getInverseCondition(), getSetCondCode(), llvm::SetCondInst::getSwappedCondition(), GetValueEqualityComparisonCases(), HandleCastToPointer(), NegateValue(), OptimizeGlobalAddressOfMalloc(), and llvm::Interpreter::visitBinaryOperator().

AllocaInst llvm::BinaryOperator::HANDLE_MEMORY_INST 24  ,
Load  ,
LoadInst 
 

llvm::BinaryOperator::HANDLE_MEMORY_INST 21  ,
Malloc  ,
MallocInst 
 

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst llvm::BinaryOperator::HANDLE_MEMORY_INST 23  ,
Alloca  ,
AllocaInst 
 

AllocaInst llvm::BinaryOperator::HANDLE_MEMORY_INST 24  ,
Load  ,
LoadInst 
 

llvm::BinaryOperator::HANDLE_MEMORY_INST 21  ,
Malloc  ,
MallocInst 
 

AllocaInst PHINode CallInst VANextInst SelectInst llvm::BinaryOperator::HANDLE_OTHER_INST 35  ,
UserOp1  ,
Instruction 
 

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

createNeg, createNot - Create the NEG and NOT instructions out of SUB and XOR instructions.

AllocaInst PHINode CallInst VANextInst llvm::BinaryOperator::HANDLE_OTHER_INST 33  ,
VAArg  ,
VAArgInst 
 

AllocaInst PHINode CallInst llvm::BinaryOperator::HANDLE_OTHER_INST 30  ,
Shl  ,
ShiftInst 
 

AllocaInst PHINode llvm::BinaryOperator::HANDLE_OTHER_INST 28  ,
Cast  ,
CastInst 
 

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst LoadInst CastInst ShiftInst VAArgInst llvm::BinaryOperator::HANDLE_OTHER_INST 34  ,
Select  ,
SelectInst 
 

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst LoadInst CastInst ShiftInst llvm::BinaryOperator::HANDLE_OTHER_INST 32  ,
VANext  ,
VANextInst 
 

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst LoadInst CastInst llvm::BinaryOperator::HANDLE_OTHER_INST 29  ,
Call  ,
CallInst 
 

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst LoadInst llvm::BinaryOperator::HANDLE_OTHER_INST 27  ,
PHI  ,
PHINode 
 

AllocaInst PHINode CallInst VANextInst SelectInst llvm::BinaryOperator::HANDLE_OTHER_INST 35  ,
UserOp1  ,
Instruction 
 

AllocaInst PHINode CallInst VANextInst llvm::BinaryOperator::HANDLE_OTHER_INST 33  ,
VAArg  ,
VAArgInst 
 

AllocaInst PHINode CallInst llvm::BinaryOperator::HANDLE_OTHER_INST 30  ,
Shl  ,
ShiftInst 
 

AllocaInst PHINode llvm::BinaryOperator::HANDLE_OTHER_INST 28  ,
Cast  ,
CastInst 
 

void BinaryOperator::init BinaryOps  iType,
Value S1,
Value S2
[protected]
 

Definition at line 540 of file Instructions.cpp.

References Add(), llvm::ISD::And, llvm::Type::BoolTy, llvm::Value::getType(), Mul(), llvm::User::Operands, llvm::ISD::Or, llvm::ISD::SetEQ, llvm::ISD::SetGE, llvm::ISD::SetGT, llvm::ISD::SetLE, llvm::ISD::SetLT, llvm::ISD::SetNE, and llvm::ISD::Xor.

Referenced by BinaryOperator().

bool BinaryOperator::isNeg const Value V  )  [static]
 

isNeg, isNot - Check if the given Value is a NEG or NOT instruction.

Definition at line 643 of file Instructions.cpp.

References llvm::ConstantFP::get(), llvm::Constant::getNullValue(), and llvm::Constant::getOperand().

Referenced by getComplexity(), and getNegArgument().

bool BinaryOperator::isNot const Value V  )  [static]
 

Definition at line 653 of file Instructions.cpp.

References isConstantAllOnes(), and llvm::ISD::Xor.

Referenced by getComplexity(), getNotArgument(), and llvm::InstructionNode::InstructionNode().

bool BinaryOperator::swapOperands  ) 
 

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 is order dependent (SetLT f.e.) the opcode is changed. If the instruction cannot be reversed (ie, it's a Div), then return true.

Definition at line 690 of file Instructions.cpp.

References llvm::Instruction::isCommutative(), and llvm::User::Operands.

Referenced by FoldSetCCLogical::apply().


Member Data Documentation

llvm::BinaryOperator::Alloca
 

Reimplemented from llvm::Instruction.

Definition at line 558 of file InstrTypes.h.

AllocaInst PHINode llvm::BinaryOperator::Call
 

Reimplemented from llvm::Instruction.

Definition at line 568 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst LoadInst llvm::BinaryOperator::Cast
 

Reimplemented from llvm::Instruction.

Definition at line 405 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst SelectInst const std::string Instruction* llvm::BinaryOperator::InsertBefore = 0)
 

Definition at line 608 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst llvm::BinaryOperator::Load
 

Reimplemented from llvm::Instruction.

Definition at line 397 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst SelectInst llvm::BinaryOperator::Malloc
 

Reimplemented from llvm::Instruction.

Definition at line 394 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst SelectInst const std::string& llvm::BinaryOperator::Name = ""
 

Reimplemented from llvm::Value.

Definition at line 607 of file InstrTypes.h.

AllocaInst llvm::BinaryOperator::PHI
 

Reimplemented from llvm::Instruction.

Definition at line 566 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst llvm::BinaryOperator::Select
 

Reimplemented from llvm::Instruction.

Definition at line 574 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst LoadInst CastInst llvm::BinaryOperator::Shl
 

Reimplemented from llvm::Instruction.

Definition at line 408 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst LoadInst CastInst ShiftInst VAArgInst llvm::BinaryOperator::UserOp1
 

Reimplemented from llvm::Instruction.

Definition at line 414 of file InstrTypes.h.

AllocaInst PHINode CallInst VANextInst SelectInst MallocInst LoadInst CastInst ShiftInst llvm::BinaryOperator::VAArg
 

Reimplemented from llvm::Instruction.

Definition at line 411 of file InstrTypes.h.

AllocaInst PHINode CallInst llvm::BinaryOperator::VANext
 

Reimplemented from llvm::Instruction.

Definition at line 572 of file InstrTypes.h.


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