diff options
| author | Cliff Click <cliffc@acm.org> | 2026-08-10 11:11:18 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-10-08 16:52:27 -0700 |
| commit | d32f97238c903765dec4e9a9f3cbfa5fd12cded6 (patch) | |
| tree | a5ac731801ef7066bab6359c4e85c2bdd20082a6 /src/main/java/com/seaofnodes/simple/print/IRPrinter.java | |
| parent | b5ebb2032aa04cf4506d533127d373d4cf5a25c6 (diff) | |
| download | Simple-linear.tar.gz Simple-linear.zip | |
Chapter 25: Modules, Separate Compilation, and SSA Constructionlinear
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com>
Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com>
Co-authored-by: Symious <14933944+symious@users.noreply.github.com>
Co-authored-by: Jun Kawasaki <jun784@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/main/java/com/seaofnodes/simple/print/IRPrinter.java')
| -rw-r--r-- | src/main/java/com/seaofnodes/simple/print/IRPrinter.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/com/seaofnodes/simple/print/IRPrinter.java b/src/main/java/com/seaofnodes/simple/print/IRPrinter.java index c912ab77..531a549a 100644 --- a/src/main/java/com/seaofnodes/simple/print/IRPrinter.java +++ b/src/main/java/com/seaofnodes/simple/print/IRPrinter.java @@ -14,6 +14,8 @@ public final class IRPrinter extends IRAdapter<Node> { @Override public String type(Node n) { return n._type==null ? "" : n._type.str(); } @Override public String inputMark(Node n, Node def) { return n instanceof MemMergeNode && def instanceof MemMergeNode ? "^" : " "; } @Override public Kind kind(Node n) { + if( n instanceof StartCUNode ) return Kind.UNIT; + if( n instanceof StopCUNode ) return Kind.UNIT; if( n instanceof StartNode ) return Kind.START; if( n instanceof StopNode ) return Kind.STOP; if( n instanceof FunNode ) return Kind.FUN; @@ -47,15 +49,12 @@ public final class IRPrinter extends IRAdapter<Node> { public static String prettyPrint(CodeGen code) { var units=new ArrayList<com.seaofnodes.print.IRPrinter.Unit<Node>>(); - var funs=new ArrayList<Node>(); - for( Node n : code._start._outputs ) if( n instanceof FunNode ) funs.add(n); - units.add(new com.seaofnodes.print.IRPrinter.Unit<>(null,null,null,funs)); + for( var cu : code._compunits.values() ) { + var funs=new ArrayList<Node>(); + for( FunNode fun : code._linker ) + if( fun!=null && fun._compunit==cu ) funs.add(fun); + units.add(new com.seaofnodes.print.IRPrinter.Unit<>(cu._cname,cu._start,cu._stop,funs)); + } return PRINT.program(code._start,code._stop,units); } - public static String _prettyPrint(CodeGen code) { - if( code._cfg==null ) return prettyPrint(code); - var blocks=new ArrayList<Node>(); - for( Node n : code._cfg ) blocks.add(n); - return PRINT.scheduled(blocks); - } } |
