libTriton  version 0.7 build 1419
ast.hpp
Go to the documentation of this file.
1 /*
3 ** Copyright (C) - Triton
4 **
5 ** This program is under the terms of the BSD License.
6 */
7 
8 #ifndef TRITON_AST_H
9 #define TRITON_AST_H
10 
11 #include <deque>
12 #include <list>
13 #include <map>
14 #include <memory>
15 #include <ostream>
16 #include <set>
17 #include <stdexcept>
18 #include <string>
19 #include <vector>
20 
21 #include <triton/astEnums.hpp>
22 #include <triton/cpuSize.hpp>
23 #include <triton/dllexport.hpp>
24 #include <triton/tritonTypes.hpp>
25 
26 
27 
29 namespace triton {
35  /* Forward declarations */
36  namespace engines {
37  namespace symbolic {
38  class SymbolicExpression;
39  using SharedSymbolicExpression = std::shared_ptr<triton::engines::symbolic::SymbolicExpression>;
40 
41  class SymbolicVariable;
42  using SharedSymbolicVariable = std::shared_ptr<triton::engines::symbolic::SymbolicVariable>;
43  };
44  };
45 
47  namespace ast {
54  class AstContext;
55  class AbstractNode;
56 
58  using SharedAbstractNode = std::shared_ptr<triton::ast::AbstractNode>;
59 
61  using WeakAbstractNode = std::weak_ptr<triton::ast::AbstractNode>;
62 
64  using SharedAstContext = std::shared_ptr<triton::ast::AstContext>;
65 
67  class AbstractNode : public std::enable_shared_from_this<AbstractNode> {
68  protected:
71 
73  std::vector<SharedAbstractNode> children;
74 
75  // This structure counter the number of use of a given parent as a node may have
76  // multiple time the same parent: eg. xor rax rax
77  std::map<AbstractNode*, std::pair<triton::uint32, WeakAbstractNode>> parents;
78 
81 
84 
86  bool symbolized;
87 
89  bool logical;
90 
93 
94  public:
97 
99  TRITON_EXPORT virtual ~AbstractNode();
100 
102  TRITON_EXPORT SharedAstContext getContext(void) const;
103 
105  TRITON_EXPORT triton::ast::ast_e getType(void) const;
106 
108  TRITON_EXPORT triton::uint32 getBitvectorSize(void) const;
109 
111  TRITON_EXPORT triton::uint512 getBitvectorMask(void) const;
112 
114  TRITON_EXPORT bool isSigned(void) const;
115 
117  TRITON_EXPORT bool isSymbolized(void) const;
118 
120  TRITON_EXPORT bool isLogical(void) const;
121 
123  TRITON_EXPORT bool equalTo(const SharedAbstractNode&) const;
124 
126  TRITON_EXPORT virtual triton::uint512 evaluate(void) const;
127 
129  void initParents(void);
130 
132  TRITON_EXPORT std::vector<SharedAbstractNode>& getChildren(void);
133 
135  TRITON_EXPORT std::vector<SharedAbstractNode> getParents(void);
136 
138  TRITON_EXPORT void removeParent(AbstractNode* p);
139 
141  TRITON_EXPORT void setParent(AbstractNode* p);
142 
144  TRITON_EXPORT void setParent(std::set<AbstractNode*>& p);
145 
147  TRITON_EXPORT void setBitvectorSize(triton::uint32 size);
148 
150  TRITON_EXPORT void addChild(const SharedAbstractNode& child);
151 
153  TRITON_EXPORT void setChild(triton::uint32 index, const SharedAbstractNode& child);
154 
156  TRITON_EXPORT std::string str(void) const;
157 
159  TRITON_EXPORT virtual void init(void) = 0;
160 
162  TRITON_EXPORT virtual triton::uint512 hash(triton::uint32 deep) const = 0;
163  };
164 
165 
167  class AssertNode : public AbstractNode {
168  public:
169  TRITON_EXPORT AssertNode(const SharedAbstractNode& expr);
170  TRITON_EXPORT void init(void);
171  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
172  };
173 
174 
176  class BvaddNode : public AbstractNode {
177  public:
178  TRITON_EXPORT BvaddNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
179  TRITON_EXPORT void init(void);
180  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
181  };
182 
183 
185  class BvandNode : public AbstractNode {
186  public:
187  TRITON_EXPORT BvandNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
188  TRITON_EXPORT void init(void);
189  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
190  };
191 
192 
194  class BvashrNode : public AbstractNode {
195  public:
196  TRITON_EXPORT BvashrNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
197  TRITON_EXPORT void init(void);
198  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
199  };
200 
201 
203  class BvlshrNode : public AbstractNode {
204  public:
205  TRITON_EXPORT BvlshrNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
206  TRITON_EXPORT void init(void);
207  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
208  };
209 
210 
212  class BvmulNode : public AbstractNode {
213  public:
214  TRITON_EXPORT BvmulNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
215  TRITON_EXPORT void init(void);
216  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
217  };
218 
219 
221  class BvnandNode : public AbstractNode {
222  public:
223  TRITON_EXPORT BvnandNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
224  TRITON_EXPORT void init(void);
225  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
226  };
227 
228 
230  class BvnegNode : public AbstractNode {
231  public:
232  TRITON_EXPORT BvnegNode(const SharedAbstractNode& expr);
233  TRITON_EXPORT void init(void);
234  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
235  };
236 
237 
239  class BvnorNode : public AbstractNode {
240  public:
241  TRITON_EXPORT BvnorNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
242  TRITON_EXPORT void init(void);
243  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
244  };
245 
246 
248  class BvnotNode : public AbstractNode {
249  public:
250  TRITON_EXPORT BvnotNode(const SharedAbstractNode& expr1);
251  TRITON_EXPORT void init(void);
252  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
253  };
254 
255 
257  class BvorNode : public AbstractNode {
258  public:
259  TRITON_EXPORT BvorNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
260  TRITON_EXPORT void init(void);
261  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
262  };
263 
264 
266  class BvrolNode : public AbstractNode {
267  public:
268  TRITON_EXPORT BvrolNode(const SharedAbstractNode& expr, triton::uint32 rot);
269  TRITON_EXPORT BvrolNode(const SharedAbstractNode& expr, const SharedAbstractNode& rot);
270  TRITON_EXPORT void init(void);
271  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
272  };
273 
274 
276  class BvrorNode : public AbstractNode {
277  public:
278  TRITON_EXPORT BvrorNode(const SharedAbstractNode& expr, triton::uint32 rot);
279  TRITON_EXPORT BvrorNode(const SharedAbstractNode& expr, const SharedAbstractNode& rot);
280  TRITON_EXPORT void init(void);
281  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
282  };
283 
284 
286  class BvsdivNode : public AbstractNode {
287  public:
288  TRITON_EXPORT BvsdivNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
289  TRITON_EXPORT void init(void);
290  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
291  };
292 
293 
295  class BvsgeNode : public AbstractNode {
296  public:
297  TRITON_EXPORT BvsgeNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
298  TRITON_EXPORT void init(void);
299  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
300  };
301 
302 
304  class BvsgtNode : public AbstractNode {
305  public:
306  TRITON_EXPORT BvsgtNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
307  TRITON_EXPORT void init(void);
308  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
309  };
310 
311 
313  class BvshlNode : public AbstractNode {
314  public:
315  TRITON_EXPORT BvshlNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
316  TRITON_EXPORT void init(void);
317  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
318  };
319 
320 
322  class BvsleNode : public AbstractNode {
323  public:
324  TRITON_EXPORT BvsleNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
325  TRITON_EXPORT void init(void);
326  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
327  };
328 
329 
331  class BvsltNode : public AbstractNode {
332  public:
333  TRITON_EXPORT BvsltNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
334  TRITON_EXPORT void init(void);
335  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
336  };
337 
338 
340  class BvsmodNode : public AbstractNode {
341  public:
342  TRITON_EXPORT BvsmodNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
343  TRITON_EXPORT void init(void);
344  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
345  };
346 
347 
349  class BvsremNode : public AbstractNode {
350  public:
351  TRITON_EXPORT BvsremNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
352  TRITON_EXPORT void init(void);
353  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
354  };
355 
356 
358  class BvsubNode : public AbstractNode {
359  public:
360  TRITON_EXPORT BvsubNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
361  TRITON_EXPORT void init(void);
362  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
363  };
364 
365 
367  class BvudivNode : public AbstractNode {
368  public:
369  TRITON_EXPORT BvudivNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
370  TRITON_EXPORT void init(void);
371  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
372  };
373 
374 
376  class BvugeNode : public AbstractNode {
377  public:
378  TRITON_EXPORT BvugeNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
379  TRITON_EXPORT void init(void);
380  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
381  };
382 
383 
385  class BvugtNode : public AbstractNode {
386  public:
387  TRITON_EXPORT BvugtNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
388  TRITON_EXPORT void init(void);
389  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
390  };
391 
392 
394  class BvuleNode : public AbstractNode {
395  public:
396  TRITON_EXPORT BvuleNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
397  TRITON_EXPORT void init(void);
398  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
399  };
400 
401 
403  class BvultNode : public AbstractNode {
404  public:
405  TRITON_EXPORT BvultNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
406  TRITON_EXPORT void init(void);
407  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
408  };
409 
410 
412  class BvuremNode : public AbstractNode {
413  public:
414  TRITON_EXPORT BvuremNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
415  TRITON_EXPORT void init(void);
416  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
417  };
418 
419 
421  class BvxnorNode : public AbstractNode {
422  public:
423  TRITON_EXPORT BvxnorNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
424  TRITON_EXPORT void init(void);
425  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
426  };
427 
428 
430  class BvxorNode : public AbstractNode {
431  public:
432  TRITON_EXPORT BvxorNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
433  TRITON_EXPORT void init(void);
434  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
435  };
436 
437 
439  class BvNode : public AbstractNode {
440  public:
441  TRITON_EXPORT BvNode(triton::uint512 value, triton::uint32 size, const SharedAstContext& ctxt);
442  TRITON_EXPORT void init(void);
443  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
444  };
445 
446 
448  class CompoundNode : public AbstractNode {
449  public:
450  template <typename T> CompoundNode(const T& exprs, const SharedAstContext& ctxt)
452  for (auto expr : exprs)
453  this->addChild(expr);
454  }
455 
456  TRITON_EXPORT void init(void);
457  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
458  };
459 
460 
462  class ConcatNode : public AbstractNode {
463  public:
464  template <typename T> ConcatNode(const T& exprs, const SharedAstContext& ctxt)
466  for (auto expr : exprs)
467  this->addChild(expr);
468  }
469 
470  TRITON_EXPORT ConcatNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
471  TRITON_EXPORT void init(void);
472  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
473  };
474 
475 
477  class DeclareNode : public AbstractNode {
478  public:
479  TRITON_EXPORT DeclareNode(const SharedAbstractNode& var);
480  TRITON_EXPORT void init(void);
481  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
482  };
483 
484 
486  class DistinctNode : public AbstractNode {
487  public:
488  TRITON_EXPORT DistinctNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
489  TRITON_EXPORT void init(void);
490  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
491  };
492 
493 
495  class EqualNode : public AbstractNode {
496  public:
497  TRITON_EXPORT EqualNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
498  TRITON_EXPORT void init(void);
499  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
500  };
501 
502 
504  class ExtractNode : public AbstractNode {
505  public:
506  TRITON_EXPORT ExtractNode(triton::uint32 high, triton::uint32 low, const SharedAbstractNode& expr);
507  TRITON_EXPORT void init(void);
508  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
509  };
510 
511 
513  class IffNode : public AbstractNode {
514  public:
515  TRITON_EXPORT IffNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
516  TRITON_EXPORT void init(void);
517  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
518  };
519 
520 
522  class IntegerNode : public AbstractNode {
523  protected:
524  triton::uint512 value;
525 
526  public:
527  TRITON_EXPORT IntegerNode(triton::uint512 value, const SharedAstContext& ctxt);
528  TRITON_EXPORT void init(void);
529  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
530  TRITON_EXPORT triton::uint512 getInteger(void);
531  };
532 
533 
535  class IteNode : public AbstractNode {
536  public:
537  TRITON_EXPORT IteNode(const SharedAbstractNode& ifExpr, const SharedAbstractNode& thenExpr, const SharedAbstractNode& elseExpr);
538  TRITON_EXPORT void init(void);
539  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
540  };
541 
542 
544  class LandNode : public AbstractNode {
545  public:
546  template <typename T> LandNode(const T& exprs, const SharedAstContext& ctxt)
548  for (auto expr : exprs)
549  this->addChild(expr);
550  }
551 
552  TRITON_EXPORT LandNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
553  TRITON_EXPORT void init(void);
554  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
555  };
556 
557 
559  class LetNode : public AbstractNode {
560  public:
561  TRITON_EXPORT LetNode(std::string alias, const SharedAbstractNode& expr2, const SharedAbstractNode& expr3);
562  TRITON_EXPORT void init(void);
563  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
564  };
565 
566 
568  class LnotNode : public AbstractNode {
569  public:
570  TRITON_EXPORT LnotNode(const SharedAbstractNode& expr);
571  TRITON_EXPORT void init(void);
572  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
573  };
574 
575 
577  class LorNode : public AbstractNode {
578  public:
579  template <typename T> LorNode(const T& exprs, const SharedAstContext& ctxt)
581  for (auto expr : exprs)
582  this->addChild(expr);
583  }
584 
585  TRITON_EXPORT LorNode(const SharedAbstractNode& expr1, const SharedAbstractNode& expr2);
586  TRITON_EXPORT void init(void);
587  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
588  };
589 
590 
592  class ReferenceNode : public AbstractNode {
593  protected:
595 
596  public:
598  TRITON_EXPORT void init(void);
599  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
600  TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression& getSymbolicExpression(void) const;
601  };
602 
603 
605  class StringNode : public AbstractNode {
606  protected:
607  std::string value;
608 
609  public:
610  TRITON_EXPORT StringNode(std::string value, const SharedAstContext& ctxt);
611  TRITON_EXPORT void init(void);
612  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
613  TRITON_EXPORT std::string getString(void);
614  };
615 
616 
618  class SxNode : public AbstractNode {
619  public:
620  TRITON_EXPORT SxNode(triton::uint32 sizeExt, const SharedAbstractNode& expr);
621  TRITON_EXPORT void init(void);
622  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
623  };
624 
625 
627  class VariableNode : public AbstractNode {
628  protected:
630 
631  public:
633  TRITON_EXPORT void init(void);
634  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
635  TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable& getSymbolicVariable(void);
636  };
637 
638 
640  class ZxNode : public AbstractNode {
641  public:
643  TRITON_EXPORT ZxNode(triton::uint32 sizeExt, const SharedAbstractNode& expr);
644  TRITON_EXPORT void init(void);
645  TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const;
646  };
647 
650 
653 
656 
658  TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, AbstractNode* node);
659 
661  TRITON_EXPORT SharedAbstractNode newInstance(AbstractNode* node, bool unroll=false);
662 
664  TRITON_EXPORT SharedAbstractNode unrollAst(const SharedAbstractNode& node);
665 
667  TRITON_EXPORT void nodesExtraction(std::deque<SharedAbstractNode>* output, const SharedAbstractNode& node, bool unroll, bool revert);
668 
670  TRITON_EXPORT std::deque<SharedAbstractNode> lookingForNodes(const SharedAbstractNode& node, triton::ast::ast_e match=ANY_NODE);
671 
673  };
675 };
676 
677 #endif /* TRITON_AST_H */
std::shared_ptr< triton::ast::AstContext > SharedAstContext
Shared AST context.
Definition: ast.hpp:64
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1305
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1850
(= <expr1> <expr2> ...) node
Definition: ast.hpp:495
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1993
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1163
(bvsge <expr1> <expr2>) node
Definition: ast.hpp:295
(ite <ifExpr> <thenExpr> <elseExpr>)
Definition: ast.hpp:535
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1247
virtual TRITON_EXPORT void init(void)=0
Init stuffs like size and eval.
triton::uint512 hash2n(triton::uint512 hash, triton::uint32 n)
Custom hash2n function for hash routine.
Definition: ast.cpp:2364
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1469
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:2012
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:2182
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1221
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1130
TRITON_EXPORT bool equalTo(const SharedAbstractNode &) const
Returns true if the current tree is equal to the second one.
Definition: ast.cpp:106
bool logical
True if it&#39;s a logical node.
Definition: ast.hpp:89
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1660
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1595
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:2147
triton::uint512 eval
The value of the tree from this root node.
Definition: ast.hpp:83
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:985
(bvsmod <expr1> <expr2>) node
Definition: ast.hpp:340
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:602
TRITON_EXPORT triton::uint512 getBitvectorMask(void) const
Returns the vector mask according the size of the node.
Definition: ast.cpp:58
TRITON_EXPORT triton::ast::ast_e getType(void) const
Returns the type of the node.
Definition: ast.cpp:48
(let ((<alias> <expr2>)) <expr3>)
Definition: ast.hpp:559
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:2133
std::vector< SharedAbstractNode > children
The children of the node.
Definition: ast.hpp:73
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1367
Abstract node.
Definition: ast.hpp:67
bool symbolized
True if the tree contains a symbolic variable.
Definition: ast.hpp:86
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1014
TRITON_EXPORT AbstractNode(triton::ast::ast_e type, const SharedAstContext &ctxt)
Constructor.
Definition: ast.cpp:29
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:2248
std::ostream & operator<<(std::ostream &stream, AbstractNode *node)
Displays the node in ast representation.
Definition: ast.cpp:2350
virtual TRITON_EXPORT triton::uint512 evaluate(void) const
Evaluates the tree.
Definition: ast.cpp:113
TRITON_EXPORT triton::uint32 getBitvectorSize(void) const
Returns the size of the node.
Definition: ast.cpp:53
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:638
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1061
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1287
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1531
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:945
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1583
Integer node.
Definition: ast.hpp:522
The Triton namespace.
Definition: api.cpp:226
triton::sint512 modularSignExtend(AbstractNode *node)
Custom modular sign extend for bitwise operation.
Definition: ast.cpp:2379
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1203
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1614
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:678
String node.
Definition: ast.hpp:605
Reference node.
Definition: ast.hpp:592
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1491
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:2200
TRITON_EXPORT std::vector< SharedAbstractNode > getParents(void)
Returns the parents of node or an empty set if there is still no parent defined.
Definition: ast.cpp:129
std::deque< SharedAbstractNode > lookingForNodes(const SharedAbstractNode &node, triton::ast::ast_e match)
Returns a deque of collected matched nodes via a depth-first pre order traversal. ...
Definition: ast.cpp:2548
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:526
TRITON_EXPORT bool isSigned(void) const
According to the size of the expression, returns true if the MSB is 1.
Definition: ast.cpp:65
triton::uint512 rotl(triton::uint512 value, triton::uint32 shift)
Custom rotate left function for hash routine.
Definition: ast.cpp:2372
std::shared_ptr< triton::ast::AbstractNode > SharedAbstractNode
Shared Abstract Node.
Definition: ast.hpp:58
((_ extract <high> <low>) <expr>) node
Definition: ast.hpp:504
TRITON_EXPORT std::vector< SharedAbstractNode > & getChildren(void)
Returns the children of the node.
Definition: ast.cpp:124
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:2283
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:446
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:253
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:898
boost::multiprecision::int512_t sint512
signed 512-bits
Definition: tritonTypes.hpp:64
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:967
((_ rotate_right rot) <expr>) node
Definition: ast.hpp:276
(bvugt <expr1> <expr2>) node
Definition: ast.hpp:385
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:751
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:880
(bvsle <expr1> <expr2>) node
Definition: ast.hpp:322
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1327
(bvuge <expr1> <expr2>) node
Definition: ast.hpp:376
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:406
(assert <expr>) node
Definition: ast.hpp:167
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1079
(bvurem <expr1> <expr2>) node
Definition: ast.hpp:412
(bvlshr <expr1> <expr2>) node
Definition: ast.hpp:203
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:2092
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1181
((_ zero_extend sizeExt) <expr>) node
Definition: ast.hpp:640
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1878
(lnot <expr>)
Definition: ast.hpp:568
(and <expr1> <expr2>)
Definition: ast.hpp:544
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:619
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1970
SharedAbstractNode unrollAst(const triton::ast::SharedAbstractNode &node)
AST C++ API - Unrolls the SSA form of a given AST.
Definition: ast.cpp:2492
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1632
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1032
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:580
TRITON_EXPORT SharedAstContext getContext(void) const
Access to its context.
Definition: ast.cpp:43
TRITON_EXPORT bool isSymbolized(void) const
Returns true if the tree contains a symbolic variable.
Definition: ast.cpp:72
TRITON_EXPORT std::string str(void) const
Returns the string representation of the node.
Definition: ast.cpp:214
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:486
(or <expr1> <expr2>)
Definition: ast.hpp:577
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:352
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:2166
(bvneg <expr>) node
Definition: ast.hpp:230
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1345
(bvsrem <expr1> <expr2>) node
Definition: ast.hpp:349
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1952
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1895
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1832
TRITON_EXPORT void removeParent(AbstractNode *p)
Removes a parent node.
Definition: ast.cpp:168
(bvslt <expr1> <expr2>) node
Definition: ast.hpp:331
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1717
void nodesExtraction(std::deque< SharedAbstractNode > *output, const SharedAbstractNode &node, bool unroll, bool revert)
Returns all nodes of an AST. If unroll is true, references are unrolled. If revert is true...
Definition: ast.cpp:2497
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1911
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:2034
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1677
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1699
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:2229
void initParents(void)
Initializes parents.
Definition: ast.cpp:118
(_ bv<value> <size>) node
Definition: ast.hpp:439
(iff <expr1> <expr2>)
Definition: ast.hpp:513
(bvashr <expr1> <expr2>) node
Definition: ast.hpp:194
TRITON_EXPORT void setChild(triton::uint32 index, const SharedAbstractNode &child)
Sets a child at an index.
Definition: ast.cpp:191
(bvor <expr1> <expr2>) node
Definition: ast.hpp:257
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:656
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:293
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:2074
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:464
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1798
std::shared_ptr< triton::engines::symbolic::SymbolicExpression > SharedSymbolicExpression
Shared Symbolic Expression.
Definition: ast.hpp:39
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1779
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:851
virtual TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const =0
Returns the has of the tree. The hash is computed recursively on the whole tree.
(bvmul <expr1> <expr2>) node
Definition: ast.hpp:212
(bvxor <expr1> <expr2>) node
Definition: ast.hpp:430
(bvule <expr1> <expr2>) node
Definition: ast.hpp:394
std::uint32_t uint32
unisgned 32-bits
Definition: tritonTypes.hpp:31
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1509
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:729
(bvand <expr1> <expr2>) node
Definition: ast.hpp:185
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1265
SharedAbstractNode newInstance(AbstractNode *node, bool unroll)
AST C++ API - Duplicates the AST.
Definition: ast.cpp:2403
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1927
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1549
(bvnand <expr1> <expr2>) node
Definition: ast.hpp:221
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1451
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:780
((_ sign_extend sizeExt) <expr>) node
Definition: ast.hpp:618
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:311
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:2051
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1757
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:424
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1385
virtual TRITON_EXPORT ~AbstractNode()
Destructor.
Definition: ast.cpp:38
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:798
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:927
TRITON_EXPORT ZxNode(triton::uint32 sizeExt, const SharedAbstractNode &expr)
Create a zero extend of expr to sizeExt bits.
Definition: ast.cpp:2277
(bvsub <expr1> <expr2>) node
Definition: ast.hpp:358
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:2115
TRITON_EXPORT void addChild(const SharedAbstractNode &child)
Adds a child.
Definition: ast.cpp:186
(bvxnor <expr1> <expr2>) node
Definition: ast.hpp:421
[<expr1> <expr2> <expr3> ...] node
Definition: ast.hpp:448
std::shared_ptr< triton::engines::symbolic::SymbolicVariable > SharedSymbolicVariable
Shared Symbolic variable.
Definition: ast.hpp:42
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:700
(bvnor <expr1> <expr2>) node
Definition: ast.hpp:239
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1739
TRITON_EXPORT void setParent(AbstractNode *p)
Sets a parent node.
Definition: ast.cpp:147
(bvult <expr1> <expr2>) node
Definition: ast.hpp:403
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:2312
(concat <expr1> <expr2> ...) node
Definition: ast.hpp:462
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:1425
TRITON_EXPORT void setBitvectorSize(triton::uint32 size)
Sets the size of the node.
Definition: ast.cpp:209
(bvudiv <expr1> <expr2>) node
Definition: ast.hpp:367
(bvadd <expr1> <expr2>) node
Definition: ast.hpp:176
(bvshl <expr1> <expr2>) node
Definition: ast.hpp:313
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:562
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:271
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:504
boost::multiprecision::uint512_t uint512
unsigned 512-bits
Definition: tritonTypes.hpp:43
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:333
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:231
(distinct <expr1> <expr2> ...) node
Definition: ast.hpp:486
triton::uint32 size
The size of the node.
Definition: ast.hpp:80
triton::ast::ast_e type
The type of the node.
Definition: ast.hpp:70
((_ rotate_left rot) <expr>) node
Definition: ast.hpp:266
TRITON_EXPORT void init(void)
Init stuffs like size and eval.
Definition: ast.cpp:543
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1407
(bvsgt <expr1> <expr2>) node
Definition: ast.hpp:304
std::weak_ptr< triton::ast::AbstractNode > WeakAbstractNode
Weak Abstract Node.
Definition: ast.hpp:61
(bvsdiv <expr1> <expr2>) node
Definition: ast.hpp:286
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:1112
(declare-fun <var_name> () (_ BitVec <var_size>)) node
Definition: ast.hpp:477
TRITON_EXPORT bool isLogical(void) const
Returns true if it&#39;s a logical node.
Definition: ast.cpp:77
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:833
TRITON_EXPORT triton::uint512 hash(triton::uint32 deep) const
Returns the has of the tree. The hash is computed recursively on the whole tree.
Definition: ast.cpp:2263
(bvnot <expr>) node
Definition: ast.hpp:248
SharedAstContext ctxt
Contect use to create this node.
Definition: ast.hpp:92
Variable node.
Definition: ast.hpp:627