]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Fix some things: get all the Quake mods to compile again (I broke binary expressions...
authorDale Weiler <killfieldengine@gmail.com>
Sun, 6 Oct 2013 03:36:48 +0000 (23:36 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Sun, 6 Oct 2013 03:36:48 +0000 (23:36 -0400)
ast.c
ir.c
misc/check-proj.sh

diff --git a/ast.c b/ast.c
index 4c142039ed281b57a7df94a1b113f491c2566fd9..362a06f4e43da901d3ef44c6aa82c5132fc3b64f 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -450,10 +450,6 @@ ast_binary* ast_binary_new(lex_ctx_t ctx, int op,
     ast_propagate_effects(self, left);
     ast_propagate_effects(self, right);
 
-    /*
-     * Try to fold away superfluous binary operations, such as:
-     * A * 1, a + 0, etc.
-     */
     if (OPTS_OPTIMIZATION(OPTIM_PEEPHOLE) && (fold = (ast_binary*)fold_superfluous(left, right, op))) {
         ast_binary_delete(self);
         return fold;
@@ -467,10 +463,12 @@ ast_binary* ast_binary_new(lex_ctx_t ctx, int op,
         else
             self->expression.vtype = TYPE_FLOAT;
     }
-    else if (op == INSTR_BITAND || op == INSTR_BITOR || op == INSTR_MUL_F)
+    else if (op == INSTR_BITAND || op == INSTR_BITOR)
         self->expression.vtype = TYPE_FLOAT;
-    else if (op >= INSTR_MUL_V && op <=  INSTR_MUL_VF)
+    else if (op == INSTR_MUL_VF || op == INSTR_MUL_FV)
         self->expression.vtype = TYPE_VECTOR;
+    else if (op == INSTR_MUL_V)
+        self->expression.vtype = TYPE_FLOAT;
     else
         self->expression.vtype = left->vtype;
 
diff --git a/ir.c b/ir.c
index f33e48c54ee64d601cdbbb9f17eb1cc0c48eb126..f0274e11bb5795a1deb26b879f060b448f34c5de 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -613,7 +613,7 @@ static bool instr_is_operation(uint16_t op)
              (op >= INSTR_NOT_F  && op <= INSTR_NOT_FNC) ||
              (op >= INSTR_AND    && op <= INSTR_BITOR) ||
              (op >= INSTR_CALL0  && op <= INSTR_CALL8) ||
-             (op >= VINSTR_BITAND_V && op <= VINSTR_CROSS) );
+             (op >= VINSTR_BITAND_V && op <= VINSTR_NEG_V) );
 }
 
 static bool ir_function_pass_peephole(ir_function *self)
@@ -3999,6 +3999,8 @@ static const char *qc_opname(int op)
         case VINSTR_BITOR_VF:  return "BITOR_VF";
         case VINSTR_BITXOR_VF: return "BITXOR_VF";
         case VINSTR_CROSS:     return "CROSS";
+        case VINSTR_NEG_F:     return "NEG_F";
+        case VINSTR_NEG_V:     return "NEG_V";
         default:               return "<UNK>";
     }
 }
index 36b3774e1e2841f294c7bca22d0c9d45cb32e411..90242e910f44a51ed4a42c9002313d1c0736901a 100755 (executable)
@@ -116,7 +116,8 @@ do
             echo -n "    compiling $dir... "
             old="$PWD"
             cd "$dir"
-            "$gmqcc_bin" $(cat ../../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}') > /dev/null 2>&1
+            cmd="$(cat ../../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}')"
+            "$gmqcc_bin" $cmd > /dev/null 2>&1
             if [ $? -ne 0 ]; then
                 echo "error"
             else
@@ -126,7 +127,9 @@ do
         done
     # nope only one project
     else
-        "$gmqcc_bin" $(cat ../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}') > /dev/null 2>&1
+        echo "$gmqcc_bin" $(cat ../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}')
+        cmd="$(cat ../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}')"
+        "$gmqcc_bin" $cmd > /dev/null 2>&1
         if [ $? -ne 0 ]; then
             echo "error"
         else