Author: kjs
Date: Sun Feb 24 07:37:01 2008
New Revision: 26041

Removed:
   trunk/docs/imcc/parsing.pod
Modified:
   trunk/MANIFEST
   trunk/MANIFEST.SKIP
   trunk/docs/imcc/operation.pod

Log:
[docs] merge 2 files of imcc documentation

update MANIFEST; this also includes some other files; MANIFEST was not updated 
properly.

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Sun Feb 24 07:37:01 2008
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Feb 22 14:12:19 2008 UT
+# generated by tools\dev\mk_manifest_and_skip.pl Sun Feb 24 15:34:53 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -438,7 +438,6 @@
 docs/imcc/imcc.pod                                          [main]doc
 docs/imcc/imcfaq.pod                                        [main]doc
 docs/imcc/operation.pod                                     [main]doc
-docs/imcc/parsing.pod                                       [main]doc
 docs/intro.pod                                              [main]doc
 docs/jit.pod                                                [main]doc
 docs/memory_internals.pod                                   [main]doc
@@ -1936,12 +1935,12 @@
 languages/plumhead/t/control_flow.t                         [plumhead]
 languages/plumhead/t/harness                                [plumhead]
 languages/plumhead/t/hello.t                                [plumhead]
+languages/plumhead/t/pmc/array.t                            [plumhead]
 languages/plumhead/t/relops.t                               [plumhead]
 languages/plumhead/t/selection.txt                          [plumhead]
 languages/plumhead/t/strings.t                              [plumhead]
 languages/plumhead/t/superglobals.t                         [plumhead]
 languages/plumhead/t/variables.t                            [plumhead]
-languages/plumhead/t/pmc/array.t                            [plumhead]
 languages/pugs/config/makefiles/root.in                     [pugs]
 languages/pugs/include/pugs_common.h                        [pugs]
 languages/pugs/pmc/pugsany.pmc                              [pugs]

Modified: trunk/MANIFEST.SKIP
==============================================================================
--- trunk/MANIFEST.SKIP (original)
+++ trunk/MANIFEST.SKIP Sun Feb 24 07:37:01 2008
@@ -1,6 +1,6 @@
 # ex: set ro:
 # $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Feb 23 20:30:41 2008 UT
+# generated by tools\dev\mk_manifest_and_skip.pl Sun Feb 24 15:34:53 2008 UT
 #
 # This file should contain a transcript of the svn:ignore properties
 # of the directories in the Parrot subversion repository. (Needed for
@@ -1011,6 +1011,8 @@
 # generated from svn:ignore of 'languages/plumhead/pmc/'
 ^languages/plumhead/pmc/.*\.bundle$
 ^languages/plumhead/pmc/.*\.bundle/
+^languages/plumhead/pmc/.*\.c$
+^languages/plumhead/pmc/.*\.c/
 ^languages/plumhead/pmc/.*\.dll$
 ^languages/plumhead/pmc/.*\.dll/
 ^languages/plumhead/pmc/.*\.dump$
@@ -1058,6 +1060,9 @@
 ^languages/plumhead/t/.*\.php/
 ^languages/plumhead/t/.*\.pir$
 ^languages/plumhead/t/.*\.pir/
+# generated from svn:ignore of 'languages/plumhead/t/pmc/'
+^languages/plumhead/t/pmc/.*\.pir$
+^languages/plumhead/t/pmc/.*\.pir/
 # generated from svn:ignore of 'languages/pugs/'
 ^languages/pugs/Makefile$
 ^languages/pugs/Makefile/

Modified: trunk/docs/imcc/operation.pod
==============================================================================
--- trunk/docs/imcc/operation.pod       (original)
+++ trunk/docs/imcc/operation.pod       Sun Feb 24 07:37:01 2008
@@ -13,6 +13,8 @@
 
 =item 0.2 uninitialized warning; optimizations
 
+=item 0.3 merged parsing.pod into this file.
+
 =back
 
 =head1 OVERVIEW
@@ -37,18 +39,59 @@
 
 =back
 
-=head1 Source file parsing
+=head1 SOURCE FILE PARSING
+
+=head2 Overview
+
+IMCC parses and generates code in terms of I<compilation units>. These
+are self-contained blocks of code very similar to subroutines.
+
+Code for a compilation unit is created as soon (or not earlier) as the
+end of the unit is reached.
+
+{{ Is this true? one sub calling another not-yet compiled sub would
+   not work in that case. }}
+
+
+=head2 Symbols, constants and labels
+
+I<Compilation units> maintain their own symbol table containing local
+labels and variable symbols. This symbol table, C<hash>, is not visible
+to code in different units.
+
+If you need global variables, please use the B<get_{hll,root}_global> opcodes.
+
+Global labels and constants are kept in the global symbol table
+C<ghash>. This allows for global constant folding beyond the scope
+of individual subroutines.
+
+This also means that you currently can't use the same global symbol (e.g.
+subroutine name) in different namespaces. The following creates invalid code:
+
+  .sub main
+     ...
+  .end
+
+   .namespace ["main"]
+  .sub main
+     ...
+  .end
+
+Local labels in different I<compilation units> with the same name are
+allowed, though assembling the generated PASM doesn't work. However,
+running this code inside imcc is ok. This will probably change in the
+future so that local labels are mangled to be unique.
+
 
-See F<parsing.pod>, F<macros.pod> and F<syntax.pod> for more.
 
-=head1 Register allocation
+=head1 REGISTER ALLOCATION
 
 Register allocation is done per I<compilation unit>.
 
 IMCC I<identifiers> and I<temporary variables> e.g. $I0 are assigned a
 physical parrot register depending on the life range of these
 variables. If the life range of one variable doesn't overlap the range
-of another variable, they might get the same parrot register. For 
+of another variable, they might get the same parrot register. For
 instance:
 
    $I0 = 10
@@ -59,8 +102,8 @@
    set I0, 10
    set I0, 20
 
-provided that $I0 is not used after these lines. In this case, the 
-assignment to $I0 is redundant and will be optimized away if imcc is
+provided that $I0 is not used after these lines. In this case, the
+assignment to $I0 is redundant and will be optimized away if IMCC is
 run with optimization level B<-O2>.
 
 I<PASM registers> keep their register. During the usage of a I<PASM
@@ -101,15 +144,15 @@
 Consider these two code snippets (block numbers are attached):
 
   .sub main :main
- 0      $I0 = 0                # initialized
+ 0      $I0 = 0     # initialized
  0      if $I0 goto l1
- 1      $I1 = 1                # init in block 1
+ 1      $I1 = 1     # init in block 1
  1      goto l2
  2  l1:
- 2      $I1 = 2                # init in block 2
+ 2      $I1 = 2     # init in block 2
  3  l2:
  3      print $I0
- 3      print $I1      # all paths leading here do init
+ 3      print $I1   # all paths leading here do init
  3      print "\n"
  3      end
   .end
@@ -117,12 +160,12 @@
 and:
 
   .sub main :main
- 0      $I0 = 0                # initialized
- 0      if $I0 goto l1 # branch to bb 1 or 2
- 1      $I1 = 1                # init only in block 1
+ 0      $I0 = 0     # initialized
+ 0      if $I0 goto l1  # branch to bb 1 or 2
+ 1      $I1 = 1     # init only in block 1
  2  l1:
  2      print $I0
- 2      print $I1      # no init in code path from block 0
+ 2      print $I1   # no init in code path from block 0
  2      print "\n"
  2      end
   .end
@@ -135,7 +178,7 @@
 =head2 Interference graph
 
 Once the above information is calculated, the next step is to look at
-which variables interfere with which others. Non-interfering variables 
+which variables interfere with which others. Non-interfering variables
 can be given the same parrot register.
 
 =head2 Register allocation
@@ -153,7 +196,7 @@
 branch to an absolute one, unreachable code will be removed then,
 which might cause unused labels ...
 
-=head1 Optimizations with -O1
+=head1 OPTIMIZATIONS WITH -O1
 
 =head2 Constant substitution
 
@@ -193,7 +236,7 @@
 Code not reachable after an unconditional branch instruction and basic
 blocks that are not entered from somewhere get removed.
 
-=head1 Optimizations with -O2
+=head1 OPTIMIZATIONS WITH -O2
 
 Note: These are currently experimental and might not do the Right
 Thing.

Reply via email to