def analyze_undefined_regs( blocks: List[BasicBlock], cfg: CFG, env: Environment, initial_defined: Set[Value]) -> AnalysisResult[Value]: """Calculate potentially undefined registers at each CFG location. A register is undefined if there is some path from initial block where it has an undefined value. """ initial_undefined = set(env.regs()) - initial_defined return run_analysis(blocks=blocks, cfg=cfg, gen_and_kill=UndefinedVisitor(), initial=initial_undefined, backward=False, kind=MAYBE_ANALYSIS)
def env_to_lines(env: Environment, names: Dict[Value, str], const_regs: Optional[Dict[LoadInt, int]] = None) -> List[str]: result = [] i = 0 regs = list(env.regs()) if const_regs is None: const_regs = {} regs = [reg for reg in regs if reg not in const_regs] while i < len(regs): i0 = i group = [names[regs[i0]]] while i + 1 < len(regs) and regs[i + 1].type == regs[i0].type: i += 1 group.append(names[regs[i]]) i += 1 result.append('%s :: %s' % (', '.join(group), regs[i0].type)) return result