annotate src/share/vm/opto/coalesce.hpp @ 216:8d191a7697e2

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