Mesa (master): i965: Make it possible to create a cfg_t without a backend_visitor.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Nov 27 04:48:56 UTC 2012


Module: Mesa
Branch: master
Commit: cd0acb1abe4c2c3120acf18f594210989bd8ec2e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd0acb1abe4c2c3120acf18f594210989bd8ec2e

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Nov 20 17:30:46 2012 -0800

i965: Make it possible to create a cfg_t without a backend_visitor.

All we really need is a memory context and the instruction list; passing
a backend_visitor is just convenient at times.

This will be necessary two patches from now.

Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_cfg.cpp |   17 ++++++++++++++---
 src/mesa/drivers/dri/i965/brw_cfg.h   |    4 ++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index 79aafb2..f4cfcd5 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -68,7 +68,18 @@ bblock_t::make_list(void *mem_ctx)
 
 cfg_t::cfg_t(backend_visitor *v)
 {
-   mem_ctx = ralloc_context(v->mem_ctx);
+   create(v->mem_ctx, &v->instructions);
+}
+
+cfg_t::cfg_t(void *mem_ctx, exec_list *instructions)
+{
+   create(mem_ctx, instructions);
+}
+
+void
+cfg_t::create(void *parent_mem_ctx, exec_list *instructions)
+{
+   mem_ctx = ralloc_context(parent_mem_ctx);
    block_list.make_empty();
    num_blocks = 0;
    ip = 0;
@@ -82,9 +93,9 @@ cfg_t::cfg_t(backend_visitor *v)
 
    set_next_block(entry);
 
-   entry->start = (backend_instruction *)v->instructions.get_head();
+   entry->start = (backend_instruction *) instructions->get_head();
 
-   foreach_list(node, &v->instructions) {
+   foreach_list(node, instructions) {
       backend_instruction *inst = (backend_instruction *)node;
 
       cur->end = inst;
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h
index 3b031df..95a18e9 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -79,7 +79,11 @@ public:
    }
 
    cfg_t(backend_visitor *v);
+   cfg_t(void *mem_ctx, exec_list *instructions);
    ~cfg_t();
+
+   void create(void *mem_ctx, exec_list *instructions);
+
    bblock_t *new_block();
    void set_next_block(bblock_t *block);
    void make_block_array();




More information about the mesa-commit mailing list