Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit c7ba4aa04b71bada93f9d428c32d669eff6de2c7 1 parent 91e9a41
tcurtis authored
View
12 setup.nqp
@@ -22,6 +22,10 @@ sub MAIN() {
# build
pir_nqp => unflatten(
+ 'build/PAST/Optimizer.pir', 'src/PAST/Optimizer.nqp',
+ 'build/PAST/Optimizer/CombinedPass.pir', 'src/PAST/Optimizer/CombinedPass.nqp',
+ 'build/PAST/Optimizer/Pass.pir', 'src/PAST/Optimizer/Pass.nqp',
+ 'build/PAST/Optimizer/Transformers.pir', 'src/PAST/Optimizer/Transformers.nqp',
'build/PAST/Pattern.pir', 'src/PAST/Pattern.nqp',
'build/PAST/Pattern/Transformer.pir', 'src/PAST/Pattern/Transformer.nqp',
'build/PAST/Transformer.pir', 'src/PAST/Transformer.nqp',
@@ -44,6 +48,10 @@ sub MAIN() {
'build/Tree/Walker.pir', 'src/Tree/Walker.nqp',
),
pbc_pir => unflatten(
+ 'build/PAST/Optimizer.pbc', 'build/PAST/Optimizer.pir',
+ 'build/PAST/Optimizer/CombinedPass.pbc', 'build/PAST/Optimizer/CombinedPass.pir',
+ 'build/PAST/Optimizer/Pass.pbc', 'build/PAST/Optimizer/Pass.pir',
+ 'build/PAST/Optimizer/Transformers.pbc', 'build/PAST/Optimizer/Transformers.pir',
'build/PAST/Pattern.pbc', 'build/PAST/Pattern.pir',
'build/PAST/Pattern/Transformer.pbc', 'build/PAST/Pattern/Transformer.pir',
'build/PAST/Transformer.pbc', 'build/PAST/Transformer.pir',
@@ -73,6 +81,10 @@ sub MAIN() {
# install
inst_lib => <
+ build/PAST/Optimizer.pbc
+ build/PAST/Optimizer/CombinedPass.pbc
+ build/PAST/Optimizer/Pass.pbc
+ build/PAST/Optimizer/Transformers.pbc
build/PAST/Pattern.pbc
build/PAST/Pattern/Transformer.pbc
build/PAST/Transformer.pbc
View
16 src/PAST/Optimizer.nqp
@@ -0,0 +1,16 @@
+INIT {
+ pir::load_bytecode('Tree/Optimizer.pbc');
+ pir::load_bytecode('PAST/Optimizer/Pass.pbc');
+ pir::load_bytecode('PAST/Optimizer/CombinedPass.pbc');
+ pir::load_bytecode('PAST/Optimizer/Transformers.pbc');
+}
+
+class PAST::Optimizer is Tree::Optimizer;
+
+method pass-class () {
+ PAST::Optimizer::Pass;
+}
+
+method combine-passes (*@passes) {
+ PAST::Optimizer::CombinedPass.new(@passes);
+}
View
5 src/PAST/Optimizer/CombinedPass.nqp
@@ -0,0 +1,5 @@
+class PAST::Optimizer::CombinedPass is Tree::Optimizer::CombinedPass;
+
+method transformer-class () {
+ PAST::Optimizer::Transformer::Combined;
+}
View
5 src/PAST/Optimizer/Pass.nqp
@@ -0,0 +1,5 @@
+class PAST::Optimizer::Pass is Tree::Optimizer::Pass;
+
+method transformer-class () {
+ PAST::Optimizer::Transformer::Single;
+}
View
15 src/PAST/Optimizer/Transformers.nqp
@@ -0,0 +1,15 @@
+class PAST::Optimizer::Transformer::Single
+ is Tree::Optimizer::Transformer::Single { }
+
+class PAST::Optimizer::Transformer::Combined
+ is Tree::Optimizer::Transformer::Combined { }
+
+INIT {
+ pir::load_bytecode('PAST/Transformer.pbc');
+ my $class := PAST::Optimizer::Transformer::Single;
+ $class.HOW.add_parent($class,
+ PAST::Transformer);
+ $class := PAST::Optimizer::Transformer::Combined;
+ $class.HOW.add_parent($class,
+ PAST::Transformer);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.