From a7cb592efa9ec72c4c5e9d3c1e7469203a4b47e2 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 2 Apr 2024 15:15:04 +0300 Subject: add simple unreachability --- include/qbt/nodes.h | 5 +++++ include/qbt/unreachable.h | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 include/qbt/unreachable.h (limited to 'include') 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 + +void unreachable(struct fn *f); + +#endif /* UNREACHABLE_H */ -- cgit v1.3