forked from M-Labs/artiq
1
0
Fork 0

compiler: Constness is a validator, not analysis.

This commit is contained in:
whitequark 2017-06-09 07:26:31 +00:00
parent 5d841d08e9
commit 4e7493843a
5 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,3 @@
from .constness import Constness
from .domination import DominatorTree
from .devirtualization import Devirtualization
from .invariant_detection import InvariantDetection

View File

@ -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)

View File

@ -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)

View File

@ -1,3 +1,4 @@
from .monomorphism import MonomorphismValidator
from .escape import EscapeValidator
from .local_access import LocalAccessValidator
from .constness import ConstnessValidator

View File

@ -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