Replace builtin_types.h generation with the generated output.
[mesa.git] / ast.h
diff --git a/ast.h b/ast.h
index a158910421d427ae1db1ed2ce86cb0f48d46694c..d899fb1d090a831a98bc90e49f940066668af239 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -68,16 +68,13 @@ public:
     *
     * \sa ast_node::get_location
     */
-   void set_location(const struct YYLTYPE *locp)
+   void set_location(const struct YYLTYPE &locp)
    {
-      this->location.source = locp->source;
-      this->location.line = locp->first_line;
-      this->location.column = locp->first_column;
+      this->location.source = locp.source;
+      this->location.line = locp.first_line;
+      this->location.column = locp.first_column;
    }
 
-
-   int  type;
-
    struct {
       unsigned source;
       unsigned line;
@@ -326,10 +323,12 @@ enum ast_types {
    ast_mat4,
    ast_sampler1d,
    ast_sampler2d,
+   ast_sampler2drect,
    ast_sampler3d,
    ast_samplercube,
    ast_sampler1dshadow,
    ast_sampler2dshadow,
+   ast_sampler2drectshadow,
    ast_samplercubeshadow,
    ast_sampler1darray,
    ast_sampler2darray,
@@ -373,6 +372,10 @@ public:
       /* empty */
    }
 
+   const struct glsl_type *glsl_type(const char **name,
+                                    struct _mesa_glsl_parse_state *state)
+      const;
+
    virtual void print(void) const;
 
    enum ast_types type_specifier;
@@ -429,6 +432,21 @@ public:
    char *identifier;
    int is_array;
    ast_expression *array_size;
+
+   static void parameters_to_hir(simple_node *ast_parameters,
+                                bool formal, exec_list *ir_parameters,
+                                struct _mesa_glsl_parse_state *state);
+
+private:
+   /** Is this parameter declaration part of a formal parameter list? */
+   bool formal_parameter;
+
+   /**
+    * Is this parameter 'void' type?
+    *
+    * This field is set by \c ::hir.
+    */
+   bool is_void;
 };
 
 
@@ -438,10 +456,36 @@ public:
 
    virtual void print(void) const;
 
+   virtual ir_rvalue *hir(exec_list *instructions,
+                         struct _mesa_glsl_parse_state *state);
+
    ast_fully_specified_type *return_type;
    char *identifier;
 
    struct simple_node parameters;
+
+private:
+   /**
+    * Is this prototype part of the function definition?
+    *
+    * Used by ast_function_definition::hir to process the parameters, etc.
+    * of the function.
+    *
+    * \sa ::hir
+    */
+   bool is_definition;
+
+   /**
+    * Function signature corresponding to this function prototype instance
+    *
+    * Used by ast_function_definition::hir to process the parameters, etc.
+    * of the function.
+    *
+    * \sa ::hir
+    */
+   class ir_function_signature *signature;
+
+   friend class ast_function_definition;
 };
 
 
@@ -492,6 +536,9 @@ public:
                           ast_node *else_statement);
    virtual void print(void) const;
 
+   virtual ir_rvalue *hir(exec_list *instructions,
+                         struct _mesa_glsl_parse_state *state);
+
    ast_expression *condition;
    ast_node *then_statement;
    ast_node *else_statement;
@@ -511,6 +558,8 @@ public:
 
    virtual void print(void) const;
 
+   virtual ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *);
+
    enum ast_iteration_modes {
       ast_for,
       ast_while,
@@ -523,6 +572,15 @@ public:
    ast_expression *rest_expression;
 
    ast_node *body;
+
+private:
+   /**
+    * Generate IR from the condition of a loop
+    *
+    * This is factored out of ::hir because some loops have the condition
+    * test at the top (for and while), and others have it at the end (do-while).
+    */
+   void condition_to_hir(class ir_loop *, struct _mesa_glsl_parse_state *);
 };