VTILVTIL

Low-level Symbolic Directives

The <vtil/symex> surface includes directive-driven symbolic matching and rewriting primitives used by VTIL simplification pipelines. These APIs are lower-level than simplify_expression and are intended for custom matcher/transformer workflows.

Public include surface
#include <vtil/symex>

This wrapper pulls in:

  • expressions/expression.hpp
  • simplifier/simplifier.hpp
  • simplifier/directives.hpp
  • directives/directive.hpp
  • directives/expression_signature.hpp
  • directives/transformer.hpp
  • directives/fast_matcher.hpp
Directive instances and matching types

symbolic::directive::instance encodes pattern trees used for matching expressions. Variables can carry constraints such asmatch_variable, match_constant,match_expression, and match_non_constant.

using namespace vtil::symbolic;
using namespace vtil::symbolic::directive;

// Directive variables.
static constexpr instance A{ "A", 0, match_any };
static constexpr instance B{ "B", 1, match_any };

// Pattern and replacement.
instance from = A + 0;
instance to = A;
Fast matcher (symbol-table extraction)

directive::fast_match attempts structural matching and produces symbol-table mappings for all valid bindings.

stack_vector<directive::symbol_table_t, 8> matches;
auto count = directive::fast_match(&matches, from, expr);
if (count != 0) {
  auto mappedA = matches.front().translate(A);
  (void)mappedA;
}
Transformer API (pattern rewrite)

symbolic::transformperforms “match pattern A, emit pattern B” with optional filters (for example complexity guards).

auto rewritten = symbolic::transform(
  expr,
  &from,
  &to,
  [&](symbolic::expression::reference out) {
    return out->complexity <= expr->complexity;
  }
);

if (rewritten) {
  expr = rewritten;
}
Simplifier directives and cache management

VTIL ships directive sets (for example universal_simplifiers and join descriptors) in simplifier/directives.hpp, then applies them through simplify_expression.

using namespace vtil::symbolic;

simplify_expression(expr, /*pretty=*/false, /*unpack=*/true);

// Optional cache control for deterministic tooling runs:
purge_simplifier_state();

Header Files