Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the size of an AST node #240

Closed
JonathanSalwan opened this issue Dec 27, 2015 · 0 comments
Closed

Get the size of an AST node #240

JonathanSalwan opened this issue Dec 27, 2015 · 0 comments

Comments

@JonathanSalwan
Copy link
Owner

In several cases (when we perform simplification) we must know the size of the root BVNODE. To do that, we must compute the AST. (c.f: concat, extract, bv, sx, zx).

The method node.getBitvectorSize() returns the current size of the root node. Which means that we can now perform simplification like this:

/* if (bvxor x x) -> (_ bv0 x_size) */
smt2lib::smtAstAbstractNode* xor_simplification(smt2lib::smtAstAbstractNode* node) {

  if (node->getKind() == smt2lib::BVXOR_NODE) {
    if (*(node->getChilds()[0]) == *(node->getChilds()[1]))
      return smt2lib::bv(0, node->getBitvectorSize());
  }

  return node;
}

Related to #226 and #93. Done with the next v0.3.

@JonathanSalwan JonathanSalwan self-assigned this Dec 27, 2015
@JonathanSalwan JonathanSalwan added this to the v0.3 milestone Dec 27, 2015
@JonathanSalwan JonathanSalwan changed the title Get the size of a AST node Get the size of an AST node Dec 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant