MCPcopy
hub / github.com/python/mypy / all_values

Function all_values

mypyc/ir/func_ir.py:348–376  ·  view source on GitHub ↗

Return the set of all values that may be initialized in the blocks. This omits registers that are only read.

(args: list[Register], blocks: list[BasicBlock])

Source from the content-addressed store, hash-verified

346
347
348def all_values(args: list[Register], blocks: list[BasicBlock]) -> list[Value]:
349 """Return the set of all values that may be initialized in the blocks.
350
351 This omits registers that are only read.
352 """
353 values: list[Value] = list(args)
354 seen_registers = set(args)
355
356 for block in blocks:
357 for op in block.ops:
358 if not isinstance(op, ControlOp):
359 if isinstance(op, (Assign, AssignMulti)):
360 if op.dest not in seen_registers:
361 values.append(op.dest)
362 seen_registers.add(op.dest)
363 elif op.is_void:
364 continue
365 else:
366 # If we take the address of a register, it might get initialized.
367 if (
368 isinstance(op, LoadAddress)
369 and isinstance(op.src, Register)
370 and op.src not in seen_registers
371 ):
372 values.append(op.src)
373 seen_registers.add(op.src)
374 values.append(op)
375
376 return values
377
378
379def all_values_full(args: list[Register], blocks: list[BasicBlock]) -> list[Value]:

Callers 4

run_caseMethod · 0.90
generate_native_functionFunction · 0.90
insert_ref_count_opcodesFunction · 0.90
insert_uninit_checksFunction · 0.90

Calls 5

listClass · 0.85
setClass · 0.85
isinstanceFunction · 0.85
appendMethod · 0.80
addMethod · 0.45

Tested by 1

run_caseMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…