Commit cb2b3432 authored by Stefan Behnel's avatar Stefan Behnel

slight code simplification

parent f8409eec
...@@ -61,7 +61,7 @@ cdef class ControlFlow: ...@@ -61,7 +61,7 @@ cdef class ControlFlow:
cpdef mark_reference(self, node, entry) cpdef mark_reference(self, node, entry)
cpdef normalize(self) cpdef normalize(self)
@cython.locals(offset=object, assmts=AssignmentList, @cython.locals(bit=object, assmts=AssignmentList,
block=ControlBlock) block=ControlBlock)
cpdef initialize(self) cpdef initialize(self)
......
...@@ -222,22 +222,21 @@ class ControlFlow(object): ...@@ -222,22 +222,21 @@ class ControlFlow(object):
"""Set initial state, map assignments to bits.""" """Set initial state, map assignments to bits."""
self.assmts = {} self.assmts = {}
offset = 0 bit = 1
for entry in self.entries: for entry in self.entries:
assmts = AssignmentList() assmts = AssignmentList()
assmts.bit = 1 << offset assmts.mask = assmts.bit = bit
assmts.mask = assmts.bit
self.assmts[entry] = assmts self.assmts[entry] = assmts
offset += 1 bit <<= 1
for block in self.blocks: for block in self.blocks:
for stat in block.stats: for stat in block.stats:
if isinstance(stat, NameAssignment): if isinstance(stat, NameAssignment):
stat.bit = 1 << offset stat.bit = bit
assmts = self.assmts[stat.entry] assmts = self.assmts[stat.entry]
assmts.stats.append(stat) assmts.stats.append(stat)
assmts.mask |= stat.bit assmts.mask |= bit
offset += 1 bit <<= 1
for block in self.blocks: for block in self.blocks:
for entry, stat in block.gen.items(): for entry, stat in block.gen.items():
......
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