@@ -27,6 +27,8 @@ public class CompiledFunction {
2727 public boolean hasLiveness ;
2828 private final IncrementalSSA issa ;
2929
30+ private StringBuilder dumpTarget ;
31+
3032 /**
3133 * We essentially do a form of abstract interpretation as we generate
3234 * the bytecode instructions. For this purpose we use a virtual operand stack.
@@ -72,7 +74,9 @@ public CompiledFunction(EZType.EZTypeFunction functionType, TypeDictionary typeD
7274 issa .finish (null );
7375 this .frameSlots = registerPool .numRegisters ();
7476 }
75-
77+ public void setDumpTarget (StringBuilder dumpTarget ) {
78+ this .dumpTarget = dumpTarget ;
79+ }
7680 private void generateArgInstructions (Scope scope ) {
7781 if (scope .isFunctionParameterScope ) {
7882 for (Symbol symbol : scope .getLocalSymbols ()) {
@@ -814,8 +818,14 @@ public StringBuilder toStr(StringBuilder sb, boolean verbose) {
814818 }
815819
816820 public void dumpIR (boolean verbose , String title ) {
817- System .out .println (title );
818- System .out .println (toStr (new StringBuilder (), verbose ));
821+ if (dumpTarget != null ) {
822+ dumpTarget .append (title ).append ("\n " );
823+ toStr (dumpTarget ,verbose );
824+ }
825+ else {
826+ System .out .println (title );
827+ System .out .println (toStr (new StringBuilder (), verbose ));
828+ }
819829 }
820830
821831 public void livenessAnalysis () {
0 commit comments