develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33606 - trunk/compilers/pirc/new

From:
kjs
Date:
December 7, 2008 07:27
Subject:
[svn:parrot] r33606 - trunk/compilers/pirc/new
Message ID:
20081207152711.8A824CB9AF@x12.develooper.com
Author: kjs
Date: Sun Dec  7 07:27:10 2008
New Revision: 33606

Modified:
   trunk/compilers/pirc/new/pircompiler.h
   trunk/compilers/pirc/new/pircompunit.c
   trunk/compilers/pirc/new/pirsymbol.c

Log:
[pirc] remove instr_counter field from lexer structure. Now use stmt_counter.

Modified: trunk/compilers/pirc/new/pircompiler.h
==============================================================================
--- trunk/compilers/pirc/new/pircompiler.h	(original)
+++ trunk/compilers/pirc/new/pircompiler.h	Sun Dec  7 07:27:10 2008
@@ -104,7 +104,6 @@
     int            curregister[4]; /* for register allocation */
     int            pir_reg_generator; /* for unique PIR register allocator, for temp. PIR regs. */
 
-    unsigned       instr_counter;  /* to assign an index to each instruction */
     unsigned       stmt_counter;   /* to count "logical" statements, even if multi-line. */
 
     Interp        *interp;         /* parrot interpreter */

Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c	(original)
+++ trunk/compilers/pirc/new/pircompunit.c	Sun Dec  7 07:27:10 2008
@@ -387,14 +387,6 @@
     /* the codesize so far will be the offset of this instruction. */
     instr->offset = lexer->codesize;
 
-
-    /* XXX instr_counter still needed? Think so, for lin.scan.reg.alloc.
-       can instr->offset be used for that? or is it already used?
-       instr->offset is now just incremented in bigger steps...
-     */
-    lexer->instr_counter++;
-    /*instr->offset = lexer->instr_counter++;*/
-
     /*
     fprintf(stderr, "offset of %s is: %d\n", opname, instr->offset);
     */
@@ -831,12 +823,7 @@
      *     goto L3
      *
      * jumping to L1 is equivalent to jumping to L2 or L3; so when calculating
-     * branch offsets, all three labels must yield the same offset. Therefore,
-     * if no instruction was set on the current node, the instruction counter
-     * must not count that node (hence the decrement).
-     */
-    if (instr->opname == NULL)
-        --lexer->instr_counter;
+     * branch offsets, all three labels must yield the same offset.
 
     /* store the labelname and its offset */
     store_local_label(lexer, labelname, instr->offset);
@@ -1888,12 +1875,12 @@
             fprintf(stderr, "converting arg to operand %d\n", ++numargs);
             */
 
+
             switch (argvalue->type) {
                 case EXPR_TARGET:
-                    if (TEST_FLAG(argvalue->expr.t->flags, TARGET_FLAG_IS_REG))
-                        flag |= argvalue->expr.t->s.reg->type;
-                    else
-                        flag |= argvalue->expr.t->s.sym->type;
+                    if (argvalue->expr.t->s.sym == NULL && argvalue->expr.t->s.reg == NULL)
+                        fprintf(stderr, "No sym or reg!\n");
+                    flag |= argvalue->expr.t->s.sym->type;
                     break;
                 case EXPR_CONSTANT:
                     flag |= argvalue->expr.c->type;
@@ -1928,10 +1915,12 @@
         fprintf(stderr, "args2operands: [%s]\n", flagsstring);
         */
 
-        /* don't add it now, it will break tests.
+        /* don't add it now, it will break tests. */
+        /*
         push_operand(lexer, expr_from_const(lexer, new_const(lexer, STRING_TYPE, flagsstring)));
         */
 
+
         /* XXX Yes, this is a hacky attempt. Cleanups will follow. */
     }
 

Modified: trunk/compilers/pirc/new/pirsymbol.c
==============================================================================
--- trunk/compilers/pirc/new/pirsymbol.c	(original)
+++ trunk/compilers/pirc/new/pirsymbol.c	Sun Dec  7 07:27:10 2008
@@ -461,7 +461,7 @@
      */
     if (reg) {
         /* update end point of interval */
-        reg->interval->endpoint = lexer->instr_counter;
+        reg->interval->endpoint = lexer->stmt_counter;
         return reg->color;
     }
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About