src/share/vm/opto/coalesce.hpp

Mon, 06 Jan 2014 11:02:21 +0100

author
goetz
date
Mon, 06 Jan 2014 11:02:21 +0100
changeset 6500
4345c6a92f35
parent 5722
8c83625e3a53
child 6198
55fb97c4c58d
permissions
-rw-r--r--

8031188: Fix for 8029015: PPC64 (part 216): opto: trap based null and range checks
Summary: Swap the Projs in the block list so that the new block is added behind the proper node.
Reviewed-by: kvn

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

mercurial