@@ -61,7 +61,18 @@ protected PassListBuilder getTranspileOnlyPasses() {
61
61
* <p>Optimization passes revolve around producing smaller and faster code. They should always run
62
62
* after checking passes.
63
63
*/
64
- protected abstract PassListBuilder getOptimizations ();
64
+ protected abstract PassListBuilder getOptimizations (OptimizationPasses optimizationPasses );
65
+
66
+ /**
67
+ * Different ways to split optimization passes. Passing one of these enum options to
68
+ * getOptimizations() to tell to configure which list of stage 2 passes to return.
69
+ */
70
+ public enum OptimizationPasses {
71
+ ALL ,
72
+ // TODO(user): Enable these in a follow-up CL.
73
+ // FIRST_HALF, // Passes from beginning of stage 2 until before the early optimization loop.
74
+ // SECOND_HALF, // Passes from the early optimization loop until the end of stage 2.
75
+ }
65
76
66
77
/**
67
78
* Gets the finalization passes to run.
@@ -75,7 +86,7 @@ protected PassListBuilder getTranspileOnlyPasses() {
75
86
GraphvizGraph getPassGraph () {
76
87
LinkedDirectedGraph <String , String > graph = LinkedDirectedGraph .createWithoutAnnotations ();
77
88
Iterable <PassFactory > allPasses =
78
- Iterables .concat (getChecks ().build (), getOptimizations ().build ());
89
+ Iterables .concat (getChecks ().build (), getOptimizations (OptimizationPasses . ALL ).build ());
79
90
String lastPass = null ;
80
91
String loopStart = null ;
81
92
for (PassFactory pass : allPasses ) {
@@ -131,8 +142,8 @@ protected PassListBuilder getChecks() {
131
142
}
132
143
133
144
@ Override
134
- protected PassListBuilder getOptimizations () {
135
- return delegate .getOptimizations ();
145
+ protected PassListBuilder getOptimizations (OptimizationPasses optimizationPasses ) {
146
+ return delegate .getOptimizations (optimizationPasses );
136
147
}
137
148
138
149
@ Override
0 commit comments