Skip to content

Cranelift modernize docs#13809

Open
AnnieSld wants to merge 4 commits into
bytecodealliance:mainfrom
AnnieSld:cranelift-modernize-docs
Open

Cranelift modernize docs#13809
AnnieSld wants to merge 4 commits into
bytecodealliance:mainfrom
AnnieSld:cranelift-modernize-docs

Conversation

@AnnieSld

@AnnieSld AnnieSld commented Jul 2, 2026

Copy link
Copy Markdown

I'm reopening this as a new, smaller PR.
This PR contains only the changes I verified against the current codebase:

  1. cranelift/docs/testing.md: removed test commands that no longer exist in cranelift/filetests/src/ (test legalizer, test regalloc, test simple-gvn, test licm, test dce, test shrink, test simple_preopt). Also, updated outdated file paths referencing the old cranelift-codegen/meta-python/ structure, and replaced broken Sphinx syntax with standard Markdown.
  2. cranelift/docs/add-clif-instruction.md: new guide documenting how to add a new opcode to CLIF, verified against cranelift/codegen/meta/src/shared/instructions.rs.
  3. cranelift/docs/isle-integration.md: updated a paragraph about move mitosis that stated regalloc2 was a future migration; regalloc2 is already integrated in the current codebase.

Addresses #4135

@AnnieSld AnnieSld requested a review from a team as a code owner July 2, 2026 22:35
@AnnieSld AnnieSld requested review from alexcrichton and removed request for a team July 2, 2026 22:35
@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator cranelift:docs labels Jul 3, 2026

@alexcrichton alexcrichton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

## 4. Add a lowering rule per backend

A CLIF instruction with no backend that can lower it will hit ISLE's "no rule
matched" panic the moment it's used. At a minimum, you should add a (rule (lower (your_instr ...)) ...) definition to each cranelift/codegen/src/isa/<arch>/lower.isle backend you intend to support. If support for an architecture is not yet implemented, consider adding an explicit "unsupported" case instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This last clause, an explicit "unsupported" case, is unnecessary because that's the default if no other rule happens to match. Basically it's fine to do nothing for unsupported backends when adding a new instruction

allocator's move coalescing, and move mitosis will eventually go away completely
once we switch over to `regalloc2`, which takes instructions in SSA form
directly as input.
allocator's move coalescing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the above docs be updated to alos remove the references to "move mitosis"?

Comment thread cranelift/docs/testing.md

The options given on the `isa` line modify the ISA-specific settings defined in
`cranelift-codegen/meta-python/isa/*/settings.py`.
`cranelift/codegen/src/isa/<arch>/settings.rs`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`cranelift/codegen/src/isa/<arch>/settings.rs`.
`cranelift/codegen/meta/src/isa/<arch>.rs`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:docs cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants