aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2020-04-03 21:25:40 -0500
committerMarge Bot <[email protected]>2020-04-17 14:48:06 +0000
commiteb5a10ff63f74f9e052ecc6c7399df8e0d193345 (patch)
tree73cbf6343be2805a3a527bae31a0e3772e5b1f0e /src/intel/compiler
parent64e3b8d66b9d4103ff815606ff20b39246418122 (diff)
intel/cfg: Add first/last_block helpers
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4447>
Diffstat (limited to 'src/intel/compiler')
-rw-r--r--src/intel/compiler/brw_cfg.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_cfg.h b/src/intel/compiler/brw_cfg.h
index c747805817d..cec1464c69e 100644
--- a/src/intel/compiler/brw_cfg.h
+++ b/src/intel/compiler/brw_cfg.h
@@ -310,6 +310,11 @@ struct cfg_t {
void remove_block(bblock_t *block);
+ bblock_t *first_block();
+ const bblock_t *first_block() const;
+ bblock_t *last_block();
+ const bblock_t *last_block() const;
+
bblock_t *new_block();
void set_next_block(bblock_t **cur, bblock_t *block, int ip);
void make_block_array();
@@ -328,6 +333,56 @@ struct cfg_t {
unsigned cycle_count;
};
+static inline struct bblock_t *
+cfg_first_block(struct cfg_t *cfg)
+{
+ return (struct bblock_t *)exec_list_get_head(&cfg->block_list);
+}
+
+static inline const struct bblock_t *
+cfg_first_block_const(const struct cfg_t *cfg)
+{
+ return (const struct bblock_t *)exec_list_get_head_const(&cfg->block_list);
+}
+
+static inline struct bblock_t *
+cfg_last_block(struct cfg_t *cfg)
+{
+ return (struct bblock_t *)exec_list_get_tail(&cfg->block_list);
+}
+
+static inline const struct bblock_t *
+cfg_last_block_const(const struct cfg_t *cfg)
+{
+ return (const struct bblock_t *)exec_list_get_tail_const(&cfg->block_list);
+}
+
+#ifdef __cplusplus
+inline bblock_t *
+cfg_t::first_block()
+{
+ return cfg_first_block(this);
+}
+
+const inline bblock_t *
+cfg_t::first_block() const
+{
+ return cfg_first_block_const(this);
+}
+
+inline bblock_t *
+cfg_t::last_block()
+{
+ return cfg_last_block(this);
+}
+
+const inline bblock_t *
+cfg_t::last_block() const
+{
+ return cfg_last_block_const(this);
+}
+#endif
+
/* Note that this is implemented with a double for loop -- break will
* break from the inner loop only!
*/