MCPcopy Create free account
hub / github.com/SeaOfNodes/Simple / dump

Method dump

chapter21/src/test/java/com/seaofnodes/simple/Simple.java:85–129  ·  view source on GitHub ↗
(CodeGen code, int dump, int pass)

Source from the content-addressed store, hash-verified

83 }
84
85 static void dump(CodeGen code, int dump, int pass) {
86 if ((dump & pass) != 0) {
87 if ((dump & DUMP_DOT) != 0) {
88 String fn = switch (pass) {
89 case DUMP_AFTER_PARSE -> "01-parse.dot";
90 case DUMP_AFTER_OPTO -> "02-opto.dot";
91 case DUMP_AFTER_TYPE_CHECK -> "03-type_check.dot";
92 case DUMP_AFTER_LOOP_TREE -> "04-loop_tree.dot";
93 case DUMP_AFTER_INSTR_SELECT -> "05-instr_select.dot";
94 case DUMP_AFTER_GCM -> "06-gcm.dot";
95 case DUMP_AFTER_LOCAL_SCHED -> "07-local_sched.dot";
96 case DUMP_AFTER_REG_ALLOC -> "08-reg_allos.dot";
97 case DUMP_AFTER_ENCODE -> "09-local_sched.dot";
98 case DUMP_FINAL -> "10-final.dot";
99 default -> throw Utils.TODO();
100 };
101
102 try {
103 Files.writeString(Path.of(fn),
104 new GraphVisualizer().generateDotOutput(code._stop, null, null));
105 } catch(IOException e) {
106 System.err.println("ERROR: Cannot write DOT file");
107 System.exit(1);
108 }
109 } else {
110 if ((dump & DUMP_PASS_NAME) != 0) {
111 System.err.println(switch (pass) {
112 case DUMP_AFTER_PARSE -> "After Parse:";
113 case DUMP_AFTER_OPTO -> "After OPTO:";
114 case DUMP_AFTER_TYPE_CHECK -> "After Type Check:";
115 case DUMP_AFTER_LOOP_TREE -> "After Loop Tree:";
116 case DUMP_AFTER_INSTR_SELECT -> "After Instruction Selection:";
117 case DUMP_AFTER_GCM -> "After GCM:";
118 case DUMP_AFTER_LOCAL_SCHED -> "After Local Scheduling:";
119 case DUMP_AFTER_REG_ALLOC -> "After Register Allocation:";
120 case DUMP_AFTER_ENCODE -> "After Instruction Encoding:";
121 case DUMP_FINAL -> "Final:";
122 default -> throw Utils.TODO();
123 });
124 }
125
126 System.err.println(IRPrinter.prettyPrint(code._stop, 9999));
127 }
128 }
129 }
130
131 static void print_compilation_times(CodeGen code) {
132 double t, total = 0;

Callers 1

mainMethod · 0.95

Calls 4

TODOMethod · 0.95
prettyPrintMethod · 0.95
generateDotOutputMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected