1 /*
2  * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 #ifndef SHARE_OPTO_PHASETYPE_HPP
26 #define SHARE_OPTO_PHASETYPE_HPP
27 
28 enum CompilerPhaseType {
29   PHASE_BEFORE_STRINGOPTS,
30   PHASE_AFTER_STRINGOPTS,
31   PHASE_BEFORE_REMOVEUSELESS,
32   PHASE_AFTER_PARSING,
33   PHASE_ITER_GVN1,
34   PHASE_EXPAND_VUNBOX,
35   PHASE_SCALARIZE_VBOX,
36   PHASE_INLINE_VECTOR_REBOX,
37   PHASE_EXPAND_VBOX,
38   PHASE_ELIMINATE_VBOX_ALLOC,
39   PHASE_PHASEIDEAL_BEFORE_EA,
40   PHASE_ITER_GVN_AFTER_VECTOR,
41   PHASE_ITER_GVN_BEFORE_EA,
42   PHASE_ITER_GVN_AFTER_EA,
43   PHASE_ITER_GVN_AFTER_ELIMINATION,
44   PHASE_PHASEIDEALLOOP1,
45   PHASE_PHASEIDEALLOOP2,
46   PHASE_PHASEIDEALLOOP3,
47   PHASE_CPP1,
48   PHASE_ITER_GVN2,
49   PHASE_PHASEIDEALLOOP_ITERATIONS,
50   PHASE_OPTIMIZE_FINISHED,
51   PHASE_AFTER_MATCHING,
52   PHASE_GLOBAL_CODE_MOTION,
53   PHASE_FINAL_CODE,
54   PHASE_AFTER_EA,
55   PHASE_BEFORE_CLOOPS,
56   PHASE_AFTER_CLOOPS,
57   PHASE_BEFORE_BEAUTIFY_LOOPS,
58   PHASE_AFTER_BEAUTIFY_LOOPS,
59   PHASE_BEFORE_MATCHING,
60   PHASE_MATCHING,
61   PHASE_INCREMENTAL_INLINE,
62   PHASE_INCREMENTAL_INLINE_STEP,
63   PHASE_INCREMENTAL_INLINE_CLEANUP,
64   PHASE_INCREMENTAL_BOXING_INLINE,
65   PHASE_CALL_CATCH_CLEANUP,
66   PHASE_INSERT_BARRIER,
67   PHASE_MACRO_EXPANSION,
68   PHASE_BARRIER_EXPANSION,
69   PHASE_ADD_UNSAFE_BARRIER,
70   PHASE_END,
71   PHASE_FAILURE,
72   PHASE_DEBUG,
73 
74   PHASE_NUM_TYPES
75 };
76 
77 class CompilerPhaseTypeHelper {
78   public:
to_string(CompilerPhaseType cpt)79   static const char* to_string(CompilerPhaseType cpt) {
80     switch (cpt) {
81       case PHASE_BEFORE_STRINGOPTS:          return "Before StringOpts";
82       case PHASE_AFTER_STRINGOPTS:           return "After StringOpts";
83       case PHASE_BEFORE_REMOVEUSELESS:       return "Before RemoveUseless";
84       case PHASE_AFTER_PARSING:              return "After Parsing";
85       case PHASE_ITER_GVN1:                  return "Iter GVN 1";
86       case PHASE_EXPAND_VUNBOX:              return "Expand VectorUnbox";
87       case PHASE_SCALARIZE_VBOX:             return "Scalarize VectorBox";
88       case PHASE_INLINE_VECTOR_REBOX:        return "Inline Vector Rebox Calls";
89       case PHASE_EXPAND_VBOX:                return "Expand VectorBox";
90       case PHASE_ELIMINATE_VBOX_ALLOC:       return "Eliminate VectorBoxAllocate";
91       case PHASE_PHASEIDEAL_BEFORE_EA:       return "PhaseIdealLoop before EA";
92       case PHASE_ITER_GVN_AFTER_VECTOR:      return "Iter GVN after vector box elimination";
93       case PHASE_ITER_GVN_BEFORE_EA:         return "Iter GVN before EA";
94       case PHASE_ITER_GVN_AFTER_EA:          return "Iter GVN after EA";
95       case PHASE_ITER_GVN_AFTER_ELIMINATION: return "Iter GVN after eliminating allocations and locks";
96       case PHASE_PHASEIDEALLOOP1:            return "PhaseIdealLoop 1";
97       case PHASE_PHASEIDEALLOOP2:            return "PhaseIdealLoop 2";
98       case PHASE_PHASEIDEALLOOP3:            return "PhaseIdealLoop 3";
99       case PHASE_CPP1:                       return "PhaseCPP 1";
100       case PHASE_ITER_GVN2:                  return "Iter GVN 2";
101       case PHASE_PHASEIDEALLOOP_ITERATIONS:  return "PhaseIdealLoop iterations";
102       case PHASE_OPTIMIZE_FINISHED:          return "Optimize finished";
103       case PHASE_AFTER_MATCHING:             return "After Matching";
104       case PHASE_GLOBAL_CODE_MOTION:         return "Global code motion";
105       case PHASE_FINAL_CODE:                 return "Final Code";
106       case PHASE_AFTER_EA:                   return "After Escape Analysis";
107       case PHASE_BEFORE_CLOOPS:              return "Before CountedLoop";
108       case PHASE_AFTER_CLOOPS:               return "After CountedLoop";
109       case PHASE_BEFORE_BEAUTIFY_LOOPS:      return "Before beautify loops";
110       case PHASE_AFTER_BEAUTIFY_LOOPS:       return "After beautify loops";
111       case PHASE_BEFORE_MATCHING:            return "Before matching";
112       case PHASE_MATCHING:                   return "After matching";
113       case PHASE_INCREMENTAL_INLINE:         return "Incremental Inline";
114       case PHASE_INCREMENTAL_INLINE_STEP:    return "Incremental Inline Step";
115       case PHASE_INCREMENTAL_INLINE_CLEANUP: return "Incremental Inline Cleanup";
116       case PHASE_INCREMENTAL_BOXING_INLINE:  return "Incremental Boxing Inline";
117       case PHASE_CALL_CATCH_CLEANUP:         return "Call catch cleanup";
118       case PHASE_INSERT_BARRIER:             return "Insert barrier";
119       case PHASE_MACRO_EXPANSION:            return "Macro expand";
120       case PHASE_BARRIER_EXPANSION:          return "Barrier expand";
121       case PHASE_ADD_UNSAFE_BARRIER:         return "Add barrier to unsafe op";
122       case PHASE_END:                        return "End";
123       case PHASE_FAILURE:                    return "Failure";
124       case PHASE_DEBUG:                      return "Debug";
125       default:
126         ShouldNotReachHere();
127         return NULL;
128     }
129   }
130 };
131 
132 #endif // SHARE_OPTO_PHASETYPE_HPP
133