summaryrefslogtreecommitdiffstats
path: root/bfs.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-07-21 19:16:54 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-07-21 19:30:26 -0400
commit2876e0ac4ecf21f26a3e5b42ac9e9a6f61db1062 (patch)
tree1e4b483c77fd5e31d5b9c66804d16d4dc5cdf628 /bfs.h
parent462589f69859354a9c623cad9015821e769beecb (diff)
downloadbfs-2876e0ac4ecf21f26a3e5b42ac9e9a6f61db1062.tar.xz
Represent never returning as always_true && always_false
Expressions that never return are vacuously always both true and false. Using this representation lets us take advantage of existing truth-based optimizations, which gets us optimizations of command lines like bfs -name foo -quit -print for free.
Diffstat (limited to 'bfs.h')
-rw-r--r--bfs.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/bfs.h b/bfs.h
index 16ce475..79a383a 100644
--- a/bfs.h
+++ b/bfs.h
@@ -206,8 +206,6 @@ struct expr {
bool always_true;
/** Whether this expression always evaluates to false. */
bool always_false;
- /** Whether this expression never returns. */
- bool never_returns;
/** Number of times this predicate was executed. */
size_t evaluations;
@@ -266,6 +264,11 @@ struct expr {
};
/**
+ * @return Whether expr is known to always quit.
+ */
+bool expr_never_returns(const struct expr *expr);
+
+/**
* Parse the command line.
*/
struct cmdline *parse_cmdline(int argc, char *argv[]);