MCPcopy Index your code
hub / github.com/python/mypy / add_block

Function add_block

mypyc/transform/refcount.py:248–264  ·  view source on GitHub ↗
(
    decs: Decs, incs: Incs, cache: BlockCache, blocks: list[BasicBlock], label: BasicBlock
)

Source from the content-addressed store, hash-verified

246
247
248def add_block(
249 decs: Decs, incs: Incs, cache: BlockCache, blocks: list[BasicBlock], label: BasicBlock
250) -> BasicBlock:
251 if not decs and not incs:
252 return label
253
254 # TODO: be able to share *partial* results
255 if (label, decs, incs) in cache:
256 return cache[label, decs, incs]
257
258 block = BasicBlock()
259 blocks.append(block)
260 block.ops.extend(DecRef(reg, is_xdec=xdec) for reg, xdec in decs)
261 block.ops.extend(IncRef(reg) for reg in incs)
262 block.ops.append(Goto(label))
263 cache[label, decs, incs] = block
264 return block
265
266
267def make_value_ordering(ir: FuncIR) -> dict[Value, int]:

Callers 1

Calls 6

BasicBlockClass · 0.90
DecRefClass · 0.90
IncRefClass · 0.90
GotoClass · 0.90
appendMethod · 0.80
extendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…