def annotation(self, xdata: InstrXData) -> str: """xdata format: a:vxx . vars[0]: lhs xprs[0]: rhs xprs[1]: rhs (simplified) xprs[2]: condition (if TC is set) """ lhs = str(xdata.vars[0]) rhs = str(xdata.xprs[1]) if xdata.xprs[1].is_function_return_value: rhs = str(xdata.xprs[1].variable.denotation) assign = lhs + " := " + rhs xctr = 2 if xdata.has_instruction_condition(): pcond = "if " + str(xdata.xprs[xctr]) + " then " xctr += 1 elif xdata.has_unknown_instruction_condition(): pcond = "if ? then " else: pcond = "" return pcond + assign
def annotation(self, xdata: InstrXData) -> str: """lhs, rhs, with optional instr condition and base update vars[0]: lhs vars[1]: memory location expressed as a variable xprs[0]: value in memory location xprs[1]: value in memory location (simplified) optional: vars[1]: lhs base register (if base update) xprs[.]: instruction condition (if has condition) xprs[.]: new address for base register """ lhs = str(xdata.vars[0]) rhs = str(xdata.xprs[1]) xctr = 2 if xdata.has_instruction_condition(): pcond = "if " + str(xdata.xprs[xctr]) + " then " xctr += 1 elif xdata.has_unknown_instruction_condition(): pcond = "if ? then " else: pcond = "" if xdata.has_base_update(): blhs = str(xdata.vars[1]) brhs = str(xdata.xprs[xctr]) pbupd = "; " + blhs + " := " + brhs else: pbupd = "" return pcond + lhs + " := " + rhs + pbupd
def annotation(self, xdata: InstrXData) -> str: """xdata format: a:vxx . with optional condition, identified by tags[1]: "TC" vars[0]: lhs xprs[0]: rhs xprs[1]: condition (if flagged by tags[1]) """ lhs = str(xdata.vars[0]) rhs = str(xdata.xprs[1]) assignment = lhs + " := " + rhs if xdata.has_unknown_instruction_condition(): return "if ? then " + assignment elif xdata.has_instruction_condition(): c = str(xdata.xprs[1]) return "if " + c + " then " + assignment else: return assignment
def annotation(self, xdata: InstrXData) -> str: """xdata format: a:v...x... . vars[0..n-1]: lhs variables xprs[0..n-1]: rhs memory values xprs[n]: conditional expression if TC is set """ vars = xdata.vars xprs = xdata.xprs xctr = len(vars) pairs = zip(vars, xprs[:xctr]) assigns = "; ".join(str(v) + " := " + str(x) for (v, x) in pairs) if xdata.has_instruction_condition(): pcond = "if " + str(xprs[xctr]) + " then " xctr += 1 elif xdata.has_unknown_instruction_condition(): pcond = "if ? then " else: pcond = "" return pcond + assigns