Initial commit: add .gitignore and README
Some checks failed
Tests / test (3.10) (push) Has been cancelled
Tests / test (3.11) (push) Has been cancelled
Tests / test (3.12) (push) Has been cancelled
Tests / lint (push) Has been cancelled
Tests / docker (push) Has been cancelled

This commit is contained in:
defiQUG
2026-02-09 21:51:42 -08:00
commit c052b07662
3146 changed files with 808305 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
from __future__ import annotations
from mypyc.ir.func_ir import FuncIR
from mypyc.ir.ops import CallC, PrimitiveOp
def find_implicit_capsule_dependencies(fn: FuncIR) -> set[str] | None:
"""Find implicit dependencies on capsules that need to be imported.
Using primitives or types defined in librt submodules such as "librt.base64"
requires a capsule import.
Note that a module can depend on a librt module even if it doesn't explicitly
import it, for example via re-exported names or via return types of functions
defined in other modules.
"""
deps: set[str] | None = None
for block in fn.blocks:
for op in block.ops:
# TODO: Also determine implicit type object dependencies (e.g. cast targets)
if isinstance(op, CallC) and op.capsule is not None:
if deps is None:
deps = set()
deps.add(op.capsule)
else:
assert not isinstance(op, PrimitiveOp), "Lowered IR is expected"
return deps