]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.h
Dump should print a warning if lifepasses don't match...
[xonotic/gmqcc.git] / ast.h
diff --git a/ast.h b/ast.h
index bea59d57b25055e87ea0793e52ef94d2df6201ee..13d351a60bfe12f3c1ae761a7233b7d7b03a927c 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -75,6 +75,8 @@ typedef struct
 {
     ast_node_common         node;
     ast_expression_codegen *codegen;
+    int                     vtype;
+    ast_expression         *next;
 } ast_expression_common;
 
 /* Value
@@ -90,8 +92,10 @@ struct ast_value_s
 
     const char *name;
 
+    /*
     int         vtype;
     ast_value  *next;
+    */
 
     bool isconst;
     union {
@@ -274,12 +278,26 @@ struct ast_function_s
     const char *name;
 
     ir_function *ir_func;
+    ir_block    *curblock;
+
+    size_t       labelcount;
+    /* in order for thread safety - for the optional
+     * channel abesed multithreading... keeping a buffer
+     * here to use in ast_function_label.
+     */
+    char         labelbuf[64];
 
     MEM_VECTOR_MAKE(ast_block*, blocks);
 };
 ast_function* ast_function_new(lex_ctx ctx, const char *name, ast_value *vtype);
 /* This will NOT delete the underlying ast_value */
 void ast_function_delete(ast_function*);
+/* TODO: for better readability in dumps, this should take some kind of
+ * value prefix...
+ * For "optimized" builds this can just keep returning "foo"...
+ * or whatever...
+ */
+const char* ast_function_label(ast_function*, const char *prefix);
 
 MEM_VECTOR_PROTO(ast_function, ast_block*, blocks);
 
@@ -291,8 +309,13 @@ union ast_expression_u
 {
     ast_expression_common expression;
 
-    ast_binary binary;
-    ast_block  block;
+    ast_value    value;
+    ast_binary   binary;
+    ast_block    block;
+    ast_ternary  ternary;
+    ast_ifthen   ifthen;
+    ast_store    store;
+    ast_entfield entfield;
 };
 
 /* Node union