The graphs a release opt will actually print, drawn inline - #48
Merged
Merged
Conversation
`opt` has six dot printers that survive a release build, and this reads their output rather than building a picture of its own. What comes back is LLVM's graph, laid out and coloured, as an inline SVG with no Graphviz on the machine and no JavaScript in the page. Not a SelectionDAG viewer. `-view-isel-dags` and the rest of that family live inside `#ifndef NDEBUG`, and the `#else` branch hands back constant `false` flags, so on the toolchain this book pins the flag is not off, it does not exist (llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:147-189@llvmorg-23.1.0). The data dependence graph is the one a release `opt` gives you that is actually a DAG, and it is here as `irx.ddg`. LLVM names its dot nodes after object addresses, so the same function printed twice gives two different files. The parser drops them for `n0`, `n1` and so on, which is also what makes the SVG bytes stable across a rebuild. `proc.run` grows a `cwd`, because the printers write into the working directory and no flag redirects them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
optcarries six dot printers that a release build keeps:dot-cfg,dot-cfg-only,dot-dom,dot-post-dom,dot-ddganddot-callgraph.This reads what they emit and draws it, so the picture in a lesson is
LLVM's graph rather than one reconstructed from the IR alongside it.
A
Graphprints as text in a plain terminal, renders as an inline SVG ina notebook, and exposes
.nodes,.edges,.loopsand.successors()for a lesson that wants to assert on the shape rather than show it.
It is not a SelectionDAG viewer
-view-isel-dagsand that whole family are declared inside#ifndef NDEBUG; the#elsebranch suppliesstatic const bool ViewDAGCombine1 = false, .... On a release toolchain the flag is not turned off, it is nota flag at all, and
opt/llcreject it(
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:147-189@llvmorg-23.1.0).The book pins a release build, so no lesson can use them. The data
dependence graph is the graph a release
optgives you that genuinely isa DAG, cycles and all collapsed into pi-blocks, and it is here as
irx.ddg.Notes
edges and for forward edges that skip a row, which is enough for the
block counts a lesson shows and keeps the install to nothing.
the same function twice gives two different files. The parser maps them
to
n0,n1, ... and the one generated id in the SVG is a contenthash, so rebuilding a notebook does not produce a diff.
static site HTML.
proc.rungrows acwdparameter: the printers write into the workingdirectory and there is no flag that redirects them.
Checks
toolkit: 209 tests, OK (26 new, 8 of them against a real LLVM)ruff check .,build.py check,prosecheck,refcheck --ledger,build.py diagramscleanPart of #10.