compiler/PPCConfiguration.st
changeset 532 132d7898a2a1
parent 531 dc3d13c2837d
child 534 a949c4fe44df
equal deleted inserted replaced
531:dc3d13c2837d 532:132d7898a2a1
   186 
   186 
   187 createRecognizingComponents
   187 createRecognizingComponents
   188     context options recognizingComponents ifFalse:[
   188     context options recognizingComponents ifFalse:[
   189         ^ self
   189         ^ self
   190     ].
   190     ].
   191     ir := (PPCRecognizerComponentDetector new)
   191     self runPass: PPCRecognizerComponentDetector
   192             options:context options;
   192 
   193             visit:ir.
   193     "Modified: / 26-08-2015 / 22:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   194     self remember:(self copyTree:ir) as:#recognizingComponents
       
   195 !
   194 !
   196 
   195 
   197 createTokens
   196 createTokens
   198     context options detectTokens ifFalse:[
   197     context options detectTokens ifFalse:[
   199         ^ self
   198         ^ self
   200     ].
   199     ].
   201     ir := (PPCTokenDetector new)
   200     self runPass: PPCTokenDetector
   202             options:context options;
   201 
   203             visit:ir.
   202     "Modified: / 26-08-2015 / 22:36:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   204     self remember:(self copyTree:ir) as:#createTokens
       
   205 !
   203 !
   206 
   204 
   207 inline
   205 inline
   208     context options inline ifFalse:[
   206     context options inline ifFalse:[
   209         ^ self
   207         ^ self
   210     ].
   208     ].
   211     ir := (PPCInliningVisitor new)
   209     self runPass: PPCInliningVisitor
   212             options:context options;
   210 
   213             visit:ir.
   211     "Modified: / 26-08-2015 / 22:36:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   214     self remember:(self copyTree:ir) as:#inline.
       
   215 !
   212 !
   216 
   213 
   217 merge
   214 merge
   218     "Merge equivalent nodes under one object with single identity"
   215     "Merge equivalent nodes under one object with single identity"
   219     
   216     
   220     context options merge ifFalse:[
   217     context options merge ifFalse:[
   221         ^ self
   218         ^ self
   222     ].
   219     ].
   223     ir := (PPCMergingVisitor new)
   220     self runPass: PPCMergingVisitor
   224             options:context options;
   221 
   225             visit:ir.
   222     "Modified: / 26-08-2015 / 22:36:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   226     self remember:(self copyTree:ir) as:#merge
       
   227 !
   223 !
   228 
   224 
   229 specialize
   225 specialize
   230     context options specialize ifFalse:[
   226     context options specialize ifFalse:[
   231         ^ self
   227         ^ self
   232     ].
   228     ].
   233      "
   229     "
   234      Invokes a visitor that creates specialized nodes
   230      Invokes a visitor that creates specialized nodes
   235      for some patterns of PPCNodes,
   231      for some patterns of PPCNodes,
   236      
   232      
   237      e.g. $a astar can be represented by PPCCharacterStarNode
   233      e.g. $a astar can be represented by PPCCharacterStarNode
   238     "
   234     "
   239     ir := ((PPCSpecializingVisitor new)
   235    self runPass: PPCSpecializingVisitor
   240             options:context options;
   236 
   241             visit:ir).
   237     "Modified: / 26-08-2015 / 22:36:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   242     self remember:(self copyTree:ir) as:#specialize
       
   243 !
   238 !
   244 
   239 
   245 toPPCIr
   240 toPPCIr
   246     "Creates a PPCNodes from a PPParser"
   241     "Creates a PPCNodes from a PPParser"
   247     ir := ir asCompilerTree.
   242     ir := ir asCompilerTree.
   257     ]
   252     ]
   258 
   253 
   259     "Modified: / 26-08-2015 / 16:35:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   254     "Modified: / 26-08-2015 / 16:35:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   260 ! !
   255 ! !
   261 
   256 
       
   257 !PPCConfiguration methodsFor:'running'!
       
   258 
       
   259 runPass: passClassOrAlike
       
   260     ir := passClassOrAlike run: ir in: context.
       
   261     self remember:(self copyTree:ir) as:passClassOrAlike name
       
   262 
       
   263     "Created: / 26-08-2015 / 22:35:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   264 ! !
       
   265