libTriton version 1.0 build 1592
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
triton::ast::AbstractNode Class Referenceabstract

Abstract node. More...

#include <ast.hpp>

Inherits std::enable_shared_from_this< AbstractNode >.

Inherited by triton::ast::ArrayNode, triton::ast::AssertNode, triton::ast::BswapNode, triton::ast::BvNode, triton::ast::BvaddNode, triton::ast::BvandNode, triton::ast::BvashrNode, triton::ast::BvlshrNode, triton::ast::BvmulNode, triton::ast::BvnandNode, triton::ast::BvnegNode, triton::ast::BvnorNode, triton::ast::BvnotNode, triton::ast::BvorNode, triton::ast::BvrolNode, triton::ast::BvrorNode, triton::ast::BvsdivNode, triton::ast::BvsgeNode, triton::ast::BvsgtNode, triton::ast::BvshlNode, triton::ast::BvsleNode, triton::ast::BvsltNode, triton::ast::BvsmodNode, triton::ast::BvsremNode, triton::ast::BvsubNode, triton::ast::BvudivNode, triton::ast::BvugeNode, triton::ast::BvugtNode, triton::ast::BvuleNode, triton::ast::BvultNode, triton::ast::BvuremNode, triton::ast::BvxnorNode, triton::ast::BvxorNode, triton::ast::CompoundNode, triton::ast::ConcatNode, triton::ast::DeclareNode, triton::ast::DistinctNode, triton::ast::EqualNode, triton::ast::ExtractNode, triton::ast::ForallNode, triton::ast::IffNode, triton::ast::IntegerNode, triton::ast::IteNode, triton::ast::LandNode, triton::ast::LetNode, triton::ast::LnotNode, triton::ast::LorNode, triton::ast::LxorNode, triton::ast::ReferenceNode, triton::ast::SelectNode, triton::ast::StoreNode, triton::ast::StringNode, triton::ast::SxNode, triton::ast::VariableNode, and triton::ast::ZxNode.

Public Member Functions

TRITON_EXPORT AbstractNode (triton::ast::ast_e type, const SharedAstContext &ctxt)
 Constructor.
 
virtual TRITON_EXPORT ~AbstractNode ()
 Destructor.
 
TRITON_EXPORT SharedAstContext getContext (void) const
 Access to its context.
 
TRITON_EXPORT triton::ast::ast_e getType (void) const
 Returns the type of the node.
 
TRITON_EXPORT triton::uint32 getBitvectorSize (void) const
 Returns the size of the node.
 
TRITON_EXPORT triton::uint512 getBitvectorMask (void) const
 Returns the vector mask according the size of the node.
 
TRITON_EXPORT bool isArray (void) const
 Returns true if it's an array node.
 
TRITON_EXPORT bool isSigned (void) const
 According to the size of the expression, returns true if the MSB is 1.
 
TRITON_EXPORT bool isSymbolized (void) const
 Returns true if the tree contains a symbolic variable.
 
TRITON_EXPORT bool isLogical (void) const
 Returns true if it's a logical node.
 
TRITON_EXPORT bool hasSameConcreteValueAndTypeAs (const SharedAbstractNode &other) const
 Returns true if the node's concrete value and value type match those of the second one.
 
TRITON_EXPORT bool canReplaceNodeWithoutUpdate (const SharedAbstractNode &other) const
 Returns true if the node's value, value type and properties match those of the second one.
 
TRITON_EXPORT bool equalTo (const SharedAbstractNode &other) const
 Returns true if the current tree is equal to the second one.
 
TRITON_EXPORT triton::uint32 getLevel (void) const
 Returns the deep level of the tree.
 
TRITON_EXPORT triton::uint512 getHash (void) const
 Returns the hash of the tree.
 
TRITON_EXPORT triton::uint512 evaluate (void) const
 Evaluates the tree.
 
void initParents (void)
 Initializes parents.
 
TRITON_EXPORT std::vector< SharedAbstractNode > & getChildren (void)
 Returns the children of the node.
 
TRITON_EXPORT std::vector< SharedAbstractNodegetParents (void)
 Returns the parents of node or an empty set if there is still no parent defined.
 
TRITON_EXPORT void removeParent (AbstractNode *p)
 Removes a parent node.
 
TRITON_EXPORT void setParent (AbstractNode *p)
 Sets a parent node.
 
TRITON_EXPORT void setParent (std::unordered_set< AbstractNode * > &p)
 Sets the parent nodes.
 
TRITON_EXPORT void setBitvectorSize (triton::uint32 size)
 Sets the size of the node.
 
TRITON_EXPORT void addChild (const SharedAbstractNode &child)
 Adds a child.
 
TRITON_EXPORT void setChild (triton::uint32 index, const SharedAbstractNode &child)
 Sets a child at an index.
 
TRITON_EXPORT std::string str (void) const
 Returns the string representation of the node.
 
virtual TRITON_EXPORT void init (bool withParents=false)=0
 Init properties of the node. If withParents is true, init also properties of parents.
 

Protected Attributes

triton::uint32 level
 Deep level for computing hash.
 
triton::ast::ast_e type
 The type of the node.
 
std::vector< SharedAbstractNodechildren
 The children of the node.
 
std::unordered_map< AbstractNode *, std::pair< triton::uint32, WeakAbstractNode > > parents
 
triton::uint32 size
 The size of the node.
 
triton::uint512 eval
 The value of the tree from this root node.
 
triton::uint512 hash
 The hash of the tree.
 
bool symbolized
 True if the tree contains a symbolic variable.
 
bool logical
 True if it's a logical node.
 
bool array
 True if it's an array node.
 
SharedAstContext ctxt
 Contect use to create this node.
 

Detailed Description

Abstract node.

Definition at line 68 of file ast.hpp.

Constructor & Destructor Documentation

◆ AbstractNode()

triton::ast::AbstractNode::AbstractNode ( triton::ast::ast_e type,
const SharedAstContext & ctxt )

Constructor.

Definition at line 31 of file ast.cpp.

◆ ~AbstractNode()

triton::ast::AbstractNode::~AbstractNode ( )
virtual

Destructor.

Definition at line 44 of file ast.cpp.

Member Function Documentation

◆ addChild()

void triton::ast::AbstractNode::addChild ( const SharedAbstractNode & child)

Adds a child.

Definition at line 245 of file ast.cpp.

◆ canReplaceNodeWithoutUpdate()

bool triton::ast::AbstractNode::canReplaceNodeWithoutUpdate ( const SharedAbstractNode & other) const

Returns true if the node's value, value type and properties match those of the second one.

Definition at line 145 of file ast.cpp.

◆ equalTo()

bool triton::ast::AbstractNode::equalTo ( const SharedAbstractNode & other) const

Returns true if the current tree is equal to the second one.

Definition at line 151 of file ast.cpp.

◆ evaluate()

triton::uint512 triton::ast::AbstractNode::evaluate ( void ) const

Evaluates the tree.

Definition at line 159 of file ast.cpp.

◆ getBitvectorMask()

triton::uint512 triton::ast::AbstractNode::getBitvectorMask ( void ) const

Returns the vector mask according the size of the node.

Definition at line 65 of file ast.cpp.

◆ getBitvectorSize()

triton::uint32 triton::ast::AbstractNode::getBitvectorSize ( void ) const

Returns the size of the node.

Definition at line 60 of file ast.cpp.

◆ getChildren()

std::vector< SharedAbstractNode > & triton::ast::AbstractNode::getChildren ( void )

Returns the children of the node.

Definition at line 182 of file ast.cpp.

◆ getContext()

SharedAstContext triton::ast::AbstractNode::getContext ( void ) const

Access to its context.

Definition at line 50 of file ast.cpp.

◆ getHash()

triton::uint512 triton::ast::AbstractNode::getHash ( void ) const

Returns the hash of the tree.

Definition at line 164 of file ast.cpp.

◆ getLevel()

triton::uint32 triton::ast::AbstractNode::getLevel ( void ) const

Returns the deep level of the tree.

Definition at line 169 of file ast.cpp.

◆ getParents()

std::vector< SharedAbstractNode > triton::ast::AbstractNode::getParents ( void )

Returns the parents of node or an empty set if there is still no parent defined.

Definition at line 187 of file ast.cpp.

◆ getType()

triton::ast::ast_e triton::ast::AbstractNode::getType ( void ) const

Returns the type of the node.

Definition at line 55 of file ast.cpp.

◆ hasSameConcreteValueAndTypeAs()

bool triton::ast::AbstractNode::hasSameConcreteValueAndTypeAs ( const SharedAbstractNode & other) const

Returns true if the node's concrete value and value type match those of the second one.

Definition at line 138 of file ast.cpp.

◆ init()

virtual TRITON_EXPORT void triton::ast::AbstractNode::init ( bool withParents = false)
pure virtual

◆ initParents()

void triton::ast::AbstractNode::initParents ( void )

Initializes parents.

Definition at line 174 of file ast.cpp.

◆ isArray()

bool triton::ast::AbstractNode::isArray ( void ) const

Returns true if it's an array node.

Definition at line 116 of file ast.cpp.

◆ isLogical()

bool triton::ast::AbstractNode::isLogical ( void ) const

Returns true if it's a logical node.

Definition at line 84 of file ast.cpp.

◆ isSigned()

bool triton::ast::AbstractNode::isSigned ( void ) const

According to the size of the expression, returns true if the MSB is 1.

Definition at line 72 of file ast.cpp.

◆ isSymbolized()

bool triton::ast::AbstractNode::isSymbolized ( void ) const

Returns true if the tree contains a symbolic variable.

Definition at line 79 of file ast.cpp.

◆ removeParent()

void triton::ast::AbstractNode::removeParent ( AbstractNode * p)

Removes a parent node.

Definition at line 226 of file ast.cpp.

◆ setBitvectorSize()

void triton::ast::AbstractNode::setBitvectorSize ( triton::uint32 size)

Sets the size of the node.

Definition at line 273 of file ast.cpp.

◆ setChild()

void triton::ast::AbstractNode::setChild ( triton::uint32 index,
const SharedAbstractNode & child )

Sets a child at an index.

Definition at line 250 of file ast.cpp.

◆ setParent() [1/2]

void triton::ast::AbstractNode::setParent ( AbstractNode * p)

Sets a parent node.

Definition at line 205 of file ast.cpp.

◆ setParent() [2/2]

void triton::ast::AbstractNode::setParent ( std::unordered_set< AbstractNode * > & p)

Sets the parent nodes.

Definition at line 238 of file ast.cpp.

◆ str()

std::string triton::ast::AbstractNode::str ( void ) const

Returns the string representation of the node.

Definition at line 278 of file ast.cpp.

Member Data Documentation

◆ array

bool triton::ast::AbstractNode::array
protected

True if it's an array node.

Definition at line 103 of file ast.hpp.

◆ children

std::vector<SharedAbstractNode> triton::ast::AbstractNode::children
protected

The children of the node.

Definition at line 81 of file ast.hpp.

◆ ctxt

SharedAstContext triton::ast::AbstractNode::ctxt
protected

Contect use to create this node.

Definition at line 106 of file ast.hpp.

◆ eval

triton::uint512 triton::ast::AbstractNode::eval
protected

The value of the tree from this root node.

Definition at line 91 of file ast.hpp.

◆ hash

triton::uint512 triton::ast::AbstractNode::hash
protected

The hash of the tree.

Definition at line 94 of file ast.hpp.

◆ level

triton::uint32 triton::ast::AbstractNode::level
protected

Deep level for computing hash.

Definition at line 75 of file ast.hpp.

◆ logical

bool triton::ast::AbstractNode::logical
protected

True if it's a logical node.

Definition at line 100 of file ast.hpp.

◆ parents

std::unordered_map<AbstractNode*, std::pair<triton::uint32, WeakAbstractNode> > triton::ast::AbstractNode::parents
protected

Definition at line 85 of file ast.hpp.

◆ size

triton::uint32 triton::ast::AbstractNode::size
protected

The size of the node.

Definition at line 88 of file ast.hpp.

◆ symbolized

bool triton::ast::AbstractNode::symbolized
protected

True if the tree contains a symbolic variable.

Definition at line 97 of file ast.hpp.

◆ type

triton::ast::ast_e triton::ast::AbstractNode::type
protected

The type of the node.

Definition at line 78 of file ast.hpp.


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