[Mesa-dev] [PATCH 1/6] glsl: Create AST data structures for switch statement and case label

Ian Romanick idr at freedesktop.org
Mon Jun 20 15:29:54 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/17/2011 05:43 PM, Dan McCabe wrote:
> Data structures for switch statement and case label are created that parallel
> the structure of other AST data.
> ---
>  src/glsl/ast.h |   24 ++++++++++++++++++++----
>  1 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/src/glsl/ast.h b/src/glsl/ast.h
> index 878f48b..39a59d4 100644
> --- a/src/glsl/ast.h
> +++ b/src/glsl/ast.h
> @@ -628,13 +628,19 @@ public:
>  
>  class ast_case_label : public ast_node {
>  public:
> +   ast_case_label(ast_expression *test_value);
> +   virtual void print(void) const;
> +
> +   virtual ir_rvalue *hir(exec_list *instructions,
> +			  struct _mesa_glsl_parse_state *state);
>  
>     /**
> -    * An expression of NULL means 'default'.
> +    * An test value of NULL means 'default'.
>      */
> -   ast_expression *expression;
> +   ast_expression *test_value;

In the AST, this is an expression.  What is significant about calling it
test_value?  Also, I think the comment should read "A test value..."

>  };
>  
> +
>  class ast_selection_statement : public ast_node {
>  public:
>     ast_selection_statement(ast_expression *condition,
> @@ -653,8 +659,18 @@ public:
>  
>  class ast_switch_statement : public ast_node {
>  public:
> -   ast_expression *expression;
> -   exec_list statements;
> +   ast_switch_statement(ast_expression *test_expression,
> +			ast_node *body);
> +   virtual void print(void) const;
> + 
> +   virtual ir_rvalue *hir(exec_list *instructions,
> +			  struct _mesa_glsl_parse_state *state);
> +
> +   ast_expression *test_expression;
> +   ast_node *body;
> +
> +protected:
> +   void test_to_hir(class ir_loop *, struct _mesa_glsl_parse_state *);
>  };
>  
>  class ast_iteration_statement : public ast_node {
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3/yeEACgkQX1gOwKyEAw8rTACfbwhD2FQRADUJZ81FA+NDAwJ+
JAEAn0f1sQK68AO/pQ7E8xHeNVPWlIlr
=cXqi
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list