PandA-2024.02
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
BinaryOpNode Class Reference

A constraint like sink = source1 operation source2 intersect [l, u]. More...

Inheritance diagram for BinaryOpNode:
Inheritance graph
[legend]
Collaboration diagram for BinaryOpNode:
Collaboration graph
[legend]

Public Member Functions

 BinaryOpNode (const ValueRangeRef &intersect, VarNode *sink, const tree_nodeConstRef &inst, VarNode *source1, VarNode *source2, kind opcode)
 
 ~BinaryOpNode () override=default
 
 BinaryOpNode (const BinaryOpNode &)=delete
 
 BinaryOpNode (BinaryOpNode &&)=delete
 
BinaryOpNodeoperator= (const BinaryOpNode &)=delete
 
BinaryOpNodeoperator= (BinaryOpNode &&)=delete
 
OperationId getValueId () const override
 
kind getOpcode () const
 Return the opcode of the operation. More...
 
VarNodegetSource1 () const
 Returns the first operand of this operation. More...
 
VarNodegetSource2 () const
 Returns the second operand of this operation. More...
 
std::vector< tree_nodeConstRefgetSources () const override
 
void print (std::ostream &OS) const override
 Prints the content of the operation. More...
 
void printDot (std::ostream &OS) const override
 
- Public Member Functions inherited from OpNode
virtual ~OpNode ()=default
 The dtor. It's virtual because this is a base class. More...
 
 OpNode (const OpNode &)=delete
 
 OpNode (OpNode &&)=delete
 
OpNodeoperator= (const OpNode &)=delete
 
OpNodeoperator= (OpNode &&)=delete
 
const tree_nodeConstRefgetInstruction () const
 Return the instruction that originated this op node. More...
 
void solveFuture (VarNode *future)
 Replace symbolic intervals with hard-wired constants. More...
 
ValueRangeConstRef getIntersect () const
 Returns the range of the operation. More...
 
void setIntersect (const RangeConstRef &newIntersect)
 Changes the interval of the operation. More...
 
VarNodegetSink () const
 Returns the target of the operation, that is, where the result will be stored. More...
 
std::string ToString () const
 

Static Public Member Functions

static bool classof (BinaryOpNode const *)
 
static bool classof (OpNode const *BO)
 
static RangeRef evaluate (kind opcode, bw_t bw, const RangeConstRef &op1, const RangeConstRef &op2, bool opSigned)
 
static std::function< OpNode *(NodeContainer *)> opCtorGenerator (const tree_nodeConstRef &stmt, unsigned int, const FunctionBehaviorConstRef &FB, const tree_managerConstRef &TM, const application_managerRef &AppM)
 
- Static Public Member Functions inherited from OpNode
static bool classof (OpNode const *)
 

Private Member Functions

RangeRef eval () const override
 Computes the interval of the sink based on the interval of the sources, the operation and the interval associated to the operation. More...
 

Private Attributes

VarNodesource1
 
VarNodesource2
 
kind opcode
 

Additional Inherited Members

- Public Types inherited from OpNode
enum  OperationId {
  OperationId::UnaryOpId, OperationId::SigmaOpId, OperationId::BinaryOpId, OperationId::TernaryOpId,
  OperationId::PhiOpId, OperationId::ControlDepId, OperationId::LoadOpId, OperationId::StoreOpId
}
 
- Data Fields inherited from OpNode
enum OpNode::OperationId __attribute__
 
- Static Public Attributes inherited from OpNode
static int debug_level = DEBUG_LEVEL_NONE
 
- Protected Member Functions inherited from OpNode
 OpNode (const ValueRangeRef &intersect, VarNode *sink, const tree_nodeConstRef &inst)
 We do not want people creating objects of this class, but we want to inherit from it. More...
 

Detailed Description

A constraint like sink = source1 operation source2 intersect [l, u].

Definition at line 3074 of file Range_Analysis.cpp.

Constructor & Destructor Documentation

◆ BinaryOpNode() [1/3]

BinaryOpNode::BinaryOpNode ( const ValueRangeRef &  intersect,
VarNode sink,
const tree_nodeConstRef inst,
VarNode source1,
VarNode source2,
kind  opcode 
)

Definition at line 3142 of file Range_Analysis.cpp.

References GET_CONST_NODE, VarNode::getValue(), THROW_ASSERT, and OpNode::ToString().

Referenced by opCtorGenerator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~BinaryOpNode()

BinaryOpNode::~BinaryOpNode ( )
overridedefault

◆ BinaryOpNode() [2/3]

BinaryOpNode::BinaryOpNode ( const BinaryOpNode )
delete

◆ BinaryOpNode() [3/3]

BinaryOpNode::BinaryOpNode ( BinaryOpNode &&  )
delete

Member Function Documentation

◆ classof() [1/2]

static bool BinaryOpNode::classof ( BinaryOpNode const *  )
inlinestatic

Definition at line 3101 of file Range_Analysis.cpp.

◆ classof() [2/2]

static bool BinaryOpNode::classof ( OpNode const *  BO)
inlinestatic

Definition at line 3105 of file Range_Analysis.cpp.

References OpNode::BinaryOpId, and OpNode::getValueId().

Here is the call graph for this function:

◆ eval()

RangeRef BinaryOpNode::eval ( ) const
overrideprivatevirtual

Computes the interval of the sink based on the interval of the sources, the operation and the interval associated to the operation.

Basically, this function performs the operation indicated in its opcode taking as its operands the source1 and the source2.

Implements OpNode.

Definition at line 3336 of file Range_Analysis.cpp.

References bitstring_to_string(), OpNode::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, Empty, evaluate(), GET_CONST_NODE, VarNode::getBitWidth(), OpNode::getIntersect(), getOpcode(), VarNode::getRange(), OpNode::getSink(), getSource1(), getSource2(), tree_node::GetString(), INDENT_DBG_MEX, Regular, result, STR, test(), THROW_ASSERT, OpNode::ToString(), and Unknown.

Here is the call graph for this function:

◆ evaluate()

RangeRef BinaryOpNode::evaluate ( kind  opcode,
bw_t  bw,
const RangeConstRef &  op1,
const RangeConstRef &  op2,
bool  opSigned 
)
static

◆ getOpcode()

kind BinaryOpNode::getOpcode ( ) const
inline

Return the opcode of the operation.

Definition at line 3113 of file Range_Analysis.cpp.

References UnaryOpNode::opcode.

Referenced by eval(), and print().

Here is the caller graph for this function:

◆ getSource1()

VarNode* BinaryOpNode::getSource1 ( ) const
inline

Returns the first operand of this operation.

Definition at line 3118 of file Range_Analysis.cpp.

Referenced by eval(), print(), and printDot().

Here is the caller graph for this function:

◆ getSource2()

VarNode* BinaryOpNode::getSource2 ( ) const
inline

Returns the second operand of this operation.

Definition at line 3123 of file Range_Analysis.cpp.

Referenced by eval(), print(), and printDot().

Here is the caller graph for this function:

◆ getSources()

std::vector<tree_nodeConstRef> BinaryOpNode::getSources ( ) const
inlineoverridevirtual

Implements OpNode.

Definition at line 3127 of file Range_Analysis.cpp.

References VarNode::getValue(), SigmaOpNode::opCtorGenerator(), SigmaOpNode::print(), and SigmaOpNode::printDot().

Here is the call graph for this function:

◆ getValueId()

OperationId BinaryOpNode::getValueId ( ) const
inlineoverridevirtual

Implements OpNode.

Definition at line 3097 of file Range_Analysis.cpp.

References OpNode::BinaryOpId.

◆ opCtorGenerator()

std::function< OpNode *(NodeContainer *)> BinaryOpNode::opCtorGenerator ( const tree_nodeConstRef stmt,
unsigned int  function_id,
const FunctionBehaviorConstRef FB,
const tree_managerConstRef TM,
const application_managerRef AppM 
)
static

Definition at line 3432 of file Range_Analysis.cpp.

References BinaryOpNode(), DEBUG_LEVEL_VERY_PEDANTIC, GET_CONST_NODE, tree_node::GetString(), INDENT_DBG_MEX, and OpNode::sink.

Referenced by TernaryOpNode::getSources(), and LoadOpNode::printDot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

BinaryOpNode& BinaryOpNode::operator= ( const BinaryOpNode )
delete

◆ operator=() [2/2]

BinaryOpNode& BinaryOpNode::operator= ( BinaryOpNode &&  )
delete

◆ print()

void BinaryOpNode::print ( std::ostream &  OS) const
overridevirtual

Prints the content of the operation.

Implements OpNode.

Definition at line 3466 of file Range_Analysis.cpp.

References GET_CONST_NODE, getOpcode(), OpNode::getSink(), getSource1(), getSource2(), and tree_node::GetString().

Referenced by TernaryOpNode::getSources().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printDot()

void BinaryOpNode::printDot ( std::ostream &  OS) const
overridevirtual

Implements OpNode.

Definition at line 3473 of file Range_Analysis.cpp.

References GET_CONST_NODE, tree_helper::GetConstValue(), OpNode::getSink(), getSource1(), getSource2(), tree_node::GetString(), VarNode::getValue(), and opcode.

Referenced by TernaryOpNode::getSources().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ opcode

kind BinaryOpNode::opcode
private

Definition at line 3082 of file Range_Analysis.cpp.

Referenced by TernaryOpNode::getOpcode(), and printDot().

◆ source1

VarNode* BinaryOpNode::source1
private

Definition at line 3078 of file Range_Analysis.cpp.

Referenced by TernaryOpNode::getSource1().

◆ source2

VarNode* BinaryOpNode::source2
private

Definition at line 3080 of file Range_Analysis.cpp.

Referenced by TernaryOpNode::getSource2().


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

Generated on Mon Feb 12 2024 13:03:45 for PandA-2024.02 by doxygen 1.8.13