#include <InsnSemanticsExpr.h>
Inheritance diagram for InsnSemanticsExpr::LeafNode:


A leaf node is either a known value or a free variable.
Public Member Functions | |
| LeafNode () | |
| virtual bool | is_known () const |
| Returns true if the expression is a known value. | |
| virtual uint64_t | get_value () const |
| Returns the integer value of a node for which is_known() returns true. | |
| uint64_t | get_name () const |
| Returns the name of a free variable. | |
| virtual void | print (std::ostream &o, RenameMap *rmap=NULL) const |
| Print the expression to a stream. | |
| virtual bool | equal_to (const TreeNode *other, SMTSolver *) const |
| Tests two expressions for equality using an optional satisfiability modulo theory (SMT) solver. | |
| virtual void | depth_first_visit (Visitor *) const |
| Traverse the expression. | |
Static Public Member Functions | |
| static LeafNode * | create_variable (size_t nbits) |
| Construct a new free variable with a specified number of significant bits. | |
| static LeafNode * | create_integer (size_t nbits, uint64_t n) |
| Construct a new integer with the specified number of significant bits. | |
Private Attributes | |
| bool | known |
| True if the value is known; false for variables. | |
| union { | |
| uint64_t ival | |
| Integer (unsigned) value when 'known' is true; unused msb are zero. | |
| uint64_t name | |
| Variable ID number when 'known' is false. | |
| }; | |
| InsnSemanticsExpr::LeafNode::LeafNode | ( | ) | [inline] |
| static LeafNode* InsnSemanticsExpr::LeafNode::create_variable | ( | size_t | nbits | ) | [static] |
Construct a new free variable with a specified number of significant bits.
| static LeafNode* InsnSemanticsExpr::LeafNode::create_integer | ( | size_t | nbits, | |
| uint64_t | n | |||
| ) | [static] |
Construct a new integer with the specified number of significant bits.
Any high-order bits beyond the specified size will be zeroed.
| virtual bool InsnSemanticsExpr::LeafNode::is_known | ( | ) | const [virtual] |
Returns true if the expression is a known value.
FIXME: The current implementation returns true only when this node is leaf node with a known value. Since InsnSemanticsExpr does not do constant folding, this is of limited use. [RPM 2010-06-08].
Implements InsnSemanticsExpr::TreeNode.
| virtual uint64_t InsnSemanticsExpr::LeafNode::get_value | ( | ) | const [virtual] |
Returns the integer value of a node for which is_known() returns true.
The high-order bits, those beyond the number of significant bits returned by get_nbits(), are guaranteed to be zero.
Implements InsnSemanticsExpr::TreeNode.
| uint64_t InsnSemanticsExpr::LeafNode::get_name | ( | ) | const |
Returns the name of a free variable.
The output functions print variables as "vN" where N is an integer. It is this N that this method returns. It should only be invoked on leaf nodes for which is_known() returns false.
| virtual void InsnSemanticsExpr::LeafNode::print | ( | std::ostream & | o, | |
| RenameMap * | rmap = NULL | |||
| ) | const [virtual] |
Print the expression to a stream.
The output is an S-expression with no line-feeds. If rmap is non-null then it will be used to rename free variables for readability. If the expression contains N variables, then the new names will be numbered from the set M = (i | 0 <= i <= N-1).
Implements InsnSemanticsExpr::TreeNode.
| virtual bool InsnSemanticsExpr::LeafNode::equal_to | ( | const TreeNode * | other, | |
| SMTSolver * | ||||
| ) | const [virtual] |
Tests two expressions for equality using an optional satisfiability modulo theory (SMT) solver.
Returns true if the inequality is not satisfiable.
Implements InsnSemanticsExpr::TreeNode.
| virtual void InsnSemanticsExpr::LeafNode::depth_first_visit | ( | Visitor * | ) | const [virtual] |
Traverse the expression.
The expression is traversed in a depth-first visit, invoking the functor at each node of the expression tree.
Implements InsnSemanticsExpr::TreeNode.
bool InsnSemanticsExpr::LeafNode::known [private] |
True if the value is known; false for variables.
uint64_t InsnSemanticsExpr::LeafNode::ival [private] |
Integer (unsigned) value when 'known' is true; unused msb are zero.
uint64_t InsnSemanticsExpr::LeafNode::name [private] |
Variable ID number when 'known' is false.
union { ... } [private] |
1.4.7