Permalink
Browse files

compiler2: Remove unused code.

There are now 3 diffs in regtest.sh.
  • Loading branch information...
Andy Chu
Andy Chu committed Mar 19, 2018
1 parent 9c8486c commit 1daf80633279707344cc4954346a2ba27e8adcc7
Showing with 14 additions and 46 deletions.
  1. +6 −35 opy/compiler2/pyassem.py
  2. +0 −3 opy/compiler2/pycodegen.py
  3. +8 −8 opy/compiler2/symbols.py
View
@@ -126,8 +126,10 @@ def __init__(self):
self.blocks.add(self.entry)
self.blocks.add(self.exit)
DEBUG = False
def startBlock(self, block):
if self._debug:
if self.DEBUG:
if self.current:
print("end", repr(self.current))
print(" next", self.current.next)
@@ -168,29 +170,15 @@ def newBlock(self):
def startExitBlock(self):
self.startBlock(self.exit)
_debug = 0
def _enable_debug(self):
self._debug = 1
def _disable_debug(self):
self._debug = 0
def emit(self, *inst):
if self._debug:
if self.DEBUG:
print("\t", inst)
if len(inst) == 2 and isinstance(inst[1], Block):
self.current.addOutEdge(inst[1])
self.current.emit(inst)
def getBlocks(self):
return self.blocks
def getRoot(self):
"""Return nodes appropriate for use with dominator"""
return self.entry
def getContainedGraphs(self):
raise AssertionError('unused')
l = []
for b in self.getBlocks():
l.extend(b.getContainedGraphs())
@@ -347,6 +335,7 @@ def getContainedGraphs(self):
For example, a MAKE_FUNCTION block will contain a reference to
the graph for the function body.
"""
raise AssertionError('unused')
contained = []
for inst in self.insts:
if len(inst) == 1:
@@ -495,24 +484,6 @@ def getCode(self):
tuple(self.freevars),
tuple(self.cellvars))
def dump(self, io=None):
if io:
save = sys.stdout
sys.stdout = io
pc = 0
for t in self.insts:
opname = t[0]
if opname == "SET_LINENO":
print()
if len(t) == 1:
print("\t", "%3d" % pc, opname)
pc = pc + 1
else:
print("\t", "%3d" % pc, opname, t[1])
pc = pc + 3
if io:
sys.stdout = save
class ArgConverter(object):
""" TODO: This should just be a simple switch ."""
@@ -210,9 +210,6 @@ def parseSymbols(self, tree):
# Next five methods handle name access
def isLocalName(self, name):
return self.locals.top().has_elt(name)
def storeName(self, name):
self._nameOp('STORE', name)
View
@@ -37,6 +37,14 @@ def __init__(self, name, module, klass=None):
def __repr__(self):
return "<%s: %s>" % (self.__class__.__name__, self.name)
def DebugDump(self):
print(self.name, self.nested and "nested" or "", file=sys.stderr)
print("\tglobals: ", self.globals, file=sys.stderr)
print("\tcells: ", self.cells, file=sys.stderr)
print("\tdefs: ", self.defs, file=sys.stderr)
print("\tuses: ", self.uses, file=sys.stderr)
print("\tfrees:", self.frees, file=sys.stderr)
def mangle(self, name):
if self.klass is None:
return name
@@ -76,14 +84,6 @@ def add_child(self, child):
def get_children(self):
return self.children
def DEBUG(self):
print(self.name, self.nested and "nested" or "", file=sys.stderr)
print("\tglobals: ", self.globals, file=sys.stderr)
print("\tcells: ", self.cells, file=sys.stderr)
print("\tdefs: ", self.defs, file=sys.stderr)
print("\tuses: ", self.uses, file=sys.stderr)
print("\tfrees:", self.frees, file=sys.stderr)
def check_name(self, name):
"""Return scope of name.

0 comments on commit 1daf806

Please sign in to comment.