duke@435: /* mikael@6198: * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef SHARE_VM_OPTO_PHASE_HPP stefank@2314: #define SHARE_VM_OPTO_PHASE_HPP stefank@2314: stefank@2314: #include "libadt/port.hpp" stefank@2314: #include "runtime/timer.hpp" stefank@2314: duke@435: class Compile; duke@435: duke@435: //------------------------------Phase------------------------------------------ duke@435: // Most optimizations are done in Phases. Creating a phase does any long duke@435: // running analysis required, and caches the analysis in internal data duke@435: // structures. Later the analysis is queried using transform() calls to duke@435: // guide transforming the program. When the Phase is deleted, so is any duke@435: // cached analysis info. This basic Phase class mostly contains timing and duke@435: // memory management code. duke@435: class Phase : public StackObj { duke@435: public: duke@435: enum PhaseNumber { duke@435: Compiler, // Top-level compiler phase duke@435: Parser, // Parse bytecodes duke@435: Remove_Useless, // Remove useless nodes duke@435: Optimistic, // Optimistic analysis phase duke@435: GVN, // Pessimistic global value numbering phase duke@435: Ins_Select, // Instruction selection phase duke@435: CFG, // Build a CFG rasbold@853: BlockLayout, // Linear ordering of blocks duke@435: Register_Allocation, // Register allocation, duh duke@435: LIVE, // Dragon-book LIVE range problem never@1515: StringOpts, // StringBuilder related optimizations duke@435: Interference_Graph, // Building the IFG duke@435: Coalesce, // Coalescing copies duke@435: Ideal_Loop, // Find idealized trip-counted loops duke@435: Macro_Expand, // Expand macro nodes duke@435: Peephole, // Apply peephole optimizations duke@435: last_phase duke@435: }; duke@435: protected: duke@435: enum PhaseNumber _pnum; // Phase number (for stat gathering) duke@435: duke@435: #ifndef PRODUCT duke@435: static int _total_bytes_compiled; duke@435: duke@435: // accumulated timers duke@435: static elapsedTimer _t_totalCompilation; duke@435: static elapsedTimer _t_methodCompilation; duke@435: static elapsedTimer _t_stubCompilation; duke@435: #endif duke@435: duke@435: // The next timers used for LogCompilation duke@435: static elapsedTimer _t_parser; duke@435: static elapsedTimer _t_optimizer; kvn@3651: public: kvn@3651: // ConnectionGraph can't be Phase since it is used after EA done. kvn@3651: static elapsedTimer _t_escapeAnalysis; kvn@3651: static elapsedTimer _t_connectionGraph; kvn@3651: protected: duke@435: static elapsedTimer _t_idealLoop; duke@435: static elapsedTimer _t_ccp; duke@435: static elapsedTimer _t_matcher; duke@435: static elapsedTimer _t_registerAllocation; duke@435: static elapsedTimer _t_output; duke@435: duke@435: #ifndef PRODUCT duke@435: static elapsedTimer _t_graphReshaping; duke@435: static elapsedTimer _t_scheduler; rasbold@853: static elapsedTimer _t_blockOrdering; kvn@3651: static elapsedTimer _t_macroEliminate; duke@435: static elapsedTimer _t_macroExpand; duke@435: static elapsedTimer _t_peephole; goetz@6478: static elapsedTimer _t_postalloc_expand; duke@435: static elapsedTimer _t_codeGeneration; duke@435: static elapsedTimer _t_registerMethod; duke@435: static elapsedTimer _t_temporaryTimer1; duke@435: static elapsedTimer _t_temporaryTimer2; never@1356: static elapsedTimer _t_idealLoopVerify; duke@435: duke@435: // Subtimers for _t_optimizer duke@435: static elapsedTimer _t_iterGVN; duke@435: static elapsedTimer _t_iterGVN2; kvn@5110: static elapsedTimer _t_incrInline; duke@435: duke@435: // Subtimers for _t_registerAllocation duke@435: static elapsedTimer _t_ctorChaitin; duke@435: static elapsedTimer _t_buildIFGphysical; duke@435: static elapsedTimer _t_computeLive; duke@435: static elapsedTimer _t_regAllocSplit; duke@435: static elapsedTimer _t_postAllocCopyRemoval; iveresov@7564: static elapsedTimer _t_mergeMultidefs; duke@435: static elapsedTimer _t_fixupSpills; duke@435: duke@435: // Subtimers for _t_output duke@435: static elapsedTimer _t_instrSched; duke@435: static elapsedTimer _t_buildOopMaps; duke@435: #endif duke@435: public: duke@435: Compile * C; duke@435: Phase( PhaseNumber pnum ); duke@435: #ifndef PRODUCT duke@435: static void print_timers(); duke@435: #endif duke@435: }; stefank@2314: stefank@2314: #endif // SHARE_VM_OPTO_PHASE_HPP