diff options
Diffstat (limited to 'devtools')
-rw-r--r-- | devtools/tasmrecover/tasm/cpp.py | 2 | ||||
-rw-r--r-- | devtools/tasmrecover/tasm/proc.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py index 5d460961a6..da21efe21d 100644 --- a/devtools/tasmrecover/tasm/cpp.py +++ b/devtools/tasmrecover/tasm/cpp.py @@ -483,6 +483,8 @@ namespace %s { self.proc.stmts.append(s) self.proc.add("ret") print "skipping %d instructions, todo: %d" %(start, len(self.proc.stmts) - start) + print "re-optimizing..." + self.proc.optimize(keep_labels=[label]) self.proc.visit(self, start) self.body += "}\n"; self.translated.insert(0, self.body) diff --git a/devtools/tasmrecover/tasm/proc.py b/devtools/tasmrecover/tasm/proc.py index e5af1afae5..6db3b7a682 100644 --- a/devtools/tasmrecover/tasm/proc.py +++ b/devtools/tasmrecover/tasm/proc.py @@ -66,7 +66,7 @@ class proc: i += 1 return - def optimize(self): + def optimize(self, keep_labels=[]): print "optimizing..." #trivial simplifications while len(self.stmts) and isinstance(self.stmts[-1], op.label): @@ -109,7 +109,7 @@ class proc: if not isinstance(s, op.label): continue print "checking label %s..." %s.name - used = False + used = s.name in keep_labels if s.name not in self.retlabels: for j in self.stmts: if isinstance(j, op.basejmp) and j.label == s.name: |