forked from M-Labs/artiq
compiler: Constness is a validator, not analysis.
This commit is contained in:
parent
5d841d08e9
commit
4e7493843a
|
@ -1,4 +1,3 @@
|
||||||
from .constness import Constness
|
|
||||||
from .domination import DominatorTree
|
from .domination import DominatorTree
|
||||||
from .devirtualization import Devirtualization
|
from .devirtualization import Devirtualization
|
||||||
from .invariant_detection import InvariantDetection
|
from .invariant_detection import InvariantDetection
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Module:
|
||||||
escape_validator = validators.EscapeValidator(engine=self.engine)
|
escape_validator = validators.EscapeValidator(engine=self.engine)
|
||||||
iodelay_estimator = transforms.IODelayEstimator(engine=self.engine,
|
iodelay_estimator = transforms.IODelayEstimator(engine=self.engine,
|
||||||
ref_period=ref_period)
|
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,
|
artiq_ir_generator = transforms.ARTIQIRGenerator(engine=self.engine,
|
||||||
module_name=src.name,
|
module_name=src.name,
|
||||||
ref_period=ref_period)
|
ref_period=ref_period)
|
||||||
|
@ -70,7 +70,7 @@ class Module:
|
||||||
monomorphism_validator.visit(src.typedtree)
|
monomorphism_validator.visit(src.typedtree)
|
||||||
escape_validator.visit(src.typedtree)
|
escape_validator.visit(src.typedtree)
|
||||||
iodelay_estimator.visit_fixpoint(src.typedtree)
|
iodelay_estimator.visit_fixpoint(src.typedtree)
|
||||||
constness.visit(src.typedtree)
|
constness_validator.visit(src.typedtree)
|
||||||
devirtualization.visit(src.typedtree)
|
devirtualization.visit(src.typedtree)
|
||||||
self.artiq_ir = artiq_ir_generator.visit(src.typedtree)
|
self.artiq_ir = artiq_ir_generator.visit(src.typedtree)
|
||||||
artiq_ir_generator.annotate_calls(devirtualization)
|
artiq_ir_generator.annotate_calls(devirtualization)
|
||||||
|
|
|
@ -3,7 +3,7 @@ from pythonparser import source, diagnostic, algorithm, parse_buffer
|
||||||
from .. import prelude, types
|
from .. import prelude, types
|
||||||
from ..transforms import ASTTypedRewriter, Inferencer, IntMonomorphizer, CastMonomorphizer
|
from ..transforms import ASTTypedRewriter, Inferencer, IntMonomorphizer, CastMonomorphizer
|
||||||
from ..transforms import IODelayEstimator
|
from ..transforms import IODelayEstimator
|
||||||
from ..analyses import Constness
|
from ..validators import ConstnessValidator
|
||||||
|
|
||||||
class Printer(algorithm.Visitor):
|
class Printer(algorithm.Visitor):
|
||||||
"""
|
"""
|
||||||
|
@ -84,7 +84,7 @@ def main():
|
||||||
parsed, comments = parse_buffer(buf, engine=engine)
|
parsed, comments = parse_buffer(buf, engine=engine)
|
||||||
typed = ASTTypedRewriter(engine=engine, prelude=prelude.globals()).visit(parsed)
|
typed = ASTTypedRewriter(engine=engine, prelude=prelude.globals()).visit(parsed)
|
||||||
Inferencer(engine=engine).visit(typed)
|
Inferencer(engine=engine).visit(typed)
|
||||||
Constness(engine=engine).visit(typed)
|
ConstnessValidator(engine=engine).visit(typed)
|
||||||
if monomorphize:
|
if monomorphize:
|
||||||
CastMonomorphizer(engine=engine).visit(typed)
|
CastMonomorphizer(engine=engine).visit(typed)
|
||||||
IntMonomorphizer(engine=engine).visit(typed)
|
IntMonomorphizer(engine=engine).visit(typed)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
from .monomorphism import MonomorphismValidator
|
from .monomorphism import MonomorphismValidator
|
||||||
from .escape import EscapeValidator
|
from .escape import EscapeValidator
|
||||||
from .local_access import LocalAccessValidator
|
from .local_access import LocalAccessValidator
|
||||||
|
from .constness import ConstnessValidator
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
"""
|
"""
|
||||||
:class:`Constness` checks that no attribute marked
|
:class:`ConstnessValidator` checks that no attribute marked
|
||||||
as constant is ever set.
|
as constant is ever set.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pythonparser import algorithm, diagnostic
|
from pythonparser import algorithm, diagnostic
|
||||||
from .. import types, builtins
|
from .. import types, builtins
|
||||||
|
|
||||||
class Constness(algorithm.Visitor):
|
class ConstnessValidator(algorithm.Visitor):
|
||||||
def __init__(self, engine):
|
def __init__(self, engine):
|
||||||
self.engine = engine
|
self.engine = engine
|
||||||
self.in_assign = False
|
self.in_assign = False
|
Loading…
Reference in New Issue