]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ir.h
Merging master to handle vector members, fields, and members of vector fields
[xonotic/gmqcc.git] / ir.h
diff --git a/ir.h b/ir.h
index 47ff96b88b30fc279e2be9c91486c0a7133e16ac..66336d6ae5a6b64a5a8e9a2ff64c2e54c48d22ed 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -55,6 +55,8 @@ typedef struct ir_value_s {
         char    *vstring;
         struct ir_value_s *vpointer;
         struct ir_function_s *vfunc;
+        quaternion vquat;
+        matrix     vmat;
     } constval;
 
     struct {
@@ -62,12 +64,19 @@ typedef struct ir_value_s {
         int32_t name;
         /* filled by the local-allocator */
         int32_t local;
+        /* added for members */
+        int32_t addroffset;
     } code;
 
+    /* for acessing vectors */
+    struct ir_value_s *members[3];
+
     /* For the temp allocator */
     MEM_VECTOR_MAKE(ir_life_entry_t, life);
 } ir_value;
 
+int32_t ir_value_code_addr(const ir_value*);
+
 /* ir_value can be a variable, or created by an operation */
 ir_value* ir_value_var(const char *name, int st, int vtype);
 /* if a result of an operation: the function should store
@@ -76,6 +85,7 @@ ir_value* ir_value_var(const char *name, int st, int vtype);
 ir_value* ir_value_out(struct ir_function_s *owner, const char *name, int st, int vtype);
 void      ir_value_delete(ir_value*);
 void      ir_value_set_name(ir_value*, const char *name);
+ir_value* ir_value_vector_member(ir_value*, unsigned int member);
 
 MEM_VECTOR_PROTO_ALL(ir_value, struct ir_instr_s*, reads);
 MEM_VECTOR_PROTO_ALL(ir_value, struct ir_instr_s*, writes);
@@ -87,8 +97,11 @@ bool GMQCC_WARN ir_value_set_int(ir_value*, int i);
 #endif
 bool GMQCC_WARN ir_value_set_string(ir_value*, const char *s);
 bool GMQCC_WARN ir_value_set_vector(ir_value*, vector v);
+bool GMQCC_WARN ir_value_set_field(ir_value*, ir_value *fld);
 /*bool   ir_value_set_pointer_v(ir_value*, ir_value* p); */
 /*bool   ir_value_set_pointer_i(ir_value*, int i);       */
+bool GMQCC_WARN ir_value_set_quaternion(ir_value*, quaternion v);
+bool GMQCC_WARN ir_value_set_matrix(ir_value*, matrix v);
 
 MEM_VECTOR_PROTO(ir_value, ir_life_entry_t, life);
 /* merge an instruction into the life-range */