MCPcopy Create free account
hub / github.com/python/mypy / LivenessVisitor

Class LivenessVisitor

mypyc/analysis/dataflow.py:469–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467
468
469class LivenessVisitor(BaseAnalysisVisitor[Value]):
470 def visit_branch(self, op: Branch) -> GenAndKill[Value]:
471 return non_trivial_sources(op), set()
472
473 def visit_return(self, op: Return) -> GenAndKill[Value]:
474 if not isinstance(op.value, (Integer, Float)):
475 return {op.value}, set()
476 else:
477 return _EMPTY
478
479 def visit_unreachable(self, op: Unreachable) -> GenAndKill[Value]:
480 return _EMPTY
481
482 def visit_register_op(self, op: RegisterOp) -> GenAndKill[Value]:
483 gen = non_trivial_sources(op)
484 if not op.is_void:
485 return gen, {op}
486 else:
487 return gen, set()
488
489 def visit_assign(self, op: Assign) -> GenAndKill[Value]:
490 return non_trivial_sources(op), {op.dest}
491
492 def visit_assign_multi(self, op: AssignMulti) -> GenAndKill[Value]:
493 return non_trivial_sources(op), {op.dest}
494
495 def visit_set_mem(self, op: SetMem) -> GenAndKill[Value]:
496 return non_trivial_sources(op), set()
497
498 def visit_inc_ref(self, op: IncRef) -> GenAndKill[Value]:
499 return _EMPTY
500
501 def visit_dec_ref(self, op: DecRef) -> GenAndKill[Value]:
502 return _EMPTY
503
504
505def analyze_live_regs(blocks: list[BasicBlock], cfg: CFG) -> AnalysisResult[Value]:

Callers 1

analyze_live_regsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…