nir: Add trivial nir_src_* getters
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 14 Aug 2023 14:33:18 +0000 (10:33 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 10 Oct 2023 08:58:04 +0000 (04:58 -0400)
These will become nontrivial later in the series. For now these have no smarts
in them, in order to make the conversion completely mechanical.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24671>

src/compiler/nir/nir.h

index 42776b5..7623bc2 100644 (file)
@@ -1009,6 +1009,24 @@ typedef struct nir_src {
    bool is_if;
 } nir_src;
 
+static inline bool
+nir_src_is_if(const nir_src *src)
+{
+   return src->is_if;
+}
+
+static inline nir_instr *
+nir_src_parent_instr(const nir_src *src)
+{
+   return src->parent_instr;
+}
+
+static inline struct nir_if *
+nir_src_parent_if(const nir_src *src)
+{
+   return src->parent_if;
+}
+
 static inline void
 nir_src_set_parent_instr(nir_src *src, nir_instr *parent_instr)
 {