Mesa (master): i965: Add basic-block aware backend_instruction:: insert_* methods.
Matt Turner
mattst88 at kemper.freedesktop.org
Fri Aug 22 17:20:38 UTC 2014
Module: Mesa
Branch: master
Commit: 3d6d4dc6f7f90d65982073294a41afac8397f68a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d6d4dc6f7f90d65982073294a41afac8397f68a
Author: Matt Turner <mattst88 at gmail.com>
Date: Sat Jul 12 21:18:08 2014 -0700
i965: Add basic-block aware backend_instruction::insert_* methods.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_shader.cpp | 47 ++++++++++++++++++++++++++++++
src/mesa/drivers/dri/i965/brw_shader.h | 5 ++++
2 files changed, 52 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 464790a..1a18169 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -758,6 +758,53 @@ adjust_later_block_ips(bblock_t *start_block, int ip_adjustment)
}
void
+backend_instruction::insert_after(bblock_t *block, backend_instruction *inst)
+{
+ assert(inst_is_in_block(block, this) || !"Instruction not in block");
+
+ block->end_ip++;
+
+ adjust_later_block_ips(block, 1);
+
+ if (block->end == this)
+ block->end = inst;
+
+ exec_node::insert_after(inst);
+}
+
+void
+backend_instruction::insert_before(bblock_t *block, backend_instruction *inst)
+{
+ assert(inst_is_in_block(block, this) || !"Instruction not in block");
+
+ block->end_ip++;
+
+ adjust_later_block_ips(block, 1);
+
+ if (block->start == this)
+ block->start = inst;
+
+ exec_node::insert_before(inst);
+}
+
+void
+backend_instruction::insert_before(bblock_t *block, exec_list *list)
+{
+ assert(inst_is_in_block(block, this) || !"Instruction not in block");
+
+ unsigned num_inst = list->length();
+
+ block->end_ip += num_inst;
+
+ adjust_later_block_ips(block, num_inst);
+
+ if (block->start == this)
+ block->start = (backend_instruction *)list->get_head();
+
+ exec_node::insert_before(list);
+}
+
+void
backend_instruction::remove(bblock_t *block)
{
assert(inst_is_in_block(block, this) || !"Instruction not in block");
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index f5af4fd..35a2b96 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -92,6 +92,11 @@ struct backend_instruction : public exec_node {
using exec_node::remove;
void remove(bblock_t *block);
+ using exec_node::insert_after;
+ void insert_after(bblock_t *block, backend_instruction *inst);
+ using exec_node::insert_before;
+ void insert_before(bblock_t *block, backend_instruction *inst);
+ void insert_before(bblock_t *block, exec_list *list);
/**
* True if the instruction has side effects other than writing to
More information about the mesa-commit
mailing list