aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-04-02 15:15:04 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-04-02 15:15:04 +0300
commita7cb592efa9ec72c4c5e9d3c1e7469203a4b47e2 (patch)
tree5c43cfbde7cad7f1f46366d9b9fedd9c81953f91 /include
parent59148d666a78d671198d56caabe7fe4d7fb3fee1 (diff)
downloadqbt-a7cb592efa9ec72c4c5e9d3c1e7469203a4b47e2.tar.gz
qbt-a7cb592efa9ec72c4c5e9d3c1e7469203a4b47e2.zip
add simple unreachability
Diffstat (limited to 'include')
-rw-r--r--include/qbt/nodes.h5
-rw-r--r--include/qbt/unreachable.h8
2 files changed, 13 insertions, 0 deletions
diff --git a/include/qbt/nodes.h b/include/qbt/nodes.h
index 011d718..63bbc58 100644
--- a/include/qbt/nodes.h
+++ b/include/qbt/nodes.h
@@ -128,6 +128,8 @@ struct blk {
/* used to temporarily store label targets */
const char *to;
+ /* used by reachability analysis */
+ bool reachable;
};
struct fn {
@@ -253,6 +255,9 @@ struct label_map {
#define blk_at(v, i)\
vect_at(struct blk *, v, i)
+#define blk_back(v)\
+ vect_at(struct blk *, v, vec_len(&v) - 1)
+
#define blk_pop(v)\
vect_pop(struct blk *, v)
diff --git a/include/qbt/unreachable.h b/include/qbt/unreachable.h
new file mode 100644
index 0000000..0f0c39e
--- /dev/null
+++ b/include/qbt/unreachable.h
@@ -0,0 +1,8 @@
+#ifndef UNREACHABLE_H
+#define UNREACHABLE_H
+
+#include <qbt/nodes.h>
+
+void unreachable(struct fn *f);
+
+#endif /* UNREACHABLE_H */