Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add PAST::Optimizer and PAST::Optimizer::Pass.

  • Loading branch information...
commit c7ba4aa04b71bada93f9d428c32d669eff6de2c7 1 parent 91e9a41
authored August 07, 2010
12  setup.nqp
@@ -22,6 +22,10 @@ sub MAIN() {
22 22
 
23 23
         # build
24 24
         pir_nqp             => unflatten(
  25
+            'build/PAST/Optimizer.pir',                   'src/PAST/Optimizer.nqp',
  26
+            'build/PAST/Optimizer/CombinedPass.pir',    'src/PAST/Optimizer/CombinedPass.nqp',
  27
+            'build/PAST/Optimizer/Pass.pir',            'src/PAST/Optimizer/Pass.nqp',
  28
+            'build/PAST/Optimizer/Transformers.pir',    'src/PAST/Optimizer/Transformers.nqp',
25 29
             'build/PAST/Pattern.pir',                   'src/PAST/Pattern.nqp',
26 30
             'build/PAST/Pattern/Transformer.pir',       'src/PAST/Pattern/Transformer.nqp',
27 31
             'build/PAST/Transformer.pir',               'src/PAST/Transformer.nqp',
@@ -44,6 +48,10 @@ sub MAIN() {
44 48
             'build/Tree/Walker.pir',                    'src/Tree/Walker.nqp',
45 49
         ),
46 50
         pbc_pir             => unflatten(
  51
+            'build/PAST/Optimizer.pbc',                 'build/PAST/Optimizer.pir',
  52
+            'build/PAST/Optimizer/CombinedPass.pbc',    'build/PAST/Optimizer/CombinedPass.pir',
  53
+            'build/PAST/Optimizer/Pass.pbc',            'build/PAST/Optimizer/Pass.pir',
  54
+            'build/PAST/Optimizer/Transformers.pbc',    'build/PAST/Optimizer/Transformers.pir',
47 55
             'build/PAST/Pattern.pbc',                   'build/PAST/Pattern.pir',
48 56
             'build/PAST/Pattern/Transformer.pbc',       'build/PAST/Pattern/Transformer.pir',
49 57
             'build/PAST/Transformer.pbc',               'build/PAST/Transformer.pir',
@@ -73,6 +81,10 @@ sub MAIN() {
73 81
 
74 82
         # install
75 83
         inst_lib            => <
  84
+            build/PAST/Optimizer.pbc
  85
+            build/PAST/Optimizer/CombinedPass.pbc
  86
+            build/PAST/Optimizer/Pass.pbc
  87
+            build/PAST/Optimizer/Transformers.pbc
76 88
             build/PAST/Pattern.pbc
77 89
             build/PAST/Pattern/Transformer.pbc
78 90
             build/PAST/Transformer.pbc
16  src/PAST/Optimizer.nqp
... ...
@@ -0,0 +1,16 @@
  1
+INIT {
  2
+    pir::load_bytecode('Tree/Optimizer.pbc');
  3
+    pir::load_bytecode('PAST/Optimizer/Pass.pbc');
  4
+    pir::load_bytecode('PAST/Optimizer/CombinedPass.pbc');
  5
+    pir::load_bytecode('PAST/Optimizer/Transformers.pbc');
  6
+}
  7
+
  8
+class PAST::Optimizer is Tree::Optimizer;
  9
+
  10
+method pass-class () {
  11
+    PAST::Optimizer::Pass;
  12
+}
  13
+
  14
+method combine-passes (*@passes) {
  15
+    PAST::Optimizer::CombinedPass.new(@passes);
  16
+}
5  src/PAST/Optimizer/CombinedPass.nqp
... ...
@@ -0,0 +1,5 @@
  1
+class PAST::Optimizer::CombinedPass is Tree::Optimizer::CombinedPass;
  2
+
  3
+method transformer-class () {
  4
+    PAST::Optimizer::Transformer::Combined;
  5
+}
5  src/PAST/Optimizer/Pass.nqp
... ...
@@ -0,0 +1,5 @@
  1
+class PAST::Optimizer::Pass is Tree::Optimizer::Pass;
  2
+
  3
+method transformer-class () {
  4
+    PAST::Optimizer::Transformer::Single;
  5
+}
15  src/PAST/Optimizer/Transformers.nqp
... ...
@@ -0,0 +1,15 @@
  1
+class PAST::Optimizer::Transformer::Single
  2
+  is Tree::Optimizer::Transformer::Single { }
  3
+
  4
+class PAST::Optimizer::Transformer::Combined
  5
+  is Tree::Optimizer::Transformer::Combined { }
  6
+
  7
+INIT {
  8
+    pir::load_bytecode('PAST/Transformer.pbc');
  9
+    my $class := PAST::Optimizer::Transformer::Single;
  10
+    $class.HOW.add_parent($class,
  11
+                          PAST::Transformer);
  12
+    $class := PAST::Optimizer::Transformer::Combined;
  13
+    $class.HOW.add_parent($class,
  14
+                          PAST::Transformer);
  15
+}

0 notes on commit c7ba4aa

Please sign in to comment.
Something went wrong with that request. Please try again.