src/share/vm/opto/phase.hpp

Thu, 24 May 2018 19:26:50 +0800

author
aoqi
date
Thu, 24 May 2018 19:26:50 +0800
changeset 8862
fd13a567f179
parent 8604
04d83ba48607
permissions
-rw-r--r--

#7046 C2 supports long branch
Contributed-by: fujie

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_OPTO_PHASE_HPP
aoqi@0 26 #define SHARE_VM_OPTO_PHASE_HPP
aoqi@0 27
aoqi@0 28 #include "libadt/port.hpp"
aoqi@0 29 #include "runtime/timer.hpp"
aoqi@0 30
aoqi@0 31 class Compile;
aoqi@0 32
aoqi@0 33 //------------------------------Phase------------------------------------------
aoqi@0 34 // Most optimizations are done in Phases. Creating a phase does any long
aoqi@0 35 // running analysis required, and caches the analysis in internal data
aoqi@0 36 // structures. Later the analysis is queried using transform() calls to
aoqi@0 37 // guide transforming the program. When the Phase is deleted, so is any
aoqi@0 38 // cached analysis info. This basic Phase class mostly contains timing and
aoqi@0 39 // memory management code.
aoqi@0 40 class Phase : public StackObj {
aoqi@0 41 public:
aoqi@0 42 enum PhaseNumber {
zmajo@8193 43 Compiler, // Top-level compiler phase
zmajo@8193 44 Parser, // Parse bytecodes
zmajo@8193 45 Remove_Useless, // Remove useless nodes
zmajo@8193 46 Remove_Useless_And_Renumber_Live, // First, remove useless nodes from the graph. Then, renumber live nodes.
zmajo@8193 47 Optimistic, // Optimistic analysis phase
zmajo@8193 48 GVN, // Pessimistic global value numbering phase
zmajo@8193 49 Ins_Select, // Instruction selection phase
zmajo@8193 50 CFG, // Build a CFG
zmajo@8193 51 BlockLayout, // Linear ordering of blocks
zmajo@8193 52 Register_Allocation, // Register allocation, duh
zmajo@8193 53 LIVE, // Dragon-book LIVE range problem
zmajo@8193 54 StringOpts, // StringBuilder related optimizations
zmajo@8193 55 Interference_Graph, // Building the IFG
zmajo@8193 56 Coalesce, // Coalescing copies
zmajo@8193 57 Ideal_Loop, // Find idealized trip-counted loops
zmajo@8193 58 Macro_Expand, // Expand macro nodes
zmajo@8193 59 Peephole, // Apply peephole optimizations
aoqi@0 60 last_phase
aoqi@0 61 };
aoqi@0 62 protected:
aoqi@0 63 enum PhaseNumber _pnum; // Phase number (for stat gathering)
aoqi@0 64
aoqi@0 65 #ifndef PRODUCT
aoqi@0 66 static int _total_bytes_compiled;
aoqi@0 67
aoqi@0 68 // accumulated timers
aoqi@0 69 static elapsedTimer _t_totalCompilation;
aoqi@0 70 static elapsedTimer _t_methodCompilation;
aoqi@0 71 static elapsedTimer _t_stubCompilation;
aoqi@0 72 #endif
aoqi@0 73
aoqi@0 74 // The next timers used for LogCompilation
aoqi@0 75 static elapsedTimer _t_parser;
aoqi@0 76 static elapsedTimer _t_optimizer;
aoqi@0 77 public:
aoqi@0 78 // ConnectionGraph can't be Phase since it is used after EA done.
aoqi@0 79 static elapsedTimer _t_escapeAnalysis;
aoqi@0 80 static elapsedTimer _t_connectionGraph;
aoqi@0 81 protected:
aoqi@0 82 static elapsedTimer _t_idealLoop;
aoqi@0 83 static elapsedTimer _t_ccp;
aoqi@0 84 static elapsedTimer _t_matcher;
aoqi@0 85 static elapsedTimer _t_registerAllocation;
aoqi@0 86 static elapsedTimer _t_output;
aoqi@0 87
aoqi@0 88 #ifndef PRODUCT
aoqi@0 89 static elapsedTimer _t_graphReshaping;
aoqi@0 90 static elapsedTimer _t_scheduler;
aoqi@0 91 static elapsedTimer _t_blockOrdering;
aoqi@0 92 static elapsedTimer _t_macroEliminate;
aoqi@0 93 static elapsedTimer _t_macroExpand;
aoqi@0 94 static elapsedTimer _t_peephole;
aoqi@0 95 static elapsedTimer _t_postalloc_expand;
aoqi@0 96 static elapsedTimer _t_codeGeneration;
aoqi@0 97 static elapsedTimer _t_registerMethod;
aoqi@0 98 static elapsedTimer _t_temporaryTimer1;
aoqi@0 99 static elapsedTimer _t_temporaryTimer2;
aoqi@0 100 static elapsedTimer _t_idealLoopVerify;
aoqi@0 101
aoqi@0 102 // Subtimers for _t_optimizer
aoqi@0 103 static elapsedTimer _t_iterGVN;
aoqi@0 104 static elapsedTimer _t_iterGVN2;
aoqi@0 105 static elapsedTimer _t_incrInline;
zmajo@8193 106 static elapsedTimer _t_renumberLive;
aoqi@0 107
aoqi@0 108 // Subtimers for _t_registerAllocation
aoqi@0 109 static elapsedTimer _t_ctorChaitin;
aoqi@0 110 static elapsedTimer _t_buildIFGphysical;
aoqi@0 111 static elapsedTimer _t_computeLive;
aoqi@0 112 static elapsedTimer _t_regAllocSplit;
aoqi@0 113 static elapsedTimer _t_postAllocCopyRemoval;
iveresov@7564 114 static elapsedTimer _t_mergeMultidefs;
aoqi@0 115 static elapsedTimer _t_fixupSpills;
aoqi@0 116
aoqi@0 117 // Subtimers for _t_output
aoqi@0 118 static elapsedTimer _t_instrSched;
aoqi@0 119 static elapsedTimer _t_buildOopMaps;
aoqi@0 120 #endif
aoqi@0 121 public:
aoqi@0 122 Compile * C;
aoqi@0 123 Phase( PhaseNumber pnum );
aoqi@0 124 #ifndef PRODUCT
aoqi@0 125 static void print_timers();
aoqi@0 126 #endif
aoqi@0 127 };
aoqi@0 128
aoqi@0 129 #endif // SHARE_VM_OPTO_PHASE_HPP

mercurial