You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 71fd1d7
Browse filesBrowse the repository at this point in the historyBrowse files
description: PythonBPF's development loop for implementing a new compiler feature — write a minimal C eBPF reference, compile it to LLVM IR and read that as the spec, stop for a human syntax decision, then implement against the reference. Use whenever adding or extending a PythonBPF language feature (new statement/expression support, map types, globals, helpers, program constructs).
4
+
---
5
+
6
+
# The IR-first feature loop
7
+
8
+
PythonBPF targets LLVM IR via llvmlite. For any new feature, clang's output for the
9
+
equivalent C is the specification — not documentation, not intuition. Follow the loop
10
+
in order; do not skip steps because the feature "looks simple".
11
+
12
+
## 1. Write the C reference
13
+
14
+
A minimal `.bpf.c` in `tests/c-form/` exercising **only** the target feature. Small
15
+
enough that every line of the resulting IR is attributable to the feature. Prefer no
16
+
includes (define `SEC` and the `__u*` typedefs by hand) so nothing else pollutes the IR.
17
+
Cover each variant of the feature in one file (e.g. for globals: zero-init, initialized,
- Ask the dev which Python binary to use, and remember that for future. The original authors use `.venv/bin/python` as their system python has no llvmlite.
103
+
- Atomic commits, `Core:`/`Tests:` subject prefixes, one logical change each.
0 commit comments