Skip to main content

gisel

ci

A free-form language for GlobalISel legalizer rules, and the toolchain that turns it into LLVM artifacts without llvm-tblgen.

# from a checkout: the corpus and frozen artifacts ship with the repo,
# not with the wheel (the wheel carries the opcode table lint needs).
python3 -m pip install .        # or: python3 -m gisel (no install)
gisel gen   tests/corpus/X86LegalizerInfo.gisel --emit=inc --out x86.inc
gisel check tests/corpus/X86LegalizerInfo.gisel --emit=inc --against x86.inc
gisel gen   tests/corpus/X86LegalizerInfo.gisel --emit=td  --out X86LegalizerInfo.td
gisel lint  tests/corpus/X86LegalizerInfo.gisel   # static checks, no LLVM

Status

milestone backend gate state
M0 --emit=td byte-identical to the generated .td done
M1 --emit=inc byte-identical to -gen-legalizer done
M2 --emit=check the -gen-legalizer-check JSON done
M3 --emit=table the -gen-legalizer-table fragment done
M4 --emit=core, eval core JSON (modulo origin) / 9632-point differential done
v0.2 lint 57 node kinds, 0 errors on both corpora done

tests/artifacts/ holds the eight frozen artifacts and their SHA256; the corpus is derivable, not hand-tuned: gisel bootstrap reproduces both .gisel files byte for byte from the frozen .td + core JSON (asserted in the suite). tests/artifacts/SHA256 (relative paths) is the oracle every backend is measured against; tools/refresh-oracle.sh re-derives it from a built LLVM tree (development only — generation never runs llvm-tblgen).

python3 -m unittest discover -q -s tests      # 43 gates, ~9 s
(cd tests/artifacts && sha256sum -c SHA256)   # 8/8

gisel lint runs the J1/J2b/J3a/J3b checks over the normal form and prints path:line: RULESET: message (exit 1 on errors, 2 on parse/IO). It needs no LLVM source tree: the opcode arity table ships in gisel/data/.

Errors point at the source, not at a synthetic string:

$ gisel gen bad.gisel --emit=td --out x.td
bad.gisel:6: expected ,, got ID ('pow2')      # exit 2

Evaluating without LLVM

--emit=core produces the schema-0.4 normal form, and gisel eval answers queries against it without any LLVM binary:

gisel gen tests/corpus/AArch64LegalizerInfo.gisel --emit=core --out a.core.json
gisel eval --doc a.core.json \
  --features tests/cases/features.json --cases tests/cases/a64_ref_dump.jsonl
# cases=9632 disagreements=0 errors=0

gisel gen tests/corpus/X86LegalizerInfo.gisel --emit=core --out x.core.json
gisel eval --doc x.core.json \
  --features tests/cases/x86-features.json --cases tests/cases/x86_ref_dump.jsonl
# cases=5632 disagreements=0 errors=0

tests/cases/a64_ref_dump.jsonl is the frozen AArch64 differential (9632 points) dumped from the in-tree reference; tests/cases/features.json is the subtarget truth table it was recorded with.

Layout

gisel/dsl.py            lexer, parser, core-IR normal form
gisel/td.py             .gisel -> .td (M0, compatibility backend)
gisel/backend/llvm_inc.py  normal form -> .inc (M1)
gisel/backend/check_json.py / table.py / core_json.py   M2 / M3 / M4
gisel/eval.py           standalone evaluator (9632 points, 0 disagreements)
spec/m1-coverage.md     shim coverage of the corpus (25 triples, 0 uncovered)
spec/grammar.md         the .gisel grammar, normative
spec/semantics.md       what a rule means (and what the evaluator does)

Ported emitter logic keeps the LLVM license header and names its source commit (d48f5512a162).

Metadata

Release files for gisel 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gisel 0.2.0
File Size Uploaded Provenance Actions
gisel-0.2.0.tar.gz 74.8 kB Without provenance Details for gisel-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gisel 0.2.0
File Interpreter ABI Platform Actions
gisel-0.2.0-py3-none-any.whl Python 3 none any Details for gisel-0.2.0-py3-none-any.whl

Total release size: 144.3 kB

Release files / gisel-0.2.0.tar.gz

Download URL gisel-0.2.0.tar.gz
Size 74.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2c0340058c00d2a1dc645e4e54f5f4a80b802ded6b9764191eca5692abd4b263
BLAKE2b-256 checksum
How to use checksums
a8af936f5786f3c78902a7b0457a92d2af33306122e25be24670cb660de1660e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / gisel-0.2.0-py3-none-any.whl

Download URL gisel-0.2.0-py3-none-any.whl
Size 69.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed375fcdb1c8184ad3b85f62a29473ce70cc4aed6d8fba8f2f8ff08ab5eee9bd
BLAKE2b-256 checksum
How to use checksums
afcc977594c43a15dee2e13a470a6130244c188641d9ecc9c70aa2a964c42c89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for gisel 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page