summaryrefslogtreecommitdiffstats
path: root/src/intel/compiler
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2019-09-27 14:49:14 -0700
committerFrancisco Jerez <[email protected]>2019-10-11 12:24:16 -0700
commitc344c92b31454115261d6f235d00e4e14ed0ce3c (patch)
tree933fd8bf9c9208fdde320c39c28d1e957321776f /src/intel/compiler
parentd6a9731d8f94c4ecaea69bed6034f8a605838b6d (diff)
intel/ir: Add helper function to push block onto CFG analysis stack.
Requested-by: Caio Marcelo de Oliveira Filho <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/intel/compiler')
-rw-r--r--src/intel/compiler/brw_cfg.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/intel/compiler/brw_cfg.cpp b/src/intel/compiler/brw_cfg.cpp
index 0d6c6fc5f5b..d5e8913e058 100644
--- a/src/intel/compiler/brw_cfg.cpp
+++ b/src/intel/compiler/brw_cfg.cpp
@@ -50,6 +50,15 @@ link(void *mem_ctx, bblock_t *block, enum bblock_link_kind kind)
return &l->link;
}
+void
+push_stack(exec_list *list, void *mem_ctx, bblock_t *block)
+{
+ /* The kind of the link is immaterial, but we need to provide one since
+ * this is (ab)using the edge data structure in order to implement a stack.
+ */
+ list->push_tail(link(mem_ctx, block, bblock_link_logical));
+}
+
bblock_t::bblock_t(cfg_t *cfg) :
cfg(cfg), idom(NULL), start_ip(0), end_ip(0), num(0), cycle_count(0)
{
@@ -188,8 +197,8 @@ cfg_t::cfg_t(exec_list *instructions)
/* Push our information onto a stack so we can recover from
* nested ifs.
*/
- if_stack.push_tail(link(mem_ctx, cur_if, bblock_link_logical));
- else_stack.push_tail(link(mem_ctx, cur_else, bblock_link_logical));
+ push_stack(&if_stack, mem_ctx, cur_if);
+ push_stack(&else_stack, mem_ctx, cur_else);
cur_if = cur;
cur_else = NULL;
@@ -249,8 +258,8 @@ cfg_t::cfg_t(exec_list *instructions)
/* Push our information onto a stack so we can recover from
* nested loops.
*/
- do_stack.push_tail(link(mem_ctx, cur_do, bblock_link_logical));
- while_stack.push_tail(link(mem_ctx, cur_while, bblock_link_logical));
+ push_stack(&do_stack, mem_ctx, cur_do);
+ push_stack(&while_stack, mem_ctx, cur_while);
/* Set up the block just after the while. Don't know when exactly
* it will start, yet.