annotate src/hotspot/share/opto/coalesce.hpp @ 54526:ee29b516a36a

revert changes
author jlaskey
date Wed, 23 Jan 2019 16:09:20 -0400
parents 71c04702a3d5
children
rev   line source
duke@1 1 /*
coleenp@54304 2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation.
duke@1 8 *
duke@1 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 13 * accompanied this code).
duke@1 14 *
duke@1 15 * You should have received a copy of the GNU General Public License version
duke@1 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 18 *
trims@5547 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@5547 20 * or visit www.oracle.com if you need additional information or have any
trims@5547 21 * questions.
duke@1 22 *
duke@1 23 */
duke@1 24
coleenp@54304 25 #ifndef SHARE_OPTO_COALESCE_HPP
coleenp@54304 26 #define SHARE_OPTO_COALESCE_HPP
stefank@7397 27
stefank@7397 28 #include "opto/phase.hpp"
stefank@7397 29
duke@1 30 class LoopTree;
duke@1 31 class LRG;
duke@1 32 class Matcher;
duke@1 33 class PhaseIFG;
duke@1 34 class PhaseCFG;
duke@1 35
duke@1 36 //------------------------------PhaseCoalesce----------------------------------
duke@1 37 class PhaseCoalesce : public Phase {
duke@1 38 protected:
duke@1 39 PhaseChaitin &_phc;
duke@1 40
duke@1 41 public:
duke@1 42 // Coalesce copies
neliasso@17013 43 PhaseCoalesce(PhaseChaitin &phc)
neliasso@17013 44 : Phase(Coalesce)
neliasso@17013 45 , _phc(phc) {}
duke@1 46
duke@1 47 virtual void verify() = 0;
duke@1 48
duke@1 49 // Coalesce copies
neliasso@17013 50 void coalesce_driver();
duke@1 51
duke@1 52 // Coalesce copies in this block
neliasso@17013 53 virtual void coalesce(Block *b) = 0;
duke@1 54
duke@1 55 // Attempt to coalesce live ranges defined by these 2
neliasso@17013 56 void combine_these_two(Node *n1, Node *n2);
duke@1 57
neliasso@17013 58 LRG &lrgs(uint lidx) { return _phc.lrgs(lidx); }
duke@1 59 #ifndef PRODUCT
duke@1 60 // Dump internally name
neliasso@17013 61 void dump(Node *n) const;
duke@1 62 // Dump whole shebang
duke@1 63 void dump() const;
duke@1 64 #endif
duke@1 65 };
duke@1 66
duke@1 67 //------------------------------PhaseAggressiveCoalesce------------------------
duke@1 68 // Aggressively, pessimistic coalesce copies. Aggressive means ignore graph
duke@1 69 // colorability; perhaps coalescing to the point of forcing a spill.
duke@1 70 // Pessimistic means we cannot coalesce if 2 live ranges interfere. This
duke@1 71 // implies we do not hit a fixed point right away.
duke@1 72 class PhaseAggressiveCoalesce : public PhaseCoalesce {
duke@1 73 uint _unique;
duke@1 74 public:
duke@1 75 // Coalesce copies
duke@1 76 PhaseAggressiveCoalesce( PhaseChaitin &chaitin ) : PhaseCoalesce(chaitin) {}
duke@1 77
duke@1 78 virtual void verify() { };
duke@1 79
duke@1 80 // Aggressively coalesce copies in this block
duke@1 81 virtual void coalesce( Block *b );
duke@1 82
duke@1 83 // Where I fail to coalesce, manifest virtual copies as the Real Thing
duke@1 84 void insert_copies( Matcher &matcher );
duke@1 85
duke@1 86 // Copy insertion needs some smarts in case live ranges overlap
duke@1 87 void insert_copy_with_overlap( Block *b, Node *copy, uint dst_name, uint src_name );
duke@1 88 };
duke@1 89
duke@1 90
duke@1 91 //------------------------------PhaseConservativeCoalesce----------------------
duke@1 92 // Conservatively, pessimistic coalesce copies. Conservative means do not
duke@1 93 // coalesce if the resultant live range will be uncolorable. Pessimistic
duke@1 94 // means we cannot coalesce if 2 live ranges interfere. This implies we do
duke@1 95 // not hit a fixed point right away.
duke@1 96 class PhaseConservativeCoalesce : public PhaseCoalesce {
duke@1 97 IndexSet _ulr; // Union live range interferences
duke@1 98 public:
duke@1 99 // Coalesce copies
duke@1 100 PhaseConservativeCoalesce( PhaseChaitin &chaitin );
duke@1 101
duke@1 102 virtual void verify();
duke@1 103
duke@1 104 // Conservatively coalesce copies in this block
duke@1 105 virtual void coalesce( Block *b );
duke@1 106
duke@1 107 // Coalesce this chain of copies away
duke@1 108 bool copy_copy( Node *dst_copy, Node *src_copy, Block *b, uint bindex );
duke@1 109
duke@1 110 void union_helper( Node *lr1_node, Node *lr2_node, uint lr1, uint lr2, Node *src_def, Node *dst_copy, Node *src_copy, Block *b, uint bindex );
duke@1 111
duke@1 112 uint compute_separating_interferences(Node *dst_copy, Node *src_copy, Block *b, uint bindex, RegMask &rm, uint rm_size, uint reg_degree, uint lr1, uint lr2);
duke@1 113
duke@1 114 void update_ifg(uint lr1, uint lr2, IndexSet *n_lr1, IndexSet *n_lr2);
duke@1 115 };
stefank@7397 116
coleenp@54304 117 #endif // SHARE_OPTO_COALESCE_HPP