[Mesa-dev] [PATCH 04/10] glsl: separate copy propagation state

Eric Anholt eric at anholt.net
Thu Jul 5 22:12:16 UTC 2018


Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com> writes:

> Separate higher level logic of visiting instructions and chosing when
> to store and use new copy data from the datastructure holding the copy
> propagation information. This will also make easier later patches that
> change the structure.
> ---
>  .../glsl/opt_copy_propagation_elements.cpp    | 269 ++++++++++--------
>  1 file changed, 143 insertions(+), 126 deletions(-)
>
> diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> index 8975e727522..5d3664a503b 100644
> --- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
> +++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> @@ -89,6 +89,121 @@ public:
>     acp_ref rhs_node;
>  };
>  
> +class copy_propagation_state {

Since this copy_propagation_state covers just the acp and not the kills
list (whcih is still part of the copy propagation state in the visitor
class), could we call it "acp"?

> @@ -191,26 +283,21 @@ ir_copy_propagation_elements_visitor::visit_enter(ir_function_signature *ir)
>     exec_list *orig_kills = this->kills;
>     bool orig_killed_all = this->killed_all;
>  
> -   hash_table *orig_lhs_ht = lhs_ht;
> -   hash_table *orig_rhs_ht = rhs_ht;
> -
>     this->kills = new(mem_ctx) exec_list;
>     this->killed_all = false;
>  
> -   create_acp();
> +   copy_propagation_state *orig_state = state;
> +   this->state = new(mem_ctx) copy_propagation_state(mem_ctx, lin_ctx);
>  
>     visit_list_elements(this, &ir->body);
>  
> -   ralloc_free(this->kills);
> -
> -   destroy_acp();
> +   delete this->state;
> +   this->state = orig_state;

Don't you want destroy_acp()'s body in ~copy_propagation_state()?

Other than that, it looks good.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180705/9d4fae4f/attachment.sig>


More information about the mesa-dev mailing list