Author: pmichaud
Date: Thu Jan  1 09:01:42 2009
New Revision: 34749

Modified:
   branches/rvar/compilers/pct/src/PAST/Compiler.pir
   branches/rvar/compilers/pct/src/PAST/Node.pir
   branches/rvar/compilers/pct/src/POST/Node.pir

Log:
[pct]:  Move subid generation to PAST::Block nodes.
* POST::Sub nodes will still generate subid as needed, but the
  primary driver is now PAST::Block.


Modified: branches/rvar/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- branches/rvar/compilers/pct/src/PAST/Compiler.pir   (original)
+++ branches/rvar/compilers/pct/src/PAST/Compiler.pir   Thu Jan  1 09:01:42 2009
@@ -743,10 +743,11 @@
     unshift blockpast, node
 
     .local string name, pirflags, blocktype
-    .local pmc ns, hll
+    .local pmc subid, ns, hll
     name = node.'name'()
     pirflags = node.'pirflags'()
     blocktype = node.'blocktype'()
+    subid = node.'subid'()
     ns = node.'namespace'()
     hll = node.'hll'()
 
@@ -760,7 +761,7 @@
     ##  create a POST::Sub node for this block
     .local pmc bpost
     $P0 = get_hll_global ['POST'], 'Sub'
-    bpost = $P0.'new'('node'=>node, 'name'=>name, 'blocktype'=>blocktype, 
'namespace'=>ns, 'hll'=>hll)
+    bpost = $P0.'new'('node'=>node, 'name'=>name, 'blocktype'=>blocktype, 
'namespace'=>ns, 'hll'=>hll, 'subid'=>subid)
     unless pirflags goto pirflags_done
     bpost.'pirflags'(pirflags)
   pirflags_done:

Modified: branches/rvar/compilers/pct/src/PAST/Node.pir
==============================================================================
--- branches/rvar/compilers/pct/src/PAST/Node.pir       (original)
+++ branches/rvar/compilers/pct/src/PAST/Node.pir       Thu Jan  1 09:01:42 2009
@@ -670,6 +670,27 @@
     .tailcall self.'attr'('compiler_args', value, have_value)
 .end
 
+=item subid([subid])
+
+If C<subid> is provided, then sets the subid for this block.
+Returns the current subid for the block, generating a unique
+subid for the block if one does not already exist.
+
+=cut
+
+.sub 'subid' :method
+    .param pmc value           :optional
+    .param int has_value       :opt_flag
+    if has_value goto getset_value
+    $I0 = exists self['subid']
+    if $I0 goto getset_value
+    value = self.'unique'()
+    has_value = 1
+  getset_value:
+    .tailcall self.'attr'('subid', value, has_value)
+.end
+
+
 =item pirflags([pirflags])
 
 Get/set any pirflags for this block.

Modified: branches/rvar/compilers/pct/src/POST/Node.pir
==============================================================================
--- branches/rvar/compilers/pct/src/POST/Node.pir       (original)
+++ branches/rvar/compilers/pct/src/POST/Node.pir       Thu Jan  1 09:01:42 2009
@@ -207,7 +207,7 @@
     if has_value goto getset_value
     $I0 = exists self['subid']
     if $I0 goto getset_value
-    value = self.'unique'()
+    value = self.'unique'('post')
     has_value = 1
   getset_value:
     .tailcall self.'attr'('subid', value, has_value)

Reply via email to