From 7043b333a772cd4fff94485068fee9058441584d Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 9 Oct 2015 00:29:31 +0300 Subject: [PATCH] =?UTF-8?q?transforms.devirtualizer=20=E2=86=92=20analyses?= =?UTF-8?q?.devirtualization.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- artiq/compiler/analyses/__init__.py | 1 + .../devirtualizer.py => analyses/devirtualization.py} | 3 +-- artiq/compiler/module.py | 6 +++--- artiq/compiler/transforms/__init__.py | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) rename artiq/compiler/{transforms/devirtualizer.py => analyses/devirtualization.py} (98%) diff --git a/artiq/compiler/analyses/__init__.py b/artiq/compiler/analyses/__init__.py index f7f69f651..708b325ef 100644 --- a/artiq/compiler/analyses/__init__.py +++ b/artiq/compiler/analyses/__init__.py @@ -1 +1,2 @@ from .domination import DominatorTree +from .devirtualization import Devirtualization diff --git a/artiq/compiler/transforms/devirtualizer.py b/artiq/compiler/analyses/devirtualization.py similarity index 98% rename from artiq/compiler/transforms/devirtualizer.py rename to artiq/compiler/analyses/devirtualization.py index 08a624212..63eea451a 100644 --- a/artiq/compiler/transforms/devirtualizer.py +++ b/artiq/compiler/analyses/devirtualization.py @@ -102,7 +102,7 @@ class MethodResolver(algorithm.Visitor): continue _advance(self.method_map, (instance_type, target.attr), value) -class Devirtualizer: +class Devirtualization: def __init__(self): self.variable_map = dict() self.method_map = dict() @@ -114,4 +114,3 @@ class Devirtualizer: method_resolver = MethodResolver(self.variable_map, self.method_map) method_resolver.visit(node) - print(self.method_map) diff --git a/artiq/compiler/module.py b/artiq/compiler/module.py index a7f773225..0dff76786 100644 --- a/artiq/compiler/module.py +++ b/artiq/compiler/module.py @@ -10,7 +10,7 @@ string and infers types for it using a trivial :module:`prelude`. import os from pythonparser import source, diagnostic, parse_buffer -from . import prelude, types, transforms, validators +from . import prelude, types, transforms, analyses, validators class Source: def __init__(self, source_buffer, engine=None): @@ -57,7 +57,7 @@ class Module: ref_period=ref_period) dead_code_eliminator = transforms.DeadCodeEliminator(engine=self.engine) local_access_validator = validators.LocalAccessValidator(engine=self.engine) - devirtualizer = transforms.Devirtualizer() + devirtualization = analyses.Devirtualization() self.name = src.name self.globals = src.globals @@ -66,7 +66,7 @@ class Module: monomorphism_validator.visit(src.typedtree) escape_validator.visit(src.typedtree) iodelay_estimator.visit_fixpoint(src.typedtree) - devirtualizer.visit(src.typedtree) + devirtualization.visit(src.typedtree) self.artiq_ir = artiq_ir_generator.visit(src.typedtree) dead_code_eliminator.process(self.artiq_ir) local_access_validator.process(self.artiq_ir) diff --git a/artiq/compiler/transforms/__init__.py b/artiq/compiler/transforms/__init__.py index fed1c6648..39831fea3 100644 --- a/artiq/compiler/transforms/__init__.py +++ b/artiq/compiler/transforms/__init__.py @@ -3,6 +3,5 @@ from .inferencer import Inferencer from .int_monomorphizer import IntMonomorphizer from .iodelay_estimator import IODelayEstimator from .artiq_ir_generator import ARTIQIRGenerator -from .devirtualizer import Devirtualizer from .dead_code_eliminator import DeadCodeEliminator from .llvm_ir_generator import LLVMIRGenerator