[Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pyassem.py,1.14,1.15
Jeremy Hylton
python-dev@python.org
Sun, 5 Nov 2000 19:47:41 -0800
Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19954/compiler
Modified Files:
pyassem.py
Log Message:
move pruneNext method to correct object (doh!)
Index: pyassem.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pyassem.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** pyassem.py 2000/11/06 03:43:11 1.14
--- pyassem.py 2000/11/06 03:47:39 1.15
***************
*** 121,148 ****
return l
- _uncond_transfer = ('RETURN_VALUE', 'RAISE_VARARGS',
- 'JUMP_ABSOLUTE', 'JUMP_FORWARD')
-
- def pruneNext(self):
- """Remove bogus edge for unconditional transfers
-
- Each block has a next edge that accounts for implicit control
- transfers, e.g. from a JUMP_IF_FALSE to the block that will be
- executed if the test is true.
-
- These edges must remain for the current assembler code to
- work. If they are removed, the dfs_postorder gets things in
- weird orders. However, they shouldn't be there for other
- purposes, e.g. conversion to SSA form. This method will
- remove the next edge when it follows an unconditional control
- transfer.
- """
- try:
- op, arg = self.insts[-1]
- except (IndexError, TypeError):
- return
- if op in self._uncond_transfer:
- self.next = []
-
def dfs_postorder(b, seen):
"""Depth-first search of tree rooted at b, return in postorder"""
--- 121,124 ----
***************
*** 197,200 ****
--- 173,200 ----
self.next.append(block)
assert len(self.next) == 1, map(str, self.next)
+
+ _uncond_transfer = ('RETURN_VALUE', 'RAISE_VARARGS',
+ 'JUMP_ABSOLUTE', 'JUMP_FORWARD')
+
+ def pruneNext(self):
+ """Remove bogus edge for unconditional transfers
+
+ Each block has a next edge that accounts for implicit control
+ transfers, e.g. from a JUMP_IF_FALSE to the block that will be
+ executed if the test is true.
+
+ These edges must remain for the current assembler code to
+ work. If they are removed, the dfs_postorder gets things in
+ weird orders. However, they shouldn't be there for other
+ purposes, e.g. conversion to SSA form. This method will
+ remove the next edge when it follows an unconditional control
+ transfer.
+ """
+ try:
+ op, arg = self.insts[-1]
+ except (IndexError, ValueError):
+ return
+ if op in self._uncond_transfer:
+ self.next = []
def get_children(self):