diff options
| author | Symious <14933944+symious@users.noreply.github.com> | 2026-09-10 04:50:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-09 13:50:36 -0700 |
| commit | 6b4ed4d07831f738755cb8162eff24d6d9a695fc (patch) | |
| tree | cb8c9f20207bf4388803c614fe7a5239c0c20295 | |
| parent | 4f8ef2140e5c41913f3f2ab49c554c6548609684 (diff) | |
| download | Simple-6b4ed4d07831f738755cb8162eff24d6d9a695fc.tar.gz Simple-6b4ed4d07831f738755cb8162eff24d6d9a695fc.zip | |
Docs: Proj is not always a data node (#250)
The node recap tables in chapters 4 and 5 classify `Proj` as "Data", but
`ProjNode.isCFG()` has returned true for control projections since chapter 4:
ch4: return _idx==0;
ch5+: return _idx==0 || ctrl() instanceof IfNode;
So `Proj#0` off `Start` is a control node, and from chapter 5 both projections
off an `If` are too -- which is exactly why the dominator walk in
`IfNode.compute()` can step through them.
Change the Type column to "Data / Control" and add a note under each table
pointing at `isCFG()`. Table alignment is unchanged: "Data / Control" is the
same width as "Abstract class".
Docs-only change.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
| -rw-r--r-- | chapter04/README.md | 5 | ||||
| -rw-r--r-- | chapter05/README.md | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/chapter04/README.md b/chapter04/README.md index a7b223b4..272d0b8d 100644 --- a/chapter04/README.md +++ b/chapter04/README.md @@ -39,10 +39,13 @@ Following are revised or new nodes |-----------|----------------|------------------------------------------------|-----------------------|----------------------------------------------------------------------------| | MultiNode | Abstract class | A node that has a tuple result | | A tuple | | Start | Control | Start of function, now a MultiNode | | A tuple with a ctrl token and an `arg` data node | -| Proj | Data | Projection nodes extract values from MultiNode | A MultiNode and index | Result is the extracted value from the input MultiNode at offset index | +| Proj | Data / Control | Projection nodes extract values from MultiNode | A MultiNode and index | Result is the extracted value from the input MultiNode at offset index | | Bool | Data | Represents results of a comparison operator | Two data nodes | Result is a comparison, represented as integer value where 1=true, 0=false | | Not | Data | Logical not | One data node | Result converts 0 to 1 and vice versa | +> A `Proj` is a control node when it projects the control slot: `Proj#0` off `Start`. +> Every other projection is a data node. See `ProjNode.isCFG()`. + Below is our list of Nodes from [Chapter 3](../chapter03/README.md): | Node Name | Type | Description | Inputs | Value | diff --git a/chapter05/README.md b/chapter05/README.md index 88bacbfc..7337da33 100644 --- a/chapter05/README.md +++ b/chapter05/README.md @@ -41,7 +41,7 @@ Here is a recap of the nodes introduced in previous chapters: |-----------|----------------|---------|------------------------------------------------|-------------------------------------------------------------------------------|----------------------------------------------------------------------------| | Multi | Abstract class | 4 | A node that has a tuple result | | A tuple | | Start | Control | 1 | Start of function, now a MultiNode | | A tuple with a ctrl token and an `arg` data node | -| Proj | Data | 4 | Projection nodes extract values from MultiNode | A MultiNode and index | Result is the extracted value from the input MultiNode at offset index | +| Proj | Data / Control | 4 | Projection nodes extract values from MultiNode | A MultiNode and index | Result is the extracted value from the input MultiNode at offset index | | Bool | Data | 4 | Represents results of a comparison operator | Two data nodes | Result is a comparison, represented as integer value where 1=true, 0=false | | Not | Data | 4 | Logical not | One data node | Result converts 0 to 1 and vice versa | | Return | Control | 1 | End of function | Predecessor control node and a data node for the return value of the function | Return value of the function | @@ -53,6 +53,10 @@ Here is a recap of the nodes introduced in previous chapters: | Minus | Data | 2 | Negate a value | One data node which value is negated | Result of the negation | | Scope | Symbol Table | 3 | Represents scopes in the graph | Nodes that represent the current value of variables | None | +> A `Proj` is a control node when it projects a control slot: `Proj#0` off `Start`, +> and both projections off an `If`. Every other projection is a data node. +> See `ProjNode.isCFG()`. + ## New Nodes The following new nodes are introduced in this chapter: |
