remove stray tab
[mesa.git] / src / mesa / shader / slang / slang_compile_operation.h
index f3c45de3c2a4c672a3dc3f426f6134ea0558bfe7..ad52b6690d5959f7934987abebaa3377243b4e3b 100644 (file)
@@ -32,7 +32,7 @@ extern "C" {
 
 /**
  * Types of slang operations.
- * These are the basic intermediate code representations.
+ * These are the types of the AST (abstract syntax tree) nodes.
  * [foo] indicates a sub-tree or reference to another type of node
  */
 typedef enum slang_operation_type_
@@ -46,6 +46,8 @@ typedef enum slang_operation_type_
    slang_oper_continue,         /* "continue" statement */
    slang_oper_discard,          /* "discard" (kill fragment) statement */
    slang_oper_return,           /* "return" [expr]  */
+   slang_oper_goto,             /* jump to label */
+   slang_oper_label,            /* a jump target */
    slang_oper_expression,       /* [expr] */
    slang_oper_if,               /* "if" [0] then [1] else [2] */
    slang_oper_while,            /* "while" [cond] [body] */
@@ -105,6 +107,7 @@ typedef enum slang_operation_type_
 /**
  * A slang_operation is basically a compiled instruction (such as assignment,
  * a while-loop, a conditional, a multiply, a function call, etc).
+ * The AST (abstract syntax tree) is built from these nodes.
  * NOTE: This structure could have been implemented as a union of simpler
  * structs which would correspond to the operation types above.
  */
@@ -112,16 +115,38 @@ typedef struct slang_operation_
 {
    slang_operation_type type;
    struct slang_operation_ *children;
-   unsigned int num_children;
-   float literal;            /**< Used for float, int and bool values */
-   slang_atom a_id;          /**< type: asm, identifier, call, field */
-   slang_variable_scope *locals;       /**< local vars for scope */
+   GLuint num_children;
+   GLfloat literal[4];           /**< Used for float, int and bool values */
+   slang_atom a_id;              /**< type: asm, identifier, call, field */
+   slang_variable_scope *locals; /**< local vars for scope */
+   struct slang_function_ *fun;  /**< If type == slang_oper_call */
+   struct slang_variable_ *var;  /**< If type == slang_oper_identier */
+   slang_fully_specified_type *datatype; /**< Type of this operation */
+   slang_assembly_typeinfo ti;
 } slang_operation;
 
 
-extern int slang_operation_construct(slang_operation *);
-extern void slang_operation_destruct(slang_operation *);
-extern int slang_operation_copy(slang_operation *, const slang_operation *);
+extern GLboolean
+slang_operation_construct(slang_operation *);
+
+extern void
+slang_operation_destruct(slang_operation *);
+
+extern GLboolean
+slang_operation_copy(slang_operation *, const slang_operation *);
+
+extern slang_operation *
+slang_operation_new(GLuint count);
+
+extern void
+slang_operation_delete(slang_operation *oper);
+
+extern slang_operation *
+slang_operation_grow(GLuint *numChildren, slang_operation **children);
+
+extern slang_operation *
+slang_operation_insert(GLuint *numChildren, slang_operation **children,
+                       GLuint pos);
 
 
 #ifdef __cplusplus