Skip to content

Add reference page for newyork IR#522

Open
elle-j wants to merge 10 commits into
cl/newyorkfrom
lj/newyork-ir-docs
Open

Add reference page for newyork IR#522
elle-j wants to merge 10 commits into
cl/newyorkfrom
lj/newyork-ir-docs

Conversation

@elle-j
Copy link
Copy Markdown
Contributor

@elle-j elle-j commented May 21, 2026

Adds a per-operation reference for the newyork IR to the compiler book for easily being able to view printed syntax, operand and result types, examples, etc. for any operation. Using easily readable syntax notation. The new page is partly inspired by MLIR's docs.

Example entry

and

(Expression::Binary with BinaryOperation::And)

Description

Bitwise AND. The common idiom for type narrowing: a constant mask on the right lets forward analysis pick up a tight result width.

Syntax

and($lhs[: <type>], $rhs[: <type>])

Example

let v2 := and(v0, v1)
let v3 := and(v0, 0xff)     // type inference narrows result to i8

Operands

Name Type Notes
lhs i256
rhs i256

Result and purity

Result Purity
min(width(lhs), width(rhs)) — AND can only clear bits, so the result fits in the narrower operand Pure

Annotations

None.

@elle-j elle-j requested a review from xermicus May 21, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant