Exemple #1
0
 public static function analyzer()
 {
     $signatureResolver = new SignatureResolver();
     $analyzer = new Analyzer();
     $analyzer->addVisitor(new AstProcessor\ReferenceKiller());
     $analyzer->addVisitor(new AstProcessor\AssignOpResolver());
     $analyzer->addVisitor(new AstProcessor\LoopResolver());
     $analyzer->addVisitor(new AstProcessor\ElseIfResolver());
     $analyzer->addVisitor(new AstProcessor\SignatureResolver($signatureResolver));
     $analyzer->addVisitor(new AstProcessor\RecursionResolver());
     $analyzer->addProcessor(new GraphProcessor\SSACompiler());
     $resolver = new GraphProcessor\Optimizer();
     $resolver->addRule(new OptimizerRule\Assign());
     $resolver->addRule(new OptimizerRule\BinaryOp());
     $resolver->addRule(new OptimizerRule\BooleanNot());
     $resolver->addRule(new OptimizerRule\BitwiseNot());
     $resolver->addRule(new OptimizerRule\ConstBinaryOp());
     $resolver->addRule(new OptimizerRule\DeadAssignmentRemover());
     $resolver->addRule(new OptimizerRule\FunctionCall());
     $resolver->addRule(new OptimizerRule\Phi());
     $resolver->addRule(new OptimizerRule\UnreachableCode());
     $analyzer->addProcessor($resolver);
     $analyzer->addProcessor(new GraphProcessor\PhiResolver());
     $analyzer->addProcessor(new GraphProcessor\FreeResolver());
     return $analyzer;
 }