]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ir.h
lex_ctx of a return will be at the return keyword now
[xonotic/gmqcc.git] / ir.h
diff --git a/ir.h b/ir.h
index 00e2ddc0382229d5d60f58a12bbafe6388e81b5d..6e32d98ef07cdb69eb3373293445965df646ef32 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -42,12 +42,14 @@ typedef struct ir_value_s {
     int       fieldtype;
     /* and the output type of a function */
     int       outtype;
+    /* 'const' vs 'var' qualifier */
+    int       cvq;
 
     struct ir_instr_s **reads;
     struct ir_instr_s **writes;
 
     /* constantvalues */
-    bool isconst;
+    bool hasvalue;
     union {
         float    vfloat;
         int      vint;
@@ -133,6 +135,9 @@ typedef struct ir_instr_s
     /* For the temp-allocation */
     size_t eid;
 
+    /* For IFs */
+    bool   likely;
+
     struct ir_block_s *owner;
 } ir_instr;
 
@@ -240,9 +245,6 @@ typedef struct ir_function_s
     /* locally defined variables */
     ir_value **locals;
 
-    /* how many of the locals are parameters */
-    size_t max_parameters;
-
     size_t allocated_locals;
 
     ir_block*     first;
@@ -271,7 +273,6 @@ void ir_function_collect_value(ir_function*, ir_value *value);
 
 bool ir_function_set_name(ir_function*, const char *name);
 
-ir_value* ir_function_get_local(ir_function *self, const char *name);
 ir_value* ir_function_create_local(ir_function *self, const char *name, int vtype, bool param);
 
 bool GMQCC_WARN ir_function_finalize(ir_function*);
@@ -281,11 +282,12 @@ bool ir_function_enumerate(ir_function*);
 bool ir_function_calculate_liferanges(ir_function*);
 */
 
-ir_block* ir_function_create_block(ir_function*, const char *label);
+ir_block* ir_function_create_block(lex_ctx ctx, ir_function*, const char *label);
 
 void ir_function_dump(ir_function*, char *ind, int (*oprintf)(const char*,...));
 
 /* builder */
+#define IR_HT_SIZE 1024
 typedef struct ir_builder_s
 {
     char *name;
@@ -293,6 +295,10 @@ typedef struct ir_builder_s
     ir_value    **globals;
     ir_value    **fields;
 
+    ht            htfunctions;
+    ht            htglobals;
+    ht            htfields;
+
     ir_value    **extparams;
 
     const char **filenames;