]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Get stuff ready to compile - #if 0 on instructions not yet added to the instruction...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 25 Apr 2012 14:21:04 +0000 (16:21 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 25 Apr 2012 15:27:48 +0000 (17:27 +0200)
ast.c
astir.h
ir.c
ir.h

diff --git a/ast.c b/ast.c
index b1d90562e38dc6126b09a1091b81c2084e430be1..d9121cf509b447b9121849eca4293793b49309e4 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "gmqcc.h"
 #include "ast.h"
 
 #define ast_setfunc(me, fn, what) ( *(void**)&((me)->fn) = what )
@@ -32,7 +33,7 @@ static void ast_expression_init(ast_expression *self,
     ast_setfunc(&self->expression, codegen, codegen);
 }
 
-ast_value* ast_value_new(lex_ctx_t ctx, const char *name, qc_type_t t)
+ast_value* ast_value_new(lex_ctx_t ctx, const char *name, int t)
 {
     ast_instantiate(ast_value, ctx, ast_value_delete);
     ast_expression_init((ast_expression*)self,
@@ -42,8 +43,8 @@ ast_value* ast_value_new(lex_ctx_t ctx, const char *name, qc_type_t t)
     self->vtype = t;
     self->next = NULL;
     MEM_VECTOR_INIT(self, params);
-    self->has_constval = false;
-    memset(&self->cvalue, 0, sizeof(self->cvalue));
+    self->isconst = false;
+    memset(&self->constval, 0, sizeof(self->constval));
 
     self->ir_v = NULL;
 
@@ -61,11 +62,11 @@ void ast_value_delete(ast_value* self)
     MEM_VECTOR_CLEAR(self, params);
     if (self->next)
         ast_delete(self->next);
-    if (self->has_constval) {
+    if (self->isconst) {
         switch (self->vtype)
         {
         case qc_string:
-            mem_d((void*)self->cvalue.vstring);
+            mem_d((void*)self->constval.vstring);
             break;
         /* NOTE: delete function? currently collected in
          * the parser structure
@@ -84,11 +85,11 @@ void ast_value_set_name(ast_value *self, const char *name)
     self->name = util_strdup(name);
 }
 
-ast_binary* ast_binary_new(lex_ctx_t ctx, qc_op_t op,
+ast_binary* ast_binary_new(lex_ctx_t ctx, int op,
                            ast_value* left, ast_value* right)
 {
     ast_instantiate(ast_binary, ctx, ast_binary_delete);
-    ast_expression_init((ast_expression*)self, (ast_expression_codegen*)codegen);
+    ast_expression_init((ast_expression*)self, NULL); /* FIXME */
 
     self->op = op;
     self->left = left;
@@ -158,32 +159,33 @@ void ast_function_delete(ast_function *self)
 /* AST codegen aprt
  */
 
+#if 0
 static qbool ast_value_gen_global(ir_builder *ir, ast_value *self, ir_value **out)
 {
     ir_value *v;
     *out = NULL;
 
     /* Generate functions */
-    if (self->vtype == qc_function && self->has_constval)
+    if (self->vtype == qc_function && self->isconst)
     {
-        /* Without has_constval it would be invalid... function pointers actually have
+        /* Without isconst it would be invalid... function pointers actually have
          * type qc_pointer and next with type qc_function
          */
-        ast_function *func = self->cvalue.vfunc;
+        ast_function *func = self->constval.vfunc;
         if (!ast_function_codegen(func, ir))
             return false;
 
         /* Here we do return NULL anyway */
         return true;
     }
-    else if (self->vtype == qc_function && !self->has_constval) {
+    else if (self->vtype == qc_function && !self->isconst) {
         fprintf(stderr,
-        "!v->has_constval <- qc_function body missing - FIXME: remove when implementing prototypes\n");
-        fprintf(stderr, "Value: %s\n", self->_name);
+        "!v->isconst <- qc_function body missing - FIXME: remove when implementing prototypes\n");
+        fprintf(stderr, "Value: %s\n", self->name);
         abort();
     }
 
-    v = ir_builder_create_global(ir, self->_name, self->vtype);
+    v = ir_builder_create_global(ir, self->name, self->vtype);
     self->ir_v = v;
 
     *out = v;
@@ -193,7 +195,7 @@ static qbool ast_value_gen_global(ir_builder *ir, ast_value *self, ir_value **ou
 qbool ast_value_codegen(ast_value *self, ast_function *func, ir_value **out)
 {
     if (!func)
-        return ast_value_gen_global(parser.ir, self, out);
+        return ast_value_gen_global(ir, self, out);
     return false;
 }
 
@@ -226,3 +228,4 @@ qbool ast_bin_store_codegen(ast_binary *self, ir_function *func, ir_value **out)
 {
     return false;
 }
+#endif
diff --git a/astir.h b/astir.h
index b4044b11d704396a028642752ed9ab242af1f05a..2441ef0e6cba69c46ba7407021281f4773cdf3ec 100644 (file)
--- a/astir.h
+++ b/astir.h
@@ -6,7 +6,7 @@
     void Towner##_##mem##_remove(Towner*, size_t);
 
 #define MEM_VECTOR_PROTO_ALL(Towner, Tmem, mem)          \
-    MEM_VECTOR_PROTO(Towner, Towner, Tmem, mem)          \
+    MEM_VECTOR_PROTO(Towner, Tmem, mem)          \
     qbool Towner##_##mem##_find(Towner*, Tmem, size_t*); \
     void Towner##_##mem##_clear(Towner*);
 
@@ -54,10 +54,10 @@ qbool Tself##_##mem##_find(Tself *self, Twhat obj, size_t *idx) \
         if (self->mem[i] == obj) {                              \
             if (idx)                                            \
                 *idx = i;                                       \
-            return itrue;                                       \
+            return true;                                        \
         }                                                       \
     }                                                           \
-    return ifalse;                                              \
+    return false;                                               \
 }
 
 #define _MEM_VEC_FUN_CLEAR(Tself, mem)  \
@@ -91,7 +91,7 @@ _MEM_VEC_FUN_ADD(Tself, Twhat, mem)
 
 #define MEM_VEC_FUNCTIONS_ALL(Tself, Twhat, mem) \
 MEM_VEC_FUNCTIONS(Tself, Twhat, mem)             \
-_MEM_VEC_FUN_CLEAR(Tself, Twhat, mem)            \
+_MEM_VEC_FUN_CLEAR(Tself, mem)                   \
 _MEM_VEC_FUN_FIND(Tself, Twhat, mem)
 
 typedef enum { false, true } qbool;
@@ -103,6 +103,7 @@ enum qc_types {
     qc_vector,
     qc_entity,
     qc_string,
+
     qc_int,
 
     /* "virtual" and internal types */
diff --git a/ir.c b/ir.c
index 2aca886ffe27791bfcefa618f766417a88b363a6..4791a5940808b75724a01e12bb5227d276f17c98 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "gmqcc.h"
 #include "ir.h"
 
 /***********************************************************************
@@ -25,7 +26,7 @@ ir_builder* ir_builder_new(const char *modulename)
 }
 
 MEM_VEC_FUNCTIONS(ir_builder, ir_value*, globals)
-MEM_VECTOR_FUNCTIONS(ir_builder, ir_function*, functions)
+MEM_VEC_FUNCTIONS(ir_builder, ir_function*, functions)
 
 void ir_builder_delete(ir_builder* self)
 {
@@ -119,9 +120,9 @@ ir_function* ir_function_new(ir_builder* owner)
     self->run_id = 0;
     return self;
 }
-MEM_VECTOR_FUNCTIONS(ir_function, ir_value*, values)
-MEM_VECTOR_FUNCTIONS(ir_function, ir_block*, blocks)
-MEM_VECTOR_FUNCTIONS(ir_function, ir_value*, locals)
+MEM_VEC_FUNCTIONS(ir_function, ir_value*, values)
+MEM_VEC_FUNCTIONS(ir_function, ir_block*, blocks)
+MEM_VEC_FUNCTIONS(ir_function, ir_value*, locals)
 
 void ir_function_set_name(ir_function *self, const char *name)
 {
@@ -218,10 +219,10 @@ ir_block* ir_block_new(ir_function* owner, const char *name)
     MEM_VECTOR_INIT(self, living);
     return self;
 }
-MEM_VECTOR_FUNCTIONS(ir_block, ir_instr*, instr)
-MEM_VECTOR_FUNCTIONS_ALL(ir_block, ir_block*, entries)
-MEM_VECTOR_FUNCTIONS_ALL(ir_block, ir_block*, exits)
-MEM_VECTOR_FUNCTIONS_ALL(ir_block, ir_value*, living)
+MEM_VEC_FUNCTIONS(ir_block, ir_instr*, instr)
+MEM_VEC_FUNCTIONS_ALL(ir_block, ir_block*, entries)
+MEM_VEC_FUNCTIONS_ALL(ir_block, ir_block*, exits)
+MEM_VEC_FUNCTIONS_ALL(ir_block, ir_value*, living)
 
 void ir_block_delete(ir_block* self)
 {
@@ -265,7 +266,7 @@ ir_instr* ir_instr_new(ir_block* owner, int op)
     self->eid = 0;
     return self;
 }
-MEM_VECTOR_FUNCTIONS(ir_instr, ir_phi_entry_t, phi)
+MEM_VEC_FUNCTIONS(ir_instr, ir_phi_entry_t, phi)
 
 void ir_instr_delete(ir_instr *self)
 {
@@ -305,7 +306,7 @@ ir_value* ir_value_var(const char *name, int storetype, int vtype)
     self->store = storetype;
     MEM_VECTOR_INIT(self, reads);
     MEM_VECTOR_INIT(self, writes);
-    self->has_constval = false;
+    self->isconst = false;
     self->context.file = "<@no context>";
     self->context.line = 0;
     self->name = NULL;
@@ -314,9 +315,9 @@ ir_value* ir_value_var(const char *name, int storetype, int vtype)
     MEM_VECTOR_INIT(self, life);
     return self;
 }
-MEM_VECTOR_FUNCTIONS(ir_value, ir_life_entry_t, life)
-MEM_VECTOR_FUNCTIONS(ir_value, ir_instr*, reads)
-MEM_VECTOR_FUNCTIONS(ir_value, ir_instr*, writes)
+MEM_VEC_FUNCTIONS(ir_value, ir_life_entry_t, life)
+MEM_VEC_FUNCTIONS(ir_value, ir_instr*, reads)
+MEM_VEC_FUNCTIONS(ir_value, ir_instr*, writes)
 
 ir_value* ir_value_out(ir_function *owner, const char *name, int storetype, int vtype)
 {
@@ -328,10 +329,10 @@ ir_value* ir_value_out(ir_function *owner, const char *name, int storetype, int
 void ir_value_delete(ir_value* self)
 {
     mem_d((void*)self->name);
-    if (self->has_constval)
+    if (self->isconst)
     {
         if (self->vtype == qc_string)
-            mem_d((void*)self->cvalue.vstring);
+            mem_d((void*)self->constval.vstring);
     }
     MEM_VECTOR_CLEAR(self, reads);
     MEM_VECTOR_CLEAR(self, writes);
@@ -350,17 +351,17 @@ qbool ir_value_set_float(ir_value *self, float f)
 {
     if (self->vtype != qc_float)
         return false;
-    self->cvalue.vfloat = f;
-    self->has_constval = true;
+    self->constval.vfloat = f;
+    self->isconst = true;
     return true;
 }
 
-qbool ir_value_set_vector(ir_value *self, qc_vec_t v)
+qbool ir_value_set_vector(ir_value *self, vector_t v)
 {
     if (self->vtype != qc_vector)
         return false;
-    self->cvalue.vvec = v;
-    self->has_constval = true;
+    self->constval.vvec = v;
+    self->isconst = true;
     return true;
 }
 
@@ -368,8 +369,8 @@ qbool ir_value_set_string(ir_value *self, const char *str)
 {
     if (self->vtype != qc_string)
         return false;
-    self->cvalue.vstring = util_strdup(str);
-    self->has_constval = true;
+    self->constval.vstring = util_strdup(str);
+    self->isconst = true;
     return true;
 }
 
@@ -377,8 +378,8 @@ qbool ir_value_set_int(ir_value *self, int i)
 {
     if (self->vtype != qc_int)
         return false;
-    self->cvalue.vint = i;
-    self->has_constval = true;
+    self->constval.vint = i;
+    self->isconst = true;
     return true;
 }
 
@@ -497,9 +498,11 @@ qbool ir_block_create_store(ir_block *self, ir_value *target, ir_value *what)
 
     switch (vtype) {
         case qc_float:
+#if 0
             if (what->vtype == qc_int)
                 op = INSTR_CONV_ITOF;
             else
+#endif
                 op = INSTR_STORE_F;
             break;
         case qc_vector:
@@ -511,14 +514,20 @@ qbool ir_block_create_store(ir_block *self, ir_value *target, ir_value *what)
         case qc_string:
             op = INSTR_STORE_S;
             break;
+#if 0
         case qc_int:
             if (what->vtype == qc_int)
                 op = INSTR_CONV_FTOI;
             else
                 op = INSTR_STORE_I;
             break;
+#endif
         case qc_pointer:
+#if 0
             op = INSTR_STORE_I;
+#else
+            op = INSTR_STORE_ENT;
+#endif
             break;
     }
     return ir_block_create_store_op(self, op, target, what);
@@ -528,7 +537,7 @@ void ir_block_create_return(ir_block *self, ir_value *v)
 {
     ir_instr *in;
     if (self->final) {
-        fprintf(stderr, "block already ended (%s)\n", self->_label);
+        fprintf(stderr, "block already ended (%s)\n", self->label);
         return;
     }
     self->final = true;
@@ -543,7 +552,7 @@ void ir_block_create_if(ir_block *self, ir_value *v,
 {
     ir_instr *in;
     if (self->final) {
-        fprintf(stderr, "block already ended (%s)\n", self->_label);
+        fprintf(stderr, "block already ended (%s)\n", self->label);
         return;
     }
     self->final = true;
@@ -564,7 +573,7 @@ void ir_block_create_jump(ir_block *self, ir_block *to)
 {
     ir_instr *in;
     if (self->final) {
-        fprintf(stderr, "block already ended (%s)\n", self->_label);
+        fprintf(stderr, "block already ended (%s)\n", self->label);
         return;
     }
     self->final = true;
@@ -580,7 +589,7 @@ void ir_block_create_goto(ir_block *self, ir_block *to)
 {
     ir_instr *in;
     if (self->final) {
-        fprintf(stderr, "block already ended (%s)\n", self->_label);
+        fprintf(stderr, "block already ended (%s)\n", self->label);
         return;
     }
     self->final = true;
@@ -641,14 +650,17 @@ ir_value* ir_block_create_binop(ir_block *self,
         case INSTR_MUL_V:
         case INSTR_AND:
         case INSTR_OR:
+#if 0
         case INSTR_AND_I:
         case INSTR_AND_IF:
         case INSTR_AND_FI:
         case INSTR_OR_I:
         case INSTR_OR_IF:
         case INSTR_OR_FI:
+#endif
         case INSTR_BITAND:
         case INSTR_BITOR:
+#if 0
         case INSTR_SUB_S: /* -- offset of string as float */
         case INSTR_MUL_IF:
         case INSTR_MUL_FI:
@@ -660,8 +672,10 @@ ir_value* ir_block_create_binop(ir_block *self,
         case INSTR_BITAND_IF:
         case INSTR_EQ_I:
         case INSTR_NE_I:
+#endif
             ot = qc_float;
             break;
+#if 0
         case INSTR_ADD_I:
         case INSTR_ADD_IF:
         case INSTR_ADD_FI:
@@ -677,18 +691,23 @@ ir_value* ir_block_create_binop(ir_block *self,
         case INSTR_LSHIFT_I:
             ot = qc_int;
             break;
+#endif
         case INSTR_ADD_V:
         case INSTR_SUB_V:
         case INSTR_MUL_VF:
         case INSTR_MUL_FV:
+#if 0
         case INSTR_DIV_VF:
         case INSTR_MUL_IV:
         case INSTR_MUL_VI:
+#endif
             ot = qc_vector;
             break;
+#if 0
         case INSTR_ADD_SF:
             ot = qc_pointer;
             break;
+#endif
         default:
             // ranges:
             /* boolean operations result in floats */
@@ -696,12 +715,14 @@ ir_value* ir_block_create_binop(ir_block *self,
                 ot = qc_float;
             else if (opcode >= INSTR_LE && opcode <= INSTR_GT)
                 ot = qc_float;
+#if 0
             else if (opcode >= INSTR_LE_I && opcode <= INSTR_EQ_FI)
                 ot = qc_float;
+#endif
             break;
     };
     if (ot == qc_void) {
-        fprintf(stderr, "binop %i (%s)\n", opcode, qc_opname(opcode));
+        /* The AST or parser were supposed to check this! */
         abort();
         return NULL;
     }
@@ -728,19 +749,23 @@ ir_value* ir_block_create_add(ir_block *self,
             case qc_float:
                 op = INSTR_ADD_F;
                 break;
+#if 0
             case qc_int:
                 op = INSTR_ADD_I;
                 break;
+#endif
             case qc_vector:
                 op = INSTR_ADD_V;
                 break;
         }
     } else {
+#if 0
         if ( (l == qc_float && r == qc_int) )
             op = INSTR_ADD_FI;
         else if ( (l == qc_int && r == qc_float) )
             op = INSTR_ADD_IF;
         else
+#endif
             return NULL;
     }
     return ir_block_create_binop(self, label, op, left, right);
@@ -761,19 +786,23 @@ ir_value* ir_block_create_sub(ir_block *self,
             case qc_float:
                 op = INSTR_SUB_F;
                 break;
+#if 0
             case qc_int:
                 op = INSTR_SUB_I;
                 break;
+#endif
             case qc_vector:
                 op = INSTR_SUB_V;
                 break;
         }
     } else {
+#if 0
         if ( (l == qc_float && r == qc_int) )
             op = INSTR_SUB_FI;
         else if ( (l == qc_int && r == qc_float) )
             op = INSTR_SUB_IF;
         else
+#endif
             return NULL;
     }
     return ir_block_create_binop(self, label, op, left, right);
@@ -794,26 +823,30 @@ ir_value* ir_block_create_mul(ir_block *self,
             case qc_float:
                 op = INSTR_MUL_F;
                 break;
+#if 0
             case qc_int:
                 op = INSTR_MUL_I;
                 break;
+#endif
             case qc_vector:
                 op = INSTR_MUL_V;
                 break;
         }
     } else {
-        if ( (l == qc_float && r == qc_int) )
-            op = INSTR_MUL_FI;
-        else if ( (l == qc_int && r == qc_float) )
-            op = INSTR_MUL_IF;
-        else if ( (l == qc_vector && r == qc_float) )
+        if ( (l == qc_vector && r == qc_float) )
             op = INSTR_MUL_VF;
         else if ( (l == qc_float && r == qc_vector) )
             op = INSTR_MUL_FV;
+#if 0
         else if ( (l == qc_vector && r == qc_int) )
             op = INSTR_MUL_VI;
         else if ( (l == qc_int && r == qc_vector) )
             op = INSTR_MUL_IV;
+        else if ( (l == qc_float && r == qc_int) )
+            op = INSTR_MUL_FI;
+        else if ( (l == qc_int && r == qc_float) )
+            op = INSTR_MUL_IF;
+#endif
         else
             return NULL;
     }
@@ -835,18 +868,22 @@ ir_value* ir_block_create_div(ir_block *self,
             case qc_float:
                 op = INSTR_DIV_F;
                 break;
+#if 0
             case qc_int:
                 op = INSTR_DIV_I;
                 break;
+#endif
         }
     } else {
-        if ( (l == qc_float && r == qc_int) )
+#if 0
+        if ( (l == qc_vector && r == qc_float) )
+            op = INSTR_DIV_VF;
+        else if ( (l == qc_float && r == qc_int) )
             op = INSTR_DIV_FI;
         else if ( (l == qc_int && r == qc_float) )
             op = INSTR_DIV_IF;
-        else if ( (l == qc_vector && r == qc_float) )
-            op = INSTR_DIV_VF;
         else
+#endif
             return NULL;
     }
     return ir_block_create_binop(self, label, op, left, right);
@@ -966,7 +1003,7 @@ typedef struct
     size_t    v_count;
     size_t    v_alloc;
 } new_reads_t;
-MEM_VECTOR_FUNCTIONS_ALL(new_reads_t, ir_value*, v)
+MEM_VEC_FUNCTIONS_ALL(new_reads_t, ir_value*, v)
 
 /* Enumerate instructions used by value's life-ranges
  */
@@ -1029,8 +1066,10 @@ static void ir_op_read_write(int op, size_t *read, size_t *write)
         break;
     case INSTR_IF:
     case INSTR_IFNOT:
+#if 0
     case INSTR_IF_S:
     case INSTR_IFNOT_S:
+#endif
     case INSTR_RETURN:
     case VINSTR_COND:
         *write = 0;
@@ -1086,7 +1125,7 @@ static void ir_block_life_prop_previous(ir_block* self, ir_block *prev, qbool *c
             continue;
         ir_block_living_add(self, prev->living[i]);
         /*
-        printf("%s got from prev: %s\n", self->_label, prev->living[i]->_name);
+        printf("%s got from prev: %s\n", self->label, prev->living[i]->_name);
         */
     }
 }
@@ -1103,7 +1142,7 @@ static void ir_block_life_propagate(ir_block *self, ir_block *prev, qbool *chang
     char dbg_ind[16] = { '#', '0' };
     (void)dbg_ind;
 
-    VEC_INIT(&new_reads, v);
+    MEM_VECTOR_INIT(&new_reads, v);
 
     if (prev)
         ir_block_life_prop_previous(self, prev, changed);
@@ -1174,7 +1213,7 @@ static void ir_block_life_propagate(ir_block *self, ir_block *prev, qbool *chang
                      * since this function is run multiple times.
                      */
                     /* For now: debug info: */
-                    fprintf(stderr, "Value only written %s\n", value->_name);
+                    fprintf(stderr, "Value only written %s\n", value->name);
                     tempbool = ir_value_life_merge(value, instr->eid);
                     *changed = *changed || tempbool;
                     /*
@@ -1189,7 +1228,7 @@ static void ir_block_life_propagate(ir_block *self, ir_block *prev, qbool *chang
                     tempbool = ir_value_life_merge(value, instr->eid);
                     /*
                     if (tempbool)
-                        fprintf(stderr, "value added id %s %i\n", value->_name, (int)instr->eid);
+                        fprintf(stderr, "value added id %s %i\n", value->name, (int)instr->eid);
                     */
                     *changed = *changed || tempbool;
                     /* Then remove */
diff --git a/ir.h b/ir.h
index cc7f5816fcc77040528f4f1b064a35ccec6a7d0f..d2741d4a2c81b450ee9b8da60a21e82b84f70325 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -15,22 +15,22 @@ typedef struct
 struct ir_function_s;
 typedef struct ir_value_s {
     char      *name;
-    int  vtype;
-    int store;
-    filecontext_t context;
+    int       vtype;
+    int       store;
+    lex_ctx_t context;
 
     MEM_VECTOR_MAKE(struct ir_instr_s*, reads);
     MEM_VECTOR_MAKE(struct ir_instr_s*, writes);
 
     /* constantvalues */
+    qbool isconst;
     union {
         float    vfloat;
         int      vint;
         vector_t vvec;
         char    *vstring;
         struct ir_value_s *vpointer;
-    } cvalue;
-    qbool has_constval;
+    } constval;
 
     /* For the temp allocator */
     MEM_VECTOR_MAKE(ir_life_entry_t, life);
@@ -51,7 +51,7 @@ MEM_VECTOR_PROTO(ir_value, struct ir_instr_s*, writes)
 qbool   ir_value_set_float(ir_value*, float f);
 qbool   ir_value_set_int(ir_value*, int i);
 qbool   ir_value_set_string(ir_value*, const char *s);
-qbool   ir_value_set_vector(ir_value*, qc_vec_t v);
+qbool   ir_value_set_vector(ir_value*, vector_t v);
 /*qbool   ir_value_set_pointer_v(ir_value*, ir_value* p); */
 /*qbool   ir_value_set_pointer_i(ir_value*, int i);       */
 
@@ -74,9 +74,9 @@ typedef struct ir_phi_entry_s
 /* instruction */
 typedef struct ir_instr_s
 {
-    ir_op_t       opcode;
-    filecontext_t context;
-    ir_value*     (_ops[3]);
+    int       opcode;
+    lex_ctx_t context;
+    ir_value* (_ops[3]);
     struct ir_block_s* (bops[2]);
 
     MEM_VECTOR_MAKE(ir_phi_entry_t, phi);
@@ -87,7 +87,7 @@ typedef struct ir_instr_s
     struct ir_block_s *owner;
 } ir_instr;
 
-ir_instr* ir_instr_new(struct ir_block_s *owner, ir_op_t opcode);
+ir_instr* ir_instr_new(struct ir_block_s *owner, int opcode);
 void      ir_instr_delete(ir_instr*);
 
 MEM_VECTOR_PROTO(ir_value, ir_phi_entry_t, phi)
@@ -124,9 +124,9 @@ MEM_VECTOR_PROTO(ir_block, ir_instr*, instr)
 MEM_VECTOR_PROTO_ALL(ir_block, ir_block*, exits)
 MEM_VECTOR_PROTO_ALL(ir_block, ir_block*, entries)
 
-ir_value* ir_block_create_binop(ir_block*, const char *label, ir_op_t op,
+ir_value* ir_block_create_binop(ir_block*, const char *label, int op,
                                 ir_value *left, ir_value *right);
-qbool   ir_block_create_store_op(ir_block*, ir_op_t op, ir_value *target, ir_value *what);
+qbool   ir_block_create_store_op(ir_block*, int op, ir_value *target, ir_value *what);
 qbool   ir_block_create_store(ir_block*, ir_value *target, ir_value *what);
 
 ir_value* ir_block_create_add(ir_block*, const char *label, ir_value *l, ir_value *r);