compiler/PPCConfiguration.st
changeset 532 132d7898a2a1
parent 531 dc3d13c2837d
child 534 a949c4fe44df
--- a/compiler/PPCConfiguration.st	Wed Aug 26 21:41:20 2015 +0100
+++ b/compiler/PPCConfiguration.st	Wed Aug 26 23:01:00 2015 +0100
@@ -188,30 +188,27 @@
     context options recognizingComponents ifFalse:[
         ^ self
     ].
-    ir := (PPCRecognizerComponentDetector new)
-            options:context options;
-            visit:ir.
-    self remember:(self copyTree:ir) as:#recognizingComponents
+    self runPass: PPCRecognizerComponentDetector
+
+    "Modified: / 26-08-2015 / 22:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 createTokens
     context options detectTokens ifFalse:[
         ^ self
     ].
-    ir := (PPCTokenDetector new)
-            options:context options;
-            visit:ir.
-    self remember:(self copyTree:ir) as:#createTokens
+    self runPass: PPCTokenDetector
+
+    "Modified: / 26-08-2015 / 22:36:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 inline
     context options inline ifFalse:[
         ^ self
     ].
-    ir := (PPCInliningVisitor new)
-            options:context options;
-            visit:ir.
-    self remember:(self copyTree:ir) as:#inline.
+    self runPass: PPCInliningVisitor
+
+    "Modified: / 26-08-2015 / 22:36:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 merge
@@ -220,26 +217,24 @@
     context options merge ifFalse:[
         ^ self
     ].
-    ir := (PPCMergingVisitor new)
-            options:context options;
-            visit:ir.
-    self remember:(self copyTree:ir) as:#merge
+    self runPass: PPCMergingVisitor
+
+    "Modified: / 26-08-2015 / 22:36:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 specialize
     context options specialize ifFalse:[
         ^ self
     ].
-     "
+    "
      Invokes a visitor that creates specialized nodes
      for some patterns of PPCNodes,
      
      e.g. $a astar can be represented by PPCCharacterStarNode
     "
-    ir := ((PPCSpecializingVisitor new)
-            options:context options;
-            visit:ir).
-    self remember:(self copyTree:ir) as:#specialize
+   self runPass: PPCSpecializingVisitor
+
+    "Modified: / 26-08-2015 / 22:36:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 toPPCIr
@@ -259,3 +254,12 @@
     "Modified: / 26-08-2015 / 16:35:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!PPCConfiguration methodsFor:'running'!
+
+runPass: passClassOrAlike
+    ir := passClassOrAlike run: ir in: context.
+    self remember:(self copyTree:ir) as:passClassOrAlike name
+
+    "Created: / 26-08-2015 / 22:35:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+