diff --git a/artiq/compiler/analyses/__init__.py b/artiq/compiler/analyses/__init__.py index 21da39d23..bea15e2ca 100644 --- a/artiq/compiler/analyses/__init__.py +++ b/artiq/compiler/analyses/__init__.py @@ -1,4 +1,3 @@ -from .constness import Constness from .domination import DominatorTree from .devirtualization import Devirtualization from .invariant_detection import InvariantDetection diff --git a/artiq/compiler/module.py b/artiq/compiler/module.py index dcbb1aab3..052a176ac 100644 --- a/artiq/compiler/module.py +++ b/artiq/compiler/module.py @@ -54,7 +54,7 @@ class Module: escape_validator = validators.EscapeValidator(engine=self.engine) iodelay_estimator = transforms.IODelayEstimator(engine=self.engine, ref_period=ref_period) - constness = analyses.Constness(engine=self.engine) + constness_validator = validators.ConstnessValidator(engine=self.engine) artiq_ir_generator = transforms.ARTIQIRGenerator(engine=self.engine, module_name=src.name, ref_period=ref_period) @@ -70,7 +70,7 @@ class Module: monomorphism_validator.visit(src.typedtree) escape_validator.visit(src.typedtree) iodelay_estimator.visit_fixpoint(src.typedtree) - constness.visit(src.typedtree) + constness_validator.visit(src.typedtree) devirtualization.visit(src.typedtree) self.artiq_ir = artiq_ir_generator.visit(src.typedtree) artiq_ir_generator.annotate_calls(devirtualization) diff --git a/artiq/compiler/testbench/inferencer.py b/artiq/compiler/testbench/inferencer.py index e7deffd33..659b3b052 100644 --- a/artiq/compiler/testbench/inferencer.py +++ b/artiq/compiler/testbench/inferencer.py @@ -3,7 +3,7 @@ from pythonparser import source, diagnostic, algorithm, parse_buffer from .. import prelude, types from ..transforms import ASTTypedRewriter, Inferencer, IntMonomorphizer, CastMonomorphizer from ..transforms import IODelayEstimator -from ..analyses import Constness +from ..validators import ConstnessValidator class Printer(algorithm.Visitor): """ @@ -84,7 +84,7 @@ def main(): parsed, comments = parse_buffer(buf, engine=engine) typed = ASTTypedRewriter(engine=engine, prelude=prelude.globals()).visit(parsed) Inferencer(engine=engine).visit(typed) - Constness(engine=engine).visit(typed) + ConstnessValidator(engine=engine).visit(typed) if monomorphize: CastMonomorphizer(engine=engine).visit(typed) IntMonomorphizer(engine=engine).visit(typed) diff --git a/artiq/compiler/validators/__init__.py b/artiq/compiler/validators/__init__.py index 7f0719ea9..ccbaa8827 100644 --- a/artiq/compiler/validators/__init__.py +++ b/artiq/compiler/validators/__init__.py @@ -1,3 +1,4 @@ from .monomorphism import MonomorphismValidator from .escape import EscapeValidator from .local_access import LocalAccessValidator +from .constness import ConstnessValidator diff --git a/artiq/compiler/analyses/constness.py b/artiq/compiler/validators/constness.py similarity index 93% rename from artiq/compiler/analyses/constness.py rename to artiq/compiler/validators/constness.py index fbca1ac9b..53f987bed 100644 --- a/artiq/compiler/analyses/constness.py +++ b/artiq/compiler/validators/constness.py @@ -1,12 +1,12 @@ """ -:class:`Constness` checks that no attribute marked +:class:`ConstnessValidator` checks that no attribute marked as constant is ever set. """ from pythonparser import algorithm, diagnostic from .. import types, builtins -class Constness(algorithm.Visitor): +class ConstnessValidator(algorithm.Visitor): def __init__(self, engine): self.engine = engine self.in_assign = False