Commit daf7dcec authored by Stefan Behnel's avatar Stefan Behnel

clean up and improve static type declarations in FlowControl.py a bit

parent cb2b3432
cimport cython cimport cython
from Cython.Compiler.Visitor cimport CythonTransform, TreeVisitor
cdef class ControlBlock: cdef class ControlBlock:
cdef public set children cdef public set children
cdef public set parents cdef public set parents
...@@ -39,6 +41,9 @@ cdef class AssignmentList: ...@@ -39,6 +41,9 @@ cdef class AssignmentList:
cdef public object mask cdef public object mask
cdef public list stats cdef public list stats
cdef class AssignmentCollector(TreeVisitor):
cdef list assignments
cdef class ControlFlow: cdef class ControlFlow:
cdef public set blocks cdef public set blocks
cdef public set entries cdef public set entries
...@@ -51,9 +56,10 @@ cdef class ControlFlow: ...@@ -51,9 +56,10 @@ cdef class ControlFlow:
cdef public dict assmts cdef public dict assmts
cpdef newblock(self, parent=*) cpdef newblock(self, ControlBlock parent=*)
cpdef nextblock(self, parent=*) cpdef nextblock(self, ControlBlock parent=*)
cpdef bint is_tracked(self, entry) cpdef bint is_tracked(self, entry)
cpdef bint is_statically_assigned(self, entry)
cpdef mark_position(self, node) cpdef mark_position(self, node)
cpdef mark_assignment(self, lhs, rhs, entry) cpdef mark_assignment(self, lhs, rhs, entry)
cpdef mark_argument(self, lhs, rhs, entry) cpdef mark_argument(self, lhs, rhs, entry)
...@@ -74,5 +80,20 @@ cdef class ControlFlow: ...@@ -74,5 +80,20 @@ cdef class ControlFlow:
cdef class Uninitialized: cdef class Uninitialized:
pass pass
cdef class Unknown:
pass
@cython.locals(dirty=bint, block=ControlBlock, parent=ControlBlock) @cython.locals(dirty=bint, block=ControlBlock, parent=ControlBlock)
cdef check_definitions(ControlFlow flow, dict compiler_directives) cdef check_definitions(ControlFlow flow, dict compiler_directives)
cdef class ControlFlowAnalysis(CythonTransform):
cdef object gv_ctx
cdef set reductions
cdef list env_stack
cdef list stack
cdef object env
cdef ControlFlow flow
cdef bint in_inplace_assignment
cpdef mark_assignment(self, lhs, rhs=*)
cpdef mark_position(self, node)
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment