def convert_from_ssa(self): """ For each phi-node, 1. Create a new variable. 2. Map the inputs and output to the new variable using Variable.CACHE. 3. For each input, flag its definition as an assign operation so that we'll create a statement for it later. """ new_pcode = [] for pcop in self.pcode: if not pcop.is_phi(): new_pcode.append(pcop) continue expr = VarnodeExpr(pcop.output) var = Variable.fromexpr(expr) for inpt in pcop.inputs: expr = VarnodeExpr(inpt) Variable.CACHE[expr] = var if inpt.defn is not None and not inpt.defn.is_assign(): inpt.defn.set_is_assign(True) self.update_elems(new_pcode)
def break_out(self): # TODO: Overwrite variable if this is its last use. var = Variable.fromexpr(self) self.propagate_change_to(var) return var