import com.seaofnodes.simple.codegen.CodeGen; import com.seaofnodes.simple.node.*; import java.nio.file.*; import java.util.regex.Pattern; /** Run from the repo root with Chapter 21's built classes on the classpath. */ public class BackendDump { static String js(String s) { return "\""+s.replace("\\","\\\\").replace("\"","\\\"") .replace("\r", "").replace("\n","\\n")+"\""; } public static void main(String[] args) throws Exception { Path deck=Path.of("docs/2026_REBASE"); String source=Files.readString(deck.resolve("demos/backend.smp")); CodeGen code=new CodeGen(source).parse().opto().typeCheck().loopTree() .instSelect("x86_64_v2","SystemV"); String selected=code.toString(); // Every row from the whole graph, in printer order. Show concrete Java // classes and every input slot; omit types and redundant use lists. StringBuilder compact=new StringBuilder("id node inputs\n"); var rows=Pattern.compile("(?m)^\\s*(\\d+) ").matcher(selected); int count=0; while(rows.find()) { Node n=code.f(Integer.parseInt(rows.group(1))); String name=n.getClass().getSimpleName(); if(n instanceof ParmNode || n instanceof CProjNode) name+=":"+n.label(); compact.append(String.format("%2d %-16s",n._nid,name)); for(int i=0;i