Don't overload meaning of RegisterList::usage for loop tests. trunk
authorRyan C. Gordon <icculus@icculus.org>
Tue, 29 Apr 2008 04:47:32 -0400
branchtrunk
changeset 248 568c8f9d7cb9
parent 247 cdf03aac00ea
child 249 7f928921766c
Don't overload meaning of RegisterList::usage for loop tests.
mojoshader.c
--- a/mojoshader.c	Tue Apr 29 04:18:35 2008 -0400
+++ b/mojoshader.c	Tue Apr 29 04:47:32 2008 -0400
@@ -216,6 +216,7 @@
     MOJOSHADER_usage usage;
     int index;
     int writemask;
+    int misc;
     struct RegisterList *next;
 } RegisterList;
 
@@ -619,9 +620,10 @@
     {
         item->regtype = regtype;
         item->regnum = regnum;
-        item->usage = 0;
+        item->usage = MOJOSHADER_USAGE_UNKNOWN;
         item->index = 0;
         item->writemask = 0;
+        item->misc = 0;
         item->next = prev->next;
         prev->next = item;
     } // if
@@ -2530,7 +2532,7 @@
     // !!! FIXME: it would be nice if we could determine if a function is
     // !!! FIXME:  only called once and, if so, forcibly inline it.
 
-    const char *uses_loopreg = ((reg) && (reg->usage == 1)) ? "int aL" : "";
+    const char *uses_loopreg = ((reg) && (reg->misc == 1)) ? "int aL" : "";
     output_line(ctx, "void %s(%s)", labelstr, uses_loopreg);
     output_line(ctx, "{");
     ctx->indent++;
@@ -3787,9 +3789,9 @@
     RegisterList *reg = reglist_find(&ctx->used_registers, REG_TYPE_LABEL, regnum);
     assert(reg != NULL);
 
-    if (reg->usage == 0)
-        reg->usage = current_usage;
-    else if (reg->usage != current_usage)
+    if (reg->misc == 0)
+        reg->misc = current_usage;
+    else if (reg->misc != current_usage)
     {
         if (current_usage == 1)
             fail(ctx, "CALL to this label must be wrapped in LOOP/ENDLOOP");