diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-02-21 15:20:01 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-02-21 15:20:01 -0500 |
commit | 43b4eb6c4318de43b163a3b5cae152ad2620d124 (patch) | |
tree | ae6ffe61e83126c51c0140b9b034a83d3c5e1a72 /bfs.h | |
parent | b2c2c65fbec390c9e5550b0cea6edcaf986ececc (diff) | |
download | bfs-43b4eb6c4318de43b163a3b5cae152ad2620d124.tar.xz |
Make optimizations based on the purity of predicates.
This allows something like
$ ./bfs -empty -false
to avoid evaluating -empty, just like find.
Diffstat (limited to 'bfs.h')
-rw-r--r-- | bfs.h | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -111,12 +111,13 @@ enum timeunit { }; struct expr { + /** The function that evaluates this expression. */ + eval_fn *eval; + /** The left hand side of the expression. */ struct expr *lhs; /** The right hand side of the expression. */ struct expr *rhs; - /** The function that evaluates this expression. */ - eval_fn *eval; /** The optional comparison flag. */ enum cmpflag cmp; @@ -138,6 +139,9 @@ struct expr { /** Optional string data for this expression. */ const char *sdata; + + /** Whether this expression has no side effects. */ + bool pure; }; /** |