@@ -27,6 +27,8 @@ public class CompiledFunction {
27
27
public boolean hasLiveness ;
28
28
private final IncrementalSSA issa ;
29
29
30
+ private StringBuilder dumpTarget ;
31
+
30
32
/**
31
33
* We essentially do a form of abstract interpretation as we generate
32
34
* the bytecode instructions. For this purpose we use a virtual operand stack.
@@ -72,7 +74,9 @@ public CompiledFunction(EZType.EZTypeFunction functionType, TypeDictionary typeD
72
74
issa .finish (null );
73
75
this .frameSlots = registerPool .numRegisters ();
74
76
}
75
-
77
+ public void setDumpTarget (StringBuilder dumpTarget ) {
78
+ this .dumpTarget = dumpTarget ;
79
+ }
76
80
private void generateArgInstructions (Scope scope ) {
77
81
if (scope .isFunctionParameterScope ) {
78
82
for (Symbol symbol : scope .getLocalSymbols ()) {
@@ -814,8 +818,14 @@ public StringBuilder toStr(StringBuilder sb, boolean verbose) {
814
818
}
815
819
816
820
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
+ }
819
829
}
820
830
821
831
public void livenessAnalysis () {
0 commit comments